From 874af85d5eb08b65476f406f6a1e7edc127ac210 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 8 Mar 2006 07:03:27 +0000 Subject: import most of e2fsprogs 1.38 updates --- e2fsprogs/ext2fs/bitops.c | 6 +++--- e2fsprogs/ext2fs/bitops.h | 6 +++--- e2fsprogs/ext2fs/ext2fs.h | 1 + e2fsprogs/ext2fs/ext2fs_inline.c | 8 +++++--- e2fsprogs/ext2fs/getsectsize.c | 2 +- e2fsprogs/ext2fs/ismounted.c | 6 ++---- 6 files changed, 15 insertions(+), 14 deletions(-) (limited to 'e2fsprogs/ext2fs') diff --git a/e2fsprogs/ext2fs/bitops.c b/e2fsprogs/ext2fs/bitops.c index e44e10c..77ac2a6 100644 --- a/e2fsprogs/ext2fs/bitops.c +++ b/e2fsprogs/ext2fs/bitops.c @@ -30,7 +30,7 @@ * systems, as well as non-32 bit systems. */ -int ext2fs_set_bit(int nr,void * addr) +int ext2fs_set_bit(unsigned int nr,void * addr) { int mask, retval; unsigned char *ADDR = (unsigned char *) addr; @@ -42,7 +42,7 @@ int ext2fs_set_bit(int nr,void * addr) return retval; } -int ext2fs_clear_bit(int nr, void * addr) +int ext2fs_clear_bit(unsigned int nr, void * addr) { int mask, retval; unsigned char *ADDR = (unsigned char *) addr; @@ -54,7 +54,7 @@ int ext2fs_clear_bit(int nr, void * addr) return retval; } -int ext2fs_test_bit(int nr, const void * addr) +int ext2fs_test_bit(unsigned int nr, const void * addr) { int mask; const unsigned char *ADDR = (const unsigned char *) addr; diff --git a/e2fsprogs/ext2fs/bitops.h b/e2fsprogs/ext2fs/bitops.h index 4dba050..5e727d1 100644 --- a/e2fsprogs/ext2fs/bitops.h +++ b/e2fsprogs/ext2fs/bitops.h @@ -15,9 +15,9 @@ #include -extern int ext2fs_set_bit(int nr,void * addr); -extern int ext2fs_clear_bit(int nr, void * addr); -extern int ext2fs_test_bit(int nr, const void * addr); +extern int ext2fs_set_bit(unsigned int nr,void * addr); +extern int ext2fs_clear_bit(unsigned int nr, void * addr); +extern int ext2fs_test_bit(unsigned int nr, const void * addr); extern __u16 ext2fs_swab16(__u16 val); extern __u32 ext2fs_swab32(__u32 val); diff --git a/e2fsprogs/ext2fs/ext2fs.h b/e2fsprogs/ext2fs/ext2fs.h index 7d2a436..b8752a5 100644 --- a/e2fsprogs/ext2fs/ext2fs.h +++ b/e2fsprogs/ext2fs/ext2fs.h @@ -330,6 +330,7 @@ typedef struct ext2_struct_inode_scan *ext2_inode_scan; #define EXT2_MF_ISROOT 2 #define EXT2_MF_READONLY 4 #define EXT2_MF_SWAP 8 +#define EXT2_MF_BUSY 16 /* * Ext2/linux mode flags. We define them here so that we don't need diff --git a/e2fsprogs/ext2fs/ext2fs_inline.c b/e2fsprogs/ext2fs/ext2fs_inline.c index 73d393d..a363b19 100644 --- a/e2fsprogs/ext2fs/ext2fs_inline.c +++ b/e2fsprogs/ext2fs/ext2fs_inline.c @@ -44,12 +44,14 @@ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size, unsigned long size, void *ptr) { void *p; - void **pp = (void **)ptr; - p = realloc(*pp, size); + /* Use "memcpy" for pointer assignments here to avoid problems + * with C99 strict type aliasing rules. */ + memcpy(&p, ptr, sizeof (p)); + p = realloc(p, size); if (!p) return EXT2_ET_NO_MEMORY; - *pp = p; + memcpy(ptr, &p, sizeof (p)); return 0; } diff --git a/e2fsprogs/ext2fs/getsectsize.c b/e2fsprogs/ext2fs/getsectsize.c index b561660..36871f2 100644 --- a/e2fsprogs/ext2fs/getsectsize.c +++ b/e2fsprogs/ext2fs/getsectsize.c @@ -23,7 +23,7 @@ #include #endif -#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE) +#if defined(__linux__) && defined(_IO) && !defined(BLKSSZGET) #define BLKSSZGET _IO(0x12,104)/* get block device sector size */ #endif diff --git a/e2fsprogs/ext2fs/ismounted.c b/e2fsprogs/ext2fs/ismounted.c index 2395cca..125fe24 100644 --- a/e2fsprogs/ext2fs/ismounted.c +++ b/e2fsprogs/ext2fs/ismounted.c @@ -339,20 +339,18 @@ int main(int argc, char **argv) exit(1); } printf("Device %s reports flags %02x\n", argv[1], mount_flags); + if (mount_flags & EXT2_MF_BUSY) + printf("\t%s is apparently in use.\n", argv[1]); if (mount_flags & EXT2_MF_MOUNTED) printf("\t%s is mounted.\n", argv[1]); - if (mount_flags & EXT2_MF_SWAP) printf("\t%s is a swap device.\n", argv[1]); - if (mount_flags & EXT2_MF_READONLY) printf("\t%s is read-only.\n", argv[1]); - if (mount_flags & EXT2_MF_ISROOT) printf("\t%s is the root filesystem.\n", argv[1]); if (mntpt[0]) printf("\t%s is mounted on %s.\n", argv[1], mntpt); - exit(0); } #endif /* DEBUG */ -- cgit v1.1