Re: gpart FTBFS
Hello,
I cant seem to upload to debian as of this moment, mainly because i am
behind a http_proxy and dupload/dput does not seem to work. Excuse the
verbose mail with a lot of attachments.
On hurd gparted behaves as follows
root@debian:~/gparted/gpart-0.1h# mount /
mount: /dev/hd0s1 already mounted
$PWD/debian/gpart/sbin/gpart /dev/hd0s1
Begin scan...
Floating point exception
root@debian:~/gparted/gpart-0.1h# gdb --args
$PWD/debian/gpart/sbin/gpart /dev/hd0s1
GNU gdb (GDB) 7.3-debian
.. <snipped> ..
Reading symbols from /root/gparted/gpart-0.1h/debian/gpart/sbin/gpart...done.
(gdb) run
Starting program: /root/gparted/gpart-0.1h/debian/gpart/sbin/gpart /dev/hd0s1
.. <snipped> ..
Program received signal SIGFPE, Arithmetic exception.
0x0804bf34 in fillin_dos_chs (p=0x80540b0, d=<optimized out>,
offset=<optimized out>) at gpart.c:489
warning: Source file is more recent than executable.
489 p->p_ssect = (n % d->d_dg.d_s) + 1;
$PWD/debian/gpart/sbin/gpart /dev/null
Begin scan...
End scan.
Checking partitions...
Ok.
Guessed primary partition table:
Primary partition(1)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
Primary partition(2)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
Primary partition(3)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
Primary partition(4)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
On Linux, gpart behaves as described
gpart-0.1h/debian/gpart/sbin/gpart /dev/null
** Error: ioctl(HDIO_GETGEO) failed: Inappropriate ioctl for device.
*** Fatal error: ioctl(HDIO_GETGEO) failed: Could not read disk
geomentry, may be retry either with the -C or the -g option. [0]
I did run ./gpart /dev/sda on my computer for about 2 minutes before
deciding against it :).
Attached are all the files in my debian/patches/ directory [1].
Regards,
Harish Badrinath
Note[0]: The second line is added by a patch i added/modified.
Note[1]: AMD64 patch should probably be renamed to, POSIX patch or
something similar :).
Author: n/a
Description: Various debian specific fixes to the build files
* Makes debian specific changes to the build files.
* Closes issue of FTBS on Debian/Hurd
Bug-Debian: http://bugs.debian.org/510219
Bug-Debian: http://bugs.debian.org/437067
--- a/Makefile
+++ b/Makefile
@@ -10,8 +10,12 @@
$(MAKE) -C src
$(MAKE) -C man
-install:
+install: install-object install-man
+
+install-object:
$(MAKE) -C src install
+
+install-man:
$(MAKE) -C man install
uninstall:
--- a/inst.defs
+++ b/inst.defs
@@ -1,9 +1,16 @@
#
# installation directories for gpart
#
-prefix=/usr/local
-bindir=$(prefix)/bin
-libdir=$(prefix)/lib
-mandir=$(prefix)/man
+
+# Added by D. Coe for Debian GNU/Linux:
+DESTDIR =
+# Changed by D. Coe for Debian GNU/Linux:
+prefix=$(DESTDIR)
+# Changed by D. Coe for Debian GNU/Linux:
+bindir=$(prefix)/sbin
+# Not used -D. Coe:
+#libdir=$(prefix)/lib
+mandir=$(prefix)/usr/share/man
manext=8
-sharedir=$(prefix)/share
+# Not used -D. Coe:
+#sharedir=$(prefix)/share
--- a/src/Makefile
+++ b/src/Makefile
@@ -5,8 +5,10 @@
include ../make.defs
CFLAGS+=-DVERSION=\"$(version)\"
-ifeq ($(shell uname),Linux)
+ifneq ($(findstring $(shell uname),Linux GNU GNU/kFreeBSD),)
LIBS=-ldl
+CFLAGS += -D__USE_FILE_OFFSET64 -D__USE_LARGEFILE64
+CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
endif
ifdef DEBUG
@@ -19,7 +21,7 @@
endif
-mod=ext2 lswap fat bsddl ntfs hpfs s86dl minix rfs hmlvm qnx4 beos xfs
+mod=ext2 lswap fat bsddl ntfs hpfs s86dl minix reiserfs hmlvm qnx4 beos xfs
modobj=$(foreach m,$(mod),gm_$(m).o)
obj=gpart.o gmodules.o disku.o l64seek.o $(modobj)
src=$(obj:.o=.c)
@@ -33,7 +35,7 @@
install: $(prg)
$(INSTALL) -d $(bindir)
- $(INSTALL) -s $(prg) $(bindir)
+ $(INSTALL) $(prg) $(bindir)
uninstall:
$(RM) $(bindir)/$(prg)
Author: n/a
Description: Modifies README file and various other doc fixes
--- a/README
+++ b/README
@@ -24,26 +24,25 @@
- Currently recognized partitions/filesystems types ---------------------
- Modname Typ Description
- fat 0x01 "Primary DOS with 12 bit FAT"
- 0x04 "Primary DOS with 16 bit FAT (<= 32MB)"
- 0x06 "Primary 'big' DOS (> 32MB)"
- 0x0B "DOS or Windows 95 with 32 bit FAT"
- 0x0C "DOS or Windows 95 with 32 bit FAT, LBA"
- ntfs 0x07 "OS/2 HPFS, NTFS, QNX or Advanced UNIX"
- hpfs 0x07 "OS/2 HPFS, NTFS, QNX or Advanced UNIX"
- ext2 0x83 "Linux ext2 filesystem"
- lswap 0x82 "Linux swap"
- bsddl 0xA5 "FreeBSD/NetBSD/386BSD"
- s86dl 0x82 "Solaris/x86 disklabel"
- minix 0x80 "Minix V1"
- 0x81 "Minix V2"
- rfs 0x83 "Reiser filesystem"
- hmlvm 0xFE "Linux LVM physical volumes"
- qnx4 0x4F "QNX 4.x"
- beos 0xEB "BeOS fs"
- xfs 0x83 "SGI XFS filesystem"
-
+ Modname Typ Description
+ fat 0x01 "Primary DOS with 12 bit FAT"
+ 0x04 "Primary DOS with 16 bit FAT (<= 32MB)"
+ 0x06 "Primary 'big' DOS (> 32MB)"
+ 0x0B "DOS or Windows 95 with 32 bit FAT"
+ 0x0C "DOS or Windows 95 with 32 bit FAT, LBA"
+ ntfs 0x07 "OS/2 HPFS, NTFS, QNX or Advanced UNIX"
+ hpfs 0x07 "OS/2 HPFS, NTFS, QNX or Advanced UNIX"
+ ext2 0x83 "Linux ext2 filesystem"
+ lswap 0x82 "Linux swap"
+ bsddl 0xA5 "FreeBSD/NetBSD/386BSD"
+ s86dl 0x82 "Solaris/x86 disklabel"
+ minix 0x80 "Minix V1"
+ 0x81 "Minix V2"
+ reiserfs 0x83 "ReiserFS filesystem"
+ hmlvm 0xFE "Linux LVM physical volumes"
+ qnx4 0x4F "QNX 4.x"
+ beos 0xEB "BeOS fs"
+ xfs 0x83 "SGI XFS filesystem"
- External guessing modules ---------------------------------------------
--- a/man/gpart.man
+++ b/man/gpart.man
@@ -63,8 +63,8 @@
.I qnx4
QNX 4.x filesystem.
.TP
-.I rfs
-The Reiser filesystem (version 3.5.X, X > 11).
+.I reiserfs
+The Reiser filesystem (version 3.5.X, X > 11, 3.6.X).
.TP
.I s86dl
Sun Solaris on Intel platforms uses a sub-partitioning
Author: n/a
Description: Various File system related fixes to gparted
* Small ext3 fix.
* Fix for FAT filesystem for alpha.
* Extend support for ReiserFS.
Bug-Debian: http://bugs.debian.org/66893
--- a/src/gm_ext2.c
+++ b/src/gm_ext2.c
@@ -121,9 +121,10 @@
/*
* current mount count shouldn't be greater than max+20
+ * but ext3 usually has s_max_mnt_count==-1
*/
- if (sb->s_mnt_count > sb->s_max_mnt_count + 20)
+ if ((sb->s_max_mnt_count!=-1)&&(sb->s_mnt_count > sb->s_max_mnt_count + 20))
return (1);
/*
--- a/src/gm_fat.h
+++ b/src/gm_fat.h
@@ -10,7 +10,7 @@
* option) any later version.
*
* Created: 04.01.1999 <mb@ichabod.han.de>
- * Modified:
+ * Modified:
*
*/
@@ -60,6 +60,11 @@
__u16 info_sector; /* filesystem info sector */
__u16 backup_boot; /* backup boot sector */
__u16 reserved2[6]; /* Unused */
-};
+} __attribute__ ((packed));
+/* "__attribute__ ((packed))"
+ added by davidc@debian.org,
+ as suggested by falk@zxmjz18.extern.uni-tuebingen.de
+ Fri Jul 07 18:04:15 2000
+ in debian bug report #66893 "FAT detection broken on Alpha" */
#endif /* _GM_FAT_H */
--- /dev/null
+++ b/src/gm_reiserfs.c
@@ -0,0 +1,92 @@
+/*
+ * gm_reiserfs.c -- gpart ReiserFS guessing module
+ *
+ * gpart (c) 1999-2001 Michail Brzitwa <mb@ichabod.han.de>
+ * Guess PC-type hard disk partitions.
+ *
+ * gpart is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Created: 21.01.1999 <mb@ichabod.han.de>
+ * Modified: 26.12.2000 Francis Devereux <francis@devereux.tc>
+ * Added reiserfs 3.5.28 support.
+ * Modified: 10.01.2003 Yury Umanets <umka@namesys.com>
+ * Added reiserfs 3.6.x support.
+ *
+ */
+
+#include <string.h>
+#include <errno.h>
+#include "gpart.h"
+#include "gm_reiserfs.h"
+
+static const char rcsid[] = "$Id: gm_reiserfs.c,v 1.5 2003/01/10 16:38:08 mb Exp mb $";
+
+
+int reiserfs_init(disk_desc *d,g_module *m)
+{
+ if ((d == 0) || (m == 0))
+ return (0);
+
+ m->m_desc = "ReiserFS filesystem";
+ return (REISERFS_FIRST_BLOCK * 1024 + SB_V35_SIZE);
+}
+
+
+
+int reiserfs_term(disk_desc *d)
+{
+ return (1);
+}
+
+
+
+int reiserfs_gfun(disk_desc *d,g_module *m)
+{
+ struct reiserfs_super_block_v35 *sb;
+ dos_part_entry *pt = &m->m_part;
+ s64_t size;
+
+ m->m_guess = GM_NO;
+ sb = (struct reiserfs_super_blockv35 *)(d->d_sbuf + REISERFS_FIRST_BLOCK * 1024);
+ if (strncmp(sb->s_magic,REISERFS_SUPER_V35_MAGIC,12) == 0 ||
+ strncmp(sb->s_magic,REISERFS_SUPER_V36_MAGIC,12) == 0)
+ {
+ /*
+ * sanity checks.
+ */
+
+ if (sb->s_block_count < sb->s_free_blocks)
+ return (1);
+
+ if (sb->s_block_count < REISERFS_MIN_BLOCK_AMOUNT)
+ return (1);
+
+ if ((sb->s_state != REISERFS_VALID_FS) &&
+ (sb->s_state != REISERFS_ERROR_FS))
+ return (1);
+
+ if (sb->s_oid_maxsize % 2) /* must be even */
+ return (1);
+
+ if (sb->s_oid_maxsize < sb->s_oid_cursize)
+ return (1);
+
+ if ((sb->s_blocksize != 4096) && (sb->s_blocksize != 8192))
+ return (1);
+
+ /*
+ * ok.
+ */
+
+ m->m_guess = GM_YES;
+ pt->p_start = d->d_nsb;
+ size = sb->s_block_count; size *= sb->s_blocksize; size /= d->d_ssize;
+ pt->p_size = (unsigned long)size;
+ pt->p_typ = 0x83;
+ }
+ return (1);
+}
+
--- /dev/null
+++ b/src/gm_reiserfs.h
@@ -0,0 +1,83 @@
+/*
+ * gm_reiserfs.h -- gpart ReiserFS guessing module header
+ *
+ * gpart (c) 1999-2001 Michail Brzitwa <mb@ichabod.han.de>
+ * Guess PC-type hard disk partitions.
+ *
+ * gpart is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Created: 21.01.1999 <mb@ichabod.han.de>
+ * Modified: 26.12.2000 Francis Devereux <francis@devereux.tc>
+ * Update support reiserfs version 3.5.28
+ * Modified: 10.01.2003 Yury Umanets <umka@namesys.com>
+ * Added reiserfs 3.6.x support.
+ *
+ */
+
+#ifndef _GM_reiserfs_H
+#define _GM_reiserfs_H
+
+/* imported from asm/types.h */
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+/*
+ * taken from ReiserFS v3.5.28, v3.6.x. Reiserfs Copyright 1996-2000 Hans Reiser
+ */
+
+#define REISERFS_SUPER_V35_MAGIC "ReIsErFs"
+#define REISERFS_SUPER_V36_MAGIC "ReIsEr2Fs"
+
+#define REISERFS_FIRST_BLOCK 64
+#define REISERFS_VALID_FS 1
+#define REISERFS_ERROR_FS 2
+#define REISERFS_MIN_BLOCK_AMOUNT 100
+
+struct reiserfs_super_block_v35
+{
+ __u32 s_block_count; /* blocks count */
+ __u32 s_free_blocks; /* free blocks count */
+ __u32 s_root_block; /* root block number */
+ __u32 s_journal_block; /* journal block number */
+ __u32 s_journal_dev; /* journal device number */
+ __u32 s_orig_journal_size; /* size of the journal on FS creation. used to make sure they don't overflow it */
+ __u32 s_journal_trans_max; /* max number of blocks in a transaction. */
+ __u32 s_journal_block_count; /* total size of the journal. can change over time */
+ __u32 s_journal_max_batch; /* max number of blocks to batch into a trans */
+ __u32 s_journal_max_commit_age; /* in seconds, how old can an async commit be */
+ __u32 s_journal_max_trans_age; /* in seconds, how old can a transaction be */
+ __u16 s_blocksize; /* block size */
+ __u16 s_oid_maxsize; /* max size of object id array, see get_objectid() commentary */
+ __u16 s_oid_cursize; /* current size of object id array */
+ __u16 s_state; /* valid or error */
+ char s_magic[12]; /* reiserfs magic string indicates that file system is reiserfs */
+ __u32 s_hash_function_code; /* indicate, what hash fuction is being use to sort names in a directory*/
+ __u16 s_tree_height; /* height of disk tree */
+ __u16 s_bmap_nr; /* amount of bitmap blocks needed to address each block of file system */
+ __u16 s_reserved;
+};
+
+#define SB_V35_SIZE (sizeof(struct reiserfs_super_block_v35))
+
+struct reiserfs_super_block_v36 {
+ struct reiserfs_super_block_v35 s_v35;
+ __u32 s_inode_generation;
+ __u32 s_flags;
+ char s_uuid[16];
+ char s_label[16];
+ char s_unused[88];
+};
+
+#define SB_V36_SIZE (sizeof(struct reiserfs_super_block_v36))
+
+#endif /* _GM_REISERFS_H */
+
--- a/src/gmodules.c
+++ b/src/gmodules.c
@@ -154,7 +154,7 @@
GMODINS(bsddl);
GMODINS(lswap);
GMODINS(qnx4);
- GMODINS(rfs);
+ GMODINS(reiserfs);
GMODINS(ntfs);
GMODINS(hpfs);
GMODINS(minix);
--- a/src/gmodules.h
+++ b/src/gmodules.h
@@ -63,7 +63,7 @@
GMODDECL(bsddl); GMODDECL(ext2); GMODDECL(fat);
GMODDECL(hpfs); GMODDECL(lswap); GMODDECL(ntfs);
-GMODDECL(s86dl); GMODDECL(minix); GMODDECL(rfs);
+GMODDECL(s86dl); GMODDECL(minix); GMODDECL(reiserfs);
GMODDECL(hmlvm); GMODDECL(qnx4); GMODDECL(beos);
GMODDECL(xfs);
Author: n/a
Description: Fix for AMD64
Origin: upstream, http://www.freebsd.org/cgi/cvsweb.cgi/ports/sysutils/gpart/files/Attic/patch-src__gpart.h?rev=1.1
Origin: upstream, http://www.freebsd.org/cgi/cvsweb.cgi/ports/sysutils/gpart/files/Attic/patch-src__gm_ntfs.h?rev=1.1
Bug-Debian: http://bugs.debian.org/397632
Index: gpart-0.1h/src/gm_ntfs.h
===================================================================
--- gpart-0.1h.orig/src/gm_ntfs.h 2012-01-30 17:07:20.000000000 +0530
+++ gpart-0.1h/src/gm_ntfs.h 2012-01-30 17:34:45.000000000 +0530
@@ -13,7 +13,10 @@
* Modified:
*
*/
-
+#include <sys/types.h>
+#include <limits.h>
+#include <endian.h>
+#include <stdint.h>
#ifndef _GM_NTFS_H
#define _GM_NTFS_H
@@ -29,32 +32,40 @@
/* 'NTFS' in little endian */
#define NTFS_SUPER_MAGIC 0x5346544E
-#if defined(i386) || defined(__i386__) || defined(__alpha__)
-
/* unsigned integral types */
#ifndef NTFS_INTEGRAL_TYPES
#define NTFS_INTEGRAL_TYPES
-typedef unsigned char ntfs_u8;
-typedef unsigned short ntfs_u16;
-typedef unsigned int ntfs_u32;
-typedef s64_t ntfs_u64;
+typedef uint8_t ntfs_u8;
+typedef uint16_t ntfs_u16;
+typedef uint32_t ntfs_u32;
+typedef uint64_t ntfs_u64;
+typedef int8_t ntfs_s8;
+typedef int16_t ntfs_s16;
#endif /* NTFS_INTEGRAL_TYPES */
-#endif /* defined(i386) || defined(__i386__) || defined(__alpha__) */
-
-/* Macros reading unsigned integers from a byte pointer */
-/* these should work for all little endian machines */
-#define NTFS_GETU8(p) (*(ntfs_u8*)(p))
-#define NTFS_GETU16(p) (*(ntfs_u16*)(p))
-#define NTFS_GETU24(p) (NTFS_GETU32(p) & 0xFFFFFF)
-#define NTFS_GETU32(p) (*(ntfs_u32*)(p))
-#define NTFS_GETU64(p) (*(ntfs_u64*)(p))
-
-/* Macros reading signed integers, returning int */
-#define NTFS_GETS8(p) ((int)(*(char*)(p)))
-#define NTFS_GETS16(p) ((int)(*(short*)(p)))
-#define NTFS_GETS24(p) (NTFS_GETU24(p) < 0x800000 ? (int)NTFS_GETU24(p) :
+#define CPU_TO_LE16(a) htole16(a)
+#define CPU_TO_LE32(a) htole32(a)
+#define CPU_TO_LE64(a) htole64(a)
+
+#define LE16_TO_CPU(a) le16toh(a)
+#define LE32_TO_CPU(a) le32toh(a)
+#define LE64_TO_CPU(a) le64toh(a)
+
+/* Macros reading unsigned integers */
+#define NTFS_GETU8(p) (*(ntfs_u8*)(p))
+#define NTFS_GETU16(p) ((ntfs_u16)LE16_TO_CPU(*(ntfs_u16*)(p)))
+#define NTFS_GETU24(p) ((ntfs_u32)NTFS_GETU16(p) | \
+ ((ntfs_u32)NTFS_GETU8(((char*)(p)) + 2) << 16))
+#define NTFS_GETU32(p) ((ntfs_u32)LE32_TO_CPU(*(ntfs_u32*)(p)))
+#define NTFS_GETU64(p) ((ntfs_u64)LE64_TO_CPU(*(ntfs_u64*)(p)))
+
+/* Macros reading signed integers */
+#define NTFS_GETS8(p) ((*(ntfs_s8*)(p)))
+#define NTFS_GETS16(p) ((ntfs_s16)LE16_TO_CPU(*(short*)(p)))
+#define NTFS_GETS24(p) (NTFS_GETU24(p) < 0x800000 ? \
+ (int)NTFS_GETU24(p) : \
+ (int)(NTFS_GETU24(p) - 0x1000000))
#endif /* _GM_NTFS_H */
Index: gpart-0.1h/src/gpart.h
===================================================================
--- gpart-0.1h.orig/src/gpart.h 2012-01-30 17:07:20.000000000 +0530
+++ gpart-0.1h/src/gpart.h 2012-01-30 17:07:21.000000000 +0530
@@ -19,6 +19,7 @@
#include "errmsgs.h"
#include "l64seek.h"
+#include <stdint.h>
#define PROGRAM "gpart"
@@ -31,7 +32,7 @@
* endianness (incomplete, later)
*/
-#if defined(__i386__) || defined(__alpha__)
+#if defined(__i386__) || defined(__alpha__) || defined(__x86_64__)
# define le16(x) (x) /* x as little endian */
# define be16(x) ((((x)&0xff00)>>8) | \
(((x)&0x00ff)<<8))
@@ -112,8 +113,8 @@
byte_t p_ehd; /* end head */
byte_t p_esect; /* end sector */
byte_t p_ecyl; /* end cylinder */
- unsigned long p_start; /* start sector (absolute) */
- unsigned long p_size; /* # of sectors */
+ uint32_t p_start; /* start sector (absolute) */
+ uint32_t p_size; /* # of sectors */
} dos_part_entry;
@@ -123,7 +124,7 @@
byte_t _align[2];
byte_t t_boot[DOSPARTOFF];
dos_part_entry t_parts[NDOSPARTS];
- unsigned short t_magic; /* DOSPTMAGIC */
+ uint16_t t_magic; /* DOSPTMAGIC */
} dos_part_table;
Author: n/a
Description: Fixes signed 64bit seek.
--- a/src/l64seek.c
+++ b/src/l64seek.c
@@ -25,30 +25,11 @@
} ostck[OSTACKLEN];
static int osptr = -1;
-#if defined(__linux__) && defined(__i386__)
-_syscall5(int,_llseek,uint,fd,ulong,hi,ulong,lo,loff_t *,res,uint,wh)
-#endif
-
-
-
off64_t l64seek(int fd,off64_t offset,int whence)
{
off64_t ret = (off64_t)-1;
-#if defined(__linux__) && defined(__i386__)
- int iret;
- unsigned long ohi, olo;
-
- ohi = (unsigned long)((offset >> 32) & 0xFFFFFFFF);
- olo = (unsigned long)(offset & 0xFFFFFFFF);
- iret = _llseek(fd,ohi,olo,&ret,whence);
- if (iret == -1)
- ret = (off64_t)-1;
-#endif
-
-#if defined(__FreeBSD__) || (defined(__linux__) && defined(__alpha__))
ret = lseek(fd,offset,whence);
-#endif
return (ret);
}
--- a/src/l64seek.h
+++ b/src/l64seek.h
@@ -17,6 +17,8 @@
#ifndef _L64SEEK_H
#define _L64SEEK_H
+#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
/*
@@ -26,18 +28,7 @@
*/
-#if defined(__linux__)
-# include <linux/unistd.h>
-# include <sys/types.h>
- typedef int64_t off64_t;
-#endif
-
-
-#if defined(__FreeBSD__)
- typedef off_t off64_t;
-#endif
-
-
+typedef loff_t off64_t;
typedef off64_t s64_t;
off64_t l64seek(int fd, off64_t offset, int whence);
@@ -45,5 +36,4 @@
int l64opush(int);
s64_t l64opop(int);
-
#endif
Author: Trace Green <debian.y.h.xu@gmail.com>
Description: Support for NTFS of Windows XP (Closes: #474321).
Bug-Debian: http://bugs.debian.org/474321
--- a/src/gm_ntfs.c
+++ b/src/gm_ntfs.c
@@ -72,11 +72,11 @@
if ((mft_clusters_per_record < 0) && (mft_clusters_per_record != -10))
return (1);
size = NTFS_GETU64(d->d_sbuf + 0x28);
-
+#if 0
size /= clusterfactor;
size *= clustersize;
size /= d->d_ssize;
-
+#endif
/*
* look for an additional backup boot sector at the end of
* this FS (NT4 puts this backup sector after the FS, this
Author: James Westby <james.westby@canonical.com>
Description: Specify a mode to open(2) as required.
Bug-Debian: http://bugs.debian.org/506816
--- a/src/gpart.c
+++ b/src/gpart.c
@@ -1221,7 +1221,7 @@
{
int fd, ret = 0;
- if ((fd = open(bfile,O_WRONLY|O_CREAT)) < 0)
+ if ((fd = open(bfile,O_WRONLY|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP |S_IROTH)) < 0)
return (ret);
if (write(fd,d->d_pt.t_boot,512) == 512)
Author: Josef Spillner <2005@kuarepoti-dju.net>
Description: Adding support for image files.
Index: gpart-0.1h/src/disku.c
===================================================================
--- gpart-0.1h.orig/src/disku.c 2012-01-30 17:07:20.000000000 +0530
+++ gpart-0.1h/src/disku.c 2012-01-30 17:07:21.000000000 +0530
@@ -22,6 +22,7 @@
#include "gpart.h"
#if defined(__linux__)
+#include <errno.h>
#include <sys/mount.h>
#include <linux/hdreg.h>
#endif
@@ -31,7 +32,7 @@
#include <sys/disklabel.h>
#endif
-
+#include <unistd.h>
/*
* get disk geometry. The medium is opened for reading,
@@ -41,13 +42,42 @@
struct disk_geom *disk_geometry(disk_desc *d)
{
static struct disk_geom g;
+ long nsects;
#if defined(__linux__)
struct hd_geometry hg;
- long nsects;
+#endif
+#if defined(__FreeBSD__)
+ struct disklabel dl;
+#endif
+
+ struct stat st;
+ int ret;
+ long lba;
+ ret = stat(d->d_dev, &st);
+ if (ret == 0)
+ {
+ if (S_ISREG(st.st_mode))
+ {
+ nsects = st.st_size / 512;
+ if (nsects == 0)
+ pr(FATAL, EM_FATALERROR, "Not a block device image file");
+ lba = nsects - 1;
+ g.d_h = (lba / 63) % 255;
+ g.d_s = lba % 63 + 1;
+ g.d_c = lba / (255 * 63);
+ return (&g);
+ }
+ }
+
+#if defined(__linux__)
if (ioctl(d->d_fd,HDIO_GETGEO,&hg) == -1)
- pr(FATAL,EM_IOCTLFAILED,"HDIO_GETGEO",strerror(errno));
+ {
+ pr(ERROR,EM_IOCTLFAILED,"HDIO_GETGEO",strerror(errno));
+ pr(FATAL,EM_IOCTLFAILED,"HDIO_GETGEO","Could not read disk geomentry, may be retry either with the -C or the -g option");
+ }
+
#ifdef BLKGETSIZE
if (ioctl(d->d_fd,BLKGETSIZE,&nsects) == -1)
pr(FATAL,EM_IOCTLFAILED,"BLKGETSIZE",strerror(errno));
@@ -61,7 +91,6 @@
#endif
#if defined(__FreeBSD__)
- struct disklabel dl;
if (ioctl(d->d_fd,DIOCGDINFO,&dl) == -1)
pr(FATAL,EM_IOCTLFAILED,"DIOCGDINFO",strerror(errno));
g.d_c = dl.d_ncylinders;
Reply to: