diff options
Diffstat (limited to 'e2fsprogs')
108 files changed, 862 insertions, 862 deletions
diff --git a/e2fsprogs/Config.in b/e2fsprogs/Config.in index 225e5aa..91e873e 100644 --- a/e2fsprogs/Config.in +++ b/e2fsprogs/Config.in @@ -17,7 +17,7 @@ config CONFIG_E2FSCK help e2fsck is used to check Linux second extended file systems (ext2fs). e2fsck also supports ext2 filesystems countaining a journal (ext3). - The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also + The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also provided. config CONFIG_FSCK @@ -25,7 +25,7 @@ config CONFIG_FSCK default n help fsck is used to check and optionally repair one or more filesystems. - In actuality, fsck is simply a front-end for the various file system + In actuality, fsck is simply a front-end for the various file system checkers (fsck.fstype) available under Linux. config CONFIG_LSATTR @@ -38,14 +38,14 @@ config CONFIG_MKE2FS bool "mke2fs" default n help - mke2fs is used to create an ext2/ext3 filesystem. The normal compat + mke2fs is used to create an ext2/ext3 filesystem. The normal compat symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided. config CONFIG_TUNE2FS bool "tune2fs" default n help - tune2fs allows the system administrator to adjust various tunable + tune2fs allows the system administrator to adjust various tunable filesystem parameters on Linux ext2/ext3 filesystems. config CONFIG_E2LABEL @@ -53,7 +53,7 @@ config CONFIG_E2LABEL default n depends on CONFIG_TUNE2FS help - e2label will display or change the filesystem label on the ext2 + e2label will display or change the filesystem label on the ext2 filesystem located on device. config CONFIG_FINDFS @@ -61,7 +61,7 @@ config CONFIG_FINDFS default n depends on CONFIG_TUNE2FS help - findfs will search the disks in the system looking for a filesystem + findfs will search the disks in the system looking for a filesystem which has a label matching label or a UUID equal to uuid. endmenu diff --git a/e2fsprogs/blkid/blkid.h b/e2fsprogs/blkid/blkid.h index 3ea94ac..3bb0e78 100644 --- a/e2fsprogs/blkid/blkid.h +++ b/e2fsprogs/blkid/blkid.h @@ -34,13 +34,13 @@ typedef struct blkid_struct_dev_iterate *blkid_dev_iterate; * Flags for blkid_get_dev * * BLKID_DEV_CREATE Create an empty device structure if not found - * in the cache. + * in the cache. * BLKID_DEV_VERIFY Make sure the device structure corresponds - * with reality. + * with reality. * BLKID_DEV_FIND Just look up a device entry, and return NULL - * if it is not found. + * if it is not found. * BLKID_DEV_NORMAL Get a valid device structure, either from the - * cache or by probing the device. + * cache or by probing the device. */ #define BLKID_DEV_FIND 0x0000 #define BLKID_DEV_CREATE 0x0001 diff --git a/e2fsprogs/blkid/blkid_getsize.c b/e2fsprogs/blkid/blkid_getsize.c index 9458c08..58cc735 100644 --- a/e2fsprogs/blkid/blkid_getsize.c +++ b/e2fsprogs/blkid/blkid_getsize.c @@ -70,7 +70,7 @@ blkid_loff_t blkid_get_dev_size(int fd) { int valid_blkgetsize64 = 1; #ifdef __linux__ - struct utsname ut; + struct utsname ut; #endif unsigned long long size64; unsigned long size; diff --git a/e2fsprogs/blkid/cache.c b/e2fsprogs/blkid/cache.c index 0dd1b62..87be126 100644 --- a/e2fsprogs/blkid/cache.c +++ b/e2fsprogs/blkid/cache.c @@ -47,9 +47,9 @@ int blkid_get_cache(blkid_cache *ret_cache, const char *filename) if (!filename) filename = BLKID_CACHE_FILE; cache->bic_filename = blkid_strdup(filename); - + blkid_read_cache(cache); - + *ret_cache = cache; return 0; } @@ -62,7 +62,7 @@ void blkid_put_cache(blkid_cache cache) (void) blkid_flush_cache(cache); DBG(DEBUG_CACHE, printf("freeing cache struct\n")); - + /* DEB_DUMP_CACHE(cache); */ while (!list_empty(&cache->bic_devs)) { @@ -79,7 +79,7 @@ void blkid_put_cache(blkid_cache cache) while (!list_empty(&tag->bit_names)) { blkid_tag bad = list_entry(tag->bit_names.next, - struct blkid_struct_tag, + struct blkid_struct_tag, bit_names); DBG(DEBUG_CACHE, printf("warning: unfreed tag %s=%s\n", @@ -90,7 +90,7 @@ void blkid_put_cache(blkid_cache cache) } if (cache->bic_filename) free(cache->bic_filename); - + free(cache); } diff --git a/e2fsprogs/blkid/dev.c b/e2fsprogs/blkid/dev.c index 0e2b4e1..d2e4683 100644 --- a/e2fsprogs/blkid/dev.c +++ b/e2fsprogs/blkid/dev.c @@ -73,7 +73,7 @@ extern const char *blkid_dev_devname(blkid_dev dev) * This series of functions iterate over all devices in a blkid cache */ #define DEV_ITERATE_MAGIC 0x01a5284c - + struct blkid_struct_dev_iterate { int magic; blkid_cache cache; diff --git a/e2fsprogs/blkid/devname.c b/e2fsprogs/blkid/devname.c index b5db29e..1e016a5 100644 --- a/e2fsprogs/blkid/devname.c +++ b/e2fsprogs/blkid/devname.c @@ -54,7 +54,7 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags) if (strcmp(tmp->bid_name, devname)) continue; - DBG(DEBUG_DEVNAME, + DBG(DEBUG_DEVNAME, printf("found devname %s in cache\n", tmp->bid_name)); dev = tmp; break; @@ -113,7 +113,7 @@ static void probe_one(blkid_cache cache, const char *ptname, dev->bid_devno == devno) goto set_pri; - if (stat(device, &st) == 0 && S_ISBLK(st.st_mode) && + if (stat(device, &st) == 0 && S_ISBLK(st.st_mode) && st.st_rdev == devno) { devname = blkid_strdup(device); break; diff --git a/e2fsprogs/blkid/devno.c b/e2fsprogs/blkid/devno.c index 93a57fd..7d083e7 100644 --- a/e2fsprogs/blkid/devno.c +++ b/e2fsprogs/blkid/devno.c @@ -171,13 +171,13 @@ char *blkid_devno_to_devname(dev_t devno) if (!devname) { DBG(DEBUG_DEVNO, - printf("blkid: couldn't find devno 0x%04lx\n", + printf("blkid: couldn't find devno 0x%04lx\n", (unsigned long) devno)); } else { DBG(DEBUG_DEVNO, printf("found devno 0x%04Lx as %s\n", devno, devname)); } - + return devname; } diff --git a/e2fsprogs/blkid/probe.c b/e2fsprogs/blkid/probe.c index cb21c10..2aaa508 100644 --- a/e2fsprogs/blkid/probe.c +++ b/e2fsprogs/blkid/probe.c @@ -41,7 +41,7 @@ static int check_mdraid(int fd, unsigned char *ret_uuid) struct mdp_superblock_s *md; blkid_loff_t offset; char buf[4096]; - + if (fd < 0) return -BLKID_ERR_PARAM; @@ -83,7 +83,7 @@ static void get_ext2_info(blkid_dev dev, unsigned char *buf) struct ext2_super_block *es = (struct ext2_super_block *) buf; const char *label = 0; - DBG(DEBUG_PROBE, printf("ext2_sb.compat = %08X:%08X:%08X\n", + DBG(DEBUG_PROBE, printf("ext2_sb.compat = %08X:%08X:%08X\n", blkid_le32(es->s_feature_compat), blkid_le32(es->s_feature_incompat), blkid_le32(es->s_feature_ro_compat))); @@ -95,8 +95,8 @@ static void get_ext2_info(blkid_dev dev, unsigned char *buf) set_uuid(dev, es->s_uuid); } -static int probe_ext3(int fd __BLKID_ATTR((unused)), - blkid_cache cache __BLKID_ATTR((unused)), +static int probe_ext3(int fd __BLKID_ATTR((unused)), + blkid_cache cache __BLKID_ATTR((unused)), blkid_dev dev, const struct blkid_magic *id, unsigned char *buf) { @@ -105,7 +105,7 @@ static int probe_ext3(int fd __BLKID_ATTR((unused)), es = (struct ext2_super_block *)buf; /* Distinguish between jbd and ext2/3 fs */ - if (blkid_le32(es->s_feature_incompat) & + if (blkid_le32(es->s_feature_incompat) & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) return -BLKID_ERR_PARAM; @@ -121,8 +121,8 @@ static int probe_ext3(int fd __BLKID_ATTR((unused)), return 0; } -static int probe_ext2(int fd __BLKID_ATTR((unused)), - blkid_cache cache __BLKID_ATTR((unused)), +static int probe_ext2(int fd __BLKID_ATTR((unused)), + blkid_cache cache __BLKID_ATTR((unused)), blkid_dev dev, const struct blkid_magic *id, unsigned char *buf) { @@ -132,7 +132,7 @@ static int probe_ext2(int fd __BLKID_ATTR((unused)), es = (struct ext2_super_block *)buf; /* Distinguish between jbd and ext2/3 fs */ - if (blkid_le32(es->s_feature_incompat) & + if (blkid_le32(es->s_feature_incompat) & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) return -BLKID_ERR_PARAM; @@ -141,10 +141,10 @@ static int probe_ext2(int fd __BLKID_ATTR((unused)), return 0; } -static int probe_jbd(int fd __BLKID_ATTR((unused)), - blkid_cache cache __BLKID_ATTR((unused)), - blkid_dev dev, - const struct blkid_magic *id __BLKID_ATTR((unused)), +static int probe_jbd(int fd __BLKID_ATTR((unused)), + blkid_cache cache __BLKID_ATTR((unused)), + blkid_dev dev, + const struct blkid_magic *id __BLKID_ATTR((unused)), unsigned char *buf) { struct ext2_super_block *es = (struct ext2_super_block *) buf; @@ -158,10 +158,10 @@ static int probe_jbd(int fd __BLKID_ATTR((unused)), return 0; } -static int probe_vfat(int fd __BLKID_ATTR((unused)), - blkid_cache cache __BLKID_ATTR((unused)), +static int probe_vfat(int fd __BLKID_ATTR((unused)), + blkid_cache cache __BLKID_ATTR((unused)), blkid_dev dev, - const struct blkid_magic *id __BLKID_ATTR((unused)), + const struct blkid_magic *id __BLKID_ATTR((unused)), unsigned char *buf) { struct vfat_super_block *vs; @@ -191,10 +191,10 @@ static int probe_vfat(int fd __BLKID_ATTR((unused)), return 0; } -static int probe_msdos(int fd __BLKID_ATTR((unused)), - blkid_cache cache __BLKID_ATTR((unused)), +static int probe_msdos(int fd __BLKID_ATTR((unused)), + blkid_cache cache __BLKID_ATTR((unused)), blkid_dev dev, - const struct blkid_magic *id __BLKID_ATTR((unused)), + const struct blkid_magic *id __BLKID_ATTR((unused)), unsigned char *buf) { struct msdos_super_block *ms = (struct msdos_super_block *) buf; @@ -223,10 +223,10 @@ static int probe_msdos(int fd __BLKID_ATTR((unused)), return 0; } -static int probe_xfs(int fd __BLKID_ATTR((unused)), - blkid_cache cache __BLKID_ATTR((unused)), +static int probe_xfs(int fd __BLKID_ATTR((unused)), + blkid_cache cache __BLKID_ATTR((unused)), blkid_dev dev, - const struct blkid_magic *id __BLKID_ATTR((unused)), + const struct blkid_magic *id __BLKID_ATTR((unused)), unsigned char *buf) { struct xfs_super_block *xs; @@ -241,8 +241,8 @@ static int probe_xfs(int fd __BLKID_ATTR((unused)), return 0; } -static int probe_reiserfs(int fd __BLKID_ATTR((unused)), - blkid_cache cache __BLKID_ATTR((unused)), +static int probe_reiserfs(int fd __BLKID_ATTR((unused)), + blkid_cache cache __BLKID_ATTR((unused)), blkid_dev dev, const struct blkid_magic *id, unsigned char *buf) { @@ -268,10 +268,10 @@ static int probe_reiserfs(int fd __BLKID_ATTR((unused)), return 0; } -static int probe_jfs(int fd __BLKID_ATTR((unused)), - blkid_cache cache __BLKID_ATTR((unused)), +static int probe_jfs(int fd __BLKID_ATTR((unused)), + blkid_cache cache __BLKID_ATTR((unused)), blkid_dev dev, - const struct blkid_magic *id __BLKID_ATTR((unused)), + const struct blkid_magic *id __BLKID_ATTR((unused)), unsigned char *buf) { struct jfs_super_block *js; @@ -286,10 +286,10 @@ static int probe_jfs(int fd __BLKID_ATTR((unused)), return 0; } -static int probe_romfs(int fd __BLKID_ATTR((unused)), - blkid_cache cache __BLKID_ATTR((unused)), +static int probe_romfs(int fd __BLKID_ATTR((unused)), + blkid_cache cache __BLKID_ATTR((unused)), blkid_dev dev, - const struct blkid_magic *id __BLKID_ATTR((unused)), + const struct blkid_magic *id __BLKID_ATTR((unused)), unsigned char *buf) { struct romfs_super_block *ros; @@ -340,7 +340,7 @@ static int probe_swap1(int fd, /* arbitrary sanity check.. is there any garbage down there? */ if (sws->sws_pad[32] == 0 && sws->sws_pad[33] == 0) { if (sws->sws_volume[0]) - blkid_set_tag(dev, "LABEL", sws->sws_volume, + blkid_set_tag(dev, "LABEL", sws->sws_volume, sizeof(sws->sws_volume)); if (sws->sws_uuid[0]) set_uuid(dev, sws->sws_uuid); @@ -354,9 +354,9 @@ static const char * const udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02", "NSR03", "TEA01", 0 }; -static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)), +static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)), blkid_dev dev __BLKID_ATTR((unused)), - const struct blkid_magic *id __BLKID_ATTR((unused)), + const struct blkid_magic *id __BLKID_ATTR((unused)), unsigned char *buf __BLKID_ATTR((unused))) { int j, bs; @@ -396,10 +396,10 @@ static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)), return 1; } -static int probe_ocfs(int fd __BLKID_ATTR((unused)), - blkid_cache cache __BLKID_ATTR((unused)), +static int probe_ocfs(int fd __BLKID_ATTR((unused)), + blkid_cache cache __BLKID_ATTR((unused)), blkid_dev dev, - const struct blkid_magic *id __BLKID_ATTR((unused)), + const struct blkid_magic *id __BLKID_ATTR((unused)), unsigned char *buf) { struct ocfs_volume_header ovh; @@ -414,17 +414,17 @@ static int probe_ocfs(int fd __BLKID_ATTR((unused)), blkid_set_tag(dev,"SEC_TYPE","ocfs1",sizeof("ocfs1")); else if (major >= 9) blkid_set_tag(dev,"SEC_TYPE","ntocfs",sizeof("ntocfs")); - + blkid_set_tag(dev, "LABEL", ovl.label, ocfslabellen(ovl)); blkid_set_tag(dev, "MOUNT", ovh.mount, ocfsmountlen(ovh)); set_uuid(dev, ovl.vol_id); return 0; } -static int probe_ocfs2(int fd __BLKID_ATTR((unused)), - blkid_cache cache __BLKID_ATTR((unused)), +static int probe_ocfs2(int fd __BLKID_ATTR((unused)), + blkid_cache cache __BLKID_ATTR((unused)), blkid_dev dev, - const struct blkid_magic *id __BLKID_ATTR((unused)), + const struct blkid_magic *id __BLKID_ATTR((unused)), unsigned char *buf) { struct ocfs2_super_block *osb; @@ -436,10 +436,10 @@ static int probe_ocfs2(int fd __BLKID_ATTR((unused)), return 0; } -static int probe_oracleasm(int fd __BLKID_ATTR((unused)), - blkid_cache cache __BLKID_ATTR((unused)), +static int probe_oracleasm(int fd __BLKID_ATTR((unused)), + blkid_cache cache __BLKID_ATTR((unused)), blkid_dev dev, - const struct blkid_magic *id __BLKID_ATTR((unused)), + const struct blkid_magic *id __BLKID_ATTR((unused)), unsigned char *buf) { struct oracle_asm_disk_label *dl; @@ -548,13 +548,13 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) diff = now - dev->bid_time; if ((now < dev->bid_time) || - (diff < BLKID_PROBE_MIN) || + (diff < BLKID_PROBE_MIN) || (dev->bid_flags & BLKID_BID_FL_VERIFIED && diff < BLKID_PROBE_INTERVAL)) return dev; DBG(DEBUG_PROBE, - printf("need to revalidate %s (time since last check %lu)\n", + printf("need to revalidate %s (time since last check %lu)\n", dev->bid_name, diff)); if (((fd = open(dev->bid_name, O_RDONLY)) < 0) || @@ -571,12 +571,12 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) } memset(bufs, 0, sizeof(bufs)); - + /* * Iterate over the type array. If we already know the type, * then try that first. If it doesn't work, then blow away * the type information, and try again. - * + * */ try_again: type = 0; @@ -637,7 +637,7 @@ try_again: blkid_free_dev(dev); return NULL; } - + found_type: if (dev && type) { dev->bid_devno = st.st_rdev; @@ -646,7 +646,7 @@ found_type: cache->bic_flags |= BLKID_BIC_FL_CHANGED; blkid_set_tag(dev, "TYPE", type, 0); - + DBG(DEBUG_PROBE, printf("%s: devno 0x%04Lx, type %s\n", dev->bid_name, st.st_rdev, type)); } @@ -696,7 +696,7 @@ int main(int argc, char **argv) printf("\tlabel is '%s'\n", dev->bid_label); if (dev->bid_uuid) printf("\tuuid is %s\n", dev->bid_uuid); - + blkid_free_dev(dev); return (0); } diff --git a/e2fsprogs/blkid/probe.h b/e2fsprogs/blkid/probe.h index 10af5d5..530b8ef 100644 --- a/e2fsprogs/blkid/probe.h +++ b/e2fsprogs/blkid/probe.h @@ -18,7 +18,7 @@ struct blkid_magic; -typedef int (*blkid_probe_t)(int fd, blkid_cache cache, blkid_dev dev, +typedef int (*blkid_probe_t)(int fd, blkid_cache cache, blkid_dev dev, const struct blkid_magic *id, unsigned char *buf); struct blkid_magic { @@ -222,16 +222,16 @@ struct ocfs_volume_header { struct ocfs_volume_label { unsigned char disk_lock[48]; - unsigned char label[64]; + unsigned char label[64]; unsigned char label_len[2]; unsigned char vol_id[16]; unsigned char vol_id_len[2]; }; #define ocfsmajor(o) ((__u32)o.major_version[0] \ - + (((__u32) o.major_version[1]) << 8) \ - + (((__u32) o.major_version[2]) << 16) \ - + (((__u32) o.major_version[3]) << 24)) + + (((__u32) o.major_version[1]) << 8) \ + + (((__u32) o.major_version[2]) << 16) \ + + (((__u32) o.major_version[3]) << 24)) #define ocfslabellen(o) ((__u32)o.label_len[0] + (((__u32) o.label_len[1]) << 8)) #define ocfsmountlen(o) ((__u32)o.mount_len[0] + (((__u32) o.mount_len[1])<<8)) @@ -334,7 +334,7 @@ _INLINE_ __u64 blkid_swab64(__u64 val) return (blkid_swab32(val >> 32) | (((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32)); } -#endif +#endif diff --git a/e2fsprogs/blkid/read.c b/e2fsprogs/blkid/read.c index 7846414..08a3162 100644 --- a/e2fsprogs/blkid/read.c +++ b/e2fsprogs/blkid/read.c @@ -302,7 +302,7 @@ static int parse_tag(blkid_cache cache, blkid_dev dev, char **cp) return ret; /* Some tags are stored directly in the device struct */ - if (!strcmp(name, "DEVNO")) + if (!strcmp(name, "DEVNO")) dev->bid_devno = STRTOULL(value, 0, 0); else if (!strcmp(name, "PRI")) dev->bid_pri = strtol(value, 0, 0); @@ -389,7 +389,7 @@ void blkid_read_cache(blkid_cache cache) cache->bic_filename)); goto errout; } - + DBG(DEBUG_CACHE, printf("reading cache file %s\n", cache->bic_filename)); diff --git a/e2fsprogs/blkid/resolve.c b/e2fsprogs/blkid/resolve.c index 625782d..591b630 100644 --- a/e2fsprogs/blkid/resolve.c +++ b/e2fsprogs/blkid/resolve.c @@ -69,7 +69,7 @@ char *blkid_get_devname(blkid_cache cache, const char *token, if (!token) return NULL; - + if (!cache) { if (blkid_get_cache(&c, NULL) < 0) return NULL; @@ -125,7 +125,7 @@ int main(int argc, char **argv) fprintf(stderr, "Couldn't get blkid cache\n"); exit(1); } - + if (argv[2]) { value = blkid_get_tag_value(cache, argv[1], argv[2]); printf("%s has tag %s=%s\n", argv[2], argv[1], diff --git a/e2fsprogs/blkid/save.c b/e2fsprogs/blkid/save.c index 3fba245..cc406eb 100644 --- a/e2fsprogs/blkid/save.c +++ b/e2fsprogs/blkid/save.c @@ -176,7 +176,7 @@ int main(int argc, char **argv) exit(1); } cache->bic_filename = blkid_strdup(argv[1]); - + if ((ret = blkid_flush_cache(cache)) < 0) { fprintf(stderr, "error (%d) saving cache\n", ret); exit(1); diff --git a/e2fsprogs/blkid/tag.c b/e2fsprogs/blkid/tag.c index 699d0fb..e2c785c 100644 --- a/e2fsprogs/blkid/tag.c +++ b/e2fsprogs/blkid/tag.c @@ -96,7 +96,7 @@ static blkid_tag blkid_find_head_cache(blkid_cache cache, const char *type) /* * Set a tag on an existing device. - * + * * If value is NULL, then delete the tagsfrom the device. */ int blkid_set_tag(blkid_dev dev, const char *name, @@ -131,7 +131,7 @@ int blkid_set_tag(blkid_dev dev, const char *name, t->bit_dev = dev; list_add_tail(&t->bit_tags, &dev->bid_tags); - + if (dev->bid_cache) { head = blkid_find_head_cache(dev->bid_cache, t->bit_name); @@ -151,7 +151,7 @@ int blkid_set_tag(blkid_dev dev, const char *name, list_add_tail(&t->bit_names, &head->bit_names); } } - + /* Link common tags directly to the device struct */ if (!strcmp(name, "TYPE")) dev->bid_type = val; @@ -159,7 +159,7 @@ int blkid_set_tag(blkid_dev dev, const char *name, dev->bid_label = val; else if (!strcmp(name, "UUID")) dev->bid_uuid = val; - + if (dev->bid_cache) dev->bid_cache->bic_flags |= BLKID_BIC_FL_CHANGED; return 0; @@ -235,7 +235,7 @@ errout: * This series of functions iterate over all tags in a device */ #define TAG_ITERATE_MAGIC 0x01a5284c - + struct blkid_struct_tag_iterate { int magic; blkid_dev dev; @@ -260,7 +260,7 @@ extern int blkid_tag_next(blkid_tag_iterate iter, const char **type, const char **value) { blkid_tag tag; - + *type = 0; *value = 0; if (!iter || iter->magic != TAG_ITERATE_MAGIC || @@ -303,9 +303,9 @@ extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache, return NULL; blkid_read_cache(cache); - + DBG(DEBUG_TAG, printf("looking for %s=%s in cache\n", type, value)); - + try_again: pri = -1; dev = 0; @@ -313,7 +313,7 @@ try_again: if (head) { list_for_each(p, &head->bit_names) { - blkid_tag tmp = list_entry(p, struct blkid_struct_tag, + blkid_tag tmp = list_entry(p, struct blkid_struct_tag, bit_names); if (!strcmp(tmp->bit_val, value) && diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c index 66838e6..c390038 100644 --- a/e2fsprogs/chattr.c +++ b/e2fsprogs/chattr.c @@ -161,8 +161,8 @@ skip_setflags: iterate_on_dir(name, chattr_dir_proc, NULL); } -static int chattr_dir_proc(const char *dir_name, struct dirent *de, - void *private EXT2FS_ATTR((unused))) +static int chattr_dir_proc(const char *dir_name, struct dirent *de, + void *private EXT2FS_ATTR((unused))) { /*if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {*/ if (de->d_name[0] == '.' && (de->d_name[1] == '\0' || \ diff --git a/e2fsprogs/e2fsck.c b/e2fsprogs/e2fsck.c index b31b194..1c97cf4 100644 --- a/e2fsprogs/e2fsck.c +++ b/e2fsprogs/e2fsck.c @@ -11797,8 +11797,8 @@ static int count_tags(struct buffer_head *bh, int size) /* Make sure we wrap around the log correctly! */ -#define wrap(journal, var) \ -do { \ +#define wrap(journal, var) \ +do { \ if (var >= (journal)->j_last) \ var -= ((journal)->j_last - (journal)->j_first); \ } while (0) diff --git a/e2fsprogs/e2p/feature.c b/e2fsprogs/e2p/feature.c index fe60161..0a90583 100644 --- a/e2fsprogs/e2p/feature.c +++ b/e2fsprogs/e2p/feature.c @@ -1,11 +1,11 @@ /* * feature.c --- convert between features and strings - * + * * Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu> - * + * * This file can be redistributed under the terms of the GNU Library General * Public License - * + * */ #include <stdio.h> diff --git a/e2fsprogs/e2p/fgetsetversion.c b/e2fsprogs/e2p/fgetsetversion.c index dcf127c..8227ab3 100644 --- a/e2fsprogs/e2p/fgetsetversion.c +++ b/e2fsprogs/e2p/fgetsetversion.c @@ -33,11 +33,11 @@ #define OPEN_FLAGS (O_RDONLY|O_NONBLOCK) #endif -/* +/* To do fsetversion: unsigned long *ptr_version must be set to NULL. - and unsigned long version must be set to a value + and unsigned long version must be set to a value To do fgetversion: unsigned long *ptr_version must NOT be set to NULL - and unsigned long version is ignored. + and unsigned long version is ignored. TITO. */ diff --git a/e2fsprogs/e2p/hashstr.c b/e2fsprogs/e2p/hashstr.c index c4b3f9f..705f63a 100644 --- a/e2fsprogs/e2p/hashstr.c +++ b/e2fsprogs/e2p/hashstr.c @@ -1,11 +1,11 @@ /* * feature.c --- convert between features and strings - * + * * Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu> - * + * * This file can be redistributed under the terms of the GNU Library General * Public License - * + * */ #include <stdio.h> diff --git a/e2fsprogs/e2p/ls.c b/e2fsprogs/e2p/ls.c index 71f8f51..0c91345 100644 --- a/e2fsprogs/e2p/ls.c +++ b/e2fsprogs/e2p/ls.c @@ -6,7 +6,7 @@ * Universite Pierre et Marie Curie (Paris VI) * * Copyright (C) 1995, 1996, 1997 Theodore Ts'o <tytso@mit.edu> - * + * * This file can be redistributed under the terms of the GNU Library General * Public License */ @@ -190,11 +190,11 @@ void list_super2(struct ext2_super_block * sb, FILE *f) "Block size: %u\n" "Fragment size: %u\n", str, sb->s_inodes_count, sb->s_blocks_count, sb->s_r_blocks_count, - sb->s_free_blocks_count, sb->s_free_inodes_count, + sb->s_free_blocks_count, sb->s_free_inodes_count, sb->s_first_data_block, EXT2_BLOCK_SIZE(sb), EXT2_FRAG_SIZE(sb)); free(str); if (sb->s_reserved_gdt_blocks) - fprintf(f, "Reserved GDT blocks: %u\n", + fprintf(f, "Reserved GDT blocks: %u\n", sb->s_reserved_gdt_blocks); fprintf(f, "Blocks per group: %u\n" diff --git a/e2fsprogs/e2p/mntopts.c b/e2fsprogs/e2p/mntopts.c index 562a9cc..b27f78e 100644 --- a/e2fsprogs/e2p/mntopts.c +++ b/e2fsprogs/e2p/mntopts.c @@ -1,11 +1,11 @@ /* * mountopts.c --- convert between default mount options and strings - * + * * Copyright (C) 2002 Theodore Ts'o <tytso@mit.edu> - * + * * This file can be redistributed under the terms of the GNU Library General * Public License - * + * */ #include <stdio.h> diff --git a/e2fsprogs/e2p/ostype.c b/e2fsprogs/e2p/ostype.c index 1084abd..4623063 100644 --- a/e2fsprogs/e2p/ostype.c +++ b/e2fsprogs/e2p/ostype.c @@ -11,10 +11,10 @@ #include <string.h> static const char * const os_tab[] = - { "Linux", - "Hurd", - "Masix", - "FreeBSD", + { "Linux", + "Hurd", + "Masix", + "FreeBSD", "Lites", 0 }; @@ -53,7 +53,7 @@ int e2p_string2os(char *str) #ifdef TEST_PROGRAM int main(int argc, char **argv) { - char *s; + char *s; int i, os; for (i=0; i <= EXT2_OS_LITES; i++) { diff --git a/e2fsprogs/e2p/parse_num.c b/e2fsprogs/e2p/parse_num.c index 3910e70..81c1605 100644 --- a/e2fsprogs/e2p/parse_num.c +++ b/e2fsprogs/e2p/parse_num.c @@ -1,8 +1,8 @@ /* - * parse_num.c - Parse the number of blocks + * parse_num.c - Parse the number of blocks * * Copyright (C) 2004,2005 Theodore Ts'o <tytso@mit.edu> - * + * * This file can be redistributed under the terms of the GNU Library General * Public License */ @@ -18,25 +18,25 @@ unsigned long parse_num_blocks(const char *arg, int log_block_size) num = strtoull(arg, &p, 0); - if (p[0] && p[1]) + if (p[0] && p[1]) return 0; switch (*p) { /* Using fall-through logic */ - case 'T': case 't': + case 'T': case 't': num <<= 10; - case 'G': case 'g': + case 'G': case 'g': num <<= 10; - case 'M': case 'm': + case 'M': case 'm': num <<= 10; - case 'K': case 'k': - num >>= log_block_size; + case 'K': case 'k': + num >>= log_block_size; break; - case 's': + case 's': num >>= 1; break; case '\0': break; - default: + default: return 0; } return num; diff --git a/e2fsprogs/e2p/pf.c b/e2fsprogs/e2p/pf.c index 2194ac6..da8357a 100644 --- a/e2fsprogs/e2p/pf.c +++ b/e2fsprogs/e2p/pf.c @@ -41,7 +41,7 @@ static const struct flags_name flags_array[] = { { EXT2_ECOMPR_FL, "E", "Compression_Error" }, #endif { EXT3_JOURNAL_DATA_FL, "j", "Journaled_Data" }, - { EXT2_INDEX_FL, "I", "Indexed_direcctory" }, + { EXT2_INDEX_FL, "I", "Indexed_direcctory" }, { EXT2_NOTAIL_FL, "t", "No_Tailmerging" }, { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" }, { 0, NULL, NULL } diff --git a/e2fsprogs/e2p/uuid.c b/e2fsprogs/e2p/uuid.c index 9feca4c..cb4ec80 100644 --- a/e2fsprogs/e2p/uuid.c +++ b/e2fsprogs/e2p/uuid.c @@ -19,7 +19,7 @@ struct uuid { /* Returns 1 if the uuid is the NULL uuid */ int e2p_is_null_uuid(void *uu) { - __u8 *cp; + __u8 *cp; int i; for (i=0, cp = uu; i < 16; i++) @@ -42,7 +42,7 @@ static void e2p_unpack_uuid(void *in, struct uuid *uu) tmp = *ptr++; tmp = (tmp << 8) | *ptr++; uu->time_mid = tmp; - + tmp = *ptr++; tmp = (tmp << 8) | *ptr++; uu->time_hi_and_version = tmp; diff --git a/e2fsprogs/ext2fs/alloc.c b/e2fsprogs/ext2fs/alloc.c index 7385123..d56ef25 100644 --- a/e2fsprogs/ext2fs/alloc.c +++ b/e2fsprogs/ext2fs/alloc.c @@ -7,7 +7,7 @@ * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% - * + * */ #include <stdio.h> @@ -32,7 +32,7 @@ * * Should have a special policy for directories. */ -errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, +errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode EXT2FS_ATTR((unused)), ext2fs_inode_bitmap map, ext2_ino_t *ret) { @@ -41,13 +41,13 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t start_inode; EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - + if (!map) map = fs->inode_map; if (!map) return EXT2_ET_NO_INODE_BITMAP; - - if (dir > 0) + + if (dir > 0) dir_group = (dir - 1) / EXT2_INODES_PER_GROUP(fs->super); start_inode = (dir_group * EXT2_INODES_PER_GROUP(fs->super)) + 1; @@ -62,7 +62,7 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, if (i > fs->super->s_inodes_count) i = EXT2_FIRST_INODE(fs->super); } while (i != start_inode); - + if (ext2fs_test_inode_bitmap(map, i)) return EXT2_ET_INODE_ALLOC_FAIL; *ret = i; @@ -131,7 +131,7 @@ errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, retval = io_channel_write_blk(fs->io, block, 1, block_buf); if (retval) goto fail; - + ext2fs_block_alloc_stats(fs, block, +1); *ret = block; return 0; diff --git a/e2fsprogs/ext2fs/alloc_sb.c b/e2fsprogs/ext2fs/alloc_sb.c index ef40b93..aa2cd05 100644 --- a/e2fsprogs/ext2fs/alloc_sb.c +++ b/e2fsprogs/ext2fs/alloc_sb.c @@ -1,5 +1,5 @@ /* - * alloc_sb.c --- Allocate the superblock and block group descriptors for a + * alloc_sb.c --- Allocate the superblock and block group descriptors for a * newly initialized filesystem. Used by mke2fs when initializing a filesystem * * Copyright (C) 1994, 1995, 1996, 2003 Theodore Ts'o. @@ -27,20 +27,20 @@ #include "ext2_fs.h" #include "ext2fs.h" -int ext2fs_reserve_super_and_bgd(ext2_filsys fs, +int ext2fs_reserve_super_and_bgd(ext2_filsys fs, dgrp_t group, ext2fs_block_bitmap bmap) { blk_t super_blk, old_desc_blk, new_desc_blk; int j, old_desc_blocks, num_blocks; - num_blocks = ext2fs_super_and_bgd_loc(fs, group, &super_blk, + num_blocks = ext2fs_super_and_bgd_loc(fs, group, &super_blk, &old_desc_blk, &new_desc_blk, 0); if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) old_desc_blocks = fs->super->s_first_meta_bg; else - old_desc_blocks = + old_desc_blocks = fs->desc_blocks + fs->super->s_reserved_gdt_blocks; if (super_blk || (group == 0)) diff --git a/e2fsprogs/ext2fs/alloc_stats.c b/e2fsprogs/ext2fs/alloc_stats.c index 4088f7b..32aa0b6 100644 --- a/e2fsprogs/ext2fs/alloc_stats.c +++ b/e2fsprogs/ext2fs/alloc_stats.c @@ -7,7 +7,7 @@ * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% - * + * */ #include <stdio.h> diff --git a/e2fsprogs/ext2fs/alloc_tables.c b/e2fsprogs/ext2fs/alloc_tables.c index 0326321..10f1f95 100644 --- a/e2fsprogs/ext2fs/alloc_tables.c +++ b/e2fsprogs/ext2fs/alloc_tables.c @@ -36,14 +36,14 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, group_blk = fs->super->s_first_data_block + (group * fs->super->s_blocks_per_group); - + last_blk = group_blk + fs->super->s_blocks_per_group; if (last_blk >= fs->super->s_blocks_count) last_blk = fs->super->s_blocks_count - 1; if (!bmap) bmap = fs->block_map; - + /* * Allocate the block and inode bitmaps, if necessary */ @@ -59,7 +59,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, if (!fs->group_desc[group].bg_block_bitmap) { retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, 1, bmap, &new_blk); - if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) + if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) retval = ext2fs_get_free_blocks(fs, group_blk, last_blk, 1, bmap, &new_blk); if (retval) @@ -71,7 +71,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, if (!fs->group_desc[group].bg_inode_bitmap) { retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, 1, bmap, &new_blk); - if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) + if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) retval = ext2fs_get_free_blocks(fs, group_blk, last_blk, 1, bmap, &new_blk); if (retval) @@ -96,11 +96,11 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, fs->group_desc[group].bg_inode_table = new_blk; } - + return 0; } - + errcode_t ext2fs_allocate_tables(ext2_filsys fs) { diff --git a/e2fsprogs/ext2fs/badblocks.c b/e2fsprogs/ext2fs/badblocks.c index 4b76ef0..d820411 100644 --- a/e2fsprogs/ext2fs/badblocks.c +++ b/e2fsprogs/ext2fs/badblocks.c @@ -1,6 +1,6 @@ /* * badblocks.c --- routines to manipulate the bad block structure - * + * * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -34,7 +34,7 @@ static errcode_t make_u32_list(int size, int num, __u32 *list, { ext2_u32_list bb; errcode_t retval; - + retval = ext2fs_get_mem(sizeof(struct ext2_struct_u32_list), &bb); if (retval) return retval; @@ -54,7 +54,7 @@ static errcode_t make_u32_list(int size, int num, __u32 *list, *ret = bb; return 0; } - + /* * This procedure creates an empty u32 list. @@ -79,7 +79,7 @@ errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret, int size) errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest) { errcode_t retval; - + retval = make_u32_list(src->size, src->num, src->list, dest); if (retval) return retval; @@ -271,11 +271,11 @@ int ext2fs_u32_list_iterate(ext2_u32_iterate iter, __u32 *blk) if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) return 0; - + if (iter->ptr < bb->num) { *blk = bb->list[iter->ptr++]; return 1; - } + } *blk = 0; return 0; } diff --git a/e2fsprogs/ext2fs/bb_compat.c b/e2fsprogs/ext2fs/bb_compat.c index 40f7343..5a158b3 100644 --- a/e2fsprogs/ext2fs/bb_compat.c +++ b/e2fsprogs/ext2fs/bb_compat.c @@ -1,6 +1,6 @@ /* * bb_compat.c --- compatibility badblocks routines - * + * * Copyright (C) 1997 Theodore Ts'o. * * %Begin-Header% diff --git a/e2fsprogs/ext2fs/bb_inode.c b/e2fsprogs/ext2fs/bb_inode.c index dd8e7c3..9af117d 100644 --- a/e2fsprogs/ext2fs/bb_inode.c +++ b/e2fsprogs/ext2fs/bb_inode.c @@ -1,12 +1,12 @@ /* * bb_inode.c --- routines to update the bad block inode. - * + * * WARNING: This routine modifies a lot of state in the filesystem; if * this routine returns an error, the bad block inode may be in an * inconsistent state. - * + * * Copyright (C) 1994, 1995 Theodore Ts'o. - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -49,7 +49,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, e2_blkcnt_t blockcnt, blk_t ref_block, int ref_offset, void *priv_data); - + /* * Given a bad blocks bitmap, update the bad blocks inode to reflect * the map. @@ -57,14 +57,14 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) { errcode_t retval; - struct set_badblock_record rec; + struct set_badblock_record rec; struct ext2_inode inode; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); if (!fs->block_map) return EXT2_ET_NO_BLOCK_BITMAP; - + rec.bad_block_count = 0; rec.ind_blocks_size = rec.ind_blocks_ptr = 0; rec.max_ind_blocks = 10; @@ -78,9 +78,9 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) goto cleanup; memset(rec.block_buf, 0, fs->blocksize); rec.err = 0; - + /* - * First clear the old bad blocks (while saving the indirect blocks) + * First clear the old bad blocks (while saving the indirect blocks) */ retval = ext2fs_block_iterate2(fs, EXT2_BAD_INO, BLOCK_FLAG_DEPTH_TRAVERSE, 0, @@ -91,7 +91,7 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) retval = rec.err; goto cleanup; } - + /* * Now set the bad blocks! * @@ -108,22 +108,22 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) BLOCK_FLAG_APPEND, 0, set_bad_block_proc, &rec); ext2fs_badblocks_list_iterate_end(rec.bb_iter); - if (retval) + if (retval) goto cleanup; if (rec.err) { retval = rec.err; goto cleanup; } } - + /* * Update the bad block inode's mod time and block count - * field. + * field. */ retval = ext2fs_read_inode(fs, EXT2_BAD_INO, &inode); if (retval) goto cleanup; - + inode.i_atime = inode.i_mtime = time(0); if (!inode.i_ctime) inode.i_ctime = time(0); @@ -133,7 +133,7 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) retval = ext2fs_write_inode(fs, EXT2_BAD_INO, &inode); if (retval) goto cleanup; - + cleanup: ext2fs_free_mem(&rec.ind_blocks); ext2fs_free_mem(&rec.block_buf); @@ -158,7 +158,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, struct set_badblock_record *rec = (struct set_badblock_record *) priv_data; errcode_t retval; - unsigned long old_size; + unsigned long old_size; if (!*block_nr) return 0; @@ -176,7 +176,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, if (rec->ind_blocks_size >= rec->max_ind_blocks) { old_size = rec->max_ind_blocks * sizeof(blk_t); rec->max_ind_blocks += 10; - retval = ext2fs_resize_mem(old_size, + retval = ext2fs_resize_mem(old_size, rec->max_ind_blocks * sizeof(blk_t), &rec->ind_blocks); if (retval) { @@ -192,12 +192,12 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, * Mark the block as unused, and update accounting information */ ext2fs_block_alloc_stats(fs, *block_nr, -1); - + *block_nr = 0; return BLOCK_CHANGED; } - + /* * Helper function for update_bb_inode() * @@ -250,12 +250,12 @@ static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr, return BLOCK_ABORT; } } - + /* * Update block counts */ ext2fs_block_alloc_stats(fs, blk, +1); - + *block_nr = blk; return BLOCK_CHANGED; } diff --git a/e2fsprogs/ext2fs/bitmaps.c b/e2fsprogs/ext2fs/bitmaps.c index 7edd28d..932c345 100644 --- a/e2fsprogs/ext2fs/bitmaps.c +++ b/e2fsprogs/ext2fs/bitmaps.c @@ -35,7 +35,7 @@ static errcode_t make_bitmap(__u32 start, __u32 end, __u32 real_end, errcode_t retval; size_t size; - retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap), + retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap), &bitmap); if (retval) return retval; @@ -106,7 +106,7 @@ void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map) ext2fs_set_bit(j, map->bitmap); return; -} +} errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, const char *descr, @@ -128,11 +128,11 @@ errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, descr, &bitmap); if (retval) return retval; - + bitmap->magic = EXT2_ET_MAGIC_INODE_BITMAP; bitmap->fs = fs; bitmap->base_error_code = EXT2_ET_BAD_INODE_MARK; - + *ret = bitmap; return 0; } @@ -151,9 +151,9 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, start = fs->super->s_first_data_block; end = fs->super->s_blocks_count-1; - real_end = (EXT2_BLOCKS_PER_GROUP(fs->super) + real_end = (EXT2_BLOCKS_PER_GROUP(fs->super) * fs->group_desc_count)-1 + start; - + retval = ext2fs_allocate_generic_bitmap(start, end, real_end, descr, &bitmap); if (retval) @@ -162,7 +162,7 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, bitmap->magic = EXT2_ET_MAGIC_BLOCK_BITMAP; bitmap->fs = fs; bitmap->base_error_code = EXT2_ET_BAD_BLOCK_MARK; - + *ret = bitmap; return 0; } @@ -171,7 +171,7 @@ errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap, ext2_ino_t end, ext2_ino_t *oend) { EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_INODE_BITMAP); - + if (end > bitmap->real_end) return EXT2_ET_FUDGE_INODE_BITMAP_END; if (oend) @@ -184,7 +184,7 @@ errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap, blk_t end, blk_t *oend) { EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_BLOCK_BITMAP); - + if (end > bitmap->real_end) return EXT2_ET_FUDGE_BLOCK_BITMAP_END; if (oend) diff --git a/e2fsprogs/ext2fs/bitops.c b/e2fsprogs/ext2fs/bitops.c index 207c44d..e44e10c 100644 --- a/e2fsprogs/ext2fs/bitops.c +++ b/e2fsprogs/ext2fs/bitops.c @@ -1,7 +1,7 @@ /* * bitops.c --- Bitmap frobbing code. See bitops.h for the inlined - * routines. - * + * routines. + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% diff --git a/e2fsprogs/ext2fs/bitops.h b/e2fsprogs/ext2fs/bitops.h index b6446ef..4dba050 100644 --- a/e2fsprogs/ext2fs/bitops.h +++ b/e2fsprogs/ext2fs/bitops.h @@ -1,14 +1,14 @@ /* * bitops.h --- Bitmap frobbing code. The byte swapping routines are - * also included here. - * + * also included here. + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% - * + * * i386 bitops operations taken from <asm/bitops.h>, Copyright 1992, * Linus Torvalds. */ diff --git a/e2fsprogs/ext2fs/block.c b/e2fsprogs/ext2fs/block.c index 7685680..18be2a5 100644 --- a/e2fsprogs/ext2fs/block.c +++ b/e2fsprogs/ext2fs/block.c @@ -1,6 +1,6 @@ /* * block.c --- iterate over all blocks in an inode - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -59,7 +59,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, ret |= BLOCK_ERROR; return ret; } - ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block, + ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block, ctx->ind_buf); if (ctx->errcode) { ret |= BLOCK_ERROR; @@ -71,7 +71,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, if (ctx->flags & BLOCK_FLAG_APPEND) { for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) { flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount, - *ind_block, offset, + *ind_block, offset, ctx->priv_data); changed |= flags; if (flags & BLOCK_ABORT) { @@ -85,7 +85,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, if (*block_nr == 0) continue; flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount, - *ind_block, offset, + *ind_block, offset, ctx->priv_data); changed |= flags; if (flags & BLOCK_ABORT) { @@ -109,7 +109,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, ref_offset, ctx->priv_data); return ret; } - + static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, int ref_offset, struct block_context *ctx) { @@ -133,7 +133,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, ret |= BLOCK_ERROR; return ret; } - ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block, + ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block, ctx->dind_buf); if (ctx->errcode) { ret |= BLOCK_ERROR; @@ -185,7 +185,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, ref_offset, ctx->priv_data); return ret; } - + static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, int ref_offset, struct block_context *ctx) { @@ -209,7 +209,7 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, ret |= BLOCK_ERROR; return ret; } - ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block, + ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block, ctx->tind_buf); if (ctx->errcode) { ret |= BLOCK_ERROR; @@ -259,10 +259,10 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, ret |= (*ctx->func)(ctx->fs, tind_block, BLOCK_COUNT_TIND, ref_block, ref_offset, ctx->priv_data); - + return ret; } - + errcode_t ext2fs_block_iterate2(ext2_filsys fs, ext2_ino_t ino, int flags, @@ -338,7 +338,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, goto abort_exit; } } - + /* * Iterate over normal data blocks */ @@ -427,7 +427,7 @@ errcode_t ext2fs_block_iterate(ext2_filsys fs, void *priv_data) { struct xlate xl; - + xl.real_private = priv_data; xl.func = func; diff --git a/e2fsprogs/ext2fs/bmap.c b/e2fsprogs/ext2fs/bmap.c index e840044..45d49f9 100644 --- a/e2fsprogs/ext2fs/bmap.c +++ b/e2fsprogs/ext2fs/bmap.c @@ -25,14 +25,14 @@ #endif extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, - struct ext2_inode *inode, + struct ext2_inode *inode, char *block_buf, int bmap_flags, blk_t block, blk_t *phys_blk); #define inode_bmap(inode, nr) ((inode)->i_block[(nr)]) -static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, - blk_t ind, char *block_buf, +static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, + blk_t ind, char *block_buf, int *blocks_alloc, blk_t nr, blk_t *ret_blk) { @@ -95,17 +95,17 @@ static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, } static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags, - blk_t dind, char *block_buf, + blk_t dind, char *block_buf, int *blocks_alloc, blk_t nr, blk_t *ret_blk) { blk_t b; errcode_t retval; blk_t addr_per_block; - + addr_per_block = (blk_t) fs->blocksize >> 2; - retval = block_ind_bmap(fs, flags & ~BMAP_SET, dind, block_buf, + retval = block_ind_bmap(fs, flags & ~BMAP_SET, dind, block_buf, blocks_alloc, nr / addr_per_block, &b); if (retval) return retval; @@ -115,17 +115,17 @@ static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags, } static _BMAP_INLINE_ errcode_t block_tind_bmap(ext2_filsys fs, int flags, - blk_t tind, char *block_buf, + blk_t tind, char *block_buf, int *blocks_alloc, blk_t nr, blk_t *ret_blk) { blk_t b; errcode_t retval; blk_t addr_per_block; - + addr_per_block = (blk_t) fs->blocksize >> 2; - retval = block_dind_bmap(fs, flags & ~BMAP_SET, tind, block_buf, + retval = block_dind_bmap(fs, flags & ~BMAP_SET, tind, block_buf, blocks_alloc, nr / addr_per_block, &b); if (retval) return retval; @@ -179,7 +179,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, *phys_blk = inode_bmap(inode, block); b = block ? inode_bmap(inode, block-1) : 0; - + if ((*phys_blk == 0) && (bmap_flags & BMAP_ALLOC)) { retval = ext2fs_alloc_block(fs, b, block_buf, &b); if (retval) @@ -190,7 +190,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, } goto done; } - + /* Indirect block */ block -= EXT2_NDIR_BLOCKS; if (block < addr_per_block) { @@ -203,17 +203,17 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, } b = inode_bmap(inode, EXT2_IND_BLOCK-1); - retval = ext2fs_alloc_block(fs, b, block_buf, &b); + retval = ext2fs_alloc_block(fs, b, block_buf, &b); if (retval) goto done; inode_bmap(inode, EXT2_IND_BLOCK) = b; blocks_alloc++; } - retval = block_ind_bmap(fs, bmap_flags, b, block_buf, + retval = block_ind_bmap(fs, bmap_flags, b, block_buf, &blocks_alloc, block, phys_blk); goto done; } - + /* Doubly indirect block */ block -= addr_per_block; if (block < addr_per_block * addr_per_block) { @@ -226,13 +226,13 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, } b = inode_bmap(inode, EXT2_IND_BLOCK); - retval = ext2fs_alloc_block(fs, b, block_buf, &b); + retval = ext2fs_alloc_block(fs, b, block_buf, &b); if (retval) goto done; inode_bmap(inode, EXT2_DIND_BLOCK) = b; blocks_alloc++; } - retval = block_dind_bmap(fs, bmap_flags, b, block_buf, + retval = block_dind_bmap(fs, bmap_flags, b, block_buf, &blocks_alloc, block, phys_blk); goto done; } @@ -254,7 +254,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, inode_bmap(inode, EXT2_TIND_BLOCK) = b; blocks_alloc++; } - retval = block_tind_bmap(fs, bmap_flags, b, block_buf, + retval = block_tind_bmap(fs, bmap_flags, b, block_buf, &blocks_alloc, block, phys_blk); done: if (buf) diff --git a/e2fsprogs/ext2fs/bmove.c b/e2fsprogs/ext2fs/bmove.c index 0b2ebb1..fb319f8 100644 --- a/e2fsprogs/ext2fs/bmove.c +++ b/e2fsprogs/ext2fs/bmove.c @@ -1,6 +1,6 @@ /* * bmove.c --- Move blocks around to make way for a particular - * filesystem structure. + * filesystem structure. * * Copyright (C) 1997 Theodore Ts'o. This file may be redistributed * under the terms of the GNU Public License. @@ -44,7 +44,7 @@ static int process_block(ext2_filsys fs, blk_t *block_nr, pb = (struct process_block_struct *) priv_data; block = orig = *block_nr; ret = 0; - + /* * Let's see if this is one which we need to relocate */ @@ -98,7 +98,7 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, struct process_block_struct pb; ext2_inode_scan scan; char *block_buf; - + retval = ext2fs_open_inode_scan(fs, 0, &scan); if (retval) return retval; @@ -107,7 +107,7 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, pb.error = 0; pb.alloc_map = alloc_map ? alloc_map : fs->block_map; pb.flags = flags; - + retval = ext2fs_get_mem(fs->blocksize * 4, &block_buf); if (retval) return retval; @@ -131,12 +131,12 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, retval = ext2fs_get_next_inode(scan, &ino, &inode); if (retval) return retval; - + while (ino) { if ((inode.i_links_count == 0) || !ext2fs_inode_has_valid_blocks(&inode)) goto next; - + pb.ino = ino; pb.inode = &inode; diff --git a/e2fsprogs/ext2fs/brel.h b/e2fsprogs/ext2fs/brel.h index be97243..a7f9776 100644 --- a/e2fsprogs/ext2fs/brel.h +++ b/e2fsprogs/ext2fs/brel.h @@ -1,6 +1,6 @@ /* * brel.h - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -47,7 +47,7 @@ struct ext2_block_relocation_table { * Initialize for iterating over the block relocation entries. */ errcode_t (*start_iter)(ext2_brel brel); - + /* * The iterator function for the inode relocation entries. * Returns an inode number of 0 when out of entries. diff --git a/e2fsprogs/ext2fs/brel_ma.c b/e2fsprogs/ext2fs/brel_ma.c index d422bb2..4dcfded 100644 --- a/e2fsprogs/ext2fs/brel_ma.c +++ b/e2fsprogs/ext2fs/brel_ma.c @@ -1,6 +1,6 @@ /* * brel_ma.c - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * TODO: rewrite to not use a direct array!!! (Fortunately this @@ -48,7 +48,7 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, { ext2_brel brel = 0; errcode_t retval; - struct brel_ma *ma = 0; + struct brel_ma *ma = 0; size_t size; *new_brel = 0; @@ -61,18 +61,18 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, if (retval) goto errout; memset(brel, 0, sizeof(struct ext2_block_relocation_table)); - + retval = ext2fs_get_mem(strlen(name)+1, &brel->name); if (retval) goto errout; strcpy(brel->name, name); - + retval = ext2fs_get_mem(sizeof(struct brel_ma), &ma); if (retval) goto errout; memset(ma, 0, sizeof(struct brel_ma)); brel->priv_data = ma; - + size = (size_t) (sizeof(struct ext2_block_relocate_entry) * (max_block+1)); retval = ext2fs_get_mem(size, &ma->entries); @@ -91,7 +91,7 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, brel->move = bma_move; brel->delete = bma_delete; brel->free = bma_free; - + *new_brel = brel; return 0; @@ -103,7 +103,7 @@ errout: static errcode_t bma_put(ext2_brel brel, blk_t old, struct ext2_block_relocate_entry *ent) { - struct brel_ma *ma; + struct brel_ma *ma; ma = brel->priv_data; if (old > ma->max_block) @@ -115,7 +115,7 @@ static errcode_t bma_put(ext2_brel brel, blk_t old, static errcode_t bma_get(ext2_brel brel, blk_t old, struct ext2_block_relocate_entry *ent) { - struct brel_ma *ma; + struct brel_ma *ma; ma = brel->priv_data; if (old > ma->max_block) @@ -135,7 +135,7 @@ static errcode_t bma_start_iter(ext2_brel brel) static errcode_t bma_next(ext2_brel brel, blk_t *old, struct ext2_block_relocate_entry *ent) { - struct brel_ma *ma; + struct brel_ma *ma; ma = brel->priv_data; while (++brel->current < ma->max_block) { @@ -151,7 +151,7 @@ static errcode_t bma_next(ext2_brel brel, blk_t *old, static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) { - struct brel_ma *ma; + struct brel_ma *ma; ma = brel->priv_data; if ((old > ma->max_block) || (new > ma->max_block)) @@ -165,7 +165,7 @@ static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) static errcode_t bma_delete(ext2_brel brel, blk_t old) { - struct brel_ma *ma; + struct brel_ma *ma; ma = brel->priv_data; if (old > ma->max_block) @@ -178,7 +178,7 @@ static errcode_t bma_delete(ext2_brel brel, blk_t old) static errcode_t bma_free(ext2_brel brel) { - struct brel_ma *ma; + struct brel_ma *ma; if (!brel) return 0; diff --git a/e2fsprogs/ext2fs/check_desc.c b/e2fsprogs/ext2fs/check_desc.c index 2a754c7..eab8c7b 100644 --- a/e2fsprogs/ext2fs/check_desc.c +++ b/e2fsprogs/ext2fs/check_desc.c @@ -1,6 +1,6 @@ /* * check_desc.c --- Check the group descriptors of an ext2 filesystem - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -61,7 +61,7 @@ errcode_t ext2fs_check_desc(ext2_filsys fs) ((fs->group_desc[i].bg_inode_table + fs->inode_blocks_per_group) >= next)) return EXT2_ET_GDESC_BAD_INODE_TABLE; - + block = next; } return 0; diff --git a/e2fsprogs/ext2fs/closefs.c b/e2fsprogs/ext2fs/closefs.c index 23e6332..da0016b 100644 --- a/e2fsprogs/ext2fs/closefs.c +++ b/e2fsprogs/ext2fs/closefs.c @@ -1,6 +1,6 @@ /* * closefs.c --- close an ext2 filesystem - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -45,7 +45,7 @@ int ext2fs_bg_has_super(ext2_filsys fs, int group_block) return 0; } -int ext2fs_super_and_bgd_loc(ext2_filsys fs, +int ext2fs_super_and_bgd_loc(ext2_filsys fs, dgrp_t group, blk_t *ret_super_blk, blk_t *ret_old_desc_blk, @@ -63,7 +63,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) old_desc_blocks = fs->super->s_first_meta_bg; else - old_desc_blocks = + old_desc_blocks = fs->desc_blocks + fs->super->s_reserved_gdt_blocks; if (group == fs->group_desc_count-1) { @@ -100,7 +100,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, numblocks--; } } - + numblocks -= 2 + fs->inode_blocks_per_group; if (ret_super_blk) @@ -188,7 +188,7 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group, struct ext2_super_block *super_shadow) { dgrp_t sgrp = group; - + if (sgrp > ((1 << 16) - 1)) sgrp = (1 << 16) - 1; #ifdef EXT2FS_ENABLE_SWAPFS @@ -198,7 +198,7 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group, #endif fs->super->s_block_group_nr = sgrp; - return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE, + return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE, super_shadow); } @@ -217,7 +217,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) dgrp_t j; struct ext2_group_desc *s, *t; #endif - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); fs_state = fs->super->s_state; @@ -252,7 +252,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) super_shadow = fs->super; group_shadow = fs->group_desc; #endif - + /* * If this is an external journal device, don't write out the * block group descriptors or any of the backup superblocks @@ -289,7 +289,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) blk_t super_blk, old_desc_blk, new_desc_blk; int meta_bg; - ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk, + ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk, &new_desc_blk, &meta_bg); if (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) &&i && super_blk) { @@ -300,7 +300,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) } if (fs->flags & EXT2_FLAG_SUPER_ONLY) continue; - if ((old_desc_blk) && + if ((old_desc_blk) && (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) || (i == 0))) { retval = io_channel_write_blk(fs->io, old_desc_blk, old_desc_blocks, group_ptr); @@ -365,7 +365,7 @@ errout: errcode_t ext2fs_close(ext2_filsys fs) { errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); if (fs->flags & EXT2_FLAG_DIRTY) { diff --git a/e2fsprogs/ext2fs/cmp_bitmaps.c b/e2fsprogs/ext2fs/cmp_bitmaps.c index 51cc3d0..fa45a43 100644 --- a/e2fsprogs/ext2fs/cmp_bitmaps.c +++ b/e2fsprogs/ext2fs/cmp_bitmaps.c @@ -30,7 +30,7 @@ errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1, ext2fs_block_bitmap bm2) { blk_t i; - + EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_BLOCK_BITMAP); EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_BLOCK_BITMAP); @@ -52,7 +52,7 @@ errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1, ext2fs_inode_bitmap bm2) { ext2_ino_t i; - + EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_INODE_BITMAP); EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_INODE_BITMAP); diff --git a/e2fsprogs/ext2fs/dblist.c b/e2fsprogs/ext2fs/dblist.c index d5833d7..0cf5698 100644 --- a/e2fsprogs/ext2fs/dblist.c +++ b/e2fsprogs/ext2fs/dblist.c @@ -1,13 +1,13 @@ /* * dblist.c -- directory block list functions - * + * * Copyright 1997 by Theodore Ts'o - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% - * + * */ #include <stdio.h> @@ -33,7 +33,7 @@ errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs) ext2_ino_t num_dirs, max_dirs; EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); - + num_dirs = 0; max_dirs = fs->super->s_inodes_per_group; for (i = 0; i < fs->group_desc_count; i++) { @@ -88,7 +88,7 @@ static errcode_t make_dblist(ext2_filsys fs, ext2_ino_t size, ext2_ino_t count, retval = ext2fs_get_mem(len, &dblist->list); if (retval) goto cleanup; - + if (list) memcpy(dblist->list, list, len); else @@ -155,10 +155,10 @@ errcode_t ext2fs_copy_dblist(ext2_dblist src, ext2_dblist *dest) errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk, int blockcnt) { - struct ext2_db_entry *new_entry; + struct ext2_db_entry *new_entry; errcode_t retval; unsigned long old_size; - + EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); if (dblist->count >= dblist->size) { @@ -189,7 +189,7 @@ errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk, int blockcnt) { dgrp_t i; - + EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); for (i=0; i < dblist->count; i++) { @@ -225,7 +225,7 @@ errcode_t ext2fs_dblist_iterate(ext2_dblist dblist, { ext2_ino_t i; int ret; - + EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); if (!dblist->sorted) @@ -247,7 +247,7 @@ static EXT2_QSORT_TYPE dir_block_cmp(const void *a, const void *b) if (db_a->blk != db_b->blk) return (int) (db_a->blk - db_b->blk); - + if (db_a->ino != db_b->ino) return (int) (db_a->ino - db_b->ino); diff --git a/e2fsprogs/ext2fs/dblist_dir.c b/e2fsprogs/ext2fs/dblist_dir.c index f2e17a6..20b1cde 100644 --- a/e2fsprogs/ext2fs/dblist_dir.c +++ b/e2fsprogs/ext2fs/dblist_dir.c @@ -2,12 +2,12 @@ * dblist_dir.c --- iterate by directory entry * * Copyright 1997 by Theodore Ts'o - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% - * + * */ #include <stdio.h> @@ -54,7 +54,7 @@ errcode_t ext2fs_dblist_dir_iterate(ext2_dblist dblist, ctx.errcode = 0; retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx); - + if (!block_buf) ext2fs_free_mem(&ctx.buf); if (retval) @@ -69,7 +69,7 @@ static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info, ctx = (struct dir_context *) priv_data; ctx->dir = db_info->ino; - + return ext2fs_process_dir_block(fs, &db_info->blk, db_info->blockcnt, 0, 0, priv_data); } diff --git a/e2fsprogs/ext2fs/dir_iterate.c b/e2fsprogs/ext2fs/dir_iterate.c index 003c0a3..df820fe 100644 --- a/e2fsprogs/ext2fs/dir_iterate.c +++ b/e2fsprogs/ext2fs/dir_iterate.c @@ -1,6 +1,6 @@ /* * dir_iterate.c --- ext2fs directory iteration operations - * + * * Copyright (C) 1993, 1994, 1994, 1995, 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -32,7 +32,7 @@ static int ext2fs_validate_entry(char *buf, int offset, int final_offset) { struct ext2_dir_entry *dirent; - + while (offset < final_offset) { dirent = (struct ext2_dir_entry *)(buf + offset); offset += dirent->rec_len; @@ -59,13 +59,13 @@ errcode_t ext2fs_dir_iterate2(ext2_filsys fs, { struct dir_context ctx; errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); retval = ext2fs_check_directory(fs, dir); if (retval) return retval; - + ctx.dir = dir; ctx.flags = flags; if (block_buf) @@ -106,7 +106,7 @@ static int xlate_func(ext2_ino_t dir EXT2FS_ATTR((unused)), return (*xl->func)(dirent, offset, blocksize, buf, xl->real_private); } -extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, +extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, ext2_ino_t dir, int flags, char *block_buf, @@ -118,7 +118,7 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, void *priv_data) { struct xlate xl; - + xl.real_private = priv_data; xl.func = func; @@ -151,7 +151,7 @@ int ext2fs_process_dir_block(ext2_filsys fs, return 0; entry = blockcnt ? DIRENT_OTHER_FILE : DIRENT_DOT_FILE; - + ctx->errcode = ext2fs_read_dir_block(fs, *blocknr, ctx->buf); if (ctx->errcode) return BLOCK_ABORT; @@ -177,18 +177,18 @@ int ext2fs_process_dir_block(ext2_filsys fs, ctx->priv_data); if (entry < DIRENT_OTHER_FILE) entry++; - + if (ret & DIRENT_CHANGED) changed++; if (ret & DIRENT_ABORT) { do_abort++; break; } -next: - if (next_real_entry == offset) +next: + if (next_real_entry == offset) next_real_entry += dirent->rec_len; - - if (ctx->flags & DIRENT_FLAG_INCLUDE_REMOVED) { + + if (ctx->flags & DIRENT_FLAG_INCLUDE_REMOVED) { size = ((dirent->name_len & 0xFF) + 11) & ~3; if (dirent->rec_len != size) { diff --git a/e2fsprogs/ext2fs/dirblock.c b/e2fsprogs/ext2fs/dirblock.c index 5d66ad1..9f82b50 100644 --- a/e2fsprogs/ext2fs/dirblock.c +++ b/e2fsprogs/ext2fs/dirblock.c @@ -1,6 +1,6 @@ /* * dirblock.c --- directory block routines. - * + * * Copyright (C) 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -28,9 +28,9 @@ errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block, unsigned int name_len, rec_len; #ifdef EXT2FS_ENABLE_SWAPFS unsigned int do_swap; -#endif +#endif - retval = io_channel_read_blk(fs->io, block, 1, buf); + retval = io_channel_read_blk(fs->io, block, 1, buf); if (retval) return retval; #ifdef EXT2FS_ENABLE_SWAPFS @@ -110,16 +110,16 @@ errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block, dirent->rec_len = ext2fs_swab16(dirent->rec_len); dirent->name_len = ext2fs_swab16(dirent->name_len); } -#ifdef WORDS_BIGENDIAN +#ifdef WORDS_BIGENDIAN if (flags & EXT2_DIRBLOCK_V2_STRUCT) dirent->name_len = ext2fs_swab16(dirent->name_len); #endif } - retval = io_channel_write_blk(fs->io, block, 1, buf); + retval = io_channel_write_blk(fs->io, block, 1, buf); ext2fs_free_mem(&buf); return retval; #else - return io_channel_write_blk(fs->io, block, 1, (char *) inbuf); + return io_channel_write_blk(fs->io, block, 1, (char *) inbuf); #endif } diff --git a/e2fsprogs/ext2fs/dirhash.c b/e2fsprogs/ext2fs/dirhash.c index 4d18593..39678a6 100644 --- a/e2fsprogs/ext2fs/dirhash.c +++ b/e2fsprogs/ext2fs/dirhash.c @@ -2,7 +2,7 @@ * dirhash.c -- Calculate the hash of a directory entry * * Copyright (c) 2001 Daniel Phillips - * + * * Copyright (c) 2002 Theodore Ts'o. * * %Begin-Header% @@ -25,7 +25,7 @@ * (see Applied Cryptography, 2nd edition, p448). * * Jeremy Fitzhardinge <jeremy@zip.com.au> 1998 - * + * * This code is made available under the terms of the GPL */ #define DELTA 0x9E3779B9 @@ -37,10 +37,10 @@ static void TEA_transform(__u32 buf[4], __u32 const in[]) __u32 a = in[0], b = in[1], c = in[2], d = in[3]; int n = 16; - do { - sum += DELTA; - b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); - b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); + do { + sum += DELTA; + b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); + b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); } while(--n); buf[0] += b0; @@ -121,7 +121,7 @@ static ext2_dirhash_t dx_hack_hash (const char *name, int len) __u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; while (len--) { __u32 hash = hash1 + (hash0 ^ (*name++ * 7152373)); - + if (hash & 0x80000000) hash -= 0x7fffffff; hash1 = hash0; hash0 = hash; @@ -160,11 +160,11 @@ static void str2hashbuf(const char *msg, int len, __u32 *buf, int num) * Returns the hash of a filename. If len is 0 and name is NULL, then * this function can be used to test whether or not a hash version is * supported. - * + * * The seed is an 4 longword (32 bits) "secret" which can be used to * uniquify a hash. If the seed is all zero's, then some default seed * may be used. - * + * * A particular hash version specifies whether or not the seed is * represented, and whether or not the returned hash is 32 bits or 64 * bits. 32 bit hashes will return 0 for the minor hash. @@ -178,7 +178,7 @@ errcode_t ext2fs_dirhash(int version, const char *name, int len, __u32 minor_hash = 0; const char *p; int i; - __u32 in[8], buf[4]; + __u32 in[8], buf[4]; /* Initialize the default seed for the hash checksum functions */ buf[0] = 0x67452301; @@ -195,7 +195,7 @@ errcode_t ext2fs_dirhash(int version, const char *name, int len, if (i < 4) memcpy(buf, seed, sizeof(buf)); } - + switch (version) { case EXT2_HASH_LEGACY: hash = dx_hack_hash(name, len); diff --git a/e2fsprogs/ext2fs/dupfs.c b/e2fsprogs/ext2fs/dupfs.c index f8919c2..2009ef7 100644 --- a/e2fsprogs/ext2fs/dupfs.c +++ b/e2fsprogs/ext2fs/dupfs.c @@ -1,6 +1,6 @@ /* * dupfs.c --- duplicate a ext2 filesystem handle - * + * * Copyright (C) 1997, 1998, 2001, 2003, 2005 by Theodore Ts'o. * * %Begin-Header% @@ -25,7 +25,7 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest) errcode_t retval; EXT2_CHECK_MAGIC(src, EXT2_ET_MAGIC_EXT2FS_FILSYS); - + retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); if (retval) return retval; @@ -91,6 +91,6 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest) errout: ext2fs_free(fs); return retval; - + } diff --git a/e2fsprogs/ext2fs/e2image.h b/e2fsprogs/ext2fs/e2image.h index e12b7d6..c05d43e 100644 --- a/e2fsprogs/ext2fs/e2image.h +++ b/e2fsprogs/ext2fs/e2image.h @@ -1,10 +1,10 @@ /* * e2image.h --- header file describing the ext2 image format - * + * * Copyright (C) 2000 Theodore Ts'o. * * Note: this uses the POSIX IO interfaces, unlike most of the other - * functions in this library. So sue me. + * functions in this library. So sue me. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public @@ -24,7 +24,7 @@ struct ext2_image_hdr { char fs_uuid[16]; /* UUID of filesystem */ __u32 fs_blocksize; /* Block size of the filesystem */ __u32 fs_reserved[8]; - + __u32 image_device; /* Device number of image file */ __u32 image_inode; /* Inode number of image file */ __u32 image_time; /* Time of image creation */ @@ -37,15 +37,15 @@ struct ext2_image_hdr { __u32 offset_reserved[8]; }; - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/e2fsprogs/ext2fs/expanddir.c b/e2fsprogs/ext2fs/expanddir.c index 10a5149..c148b93 100644 --- a/e2fsprogs/ext2fs/expanddir.c +++ b/e2fsprogs/ext2fs/expanddir.c @@ -1,6 +1,6 @@ /* * expand.c --- expand an ext2fs directory - * + * * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999 Theodore Ts'o. * * %Begin-Header% @@ -36,7 +36,7 @@ static int expand_dir_proc(ext2_filsys fs, static blk_t last_blk = 0; char *block; errcode_t retval; - + if (*blocknr) { last_blk = *blocknr; return 0; @@ -62,7 +62,7 @@ static int expand_dir_proc(ext2_filsys fs, } memset(block, 0, fs->blocksize); retval = io_channel_write_blk(fs->io, new_blk, 1, block); - } + } if (retval) { es->err = retval; return BLOCK_ABORT; @@ -83,7 +83,7 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) errcode_t retval; struct expand_dir_struct es; struct ext2_inode inode; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); if (!(fs->flags & EXT2_FLAG_RW)) @@ -95,11 +95,11 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) retval = ext2fs_check_directory(fs, dir); if (retval) return retval; - + es.done = 0; es.err = 0; es.newblocks = 0; - + retval = ext2fs_block_iterate2(fs, dir, BLOCK_FLAG_APPEND, 0, expand_dir_proc, &es); @@ -114,7 +114,7 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) retval = ext2fs_read_inode(fs, dir, &inode); if (retval) return retval; - + inode.i_size += fs->blocksize; inode.i_blocks += (fs->blocksize / 512) * es.newblocks; diff --git a/e2fsprogs/ext2fs/ext2_fs.h b/e2fsprogs/ext2fs/ext2_fs.h index 7a98903..4005873 100644 --- a/e2fsprogs/ext2fs/ext2_fs.h +++ b/e2fsprogs/ext2fs/ext2_fs.h @@ -231,9 +231,9 @@ struct ext2_dx_countlimit { #define EXT2_IMAGIC_FL 0x00002000 #define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ #define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ -#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */ +#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */ #define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ -#define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */ +#define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */ #define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ #define EXT2_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ @@ -501,12 +501,12 @@ struct ext2_super_block { __u32 s_last_orphan; /* start of list of inodes to delete */ __u32 s_hash_seed[4]; /* HTREE hash seed */ __u8 s_def_hash_version; /* Default hash version to use */ - __u8 s_jnl_backup_type; /* Default type of journal backup */ + __u8 s_jnl_backup_type; /* Default type of journal backup */ __u16 s_reserved_word_pad; __u32 s_default_mount_opts; __u32 s_first_meta_bg; /* First metablock group */ __u32 s_mkfs_time; /* When the filesystem was created */ - __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ + __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ __u32 s_reserved[172]; /* Padding to the end of the block */ }; @@ -585,7 +585,7 @@ struct ext2_super_block { #define EXT2_DEFM_XATTR_USER 0x0004 #define EXT2_DEFM_ACL 0x0008 #define EXT2_DEFM_UID16 0x0010 -#define EXT3_DEFM_JMODE 0x0060 +#define EXT3_DEFM_JMODE 0x0060 #define EXT3_DEFM_JMODE_DATA 0x0020 #define EXT3_DEFM_JMODE_ORDERED 0x0040 #define EXT3_DEFM_JMODE_WBACK 0x0060 diff --git a/e2fsprogs/ext2fs/ext2fs.h b/e2fsprogs/ext2fs/ext2fs.h index e2e8657..7d2a436 100644 --- a/e2fsprogs/ext2fs/ext2fs.h +++ b/e2fsprogs/ext2fs/ext2fs.h @@ -1,6 +1,6 @@ /* * ext2fs.h --- ext2fs - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -46,7 +46,7 @@ extern "C" { * 1032 bytes long). */ #define SUPERBLOCK_OFFSET 1024 -#define SUPERBLOCK_SIZE 1024 +#define SUPERBLOCK_SIZE 1024 /* * The last ext2fs revision level that this version of the library is @@ -87,7 +87,7 @@ typedef struct struct_ext2_filsys *ext2_filsys; struct ext2fs_struct_generic_bitmap { errcode_t magic; - ext2_filsys fs; + ext2_filsys fs; __u32 start, end; __u32 real_end; char * description; @@ -96,8 +96,8 @@ struct ext2fs_struct_generic_bitmap { __u32 reserved[7]; }; -#define EXT2FS_MARK_ERROR 0 -#define EXT2FS_UNMARK_ERROR 1 +#define EXT2FS_MARK_ERROR 0 +#define EXT2FS_UNMARK_ERROR 1 #define EXT2FS_TEST_ERROR 2 typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap; @@ -194,7 +194,7 @@ struct struct_ext2_filsys { io_channel io; int flags; char * device_name; - struct ext2_super_block * super; + struct ext2_super_block * super; unsigned int blocksize; int fragsize; dgrp_t group_desc_count; @@ -250,7 +250,7 @@ struct struct_ext2_filsys { * This is used by ext2fs_expand_dir() to be able to add a new block * to an inode. It can also be used for programs that want to be able * to deal with files that contain "holes". - * + * * BLOCK_FLAG_TRAVERSE indicates that the iterator function for the * indirect, doubly indirect, etc. blocks should be called after all * of the blocks containined in the indirect blocks are processed. @@ -282,7 +282,7 @@ struct struct_ext2_filsys { /* * Flags for ext2fs_move_blocks */ -#define EXT2_BMOVE_GET_DBLIST 0x0001 +#define EXT2_BMOVE_GET_DBLIST 0x0001 #define EXT2_BMOVE_DEBUG 0x0002 #endif @@ -457,7 +457,7 @@ extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, char *block_buf, blk_t *ret); /* alloc_sb.c */ -extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs, +extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs, dgrp_t group, ext2fs_block_bitmap bmap); @@ -567,7 +567,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, /* bmap.c */ extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, - struct ext2_inode *inode, + struct ext2_inode *inode, char *block_buf, int bmap_flags, blk_t block, blk_t *phys_blk); @@ -587,7 +587,7 @@ extern errcode_t ext2fs_check_desc(ext2_filsys fs); extern errcode_t ext2fs_close(ext2_filsys fs); extern errcode_t ext2fs_flush(ext2_filsys fs); extern int ext2fs_bg_has_super(ext2_filsys fs, int group_block); -extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, +extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, dgrp_t group, blk_t *ret_super_blk, blk_t *ret_old_desc_blk, @@ -652,7 +652,7 @@ extern errcode_t ext2fs_dirhash(int version, const char *name, int len, /* dir_iterate.c */ -extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, +extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, ext2_ino_t dir, int flags, char *block_buf, @@ -662,7 +662,7 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, char *buf, void *priv_data), void *priv_data); -extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs, +extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs, ext2_ino_t dir, int flags, char *block_buf, @@ -751,10 +751,10 @@ extern errcode_t ext2fs_initialize(const char *name, int flags, /* icount.c */ extern void ext2fs_free_icount(ext2_icount_t icount); -extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, +extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size, ext2_icount_t hint, ext2_icount_t *ret); -extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, +extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, unsigned int size, ext2_icount_t *ret); extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, @@ -770,9 +770,9 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *); /* inode.c */ extern errcode_t ext2fs_flush_icache(ext2_filsys fs); -extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, +extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, - struct ext2_inode *inode, + struct ext2_inode *inode, int bufsize); extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, ext2_inode_scan *ret_scan); @@ -791,12 +791,12 @@ extern void ext2fs_set_inode_callback extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags, int clear_flags); extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, - struct ext2_inode * inode, + struct ext2_inode * inode, int bufsize); extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino, struct ext2_inode * inode); extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, - struct ext2_inode * inode, + struct ext2_inode * inode, int bufsize); extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode * inode); @@ -807,12 +807,12 @@ extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino); /* inode_io.c */ extern io_manager inode_io_manager; -extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, +extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, char **name); extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, char **name); - + /* ismounted.c */ extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags); extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, @@ -852,11 +852,11 @@ extern errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, extern errcode_t ext2fs_open(const char *name, int flags, int superblock, unsigned int block_size, io_manager manager, ext2_filsys *ret_fs); -extern errcode_t ext2fs_open2(const char *name, const char *io_options, - int flags, int superblock, +extern errcode_t ext2fs_open2(const char *name, const char *io_options, + int flags, int superblock, unsigned int block_size, io_manager manager, ext2_filsys *ret_fs); -extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, +extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i); errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io); errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io); @@ -877,14 +877,14 @@ extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs, ext2_badblocks_list *bb_list); /* read_bb_file.c */ -extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, +extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, ext2_badblocks_list *bb_list, void *priv_data, void (*invalid)(ext2_filsys fs, blk_t blk, char *badstr, void *priv_data)); -extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, +extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, ext2_badblocks_list *bb_list, void (*invalid)(ext2_filsys fs, blk_t blk)); @@ -904,7 +904,7 @@ extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src, ext2fs_generic_bitmap *dest); /* swapfs.c */ -extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, +extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, int has_header); extern void ext2fs_swap_super(struct ext2_super_block * super); extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp); diff --git a/e2fsprogs/ext2fs/ext2fsP.h b/e2fsprogs/ext2fs/ext2fsP.h index eea32d6..90b0812 100644 --- a/e2fsprogs/ext2fs/ext2fsP.h +++ b/e2fsprogs/ext2fs/ext2fsP.h @@ -1,6 +1,6 @@ /* * ext2fsP.h --- private header file for ext2 library - * + * * Copyright (C) 1997 Theodore Ts'o. * * %Begin-Header% @@ -78,7 +78,7 @@ struct ext2_inode_cache_ent { /* Function prototypes */ -extern int ext2fs_process_dir_block(ext2_filsys fs, +extern int ext2fs_process_dir_block(ext2_filsys fs, blk_t *blocknr, e2_blkcnt_t blockcnt, blk_t ref_block, diff --git a/e2fsprogs/ext2fs/ext2fs_inline.c b/e2fsprogs/ext2fs/ext2fs_inline.c index f14e7b2..2fa9a9e 100644 --- a/e2fsprogs/ext2fs/ext2fs_inline.c +++ b/e2fsprogs/ext2fs/ext2fs_inline.c @@ -1,6 +1,6 @@ /* * ext2fs.h --- ext2fs - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -36,7 +36,7 @@ errcode_t ext2fs_free_mem(void *ptr) *pp = 0; return 0; } - + /* * Resize memory */ @@ -154,7 +154,7 @@ blk_t ext2fs_inode_data_blocks(ext2_filsys fs, struct ext2_inode *inode) { return inode->i_blocks - - (inode->i_file_acl ? fs->blocksize >> 9 : 0); + (inode->i_file_acl ? fs->blocksize >> 9 : 0); } @@ -179,7 +179,7 @@ __u32 ext2fs_swab32(__u32 val) int ext2fs_find_first_bit_set(void * addr, unsigned size) { char *cp = (unsigned char *) addr; - int res = 0, d0; + int res = 0, d0; if (!size) return 0; @@ -191,7 +191,7 @@ int ext2fs_find_first_bit_set(void * addr, unsigned size) d0 = ffs(*cp); if (d0 == 0) return size; - + return res + d0 - 1; } @@ -199,10 +199,10 @@ int ext2fs_find_next_bit_set (void * addr, int size, int offset) { unsigned char * p; int set = 0, bit = offset & 7, res = 0, d0; - + res = offset >> 3; p = ((unsigned char *) addr) + res; - + if (bit) { set = ffs(*p & ~((1 << bit) - 1)); if (set) @@ -245,35 +245,35 @@ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block) { - return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); } int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block) { - return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, + return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); } int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { - return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); } int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { - return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); } int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode) { - return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, + return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); } @@ -286,7 +286,7 @@ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, bitmap->description); return; } -#endif +#endif ext2fs_set_bit(block - bitmap->start, bitmap->bitmap); } @@ -415,7 +415,7 @@ void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num) { int i; - + if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, bitmap->description); @@ -429,14 +429,14 @@ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num) { int i; - + #ifdef EXT2FS_DEBUG_FAST_OPS if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, bitmap->description); return; } -#endif +#endif for (i=0; i < num; i++) ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap); } @@ -445,7 +445,7 @@ void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num) { int i; - + if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, bitmap->description); @@ -459,14 +459,14 @@ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num) { int i; - + #ifdef EXT2FS_DEBUG_FAST_OPS if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, bitmap->description); return; } -#endif +#endif for (i=0; i < num; i++) ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap); } diff --git a/e2fsprogs/ext2fs/ext_attr.c b/e2fsprogs/ext2fs/ext_attr.c index 08211c3..10b8bfd 100644 --- a/e2fsprogs/ext2fs/ext_attr.c +++ b/e2fsprogs/ext2fs/ext_attr.c @@ -1,6 +1,6 @@ /* * ext_attr.c --- extended attribute blocks - * + * * Copyright (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org> * * Copyright (C) 2002 Theodore Ts'o. @@ -27,7 +27,7 @@ errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf) { errcode_t retval; - retval = io_channel_read_blk(fs->io, block, 1, buf); + retval = io_channel_read_blk(fs->io, block, 1, buf); if (retval) return retval; #ifdef EXT2FS_ENABLE_SWAPFS @@ -55,7 +55,7 @@ errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *inbuf) } else #endif write_buf = (char *) inbuf; - retval = io_channel_write_blk(fs->io, block, 1, write_buf); + retval = io_channel_write_blk(fs->io, block, 1, write_buf); if (buf) ext2fs_free_mem(&buf); if (!retval) diff --git a/e2fsprogs/ext2fs/fileio.c b/e2fsprogs/ext2fs/fileio.c index 3e42cbc..669e80c 100644 --- a/e2fsprogs/ext2fs/fileio.c +++ b/e2fsprogs/ext2fs/fileio.c @@ -1,6 +1,6 @@ /* * fileio.c --- Simple file I/O routines - * + * * Copyright (C) 1997 Theodore Ts'o. * * %Begin-Header% @@ -20,14 +20,14 @@ struct ext2_file { errcode_t magic; - ext2_filsys fs; + ext2_filsys fs; ext2_ino_t ino; struct ext2_inode inode; - int flags; + int flags; __u64 pos; blk_t blockno; blk_t physblock; - char *buf; + char *buf; }; #define BMAP_BUFFER (file->buf + fs->blocksize) @@ -36,7 +36,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, int flags, ext2_file_t *ret) { - ext2_file_t file; + ext2_file_t file; errcode_t retval; /* @@ -50,7 +50,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, retval = ext2fs_get_mem(sizeof(struct ext2_file), &file); if (retval) return retval; - + memset(file, 0, sizeof(struct ext2_file)); file->magic = EXT2_ET_MAGIC_EXT2_FILE; file->fs = fs; @@ -64,14 +64,14 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, if (retval) goto fail; } - + retval = ext2fs_get_mem(fs->blocksize * 3, &file->buf); if (retval) goto fail; *ret = file; return 0; - + fail: if (file->buf) ext2fs_free_mem(&file->buf); @@ -103,7 +103,7 @@ errcode_t ext2fs_file_flush(ext2_file_t file) { errcode_t retval; ext2_filsys fs; - + EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); fs = file->fs; @@ -176,7 +176,7 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill) if (!dontfill) { if (file->physblock) { retval = io_channel_read_blk(fs->io, - file->physblock, + file->physblock, 1, file->buf); if (retval) return retval; @@ -187,16 +187,16 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill) } return 0; } - + errcode_t ext2fs_file_close(ext2_file_t file) { errcode_t retval; - + EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); retval = ext2fs_file_flush(file); - + if (file->buf) ext2fs_free_mem(&file->buf); ext2fs_free_mem(&file); @@ -232,14 +232,14 @@ errcode_t ext2fs_file_read(ext2_file_t file, void *buf, left = EXT2_I_SIZE(&file->inode) - file->pos ; if (c > left) c = left; - + memcpy(ptr, file->buf+start, c); file->pos += c; ptr += c; count += c; wanted -= c; } - + fail: if (got) *got = count; @@ -265,7 +265,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, retval = sync_buffer_position(file); if (retval) goto fail; - + start = file->pos % fs->blocksize; c = fs->blocksize - start; if (c > nbytes) @@ -286,7 +286,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, count += c; nbytes -= c; } - + fail: if (written) *written = count; @@ -318,7 +318,7 @@ errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset, { __u64 loffset, ret_loffset; errcode_t retval; - + loffset = offset; retval = ext2fs_file_llseek(file, loffset, whence, &ret_loffset); if (ret_pos) @@ -354,14 +354,14 @@ ext2_off_t ext2fs_file_get_size(ext2_file_t file) /* * This function sets the size of the file, truncating it if necessary - * + * * XXX still need to call truncate */ errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size) { errcode_t retval; EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); - + file->inode.i_size = size; file->inode.i_size_high = 0; if (file->ino) { @@ -370,7 +370,7 @@ errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size) return retval; } - /* + /* * XXX truncate inode if necessary */ diff --git a/e2fsprogs/ext2fs/finddev.c b/e2fsprogs/ext2fs/finddev.c index c459c08..552aa79 100644 --- a/e2fsprogs/ext2fs/finddev.c +++ b/e2fsprogs/ext2fs/finddev.c @@ -1,7 +1,7 @@ /* * finddev.c -- this routine attempts to find a particular device in - * /dev - * + * /dev + * * Copyright (C) 2000 Theodore Ts'o. * * %Begin-Header% @@ -124,7 +124,7 @@ char *ext2fs_find_block_device(dev_t device) add_to_dirlist("/devices", &list); add_to_dirlist("/devfs", &list); add_to_dirlist("/dev", &list); - + while (list) { current = list; list = list->next; @@ -150,7 +150,7 @@ char *ext2fs_find_block_device(dev_t device) return ret_path; } - + #ifdef DEBUG int main(int argc, char** argv) { @@ -194,5 +194,5 @@ int main(int argc, char** argv) } return 0; } - + #endif diff --git a/e2fsprogs/ext2fs/flushb.c b/e2fsprogs/ext2fs/flushb.c index 1882795..9f04647 100644 --- a/e2fsprogs/ext2fs/flushb.c +++ b/e2fsprogs/ext2fs/flushb.c @@ -1,7 +1,7 @@ /* * flushb.c --- Hides system-dependent information for both syncing a - * device to disk and to flush any buffers from disk cache. - * + * device to disk and to flush any buffers from disk cache. + * * Copyright (C) 2000 Theodore Ts'o. * * %Begin-Header% @@ -29,7 +29,7 @@ #include "ext2fs.h" /* - * For Linux, define BLKFLSBUF and FDFLUSH if necessary, since + * For Linux, define BLKFLSBUF and FDFLUSH if necessary, since * not all portable header file does so for us. This really should be * fixed in the glibc header files. (Recent glibcs appear to define * BLKFLSBUF in sys/mount.h, but FDFLUSH still doesn't seem to be diff --git a/e2fsprogs/ext2fs/freefs.c b/e2fsprogs/ext2fs/freefs.c index 029ffaa..3fd51f2 100644 --- a/e2fsprogs/ext2fs/freefs.c +++ b/e2fsprogs/ext2fs/freefs.c @@ -1,6 +1,6 @@ /* * freefs.c --- free an ext2 filesystem - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. * * %Begin-Header% @@ -52,7 +52,7 @@ void ext2fs_free(ext2_filsys fs) if (fs->icache) ext2fs_free_inode_cache(fs->icache); - + fs->magic = 0; ext2fs_free_mem(&fs); diff --git a/e2fsprogs/ext2fs/gen_bitmap.c b/e2fsprogs/ext2fs/gen_bitmap.c index 700affa..3f15ce6 100644 --- a/e2fsprogs/ext2fs/gen_bitmap.c +++ b/e2fsprogs/ext2fs/gen_bitmap.c @@ -1,6 +1,6 @@ /* * gen_bitmap.c --- Generic bitmap routines that used to be inlined. - * + * * Copyright (C) 2001 Theodore Ts'o. * * %Begin-Header% diff --git a/e2fsprogs/ext2fs/get_pathname.c b/e2fsprogs/ext2fs/get_pathname.c index 23f593f..594090d 100644 --- a/e2fsprogs/ext2fs/get_pathname.c +++ b/e2fsprogs/ext2fs/get_pathname.c @@ -1,6 +1,6 @@ /* * get_pathname.c --- do directry/inode -> name translation - * + * * Copyright (C) 1993, 1994, 1995 Theodore Ts'o. * * %Begin-Header% @@ -8,14 +8,14 @@ * License. * %End-Header% * - * ext2fs_get_pathname(fs, dir, ino, name) + * ext2fs_get_pathname(fs, dir, ino, name) + * + * This function translates takes two inode numbers into a + * string, placing the result in <name>. <dir> is the containing + * directory inode, and <ino> is the inode number itself. If + * <ino> is zero, then ext2fs_get_pathname will return pathname + * of the the directory <dir>. * - * This function translates takes two inode numbers into a - * string, placing the result in <name>. <dir> is the containing - * directory inode, and <ino> is the inode number itself. If - * <ino> is zero, then ext2fs_get_pathname will return pathname - * of the the directory <dir>. - * */ #include <stdio.h> @@ -65,8 +65,8 @@ static int get_pathname_proc(struct ext2_dir_entry *dirent, return 0; } -static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, - ext2_ino_t ino, int maxdepth, +static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, + ext2_ino_t ino, int maxdepth, char *buf, char **name) { struct get_pathname_struct gp; @@ -93,7 +93,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, gp.parent = 0; gp.name = 0; gp.errcode = 0; - + retval = ext2fs_dir_iterate(fs, dir, 0, buf, get_pathname_proc, &gp); if (retval) goto cleanup; @@ -110,15 +110,15 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, *name = parent_name; return 0; } - - if (gp.name) + + if (gp.name) retval = ext2fs_get_mem(strlen(parent_name)+strlen(gp.name)+2, &ret); else retval = ext2fs_get_mem(strlen(parent_name)+5, &ret); if (retval) goto cleanup; - + ret[0] = 0; if (parent_name[1]) strcat(ret, parent_name); @@ -130,7 +130,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, *name = ret; ext2fs_free_mem(&parent_name); retval = 0; - + cleanup: if (gp.name) ext2fs_free_mem(&gp.name); @@ -153,5 +153,5 @@ errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino, retval = ext2fs_get_pathname_int(fs, dir, ino, 32, buf, name); ext2fs_free_mem(&buf); return retval; - + } diff --git a/e2fsprogs/ext2fs/getsectsize.c b/e2fsprogs/ext2fs/getsectsize.c index 77a9e3d..b561660 100644 --- a/e2fsprogs/ext2fs/getsectsize.c +++ b/e2fsprogs/ext2fs/getsectsize.c @@ -1,6 +1,6 @@ /* * getsectsize.c --- get the sector size of a device. - * + * * Copyright (C) 1995, 1995 Theodore Ts'o. * Copyright (C) 2003 VMware, Inc. * diff --git a/e2fsprogs/ext2fs/getsize.c b/e2fsprogs/ext2fs/getsize.c index 036d926..bfafdf2 100644 --- a/e2fsprogs/ext2fs/getsize.c +++ b/e2fsprogs/ext2fs/getsize.c @@ -1,11 +1,11 @@ /* * getsize.c --- get the size of a partition. - * + * * Copyright (C) 1995, 1995 Theodore Ts'o. * Copyright (C) 2003 VMware, Inc. * * Windows version of ext2fs_get_device_size by Chris Li, VMware. - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -75,10 +75,10 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize, DWORD filesize; #endif /* HAVE_GET_FILE_SIZE_EX */ - dev = CreateFile(file, GENERIC_READ, + dev = CreateFile(file, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE , - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (dev == INVALID_HANDLE_VALUE) return EBADF; if (DeviceIoControl(dev, IOCTL_DISK_GET_PARTITION_INFO, @@ -87,7 +87,7 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize, &retbytes, NULL)) { *retblocks = pi.PartitionLength.QuadPart / blocksize; - + } else if (DeviceIoControl(dev, IOCTL_DISK_GET_DRIVE_GEOMETRY, &gi, sizeof(DISK_GEOMETRY), &gi, sizeof(DISK_GEOMETRY), @@ -137,7 +137,7 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize, int fd; int valid_blkgetsize64 = 1; #ifdef __linux__ - struct utsname ut; + struct utsname ut; #endif unsigned long long size64; unsigned long size; @@ -272,7 +272,7 @@ int main(int argc, char **argv) { blk_t blocks; int retval; - + if (argc < 2) { fprintf(stderr, "Usage: %s device\n", argv[0]); exit(1); diff --git a/e2fsprogs/ext2fs/icount.c b/e2fsprogs/ext2fs/icount.c index 5997792..0167777 100644 --- a/e2fsprogs/ext2fs/icount.c +++ b/e2fsprogs/ext2fs/icount.c @@ -81,19 +81,19 @@ errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size, if (hint->size > size) size = (size_t) hint->size; } - + retval = ext2fs_get_mem(sizeof(struct ext2_icount), &icount); if (retval) return retval; memset(icount, 0, sizeof(struct ext2_icount)); - retval = ext2fs_allocate_inode_bitmap(fs, 0, + retval = ext2fs_allocate_inode_bitmap(fs, 0, &icount->single); if (retval) goto errout; if (flags & EXT2_ICOUNT_OPT_INCREMENT) { - retval = ext2fs_allocate_inode_bitmap(fs, 0, + retval = ext2fs_allocate_inode_bitmap(fs, 0, &icount->multiple); if (retval) goto errout; @@ -113,7 +113,7 @@ errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size, goto errout; icount->size += fs->super->s_inodes_count / 50; } - + bytes = (size_t) (icount->size * sizeof(struct ext2_icount_el)); #if 0 printf("Icount allocated %d entries, %d bytes.\n", @@ -148,7 +148,7 @@ errout: return(retval); } -errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, +errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, unsigned int size, ext2_icount_t *ret) { @@ -157,12 +157,12 @@ errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, /* * insert_icount_el() --- Insert a new entry into the sorted list at a - * specified position. + * specified position. */ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, ext2_ino_t ino, int pos) { - struct ext2_icount_el *el; + struct ext2_icount_el *el; errcode_t retval; ext2_ino_t new_size = 0; int num; @@ -170,14 +170,14 @@ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, if (icount->count >= icount->size) { if (icount->count) { new_size = icount->list[(unsigned)icount->count-1].ino; - new_size = (ext2_ino_t) (icount->count * + new_size = (ext2_ino_t) (icount->count * ((float) icount->num_inodes / new_size)); } if (new_size < (icount->size + 100)) new_size = icount->size + 100; #if 0 printf("Reallocating icount %d entries...\n", new_size); -#endif +#endif retval = ext2fs_resize_mem((size_t) icount->size * sizeof(struct ext2_icount_el), (size_t) new_size * @@ -203,8 +203,8 @@ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, /* * get_icount_el() --- given an inode number, try to find icount - * information in the sorted list. If the create flag is set, - * and we can't find an entry, create one in the sorted list. + * information in the sorted list. If the create flag is set, + * and we can't find an entry, create one in the sorted list. */ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, ext2_ino_t ino, int create) @@ -222,7 +222,7 @@ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, } if (icount->count == 0) return 0; - + if (icount->cursor >= icount->count) icount->cursor = 0; if (ino == icount->list[icount->cursor].ino) @@ -247,7 +247,7 @@ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, range = 0; else if (ino > highval) range = 1; - else + else range = ((float) (ino - lowval)) / (highval - lowval); mid = low + ((int) (range * (high-low))); @@ -276,7 +276,7 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out) errcode_t ret = 0; unsigned int i; const char *bad = "bad icount"; - + EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); if (icount->count > icount->size) { @@ -297,7 +297,7 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out) errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, __u16 *ret) { struct ext2_icount_el *el; - + EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); if (!ino || (ino > icount->num_inodes)) @@ -413,7 +413,7 @@ errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino, if (icount->multiple && !ext2fs_test_inode_bitmap(icount->multiple, ino)) return EXT2_ET_INVALID_ARGUMENT; - + el = get_icount_el(icount, ino, 0); if (!el || el->count == 0) return EXT2_ET_INVALID_ARGUMENT; diff --git a/e2fsprogs/ext2fs/imager.c b/e2fsprogs/ext2fs/imager.c index 3f2826b..00eb717 100644 --- a/e2fsprogs/ext2fs/imager.c +++ b/e2fsprogs/ext2fs/imager.c @@ -1,11 +1,11 @@ /* * image.c --- writes out the critical parts of the filesystem as a - * flat file. + * flat file. * * Copyright (C) 2000 Theodore Ts'o. * * Note: this uses the POSIX IO interfaces, unlike most of the other - * functions in this library. So sue me. + * functions in this library. So sue me. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public @@ -67,7 +67,7 @@ errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags) errcode_t retval; buf = xmalloc(fs->blocksize * BUF_BLOCKS); - + for (group = 0; group < fs->group_desc_count; group++) { blk = fs->group_desc[(unsigned)group].bg_inode_table; if (!blk) @@ -127,7 +127,7 @@ errout: /* * Read in the inode table and stuff it into place */ -errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, +errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, int flags EXT2FS_ATTR((unused))) { unsigned int group, c, left; @@ -137,7 +137,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, errcode_t retval; buf = xmalloc(fs->blocksize * BUF_BLOCKS); - + for (group = 0; group < fs->group_desc_count; group++) { blk = fs->group_desc[(unsigned)group].bg_inode_table; if (!blk) { @@ -161,7 +161,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, retval = io_channel_write_blk(fs->io, blk, c, buf); if (retval) goto errout; - + blk += c; left -= c; } @@ -176,7 +176,7 @@ errout: /* * Write out superblock and group descriptors */ -errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, +errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, int flags EXT2FS_ATTR((unused))) { char *buf, *cp; @@ -213,7 +213,7 @@ errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, retval = EXT2_ET_SHORT_WRITE; goto errout; } - + retval = 0; errout: @@ -224,7 +224,7 @@ errout: /* * Read the superblock and group descriptors and overwrite them. */ -errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, +errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, int flags EXT2FS_ATTR((unused))) { char *buf; @@ -368,7 +368,7 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags) goto errout; } memcpy(ptr, buf, size); - + retval = 0; errout: if (buf) diff --git a/e2fsprogs/ext2fs/ind_block.c b/e2fsprogs/ext2fs/ind_block.c index c9fd86a..3e6cdc1 100644 --- a/e2fsprogs/ext2fs/ind_block.c +++ b/e2fsprogs/ext2fs/ind_block.c @@ -1,8 +1,8 @@ /* * ind_block.c --- indirect block I/O routines - * - * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. + * + * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public diff --git a/e2fsprogs/ext2fs/initialize.c b/e2fsprogs/ext2fs/initialize.c index 82cd9f1..3d326b5 100644 --- a/e2fsprogs/ext2fs/initialize.c +++ b/e2fsprogs/ext2fs/initialize.c @@ -1,9 +1,9 @@ /* * initialize.c --- initialize a filesystem handle given superblock - * parameters. Used by mke2fs when initializing a filesystem. - * + * parameters. Used by mke2fs when initializing a filesystem. + * * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -36,7 +36,7 @@ #if defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) #define CREATOR_OS EXT2_OS_FREEBSD #else -#if defined(LITES) && defined(EXT2_OS_LITES) +#if defined(LITES) && defined(EXT2_OS_LITES) #define CREATOR_OS EXT2_OS_LITES #else #define CREATOR_OS EXT2_OS_LINUX /* by default */ @@ -44,13 +44,13 @@ #endif /* defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) */ #endif /* defined(__GNU__) && defined(EXT2_OS_HURD) */ #endif /* defined(__linux__) && defined(EXT2_OS_LINUX) */ - + /* * Note we override the kernel include file's idea of what the default * check interval (never) should be. It's a good idea to check at * least *occasionally*, specially since servers will never rarely get * to reboot, since Linux is so robust these days. :-) - * + * * 180 days (six months) seems like a good value. */ #ifdef EXT2_DFL_CHECKINTERVAL @@ -108,11 +108,11 @@ errcode_t ext2fs_initialize(const char *name, int flags, if (!param || !param->s_blocks_count) return EXT2_ET_INVALID_ARGUMENT; - + retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); if (retval) return retval; - + memset(fs, 0, sizeof(struct struct_ext2_filsys)); fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; fs->flags = flags | EXT2_FLAG_RW; @@ -181,7 +181,7 @@ errcode_t ext2fs_initialize(const char *name, int flags, if (super->s_blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(super)) super->s_blocks_per_group = EXT2_MAX_BLOCKS_PER_GROUP(super); super->s_frags_per_group = super->s_blocks_per_group * frags_per_block; - + super->s_blocks_count = param->s_blocks_count; super->s_r_blocks_count = param->s_r_blocks_count; if (super->s_r_blocks_count >= param->s_blocks_count) { @@ -222,7 +222,7 @@ retry: */ if (super->s_inodes_count < EXT2_FIRST_INODE(super)+1) super->s_inodes_count = EXT2_FIRST_INODE(super)+1; - + /* * There should be at least as many inodes as the user * requested. Figure out how many inodes per group that @@ -332,12 +332,12 @@ retry: retval = ext2fs_get_mem(strlen(fs->device_name) + 80, &buf); if (retval) goto cleanup; - + sprintf(buf, "block bitmap for %s", fs->device_name); retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map); if (retval) goto cleanup; - + sprintf(buf, "inode bitmap for %s", fs->device_name); retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map); if (retval) @@ -369,14 +369,14 @@ retry: fs->group_desc[i].bg_free_inodes_count = fs->super->s_inodes_per_group; fs->group_desc[i].bg_used_dirs_count = 0; - + group_block += super->s_blocks_per_group; } - + ext2fs_mark_super_dirty(fs); ext2fs_mark_bb_dirty(fs); ext2fs_mark_ib_dirty(fs); - + io_channel_set_blksize(fs->io, fs->blocksize); *ret_fs = fs; diff --git a/e2fsprogs/ext2fs/inline.c b/e2fsprogs/ext2fs/inline.c index 5833b1d..9c3a6c0 100644 --- a/e2fsprogs/ext2fs/inline.c +++ b/e2fsprogs/ext2fs/inline.c @@ -1,8 +1,8 @@ /* * inline.c --- Includes the inlined functions defined in the header - * files as standalone functions, in case the application program - * is compiled with inlining turned off. - * + * files as standalone functions, in case the application program + * is compiled with inlining turned off. + * * Copyright (C) 1993, 1994 Theodore Ts'o. * * %Begin-Header% diff --git a/e2fsprogs/ext2fs/inode.c b/e2fsprogs/ext2fs/inode.c index 30580bf..e50bece 100644 --- a/e2fsprogs/ext2fs/inode.c +++ b/e2fsprogs/ext2fs/inode.c @@ -1,6 +1,6 @@ /* * inode.c --- utility routines to read and write inodes - * + * * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -59,7 +59,7 @@ struct ext2_struct_inode_scan { errcode_t ext2fs_flush_icache(ext2_filsys fs) { int i; - + if (!fs->icache) return 0; @@ -73,7 +73,7 @@ errcode_t ext2fs_flush_icache(ext2_filsys fs) static errcode_t create_icache(ext2_filsys fs) { errcode_t retval; - + if (fs->icache) return 0; retval = ext2fs_get_mem(sizeof(struct ext2_inode_cache), &fs->icache); @@ -146,7 +146,7 @@ errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, group_desc[scan->current_group].bg_inode_table; scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super); scan->blocks_left = scan->fs->inode_blocks_per_group; - retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks * + retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks * fs->blocksize), &scan->inode_buffer); scan->done_group = 0; @@ -172,7 +172,7 @@ void ext2fs_close_inode_scan(ext2_inode_scan scan) { if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) return; - + ext2fs_free_mem(&scan->inode_buffer); scan->inode_buffer = NULL; ext2fs_free_mem(&scan->temp_buffer); @@ -190,7 +190,7 @@ void ext2fs_set_inode_callback(ext2_inode_scan scan, { if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) return; - + scan->done_group = done_group; scan->done_group_data = done_group_data; } @@ -217,7 +217,7 @@ static errcode_t get_next_blockgroup(ext2_inode_scan scan) { scan->current_group++; scan->groups_left--; - + scan->current_block = scan->fs-> group_desc[scan->current_group].bg_inode_table; @@ -335,7 +335,7 @@ static errcode_t get_next_blocks(ext2_inode_scan scan) if (retval) return retval; } - + if ((scan->scan_flags & EXT2_SF_BAD_INODE_BLK) || (scan->current_block == 0)) { memset(scan->inode_buffer, 0, @@ -367,7 +367,7 @@ static errcode_t get_next_blocks(ext2_inode_scan scan) static inline int is_empty_scan(ext2_inode_scan scan) { int i; - + if (scan->bytes_left == 0) return 0; @@ -383,7 +383,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, { errcode_t retval; int extra_bytes = 0; - + EXT2_CHECK_MAGIC(scan, EXT2_ET_MAGIC_INODE_SCAN); /* @@ -416,7 +416,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, } else return EXT2_ET_MISSING_INODE_TABLE; } - + /* * Have we run out of space in the inode buffer? If so, we @@ -449,9 +449,9 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, #ifdef EXT2FS_ENABLE_SWAPFS if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) - ext2fs_swap_inode_full(scan->fs, + ext2fs_swap_inode_full(scan->fs, (struct ext2_inode_large *) inode, - (struct ext2_inode_large *) scan->temp_buffer, + (struct ext2_inode_large *) scan->temp_buffer, 0, bufsize); else #endif @@ -463,7 +463,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, #ifdef EXT2FS_ENABLE_SWAPFS if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) - ext2fs_swap_inode_full(scan->fs, + ext2fs_swap_inode_full(scan->fs, (struct ext2_inode_large *) inode, (struct ext2_inode_large *) scan->ptr, 0, bufsize); @@ -495,10 +495,10 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino, errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode * inode, int bufsize) { - unsigned long group, block, block_nr, offset; - char *ptr; + unsigned long group, block, block_nr, offset; + char *ptr; errcode_t retval; - int clen, i, inodes_per_block, length; + int clen, i, inodes_per_block, length; io_channel io; EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); @@ -541,7 +541,7 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super); if (!fs->group_desc[(unsigned)group].bg_inode_table) return EXT2_ET_MISSING_INODE_TABLE; - block_nr = fs->group_desc[(unsigned)group].bg_inode_table + + block_nr = fs->group_desc[(unsigned)group].bg_inode_table + block; io = fs->io; } @@ -577,8 +577,8 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, #ifdef EXT2FS_ENABLE_SWAPFS if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) - ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode, - (struct ext2_inode_large *) inode, + ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode, + (struct ext2_inode_large *) inode, 0, length); #endif @@ -587,7 +587,7 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, fs->icache->cache_size; fs->icache->cache[fs->icache->cache_last].ino = ino; fs->icache->cache[fs->icache->cache_last].inode = *inode; - + return 0; } @@ -629,7 +629,7 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, if (retval) return retval; } - + if (!(fs->flags & EXT2_FLAG_RW)) return EXT2_ET_RO_FILSYS; @@ -649,13 +649,13 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, #ifdef EXT2FS_ENABLE_SWAPFS if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) - ext2fs_swap_inode_full(fs, w_inode, - (struct ext2_inode_large *) inode, + ext2fs_swap_inode_full(fs, w_inode, + (struct ext2_inode_large *) inode, 1, bufsize); else #endif memcpy(w_inode, inode, bufsize); - + group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super); offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) * EXT2_INODE_SIZE(fs->super); @@ -685,11 +685,11 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, fs->icache->buffer_blk = block_nr; } - - memcpy((char *) fs->icache->buffer + (unsigned) offset, + + memcpy((char *) fs->icache->buffer + (unsigned) offset, ptr, clen); - retval = io_channel_write_blk(fs->io, block_nr, 1, + retval = io_channel_write_blk(fs->io, block_nr, 1, fs->icache->buffer); if (retval) goto errout; @@ -699,7 +699,7 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, length -= clen; block_nr++; } - + fs->flags |= EXT2_FLAG_CHANGED; errout: if (w_inode && w_inode != &temp_inode) @@ -714,7 +714,7 @@ errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, sizeof(struct ext2_inode)); } -/* +/* * This function should be called when writing a new inode. It makes * sure that extra part of large inodes is initialized properly. */ @@ -722,7 +722,7 @@ errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode) { struct ext2_inode *buf; - int size = EXT2_INODE_SIZE(fs->super); + int size = EXT2_INODE_SIZE(fs->super); struct ext2_inode_large *large_inode; if (size == sizeof(struct ext2_inode)) @@ -735,19 +735,19 @@ errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino, *buf = *inode; large_inode = (struct ext2_inode_large *) buf; - large_inode->i_extra_isize = sizeof(struct ext2_inode_large) - + large_inode->i_extra_isize = sizeof(struct ext2_inode_large) - EXT2_GOOD_OLD_INODE_SIZE; return ext2fs_write_inode_full(fs, ino, buf, size); } - + errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks) { struct ext2_inode inode; int i; errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); if (ino > fs->super->s_inodes_count) @@ -769,7 +769,7 @@ errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino) { struct ext2_inode inode; errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); if (ino > fs->super->s_inodes_count) diff --git a/e2fsprogs/ext2fs/inode_io.c b/e2fsprogs/ext2fs/inode_io.c index b5c08b9..deaa955 100644 --- a/e2fsprogs/ext2fs/inode_io.c +++ b/e2fsprogs/ext2fs/inode_io.c @@ -1,6 +1,6 @@ /* * inode_io.c --- This is allows an inode in an ext2 filesystem image - * to be accessed via the I/O manager interface. + * to be accessed via the I/O manager interface. * * Copyright (C) 2002 Theodore Ts'o. * @@ -35,7 +35,7 @@ struct inode_private_data { char name[32]; ext2_file_t file; ext2_filsys fs; - ext2_ino_t ino; + ext2_ino_t ino; struct ext2_inode inode; int flags; struct inode_private_data *next; @@ -75,7 +75,7 @@ errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, char **name) { - struct inode_private_data *data; + struct inode_private_data *data; errcode_t retval; if ((retval = ext2fs_get_mem(sizeof(struct inode_private_data), @@ -150,7 +150,7 @@ static errcode_t inode_open(const char *name, int flags, io_channel *channel) &data->file); if (retval) goto cleanup; - + *channel = io; return 0; @@ -176,7 +176,7 @@ static errcode_t inode_close(io_channel channel) return 0; retval = ext2fs_file_close(data->file); - + ext2fs_free_mem(&channel->private_data); if (channel->name) ext2fs_free_mem(&channel->name); @@ -255,12 +255,12 @@ static errcode_t inode_write_byte(io_channel channel, unsigned long offset, } /* - * Flush data buffers to disk. + * Flush data buffers to disk. */ static errcode_t inode_flush(io_channel channel) { struct inode_private_data *data; - + EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); data = (struct inode_private_data *) channel->private_data; EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL); diff --git a/e2fsprogs/ext2fs/io_manager.c b/e2fsprogs/ext2fs/io_manager.c index e50d7e4..3d0987b 100644 --- a/e2fsprogs/ext2fs/io_manager.c +++ b/e2fsprogs/ext2fs/io_manager.c @@ -61,8 +61,8 @@ errcode_t io_channel_write_byte(io_channel channel, unsigned long offset, { EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); - if (channel->manager->write_byte) - return channel->manager->write_byte(channel, offset, + if (channel->manager->write_byte) + return channel->manager->write_byte(channel, offset, count, data); return EXT2_ET_UNIMPLEMENTED; diff --git a/e2fsprogs/ext2fs/irel.h b/e2fsprogs/ext2fs/irel.h index 9b943ce..45e031b 100644 --- a/e2fsprogs/ext2fs/irel.h +++ b/e2fsprogs/ext2fs/irel.h @@ -1,6 +1,6 @@ /* * irel.h - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * %Begin-Header% diff --git a/e2fsprogs/ext2fs/irel_ma.c b/e2fsprogs/ext2fs/irel_ma.c index eedbe55..d9e73f7 100644 --- a/e2fsprogs/ext2fs/irel_ma.c +++ b/e2fsprogs/ext2fs/irel_ma.c @@ -1,6 +1,6 @@ /* * irel_ma.c - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -64,7 +64,7 @@ errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode, { ext2_irel irel = 0; errcode_t retval; - struct irel_ma *ma = 0; + struct irel_ma *ma = 0; size_t size; *new_irel = 0; @@ -77,18 +77,18 @@ errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode, if (retval) goto errout; memset(irel, 0, sizeof(struct ext2_inode_relocation_table)); - + retval = ext2fs_get_mem(strlen(name)+1, &irel->name); if (retval) goto errout; strcpy(irel->name, name); - + retval = ext2fs_get_mem(sizeof(struct irel_ma), &ma); if (retval) goto errout; memset(ma, 0, sizeof(struct irel_ma)); irel->priv_data = ma; - + size = (size_t) (sizeof(ext2_ino_t) * (max_inode+1)); retval = ext2fs_get_mem(size, &ma->orig_map); if (retval) @@ -124,7 +124,7 @@ errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode, irel->move = ima_move; irel->delete = ima_delete; irel->free = ima_free; - + *new_irel = irel; return 0; @@ -137,7 +137,7 @@ static errcode_t ima_put(ext2_irel irel, ext2_ino_t old, struct ext2_inode_relocate_entry *ent) { struct inode_reference_entry *ref_ent; - struct irel_ma *ma; + struct irel_ma *ma; errcode_t retval; size_t size, old_size; @@ -153,7 +153,7 @@ static errcode_t ima_put(ext2_irel irel, ext2_ino_t old, ent->orig = old; else ent->orig = ma->entries[(unsigned) old].orig; - + /* * If max_refs has changed, reallocate the refs array */ @@ -176,7 +176,7 @@ static errcode_t ima_put(ext2_irel irel, ext2_ino_t old, static errcode_t ima_get(ext2_irel irel, ext2_ino_t old, struct ext2_inode_relocate_entry *ent) { - struct irel_ma *ma; + struct irel_ma *ma; ma = irel->priv_data; if (old > ma->max_inode) @@ -190,7 +190,7 @@ static errcode_t ima_get(ext2_irel irel, ext2_ino_t old, static errcode_t ima_get_by_orig(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old, struct ext2_inode_relocate_entry *ent) { - struct irel_ma *ma; + struct irel_ma *ma; ext2_ino_t ino; ma = irel->priv_data; @@ -213,7 +213,7 @@ static errcode_t ima_start_iter(ext2_irel irel) static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old, struct ext2_inode_relocate_entry *ent) { - struct irel_ma *ma; + struct irel_ma *ma; ma = irel->priv_data; while (++irel->current < ma->max_inode) { @@ -230,7 +230,7 @@ static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old, static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, struct ext2_inode_reference *ref) { - struct irel_ma *ma; + struct irel_ma *ma; size_t size; struct inode_reference_entry *ref_ent; struct ext2_inode_relocate_entry *ent; @@ -242,12 +242,12 @@ static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, ref_ent = ma->ref_entries + (unsigned) ino; ent = ma->entries + (unsigned) ino; - + /* * If the inode reference array doesn't exist, create it. */ if (ref_ent->refs == 0) { - size = (size_t) ((sizeof(struct ext2_inode_reference) * + size = (size_t) ((sizeof(struct ext2_inode_reference) * ent->max_refs)); retval = ext2fs_get_mem(size, &ref_ent->refs); if (retval) @@ -265,7 +265,7 @@ static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino) { - struct irel_ma *ma; + struct irel_ma *ma; ma = irel->priv_data; if (ino > ma->max_inode) @@ -280,11 +280,11 @@ static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino) static errcode_t ima_next_ref(ext2_irel irel, struct ext2_inode_reference *ref) { - struct irel_ma *ma; + struct irel_ma *ma; struct inode_reference_entry *ref_ent; ma = irel->priv_data; - + ref_ent = ma->ref_entries + ma->ref_current; if ((ref_ent->refs == NULL) || @@ -300,19 +300,19 @@ static errcode_t ima_next_ref(ext2_irel irel, static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new) { - struct irel_ma *ma; + struct irel_ma *ma; ma = irel->priv_data; if ((old > ma->max_inode) || (new > ma->max_inode)) return EXT2_ET_INVALID_ARGUMENT; if (ma->entries[(unsigned) old].new == 0) return ENOENT; - + ma->entries[(unsigned) new] = ma->entries[(unsigned) old]; if (ma->ref_entries[(unsigned) new].refs) ext2fs_free_mem(&ma->ref_entries[(unsigned) new].refs); ma->ref_entries[(unsigned) new] = ma->ref_entries[(unsigned) old]; - + ma->entries[(unsigned) old].new = 0; ma->ref_entries[(unsigned) old].num = 0; ma->ref_entries[(unsigned) old].refs = 0; @@ -323,19 +323,19 @@ static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new) static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old) { - struct irel_ma *ma; + struct irel_ma *ma; ma = irel->priv_data; if (old > ma->max_inode) return EXT2_ET_INVALID_ARGUMENT; if (ma->entries[(unsigned) old].new == 0) return ENOENT; - + ma->entries[old].new = 0; if (ma->ref_entries[(unsigned) old].refs) ext2fs_free_mem(&ma->ref_entries[(unsigned) old].refs); ma->orig_map[ma->entries[(unsigned) old].orig] = 0; - + ma->ref_entries[(unsigned) old].num = 0; ma->ref_entries[(unsigned) old].refs = 0; return 0; @@ -343,7 +343,7 @@ static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old) static errcode_t ima_free(ext2_irel irel) { - struct irel_ma *ma; + struct irel_ma *ma; ext2_ino_t ino; if (!irel) diff --git a/e2fsprogs/ext2fs/ismounted.c b/e2fsprogs/ext2fs/ismounted.c index 3f2241d..2395cca 100644 --- a/e2fsprogs/ext2fs/ismounted.c +++ b/e2fsprogs/ext2fs/ismounted.c @@ -1,6 +1,6 @@ /* * ismounted.c --- Check to see if the filesystem was mounted - * + * * Copyright (C) 1995,1996,1997,1998,1999,2000 Theodore Ts'o. * * %Begin-Header% @@ -38,17 +38,17 @@ /* * Helper function which checks a file in /etc/mtab format to see if a * filesystem is mounted. Returns an error if the file doesn't exist - * or can't be opened. + * or can't be opened. */ -static errcode_t check_mntent_file(const char *mtab_file, const char *file, +static errcode_t check_mntent_file(const char *mtab_file, const char *file, int *mount_flags, char *mtpt, int mtlen) { - struct mntent *mnt; + struct mntent *mnt; struct stat st_buf; errcode_t retval = 0; dev_t file_dev=0, file_rdev=0; ino_t file_ino=0; - FILE *f; + FILE *f; int fd; *mount_flags = 0; @@ -103,7 +103,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, } #ifndef __GNU__ /* The GNU hurd is deficient; what else is new? */ /* Validate the entry in case /etc/mtab is out of date */ - /* + /* * We need to be paranoid, because some broken distributions * (read: Slackware) don't initialize /etc/mtab before checking * all of the non-root filesystems on the disk. @@ -128,7 +128,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, } #endif /* __GNU__ */ *mount_flags = EXT2_MF_MOUNTED; - + #ifdef MNTOPT_RO /* Check to see if the ro option is set */ if (hasmntopt(mnt, MNTOPT_RO)) @@ -145,7 +145,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, */ if (!strcmp(mnt->mnt_dir, "/")) { is_root: -#define TEST_FILE "/.ismount-test-file" +#define TEST_FILE "/.ismount-test-file" *mount_flags |= EXT2_MF_ISROOT; fd = open(TEST_FILE, O_RDWR|O_CREAT); if (fd < 0) { @@ -184,7 +184,7 @@ static errcode_t check_mntent(const char *file, int *mount_flags, #endif /* MOUNTED */ retval = check_mntent_file(MOUNTED, file, mount_flags, mtpt, mtlen); return retval; -#else +#else *mount_flags = 0; return 0; #endif /* defined(MOUNTED) || defined(_PATH_MOUNTED) */ @@ -197,31 +197,31 @@ static errcode_t check_getmntinfo(const char *file, int *mount_flags, char *mtpt, int mtlen) { struct statfs *mp; - int len, n; - const char *s1; + int len, n; + const char *s1; char *s2; - n = getmntinfo(&mp, MNT_NOWAIT); - if (n == 0) + n = getmntinfo(&mp, MNT_NOWAIT); + if (n == 0) return errno; - len = sizeof(_PATH_DEV) - 1; - s1 = file; - if (strncmp(_PATH_DEV, s1, len) == 0) - s1 += len; - + len = sizeof(_PATH_DEV) - 1; + s1 = file; + if (strncmp(_PATH_DEV, s1, len) == 0) + s1 += len; + *mount_flags = 0; - while (--n >= 0) { - s2 = mp->f_mntfromname; - if (strncmp(_PATH_DEV, s2, len) == 0) { - s2 += len - 1; - *s2 = 'r'; - } - if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0) { + while (--n >= 0) { + s2 = mp->f_mntfromname; + if (strncmp(_PATH_DEV, s2, len) == 0) { + s2 += len - 1; + *s2 = 'r'; + } + if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0) { *mount_flags = EXT2_MF_MOUNTED; break; } - ++mp; + ++mp; } if (mtpt) strncpy(mtpt, mp->f_mntonname, mtlen); @@ -270,7 +270,7 @@ static int is_swap_device(const char *file) ret++; break; } -#endif /* __GNU__ */ +#endif /* __GNU__ */ } fclose(f); return ret; @@ -296,7 +296,7 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, } #ifdef HAVE_MNTENT_H return check_mntent(device, mount_flags, mtpt, mtlen); -#else +#else #ifdef HAVE_GETMNTINFO return check_getmntinfo(device, mount_flags, mtpt, mtlen); #else @@ -312,7 +312,7 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, /* * ext2fs_check_if_mounted() sets the mount_flags EXT2_MF_MOUNTED, * EXT2_MF_READONLY, and EXT2_MF_ROOT - * + * */ errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags) { @@ -324,7 +324,7 @@ int main(int argc, char **argv) { int retval, mount_flags; char mntpt[80]; - + if (argc < 2) { fprintf(stderr, "Usage: %s device\n", argv[0]); exit(1); @@ -347,12 +347,12 @@ int main(int argc, char **argv) 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 */ diff --git a/e2fsprogs/ext2fs/jfs_dat.h b/e2fsprogs/ext2fs/jfs_dat.h index d6ad9c4..8ec5d38 100644 --- a/e2fsprogs/ext2fs/jfs_dat.h +++ b/e2fsprogs/ext2fs/jfs_dat.h @@ -1,6 +1,6 @@ /* * jfs_dat.h --- stripped down header file which only contains the JFS - * on-disk data structures + * on-disk data structures */ #define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */ @@ -9,7 +9,7 @@ * On-disk structures */ -/* +/* * Descriptor block types: */ @@ -28,8 +28,8 @@ typedef struct journal_header_s } journal_header_t; -/* - * The block tag: used to describe a single buffer in the journal +/* + * The block tag: used to describe a single buffer in the journal */ typedef struct journal_block_tag_s { @@ -55,10 +55,10 @@ typedef struct journal_superblock_s __u32 s_blocksize; /* journal device blocksize */ __u32 s_maxlen; /* total blocks in journal file */ __u32 s_first; /* first block of log information */ - + /* Dynamic information describing the current state of the log */ __u32 s_sequence; /* first commit ID expected in log */ __u32 s_start; /* blocknr of start of log */ - + } journal_superblock_t; diff --git a/e2fsprogs/ext2fs/kernel-jbd.h b/e2fsprogs/ext2fs/kernel-jbd.h index d0efdb3..8a5de5e 100644 --- a/e2fsprogs/ext2fs/kernel-jbd.h +++ b/e2fsprogs/ext2fs/kernel-jbd.h @@ -1,6 +1,6 @@ /* * linux/include/linux/jbd.h - * + * * Written by Stephen C. Tweedie <sct@redhat.com> * * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved @@ -51,7 +51,7 @@ extern int journal_enable_debug; if ((n) <= journal_enable_debug) { \ printk (KERN_DEBUG "(%s, %d): %s: ", \ __FILE__, __LINE__, __FUNCTION__); \ - printk (f, ## a); \ + printk (f, ## a); \ } \ } while (0) #else @@ -59,7 +59,7 @@ extern int journal_enable_debug; #define jbd_debug(f, a...) /**/ #else #define jbd_debug(f, ...) /**/ -#endif +#endif #endif #else #define jbd_debug(x) /* AIX doesn't do STDC */ @@ -88,7 +88,7 @@ typedef struct journal_s journal_t; /* Journal control structure */ * On-disk structures */ -/* +/* * Descriptor block types: */ @@ -109,8 +109,8 @@ typedef struct journal_header_s } journal_header_t; -/* - * The block tag: used to describe a single buffer in the journal +/* + * The block tag: used to describe a single buffer in the journal */ typedef struct journal_block_tag_s { @@ -118,9 +118,9 @@ typedef struct journal_block_tag_s __u32 t_flags; /* See below */ } journal_block_tag_t; -/* +/* * The revoke descriptor: used on disk to describe a series of blocks to - * be revoked from the log + * be revoked from the log */ typedef struct journal_revoke_header_s { @@ -149,7 +149,7 @@ typedef struct journal_superblock_s __u32 s_blocksize; /* journal device blocksize */ __u32 s_maxlen; /* total blocks in journal file */ __u32 s_first; /* first block of log information */ - + /* 0x0018 */ /* Dynamic information describing the current state of the log */ __u32 s_sequence; /* first commit ID expected in log */ @@ -161,17 +161,17 @@ typedef struct journal_superblock_s /* 0x0024 */ /* Remaining fields are only valid in a version-2 superblock */ - __u32 s_feature_compat; /* compatible feature set */ - __u32 s_feature_incompat; /* incompatible feature set */ - __u32 s_feature_ro_compat; /* readonly-compatible feature set */ + __u32 s_feature_compat; /* compatible feature set */ + __u32 s_feature_incompat; /* incompatible feature set */ + __u32 s_feature_ro_compat; /* readonly-compatible feature set */ /* 0x0030 */ __u8 s_uuid[16]; /* 128-bit uuid for journal */ /* 0x0040 */ __u32 s_nr_users; /* Nr of filesystems sharing log */ - + __u32 s_dynsuper; /* Blocknr of dynamic superblock copy*/ - + /* 0x0048 */ __u32 s_max_transaction; /* Limit of journal blocks per trans.*/ __u32 s_max_trans_data; /* Limit of data blocks per trans. */ @@ -276,7 +276,7 @@ struct jbd_revoke_table_s; * the transaction, so that at all times we know how many buffers the * outstanding updates on a transaction might possibly touch. */ -struct handle_s +struct handle_s { /* Which compound transaction is this update a part of? */ transaction_t * h_transaction; @@ -314,14 +314,14 @@ struct handle_s * flushed to home for finished transactions. */ -struct transaction_s +struct transaction_s { /* Pointer to the journal for this transaction. */ journal_t * t_journal; - + /* Sequence number for this transaction */ tid_t t_tid; - + /* Transaction's current state */ enum { T_RUNNING, @@ -329,74 +329,74 @@ struct transaction_s T_RUNDOWN, T_FLUSH, T_COMMIT, - T_FINISHED + T_FINISHED } t_state; /* Where in the log does this transaction's commit start? */ unsigned long t_log_start; - + /* Doubly-linked circular list of all inodes owned by this - transaction */ /* AKPM: unused */ + transaction */ /* AKPM: unused */ struct inode * t_ilist; - + /* Number of buffers on the t_buffers list */ int t_nr_buffers; - + /* Doubly-linked circular list of all buffers reserved but not - yet modified by this transaction */ + yet modified by this transaction */ struct journal_head * t_reserved_list; - + /* Doubly-linked circular list of all metadata buffers owned by this - transaction */ + transaction */ struct journal_head * t_buffers; - + /* * Doubly-linked circular list of all data buffers still to be * flushed before this transaction can be committed. * Protected by journal_datalist_lock. */ struct journal_head * t_sync_datalist; - + /* * Doubly-linked circular list of all writepage data buffers * still to be written before this transaction can be committed. * Protected by journal_datalist_lock. */ struct journal_head * t_async_datalist; - + /* Doubly-linked circular list of all forget buffers (superceded - buffers which we can un-checkpoint once this transaction - commits) */ + buffers which we can un-checkpoint once this transaction + commits) */ struct journal_head * t_forget; - + /* * Doubly-linked circular list of all buffers still to be * flushed before this transaction can be checkpointed. */ /* Protected by journal_datalist_lock */ struct journal_head * t_checkpoint_list; - + /* Doubly-linked circular list of temporary buffers currently - undergoing IO in the log */ + undergoing IO in the log */ struct journal_head * t_iobuf_list; - + /* Doubly-linked circular list of metadata buffers being - shadowed by log IO. The IO buffers on the iobuf list and the - shadow buffers on this list match each other one for one at - all times. */ + shadowed by log IO. The IO buffers on the iobuf list and the + shadow buffers on this list match each other one for one at + all times. */ struct journal_head * t_shadow_list; - + /* Doubly-linked circular list of control buffers being written - to the log. */ + to the log. */ struct journal_head * t_log_list; - + /* Number of outstanding updates running on this transaction */ int t_updates; /* Number of buffers reserved for use by all handles in this * transaction handle but not yet modified. */ int t_outstanding_credits; - + /* * Forward and backward links for the circular list of all * transactions awaiting checkpoint. @@ -415,7 +415,7 @@ struct transaction_s /* The journal_t maintains all of the journaling state information for a * single filesystem. It is linked to from the fs superblock structure. - * + * * We use the journal_t to keep track of all outstanding transaction * activity on the filesystem, and to manage the state of the log * writing process. */ @@ -428,7 +428,7 @@ struct journal_s /* Is there an outstanding uncleared error on the journal (from * a prior abort)? */ int j_errno; - + /* The superblock buffer */ struct buffer_head * j_sb_buffer; journal_superblock_t * j_superblock; @@ -438,49 +438,49 @@ struct journal_s /* Number of processes waiting to create a barrier lock */ int j_barrier_count; - + /* The barrier lock itself */ struct semaphore j_barrier; - + /* Transactions: The current running transaction... */ transaction_t * j_running_transaction; - + /* ... the transaction we are pushing to disk ... */ transaction_t * j_committing_transaction; - + /* ... and a linked circular list of all transactions waiting * for checkpointing. */ /* Protected by journal_datalist_lock */ transaction_t * j_checkpoint_transactions; /* Wait queue for waiting for a locked transaction to start - committing, or for a barrier lock to be released */ + committing, or for a barrier lock to be released */ wait_queue_head_t j_wait_transaction_locked; - + /* Wait queue for waiting for checkpointing to complete */ wait_queue_head_t j_wait_logspace; - + /* Wait queue for waiting for commit to complete */ wait_queue_head_t j_wait_done_commit; - + /* Wait queue to trigger checkpointing */ wait_queue_head_t j_wait_checkpoint; - + /* Wait queue to trigger commit */ wait_queue_head_t j_wait_commit; - + /* Wait queue to wait for updates to complete */ wait_queue_head_t j_wait_updates; /* Semaphore for locking against concurrent checkpoints */ - struct semaphore j_checkpoint_sem; + struct semaphore j_checkpoint_sem; /* The main journal lock, used by lock_journal() */ struct semaphore j_sem; - + /* Journal head: identifies the first unused block in the journal. */ unsigned long j_head; - + /* Journal tail: identifies the oldest still-used block in the * journal. */ unsigned long j_tail; @@ -546,12 +546,12 @@ struct journal_s struct list_head j_all_journals; /* The revoke table: maintains the list of revoked blocks in the - current transaction. */ + current transaction. */ struct jbd_revoke_table_s *j_revoke; }; -/* - * Journal flag definitions +/* + * Journal flag definitions */ #define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ #define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ @@ -559,7 +559,7 @@ struct journal_s #define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */ #define JFS_LOADED 0x010 /* The journal superblock has been loaded */ -/* +/* * Function declarations for the journaling transaction and buffer * management */ @@ -589,7 +589,7 @@ extern void journal_insert_checkpoint(struct journal_head *, transaction_t *); extern void __journal_insert_checkpoint(struct journal_head *,transaction_t *); /* Buffer IO */ -extern int +extern int journal_write_metadata_buffer(transaction_t *transaction, struct journal_head *jh_in, struct journal_head **jh_out, @@ -603,7 +603,7 @@ extern void __wait_on_journal (journal_t *); * * We need to lock the journal during transaction state changes so that * nobody ever tries to take a handle on the running transaction while - * we are in the middle of moving it to the commit phase. + * we are in the middle of moving it to the commit phase. * * Note that the locking is completely interrupt unsafe. We never touch * journal structures from interrupts. @@ -637,7 +637,7 @@ static inline handle_t *journal_current_handle(void) /* The journaling code user interface: * * Create and destroy handles - * Register buffer modifications against the current transaction. + * Register buffer modifications against the current transaction. */ extern handle_t *journal_start(journal_t *, int nblocks); @@ -665,11 +665,11 @@ extern journal_t * journal_init_dev(kdev_t dev, kdev_t fs_dev, int start, int len, int bsize); extern journal_t * journal_init_inode (struct inode *); extern int journal_update_format (journal_t *); -extern int journal_check_used_features +extern int journal_check_used_features (journal_t *, unsigned long, unsigned long, unsigned long); -extern int journal_check_available_features +extern int journal_check_available_features (journal_t *, unsigned long, unsigned long, unsigned long); -extern int journal_set_features +extern int journal_set_features (journal_t *, unsigned long, unsigned long, unsigned long); extern int journal_create (journal_t *); extern int journal_load (journal_t *journal); @@ -747,7 +747,7 @@ do { \ * bit, when set, indicates that we have had a fatal error somewhere, * either inside the journaling layer or indicated to us by the client * (eg. ext3), and that we and should not commit any further - * transactions. + * transactions. */ static inline int is_journal_aborted(journal_t *journal) @@ -770,7 +770,7 @@ static inline void journal_abort_handle(handle_t *handle) /* Not all architectures define BUG() */ #ifndef BUG #define BUG() do { \ - printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ + printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ * ((char *) 0) = 0; \ } while (0) #endif /* BUG */ @@ -826,7 +826,7 @@ extern int journal_blocks_per_page(struct inode *inode); #define BJ_LogCtl 7 /* Buffer contains log descriptors */ #define BJ_Reserved 8 /* Buffer is reserved for access by journal */ #define BJ_Types 9 - + extern int jbd_blocks_per_page(struct inode *inode); #ifdef __KERNEL__ diff --git a/e2fsprogs/ext2fs/kernel-list.h b/e2fsprogs/ext2fs/kernel-list.h index 24e6ab4..fa62ff1 100644 --- a/e2fsprogs/ext2fs/kernel-list.h +++ b/e2fsprogs/ext2fs/kernel-list.h @@ -29,7 +29,7 @@ struct list_head { #endif /* - * Insert a new entry between two known consecutive entries. + * Insert a new entry between two known consecutive entries. * * This is only for internal list manipulation where we know * the prev/next entries already! @@ -107,6 +107,6 @@ static __inline__ void list_splice(struct list_head *list, struct list_head *hea ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) #define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) + for (pos = (head)->next; pos != (head); pos = pos->next) #endif diff --git a/e2fsprogs/ext2fs/link.c b/e2fsprogs/ext2fs/link.c index 5e0f4f3..281ad06 100644 --- a/e2fsprogs/ext2fs/link.c +++ b/e2fsprogs/ext2fs/link.c @@ -1,6 +1,6 @@ /* * link.c --- create links in a ext2fs directory - * + * * Copyright (C) 1993, 1994 Theodore Ts'o. * * %Begin-Header% @@ -25,7 +25,7 @@ struct link_struct { int flags; int done; struct ext2_super_block *sb; -}; +}; static int link_proc(struct ext2_dir_entry *dirent, int offset, @@ -94,7 +94,7 @@ static int link_proc(struct ext2_dir_entry *dirent, #ifdef __TURBOC__ #pragma argsused #endif -errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, +errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, ext2_ino_t ino, int flags) { errcode_t retval; diff --git a/e2fsprogs/ext2fs/lookup.c b/e2fsprogs/ext2fs/lookup.c index 1745f33..9cb97f1 100644 --- a/e2fsprogs/ext2fs/lookup.c +++ b/e2fsprogs/ext2fs/lookup.c @@ -1,6 +1,6 @@ /* * lookup.c --- ext2fs directory lookup operations - * + * * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. * * %Begin-Header% @@ -23,7 +23,7 @@ struct lookup_struct { int len; ext2_ino_t *inode; int found; -}; +}; #ifdef __TURBOC__ #pragma argsused diff --git a/e2fsprogs/ext2fs/mkdir.c b/e2fsprogs/ext2fs/mkdir.c index 81e7aea..bf46e50 100644 --- a/e2fsprogs/ext2fs/mkdir.c +++ b/e2fsprogs/ext2fs/mkdir.c @@ -1,6 +1,6 @@ /* * mkdir.c --- make a directory in the filesystem - * + * * Copyright (C) 1994, 1995 Theodore Ts'o. * * %Begin-Header% @@ -94,7 +94,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, retval = ext2fs_write_dir_block(fs, blk, block); if (retval) goto cleanup; - retval = ext2fs_write_new_inode(fs, ino, &inode); + retval = ext2fs_write_new_inode(fs, ino, &inode); if (retval) goto cleanup; @@ -125,7 +125,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, if (retval) goto cleanup; } - + /* * Update accounting.... */ diff --git a/e2fsprogs/ext2fs/mkjournal.c b/e2fsprogs/ext2fs/mkjournal.c index b748918..0a9ae7a 100644 --- a/e2fsprogs/ext2fs/mkjournal.c +++ b/e2fsprogs/ext2fs/mkjournal.c @@ -2,7 +2,7 @@ * mkjournal.c --- make a journal for a filesystem * * Copyright (C) 2000 Theodore Ts'o. - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -155,7 +155,7 @@ static int mkjournal_proc(ext2_filsys fs, blk_t new_blk; static blk_t last_blk = 0; errcode_t retval; - + if (*blocknr) { last_blk = *blocknr; return 0; @@ -186,7 +186,7 @@ static int mkjournal_proc(ext2_filsys fs, return (BLOCK_CHANGED | BLOCK_ABORT); else return BLOCK_CHANGED; - + } /* @@ -202,7 +202,7 @@ static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino, if ((retval = ext2fs_create_journal_superblock(fs, size, flags, &buf))) return retval; - + if ((retval = ext2fs_read_bitmaps(fs))) return retval; @@ -227,7 +227,7 @@ static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino, if ((retval = ext2fs_read_inode(fs, journal_ino, &inode))) goto errout; - inode.i_size += fs->blocksize * size; + inode.i_size += fs->blocksize * size; inode.i_blocks += (fs->blocksize / 512) * es.newblocks; inode.i_mtime = inode.i_ctime = time(0); inode.i_links_count = 1; @@ -262,7 +262,7 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev) /* Make sure the device exists and is a block device */ if (stat(journal_dev->device_name, &st) < 0) return errno; - + if (!S_ISBLK(st.st_mode)) return EXT2_ET_JOURNAL_NOT_BLOCK; /* Must be a block device */ @@ -297,7 +297,7 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev) /* Writeback the journal superblock */ if ((retval = io_channel_write_blk(journal_dev->io, start, -1024, buf))) return retval; - + fs->super->s_journal_inum = 0; fs->super->s_journal_dev = st.st_rdev; memcpy(fs->super->s_journal_uuid, jsb->s_uuid, @@ -328,7 +328,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) strcat(jfile, "/.journal"); /* - * If .../.journal already exists, make sure any + * If .../.journal already exists, make sure any * immutable or append-only flags are cleared. */ #if defined(HAVE_CHFLAGS) && defined(UF_NODUMP) @@ -350,7 +350,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) if ((retval = write_journal_file(fs, jfile, size, flags))) goto errout; - + /* Get inode number of the journal file */ if (fstat(fd, &st) < 0) goto errout; @@ -365,7 +365,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) #endif if (retval) goto errout; - + close(fd); journal_ino = st.st_ino; } else { @@ -374,7 +374,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) size, flags))) return retval; } - + fs->super->s_journal_inum = journal_ino; fs->super->s_journal_dev = 0; memset(fs->super->s_journal_uuid, 0, @@ -393,14 +393,14 @@ main(int argc, char **argv) { errcode_t retval; char *device_name; - ext2_filsys fs; + ext2_filsys fs; if (argc < 2) { fprintf(stderr, "Usage: %s filesystem\n", argv[0]); exit(1); } device_name = argv[1]; - + retval = ext2fs_open (device_name, EXT2_FLAG_RW, 0, 0, unix_io_manager, &fs); if (retval) { @@ -420,6 +420,6 @@ main(int argc, char **argv) } ext2fs_close(fs); exit(0); - + } #endif diff --git a/e2fsprogs/ext2fs/namei.c b/e2fsprogs/ext2fs/namei.c index 13d13ad..6ce4bb3 100644 --- a/e2fsprogs/ext2fs/namei.c +++ b/e2fsprogs/ext2fs/namei.c @@ -1,6 +1,6 @@ /* * namei.c --- ext2fs directory lookup operations - * + * * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. * * %Begin-Header% @@ -36,7 +36,7 @@ static errcode_t follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, #ifdef NAMEI_DEBUG printf("follow_link: root=%lu, dir=%lu, inode=%lu, lc=%d\n", root, dir, inode, link_count); - + #endif retval = ext2fs_read_inode (fs, inode, &ei); if (retval) return retval; @@ -85,12 +85,12 @@ static errcode_t dir_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, errcode_t retval; if ((c = *pathname) == '/') { - dir = root; + dir = root; pathname++; pathlen--; } while (1) { - thisname = pathname; + thisname = pathname; for (len=0; --pathlen >= 0;len++) { c = *(pathname++); if (c == '/') @@ -100,10 +100,10 @@ static errcode_t dir_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, break; retval = ext2fs_lookup (fs, dir, thisname, len, buf, &inode); if (retval) return retval; - retval = follow_link (fs, root, dir, inode, + retval = follow_link (fs, root, dir, inode, link_count, buf, &dir); - if (retval) return retval; - } + if (retval) return retval; + } *name = thisname; *namelen = len; *res_inode = dir; @@ -152,13 +152,13 @@ errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, { char *buf; errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); retval = ext2fs_get_mem(fs->blocksize, &buf); if (retval) return retval; - + retval = open_namei(fs, root, cwd, name, strlen(name), 0, 0, buf, inode); @@ -171,13 +171,13 @@ errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, { char *buf; errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); retval = ext2fs_get_mem(fs->blocksize, &buf); if (retval) return retval; - + retval = open_namei(fs, root, cwd, name, strlen(name), 1, 0, buf, inode); @@ -190,7 +190,7 @@ errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, { char *buf; errcode_t retval; - + EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); retval = ext2fs_get_mem(fs->blocksize, &buf); diff --git a/e2fsprogs/ext2fs/newdir.c b/e2fsprogs/ext2fs/newdir.c index 3904d91..27c718e 100644 --- a/e2fsprogs/ext2fs/newdir.c +++ b/e2fsprogs/ext2fs/newdir.c @@ -1,6 +1,6 @@ /* * newdir.c --- create a new directory block - * + * * Copyright (C) 1994, 1995 Theodore Ts'o. * * %Begin-Header% @@ -28,7 +28,7 @@ errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, ext2_ino_t parent_ino, char **block) { - struct ext2_dir_entry *dir = NULL; + struct ext2_dir_entry *dir = NULL; errcode_t retval; char *buf; int rec_len; @@ -65,7 +65,7 @@ errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, dir->name_len = 2 | filetype; dir->name[0] = '.'; dir->name[1] = '.'; - + } *block = buf; return 0; diff --git a/e2fsprogs/ext2fs/openfs.c b/e2fsprogs/ext2fs/openfs.c index e8f1649..aa60333 100644 --- a/e2fsprogs/ext2fs/openfs.c +++ b/e2fsprogs/ext2fs/openfs.c @@ -1,8 +1,8 @@ /* * openfs.c --- open an ext2 filesystem - * + * * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. @@ -42,7 +42,7 @@ blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i) bg = (fs->blocksize / sizeof (struct ext2_group_desc)) * i; if (ext2fs_bg_has_super(fs, bg)) has_super = 1; - ret_blk = (fs->super->s_first_data_block + has_super + + ret_blk = (fs->super->s_first_data_block + has_super + (bg * fs->super->s_blocks_per_group)); /* * If group_block is not the normal value, we're trying to use @@ -60,27 +60,27 @@ blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i) } errcode_t ext2fs_open(const char *name, int flags, int superblock, - unsigned int block_size, io_manager manager, + unsigned int block_size, io_manager manager, ext2_filsys *ret_fs) { - return ext2fs_open2(name, 0, flags, superblock, block_size, + return ext2fs_open2(name, 0, flags, superblock, block_size, manager, ret_fs); } /* * Note: if superblock is non-zero, block-size must also be non-zero. - * Superblock and block_size can be zero to use the default size. + * Superblock and block_size can be zero to use the default size. * * Valid flags for ext2fs_open() - * - * EXT2_FLAG_RW - Open the filesystem for read/write. - * EXT2_FLAG_FORCE - Open the filesystem even if some of the + * + * EXT2_FLAG_RW - Open the filesystem for read/write. + * EXT2_FLAG_FORCE - Open the filesystem even if some of the * features aren't supported. * EXT2_FLAG_JOURNAL_DEV_OK - Open an ext3 journal device */ errcode_t ext2fs_open2(const char *name, const char *io_options, int flags, int superblock, - unsigned int block_size, io_manager manager, + unsigned int block_size, io_manager manager, ext2_filsys *ret_fs) { ext2_filsys fs; @@ -93,13 +93,13 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, int j; struct ext2_group_desc *gdp; #endif - + EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER); retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); if (retval) return retval; - + memset(fs, 0, sizeof(struct struct_ext2_filsys)); fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; fs->flags = flags; @@ -113,13 +113,13 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, *cp++ = 0; io_options = cp; } - - retval = manager->open(fs->device_name, + + retval = manager->open(fs->device_name, (flags & EXT2_FLAG_RW) ? IO_FLAG_RW : 0, &fs->io); if (retval) goto cleanup; - if (io_options && + if (io_options && (retval = io_channel_set_options(fs->io, io_options))) goto cleanup; fs->image_io = fs->io; @@ -183,7 +183,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, ext2fs_swap_super(fs->super); } #endif - + if (fs->super->s_magic != EXT2_SUPER_MAGIC) { retval = EXT2_ET_BAD_MAGIC; goto cleanup; @@ -215,7 +215,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, goto cleanup; } } - + fs->blocksize = EXT2_BLOCK_SIZE(fs->super); if (fs->blocksize == 0) { retval = EXT2_ET_CORRUPT_SUPERBLOCK; @@ -247,7 +247,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, *ret_fs = fs; return 0; } - + /* * Read group descriptors */ @@ -296,7 +296,7 @@ cleanup: /* * Set/get the filesystem data I/O channel. - * + * * These functions are only valid if EXT2_FLAG_IMAGE_FILE is true. */ errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io) @@ -322,7 +322,7 @@ errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io) if ((fs->flags & EXT2_FLAG_IMAGE_FILE) == 0) return EXT2_ET_NOT_IMAGE_FILE; fs->io = fs->image_io = new_io; - fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_RW | + fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_RW | EXT2_FLAG_BB_DIRTY | EXT2_FLAG_IB_DIRTY; fs->flags &= ~EXT2_FLAG_IMAGE_FILE; return 0; diff --git a/e2fsprogs/ext2fs/read_bb.c b/e2fsprogs/ext2fs/read_bb.c index c717adc..226c537 100644 --- a/e2fsprogs/ext2fs/read_bb.c +++ b/e2fsprogs/ext2fs/read_bb.c @@ -38,16 +38,16 @@ struct read_bb_record { #pragma argsused #endif static int mark_bad_block(ext2_filsys fs, blk_t *block_nr, - e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), + e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), blk_t ref_block EXT2FS_ATTR((unused)), - int ref_offset EXT2FS_ATTR((unused)), + int ref_offset EXT2FS_ATTR((unused)), void *priv_data) { struct read_bb_record *rb = (struct read_bb_record *) priv_data; - + if (blockcnt < 0) return 0; - + if ((*block_nr < fs->super->s_first_data_block) || (*block_nr >= fs->super->s_blocks_count)) return 0; /* Ignore illegal blocks */ diff --git a/e2fsprogs/ext2fs/read_bb_file.c b/e2fsprogs/ext2fs/read_bb_file.c index 40c34ee..f7851f1 100644 --- a/e2fsprogs/ext2fs/read_bb_file.c +++ b/e2fsprogs/ext2fs/read_bb_file.c @@ -29,7 +29,7 @@ /* * Reads a list of bad blocks from a FILE * */ -errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, +errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, ext2_badblocks_list *bb_list, void *priv_data, void (*invalid)(ext2_filsys fs, @@ -72,7 +72,7 @@ errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, } static void call_compat_invalid(ext2_filsys fs, blk_t blk, - char *badstr EXT2FS_ATTR((unused)), + char *badstr EXT2FS_ATTR((unused)), void *priv_data) { void (*invalid)(ext2_filsys, blk_t); @@ -86,7 +86,7 @@ static void call_compat_invalid(ext2_filsys fs, blk_t blk, /* * Reads a list of bad blocks from a FILE * */ -errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, +errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, ext2_badblocks_list *bb_list, void (*invalid)(ext2_filsys fs, blk_t blk)) { diff --git a/e2fsprogs/ext2fs/rs_bitmap.c b/e2fsprogs/ext2fs/rs_bitmap.c index 46653f0..c2e51e0 100644 --- a/e2fsprogs/ext2fs/rs_bitmap.c +++ b/e2fsprogs/ext2fs/rs_bitmap.c @@ -53,7 +53,7 @@ errcode_t ext2fs_resize_generic_bitmap(__u32 new_end, __u32 new_real_end, bmap->end = new_end; return 0; } - + size = ((bmap->real_end - bmap->start) / 8) + 1; new_size = ((new_real_end - bmap->start) / 8) + 1; @@ -74,7 +74,7 @@ errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end, ext2fs_inode_bitmap bmap) { errcode_t retval; - + if (!bmap) return EXT2_ET_INVALID_ARGUMENT; @@ -91,7 +91,7 @@ errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end, ext2fs_block_bitmap bmap) { errcode_t retval; - + if (!bmap) return EXT2_ET_INVALID_ARGUMENT; diff --git a/e2fsprogs/ext2fs/rw_bitmaps.c b/e2fsprogs/ext2fs/rw_bitmaps.c index b67a925..ae7b6e0 100644 --- a/e2fsprogs/ext2fs/rw_bitmaps.c +++ b/e2fsprogs/ext2fs/rw_bitmaps.c @@ -45,7 +45,7 @@ static void ext2fs_swap_bitmap(ext2_filsys fs, char *bitmap, int nbytes) { __u32 *p = (__u32 *) bitmap; int n; - + for (n = nbytes / sizeof(__u32); n > 0; --n, ++p) *p = ext2fs_swab32(*p); } @@ -53,7 +53,7 @@ static void ext2fs_swap_bitmap(ext2_filsys fs, char *bitmap, int nbytes) errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) { - dgrp_t i; + dgrp_t i; size_t nbytes; errcode_t retval; char * inode_bitmap = fs->inode_map->bitmap; @@ -67,7 +67,7 @@ errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) if (!inode_bitmap) return 0; nbytes = (size_t) ((EXT2_INODES_PER_GROUP(fs->super)+7) / 8); - + retval = ext2fs_get_mem(fs->blocksize, &bitmap_block); if (retval) return retval; @@ -95,7 +95,7 @@ errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) errcode_t ext2fs_write_block_bitmap (ext2_filsys fs) { - dgrp_t i; + dgrp_t i; unsigned int j; int nbytes; unsigned int nbits; @@ -195,7 +195,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block) if (block_bitmap) { blk = (fs->image_header->offset_blockmap / fs->blocksize); - retval = io_channel_read_blk(fs->image_io, blk, + retval = io_channel_read_blk(fs->image_io, blk, -(block_nbytes * fs->group_desc_count), block_bitmap); if (retval) @@ -243,7 +243,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block) } } return 0; - + cleanup: if (do_block) { ext2fs_free_mem(&fs->block_map); @@ -296,5 +296,5 @@ errcode_t ext2fs_write_bitmaps(ext2_filsys fs) return retval; } return 0; -} +} diff --git a/e2fsprogs/ext2fs/swapfs.c b/e2fsprogs/ext2fs/swapfs.c index 8a08995..af8b6eb 100644 --- a/e2fsprogs/ext2fs/swapfs.c +++ b/e2fsprogs/ext2fs/swapfs.c @@ -1,6 +1,6 @@ /* * swapfs.c --- swap ext2 filesystem data structures - * + * * Copyright (C) 1995, 1996, 2002 Theodore Ts'o. * * %Begin-Header% @@ -23,7 +23,7 @@ #ifdef EXT2FS_ENABLE_SWAPFS void ext2fs_swap_super(struct ext2_super_block * sb) { - int i; + int i; sb->s_inodes_count = ext2fs_swab32(sb->s_inodes_count); sb->s_blocks_count = ext2fs_swab32(sb->s_blocks_count); sb->s_r_blocks_count = ext2fs_swab32(sb->s_r_blocks_count); @@ -108,11 +108,11 @@ void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, int has_header) } while ((char *)from_entry < from_end && *(__u32 *)from_entry) { - to_entry->e_value_offs = + to_entry->e_value_offs = ext2fs_swab16(from_entry->e_value_offs); - to_entry->e_value_block = + to_entry->e_value_block = ext2fs_swab32(from_entry->e_value_block); - to_entry->e_value_size = + to_entry->e_value_size = ext2fs_swab32(from_entry->e_value_size); from_entry = EXT2_EXT_ATTR_NEXT(from_entry); to_entry = EXT2_EXT_ATTR_NEXT(to_entry); diff --git a/e2fsprogs/ext2fs/test_io.c b/e2fsprogs/ext2fs/test_io.c index 6a3b248..d4b3653 100644 --- a/e2fsprogs/ext2fs/test_io.c +++ b/e2fsprogs/ext2fs/test_io.c @@ -32,7 +32,7 @@ #define EXT2_CHECK_MAGIC(struct, code) \ if ((struct)->magic != (code)) return (code) - + struct test_private_data { int magic; io_channel real; @@ -56,7 +56,7 @@ static errcode_t test_write_blk(io_channel channel, unsigned long block, static errcode_t test_flush(io_channel channel); static errcode_t test_write_byte(io_channel channel, unsigned long offset, int count, const void *buf); -static errcode_t test_set_option(io_channel channel, const char *option, +static errcode_t test_set_option(io_channel channel, const char *option, const char *arg); static struct struct_io_manager struct_test_manager = { @@ -172,10 +172,10 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) goto cleanup; } else data->real = 0; - data->read_blk = test_io_cb_read_blk; - data->write_blk = test_io_cb_write_blk; - data->set_blksize = test_io_cb_set_blksize; - data->write_byte = test_io_cb_write_byte; + data->read_blk = test_io_cb_read_blk; + data->write_blk = test_io_cb_write_blk; + data->set_blksize = test_io_cb_set_blksize; + data->write_byte = test_io_cb_write_byte; data->outfile = NULL; if ((value = getenv("TEST_IO_LOGFILE")) != NULL) @@ -186,7 +186,7 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) data->flags = 0; if ((value = getenv("TEST_IO_FLAGS")) != NULL) data->flags = strtoul(value, NULL, 0); - + data->block = 0; if ((value = getenv("TEST_IO_BLOCK")) != NULL) data->block = strtoul(value, NULL, 0); @@ -198,7 +198,7 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) data->write_abort_count = 0; if ((value = getenv("TEST_IO_WRITE_ABORT")) != NULL) data->write_abort_count = strtoul(value, NULL, 0); - + *channel = io; return 0; @@ -221,13 +221,13 @@ static errcode_t test_close(io_channel channel) if (--channel->refcount > 0) return 0; - + if (data->real) retval = io_channel_close(data->real); if (data->outfile && data->outfile != stderr) fclose(data->outfile); - + ext2fs_free_mem(&channel->private_data); if (channel->name) ext2fs_free_mem(&channel->name); @@ -280,7 +280,7 @@ static errcode_t test_read_blk(io_channel channel, unsigned long block, test_dump_block(channel, data, block, buf); if (--data->read_abort_count == 0) test_abort(channel, block); - } + } return retval; } @@ -339,22 +339,22 @@ static errcode_t test_flush(io_channel channel) { struct test_private_data *data; errcode_t retval = 0; - + EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); data = (struct test_private_data *) channel->private_data; EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL); if (data->real) retval = io_channel_flush(data->real); - + if (data->flags & TEST_FLAG_FLUSH) fprintf(data->outfile, "Test_io: flush() returned %s\n", retval ? error_message(retval) : "OK"); - + return retval; } -static errcode_t test_set_option(io_channel channel, const char *option, +static errcode_t test_set_option(io_channel channel, const char *option, const char *arg) { struct test_private_data *data; @@ -366,10 +366,10 @@ static errcode_t test_set_option(io_channel channel, const char *option, if (data->flags & TEST_FLAG_SET_OPTION) - fprintf(data->outfile, "Test_io: set_option(%s, %s) ", + fprintf(data->outfile, "Test_io: set_option(%s, %s) ", option, arg); if (data->real && data->real->manager->set_option) { - retval = (data->real->manager->set_option)(data->real, + retval = (data->real->manager->set_option)(data->real, option, arg); if (data->flags & TEST_FLAG_SET_OPTION) fprintf(data->outfile, "returned %s\n", diff --git a/e2fsprogs/ext2fs/unix_io.c b/e2fsprogs/ext2fs/unix_io.c index 5bc7a6a..36b2225 100644 --- a/e2fsprogs/ext2fs/unix_io.c +++ b/e2fsprogs/ext2fs/unix_io.c @@ -1,13 +1,13 @@ /* * unix_io.c --- This is the Unix (well, really POSIX) implementation - * of the I/O manager. + * of the I/O manager. * * Implements a one-block write-through cache. * - * Includes support for Windows NT support under Cygwin. + * Includes support for Windows NT support under Cygwin. * * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - * 2002 by Theodore Ts'o. + * 2002 by Theodore Ts'o. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public @@ -79,7 +79,7 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block, static errcode_t unix_flush(io_channel channel); static errcode_t unix_write_byte(io_channel channel, unsigned long offset, int size, const void *data); -static errcode_t unix_set_option(io_channel channel, const char *option, +static errcode_t unix_set_option(io_channel channel, const char *option, const char *arg); static void reuse_cache(io_channel channel, struct unix_private_data *data, @@ -140,7 +140,7 @@ static errcode_t raw_read_blk(io_channel channel, goto error_out; } return 0; - + error_out: memset((char *) buf+actual, 0, size-actual); if (channel->read_error) @@ -168,7 +168,7 @@ static errcode_t raw_read_blk(io_channel channel, location = ((ext2_loff_t) block * channel->block_size) + data->offset; #ifdef DEBUG printf("count=%d, size=%d, block=%d, blk_size=%d, location=%lx\n", - count, size, block, channel->block_size, location); + count, size, block, channel->block_size, location); #endif if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) { retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; @@ -227,14 +227,14 @@ static errcode_t raw_write_blk(io_channel channel, retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; goto error_out; } - + actual = write(data->dev, buf, size); if (actual != size) { retval = EXT2_ET_SHORT_WRITE; goto error_out; } return 0; - + error_out: if (channel->write_error) retval = (channel->write_error)(channel, block, count, buf, @@ -254,7 +254,7 @@ static errcode_t alloc_cache(io_channel channel, errcode_t retval; struct unix_cache *cache; int i; - + data->access_time = 0; for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { cache->block = 0; @@ -273,7 +273,7 @@ static void free_cache(struct unix_private_data *data) { struct unix_cache *cache; int i; - + data->access_time = 0; for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { cache->block = 0; @@ -298,7 +298,7 @@ static struct unix_cache *find_cached_block(struct unix_private_data *data, { struct unix_cache *cache, *unused_cache, *oldest_cache; int i; - + unused_cache = oldest_cache = 0; for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { if (!cache->in_use) { @@ -345,18 +345,18 @@ static errcode_t flush_cached_blocks(io_channel channel, struct unix_cache *cache; errcode_t retval, retval2; int i; - + retval2 = 0; for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { if (!cache->in_use) continue; - + if (invalidate) cache->in_use = 0; - + if (!cache->dirty) continue; - + retval = raw_write_blk(channel, data, cache->block, 1, cache->buf); if (retval) @@ -376,7 +376,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) int open_flags; struct stat st; #ifdef __linux__ - struct utsname ut; + struct utsname ut; #endif if (name == 0) @@ -431,7 +431,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) * block devices are wrongly getting hit by the filesize * limit. This workaround isn't perfect, since it won't work * if glibc wasn't built against 2.2 header files. (Sigh.) - * + * */ if ((flags & IO_FLAG_RW) && (uname(&ut) == 0) && @@ -442,7 +442,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) (fstat(data->dev, &st) == 0) && (S_ISBLK(st.st_mode))) { struct rlimit rlim; - + rlim.rlim_cur = rlim.rlim_max = (unsigned long) RLIM_INFINITY; setrlimit(RLIMIT_FSIZE, &rlim); getrlimit(RLIMIT_FSIZE, &rlim); @@ -507,7 +507,7 @@ static errcode_t unix_set_blksize(io_channel channel, int blksize) if ((retval = flush_cached_blocks(channel, data, 0))) return retval; #endif - + channel->block_size = blksize; free_cache(data); if ((retval = alloc_cache(channel, data))) @@ -568,7 +568,7 @@ static errcode_t unix_read_blk(io_channel channel, unsigned long block, #endif if ((retval = raw_read_blk(channel, data, block, i, cp))) return retval; - + /* Save the results in the cache */ for (j=0; j < i; j++) { count--; @@ -597,7 +597,7 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block, #ifdef NO_IO_CACHE return raw_write_blk(channel, data, block, count, buf); -#else +#else /* * If we're doing an odd-sized write or a very large write, * flush out the cache completely and then do a direct write. @@ -616,7 +616,7 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block, writethrough = channel->flags & CHANNEL_FLAGS_WRITETHROUGH; if (writethrough) retval = raw_write_blk(channel, data, block, count, buf); - + cp = buf; while (count > 0) { cache = find_cached_block(data, block, &reuse); @@ -655,7 +655,7 @@ static errcode_t unix_write_byte(io_channel channel, unsigned long offset, if (lseek(data->dev, offset + data->offset, SEEK_SET) < 0) return errno; - + actual = write(data->dev, buf, size); if (actual != size) return EXT2_ET_SHORT_WRITE; @@ -664,13 +664,13 @@ static errcode_t unix_write_byte(io_channel channel, unsigned long offset, } /* - * Flush data buffers to disk. + * Flush data buffers to disk. */ static errcode_t unix_flush(io_channel channel) { struct unix_private_data *data; errcode_t retval = 0; - + EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); data = (struct unix_private_data *) channel->private_data; EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL); @@ -682,7 +682,7 @@ static errcode_t unix_flush(io_channel channel) return retval; } -static errcode_t unix_set_option(io_channel channel, const char *option, +static errcode_t unix_set_option(io_channel channel, const char *option, const char *arg) { struct unix_private_data *data; diff --git a/e2fsprogs/ext2fs/unlink.c b/e2fsprogs/ext2fs/unlink.c index e7b2182..a6ab53a 100644 --- a/e2fsprogs/ext2fs/unlink.c +++ b/e2fsprogs/ext2fs/unlink.c @@ -1,6 +1,6 @@ /* * unlink.c --- delete links in a ext2fs directory - * + * * Copyright (C) 1993, 1994, 1997 Theodore Ts'o. * * %Begin-Header% @@ -25,7 +25,7 @@ struct link_struct { int flags; struct ext2_dir_entry *prev; int done; -}; +}; #ifdef __TURBOC__ #pragma argsused @@ -56,7 +56,7 @@ static int unlink_proc(struct ext2_dir_entry *dirent, return 0; } - if (prev) + if (prev) prev->rec_len += dirent->rec_len; else dirent->inode = 0; @@ -89,7 +89,7 @@ errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, ls.done = 0; ls.prev = 0; - retval = ext2fs_dir_iterate(fs, dir, DIRENT_FLAG_INCLUDE_EMPTY, + retval = ext2fs_dir_iterate(fs, dir, DIRENT_FLAG_INCLUDE_EMPTY, 0, unlink_proc, &ls); if (retval) return retval; diff --git a/e2fsprogs/ext2fs/valid_blk.c b/e2fsprogs/ext2fs/valid_blk.c index 29ff27a..d0367e7 100644 --- a/e2fsprogs/ext2fs/valid_blk.c +++ b/e2fsprogs/ext2fs/valid_blk.c @@ -2,12 +2,12 @@ * valid_blk.c --- does the inode have valid blocks? * * Copyright 1997 by Theodore Ts'o - * + * * %Begin-Header% * This file may be redistributed under the terms of the GNU Public * License. * %End-Header% - * + * */ #include <stdio.h> @@ -33,7 +33,7 @@ int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode) if (!LINUX_S_ISDIR(inode->i_mode) && !LINUX_S_ISREG(inode->i_mode) && !LINUX_S_ISLNK(inode->i_mode)) return 0; - + /* * If the symbolic link is a "fast symlink", then the symlink * target is stored in the block entries. diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index 848d559..af76c4d 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c @@ -104,10 +104,10 @@ struct fsck_instance { * assure that we only fsck one partition on a particular drive at any * one time. Otherwise, the disk heads will be seeking all over the * place. If the base device can not be determined, return NULL. - * + * * The base_device() function returns an allocated string which must * be freed. - * + * */ diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c index e25f36d..b5ec8ab 100644 --- a/e2fsprogs/lsattr.c +++ b/e2fsprogs/lsattr.c @@ -97,8 +97,8 @@ static void lsattr_args(const char *name) } } -static int lsattr_dir_proc(const char *dir_name, struct dirent *de, - void *private EXT2FS_ATTR((unused))) +static int lsattr_dir_proc(const char *dir_name, struct dirent *de, + void *private EXT2FS_ATTR((unused))) { STRUCT_STAT st; char *path; diff --git a/e2fsprogs/mke2fs.c b/e2fsprogs/mke2fs.c index 9c4f1c4..10563e2 100644 --- a/e2fsprogs/mke2fs.c +++ b/e2fsprogs/mke2fs.c @@ -107,9 +107,9 @@ static const struct mke2fs_defaults settings[] = { { default_str, 3, 1024, 8192 }, { "journal", 0, 4096, 8192 }, { "news", 0, 4096, 4096 }, - { "largefile", 0, 4096, 1024 * 1024 }, + { "largefile", 0, 4096, 1024 * 1024 }, { "largefile4", 0, 4096, 4096 * 1024 }, - { 0, 0, 0, 0}, + { 0, 0, 0, 0}, }; static void set_fs_defaults(const char *fs_type, @@ -448,7 +448,7 @@ static void write_inode_tables(ext2_filsys fs) num = fs->inode_blocks_per_group; retval = zero_blocks(fs, blk, num, 0, &blk, &num); - mke2fs_error_msg_and_die(retval, + mke2fs_error_msg_and_die(retval, "write %d blocks in inode table starting at %d.", num, blk); if (sync_kludge) { @@ -572,7 +572,7 @@ static void zap_sector(ext2_filsys fs, int sect, int nsect) static void create_journal_dev(ext2_filsys fs) { - struct progress_struct progress; + struct progress_struct progress; errcode_t retval; char *buf; char *fmt = "%s journal superblock"; @@ -624,7 +624,7 @@ static void show_stats(ext2_filsys fs) os, fs->blocksize, s->s_log_block_size, fs->fragsize, s->s_log_frag_size, - s->s_inodes_count, s->s_blocks_count, + s->s_inodes_count, s->s_blocks_count, s->s_r_blocks_count, 100.0 * s->s_r_blocks_count / s->s_blocks_count, s->s_first_data_block); free(os); @@ -679,7 +679,7 @@ static int set_os(struct ext2_super_block *sb, char *os) if((sb->s_creator_os = e2p_string2os(os)) >= 0) { return 1; } else if (!strcasecmp("GNU", os)) { - sb->s_creator_os = EXT2_OS_HURD; + sb->s_creator_os = EXT2_OS_HURD; return 1; } return 0; @@ -842,7 +842,7 @@ static int PRS(int argc, char *argv[]) #endif /* If called as mkfs.ext3, create a journal inode */ - if (last_char_is(bb_applet_name, '3')) + if (last_char_is(bb_applet_name, '3')) journal_size = -1; while ((c = getopt (argc, argv, @@ -886,8 +886,8 @@ BLOCKSIZE_ERROR: } break; case 'i': - if (safe_strtoi(optarg, &inode_ratio) - || inode_ratio < EXT2_MIN_BLOCK_SIZE + if (safe_strtoi(optarg, &inode_ratio) + || inode_ratio < EXT2_MIN_BLOCK_SIZE || inode_ratio > EXT2_MAX_BLOCK_SIZE * 1024) { bb_error_msg_and_die("bad inode ratio %s (min %d/max %d)", optarg, EXT2_MIN_BLOCK_SIZE, diff --git a/e2fsprogs/tune2fs.c b/e2fsprogs/tune2fs.c index f23688b..f228c56 100644 --- a/e2fsprogs/tune2fs.c +++ b/e2fsprogs/tune2fs.c @@ -163,7 +163,7 @@ no_valid_journal: /* Helper function for remove_journal_inode */ static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr, - int blockcnt EXT2FS_ATTR((unused)), + int blockcnt EXT2FS_ATTR((unused)), void *private EXT2FS_ATTR((unused))) { blk_t block; @@ -187,9 +187,9 @@ static void remove_journal_inode(ext2_filsys fs) ino_t ino = fs->super->s_journal_inum; char *msg = "to read"; char *s = "journal inode"; - + retval = ext2fs_read_inode(fs, ino, &inode); - if (retval) + if (retval) goto REMOVE_JOURNAL_INODE_ERROR; if (ino == EXT2_JOURNAL_INO) { retval = ext2fs_read_bitmaps(fs); @@ -343,13 +343,13 @@ static void add_journal(ext2_filsys fs) return; } -/* +/* * Busybox stuff */ static char * x_blkid_get_devname(const char *token) { char * dev_name; - + if (!(dev_name = blkid_get_devname(NULL, token, NULL))) bb_error_msg_and_die("Unable to resolve '%s'", token); return dev_name; @@ -368,11 +368,11 @@ static void parse_e2label_options(int argc, char ** argv) open_flag = EXT2_FLAG_RW | EXT2_FLAG_JOURNAL_DEV_OK; L_flag = 1; new_label = argv[2]; - } else + } else print_label++; } #else -#define parse_e2label_options(x,y) +#define parse_e2label_options(x,y) #endif static time_t parse_time(char *str) @@ -516,7 +516,7 @@ MOUNTS_COUNT_ERROR: mntopts_cmd = optarg; open_flag = EXT2_FLAG_RW; break; - + case 'O': if (features_cmd) { bb_error_msg_and_die("-O may only be specified once"); @@ -594,7 +594,7 @@ int tune2fs_main(int argc, char **argv) if (ENABLE_FEATURE_CLEAN_UP) atexit(clean_up); - + if (ENABLE_FINDFS && (bb_applet_name[0] == 'f')) /* findfs */ do_findfs(argc, argv); /* no return */ else if (ENABLE_E2LABEL && (bb_applet_name[0] == 'e')) /* e2label */ @@ -603,7 +603,7 @@ int tune2fs_main(int argc, char **argv) parse_tune2fs_options(argc, argv); /* tune2fs */ io_ptr = unix_io_manager; - retval = ext2fs_open2(device_name, io_options, open_flag, + retval = ext2fs_open2(device_name, io_options, open_flag, 0, 0, io_ptr, &fs); if (retval) bb_error_msg_and_die("No valid superblock on %s", device_name); diff --git a/e2fsprogs/util.c b/e2fsprogs/util.c index 7e9c092..3902f7e 100644 --- a/e2fsprogs/util.c +++ b/e2fsprogs/util.c @@ -1,6 +1,6 @@ /* * util.c --- helper functions used by tune2fs and mke2fs - * + * * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o. * * %Begin-Header% @@ -99,8 +99,8 @@ void check_mount(const char *device, int force, const char *type) bb_error_msg_and_die("will not make a %s here!", type); } -void parse_journal_opts(char **journal_device, int *journal_flags, - int *journal_size, const char *opts) +void parse_journal_opts(char **journal_device, int *journal_flags, + int *journal_size, const char *opts) { char *buf, *token, *next, *p, *arg; int journal_usage = 0; @@ -118,7 +118,7 @@ void parse_journal_opts(char **journal_device, int *journal_flags, if (p) { *p = 0; next = p+1; - } + } arg = strchr(token, '='); if (arg) { *arg = 0; @@ -155,13 +155,13 @@ void parse_journal_opts(char **journal_device, int *journal_flags, "\tdevice=<journal device>\n\n" "The journal size must be between " "1024 and 102400 filesystem blocks.\n\n"); -} +} /* * Determine the number of journal blocks to use, either via * user-specified # of megabytes, or via some intelligently selected * defaults. - * + * * Find a reasonable journal file size (in blocks) given the number of blocks * in the filesystem. For very small filesystems, it is not reasonable to * have a journal that fills more than half of the filesystem. @@ -214,8 +214,8 @@ void make_journal_device(char *journal_device, ext2_filsys fs, int quiet, int fo io_manager io_ptr; check_plausibility(journal_device, force); - check_mount(journal_device, force, "journal"); - io_ptr = unix_io_manager; + check_mount(journal_device, force, "journal"); + io_ptr = unix_io_manager; retval = ext2fs_open(journal_device, EXT2_FLAG_RW| EXT2_FLAG_JOURNAL_DEV_OK, 0, fs->blocksize, io_ptr, &jfs); @@ -236,7 +236,7 @@ void make_journal_blocks(ext2_filsys fs, int journal_size, int journal_flags, in { unsigned long journal_blocks; errcode_t retval; - + journal_blocks = figure_journal_size(journal_size, fs); if (!journal_blocks) { fs->super->s_feature_compat &= @@ -259,9 +259,9 @@ char *e2fs_set_sbin_path(void) char *oldpath = getenv("PATH"); /* Update our PATH to include /sbin */ #define PATH_SET "/sbin" - if (oldpath) + if (oldpath) oldpath = bb_xasprintf("%s:%s", PATH_SET, oldpath); - else + else oldpath = PATH_SET; putenv (oldpath); return oldpath; diff --git a/e2fsprogs/util.h b/e2fsprogs/util.h index 24d5e65..5041046 100644 --- a/e2fsprogs/util.h +++ b/e2fsprogs/util.h @@ -1,7 +1,7 @@ /* * util.h --- header file defining prototypes for helper functions * used by tune2fs and mke2fs - * + * * Copyright 2000 by Theodore Ts'o. * * %Begin-Header% diff --git a/e2fsprogs/uuid/compare.c b/e2fsprogs/uuid/compare.c index 83afeaf..94c32b1 100644 --- a/e2fsprogs/uuid/compare.c +++ b/e2fsprogs/uuid/compare.c @@ -2,7 +2,7 @@ * compare.c --- compare whether or not two UUID's are the same * * Returns 0 if the two UUID's are different, and 1 if they are the same. - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -18,7 +18,7 @@ * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF diff --git a/e2fsprogs/uuid/gen_uuid.c b/e2fsprogs/uuid/gen_uuid.c index 52328cf..fca3ebe 100644 --- a/e2fsprogs/uuid/gen_uuid.c +++ b/e2fsprogs/uuid/gen_uuid.c @@ -16,7 +16,7 @@ * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF @@ -63,8 +63,8 @@ #include "uuidP.h" #ifdef HAVE_SRANDOM -#define srand(x) srandom(x) -#define rand() random() +#define srand(x) srandom(x) +#define rand() random() #endif static int get_random_fd(void) @@ -111,7 +111,7 @@ static void get_random_bytes(void *buf, int nbytes) lose_counter = 0; } } - + /* * We do this all the time, but this is the only source of * randomness if /dev/random/urandom is out to lunch. @@ -127,12 +127,12 @@ static void get_random_bytes(void *buf, int nbytes) static int get_node_id(unsigned char *node_id) { #ifdef HAVE_NET_IF_H - int sd; - struct ifreq ifr, *ifrp; - struct ifconf ifc; + int sd; + struct ifreq ifr, *ifrp; + struct ifconf ifc; char buf[1024]; int n, i; - unsigned char *a; + unsigned char *a; #ifdef HAVE_NET_IF_DL_H struct sockaddr_dl *sdlp; #endif @@ -140,7 +140,7 @@ static int get_node_id(unsigned char *node_id) /* * BSD 4.4 defines the size of an ifreq to be * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len - * However, under earlier systems, sa_len isn't present, so the size is + * However, under earlier systems, sa_len isn't present, so the size is * just sizeof(struct ifreq) */ #ifdef HAVE_SA_LEN @@ -214,9 +214,9 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low, uint16_t *ret_cl static int adjustment = 0; static struct timeval last = {0, 0}; static uint16_t clock_seq; - struct timeval tv; + struct timeval tv; unsigned long long clock_reg; - + try_again: gettimeofday(&tv, 0); if ((last.tv_sec == 0) && (last.tv_usec == 0)) { @@ -240,7 +240,7 @@ try_again: adjustment = 0; last = tv; } - + clock_reg = tv.tv_usec*10 + adjustment; clock_reg += ((unsigned long long) tv.tv_sec)*10000000; clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000; diff --git a/e2fsprogs/uuid/pack.c b/e2fsprogs/uuid/pack.c index 1013886..9d733f0 100644 --- a/e2fsprogs/uuid/pack.c +++ b/e2fsprogs/uuid/pack.c @@ -1,6 +1,6 @@ /* * Internal routine for packing UUID's - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -16,7 +16,7 @@ * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF diff --git a/e2fsprogs/uuid/parse.c b/e2fsprogs/uuid/parse.c index 07b894d..21b2949 100644 --- a/e2fsprogs/uuid/parse.c +++ b/e2fsprogs/uuid/parse.c @@ -1,6 +1,6 @@ /* * parse.c --- UUID parsing - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -16,7 +16,7 @@ * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF @@ -42,7 +42,7 @@ int uuid_parse(const char *in, uuid_t uu) { struct uuid uuid; - int i; + int i; const char *cp; char buf[3]; @@ -73,7 +73,7 @@ int uuid_parse(const char *in, uuid_t uu) buf[1] = *cp++; uuid.node[i] = strtoul(buf, NULL, 16); } - + uuid_pack(&uuid, uu); return 0; } diff --git a/e2fsprogs/uuid/unpack.c b/e2fsprogs/uuid/unpack.c index d635895..8f9c520 100644 --- a/e2fsprogs/uuid/unpack.c +++ b/e2fsprogs/uuid/unpack.c @@ -1,6 +1,6 @@ /* * Internal routine for unpacking UUID - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -16,7 +16,7 @@ * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF diff --git a/e2fsprogs/uuid/unparse.c b/e2fsprogs/uuid/unparse.c index c0e08ef..a95bbb0 100644 --- a/e2fsprogs/uuid/unparse.c +++ b/e2fsprogs/uuid/unparse.c @@ -1,6 +1,6 @@ /* * unparse.c -- convert a UUID to string - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -16,7 +16,7 @@ * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF @@ -36,10 +36,10 @@ #include "uuidP.h" -static const char *fmt_lower = +static const char *fmt_lower = "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"; -static const char *fmt_upper = +static const char *fmt_upper = "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"; #ifdef UUID_UNPARSE_DEFAULT_UPPER diff --git a/e2fsprogs/uuid/uuid.h b/e2fsprogs/uuid/uuid.h index a05f1c6..cd97a5e 100644 --- a/e2fsprogs/uuid/uuid.h +++ b/e2fsprogs/uuid/uuid.h @@ -1,6 +1,6 @@ /* * Public include file for the UUID library - * + * * Copyright (C) 1996, 1997, 1998 Theodore Ts'o. * * %Begin-Header% @@ -16,7 +16,7 @@ * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF @@ -42,8 +42,8 @@ typedef unsigned char uuid_t[16]; /* UUID Variant definitions */ -#define UUID_VARIANT_NCS 0 -#define UUID_VARIANT_DCE 1 +#define UUID_VARIANT_NCS 0 +#define UUID_VARIANT_DCE 1 #define UUID_VARIANT_MICROSOFT 2 #define UUID_VARIANT_OTHER 3 diff --git a/e2fsprogs/uuid/uuidP.h b/e2fsprogs/uuid/uuidP.h index d2e1a45..9d30ce2 100644 --- a/e2fsprogs/uuid/uuidP.h +++ b/e2fsprogs/uuid/uuidP.h @@ -1,6 +1,6 @@ /* * uuid.h -- private header file for uuids - * + * * Copyright (C) 1996, 1997 Theodore Ts'o. * * %Begin-Header% @@ -16,7 +16,7 @@ * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF diff --git a/e2fsprogs/uuid/uuid_time.c b/e2fsprogs/uuid/uuid_time.c index d5f992b..9ff3607 100644 --- a/e2fsprogs/uuid/uuid_time.c +++ b/e2fsprogs/uuid/uuid_time.c @@ -1,8 +1,8 @@ /* * uuid_time.c --- Interpret the time field from a uuid. This program - * violates the UUID abstraction barrier by reaching into the guts + * violates the UUID abstraction barrier by reaching into the guts * of a UUID and interpreting it. - * + * * Copyright (C) 1998, 1999 Theodore Ts'o. * * %Begin-Header% @@ -18,7 +18,7 @@ * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF @@ -51,7 +51,7 @@ time_t uuid_time(const uuid_t uu, struct timeval *ret_tv) unsigned long long clock_reg; uuid_unpack(uu, &uuid); - + high = uuid.time_mid | ((uuid.time_hi_and_version & 0xFFF) << 16); clock_reg = uuid.time_low | ((unsigned long long) high << 32); @@ -69,7 +69,7 @@ int uuid_type(const uuid_t uu) { struct uuid uuid; - uuid_unpack(uu, &uuid); + uuid_unpack(uu, &uuid); return ((uuid.time_hi_and_version >> 12) & 0xF); } @@ -78,7 +78,7 @@ int uuid_variant(const uuid_t uu) struct uuid uuid; int var; - uuid_unpack(uu, &uuid); + uuid_unpack(uu, &uuid); var = uuid.clock_seq; if ((var & 0x8000) == 0) @@ -105,7 +105,7 @@ static const char *variant_string(int variant) } } - + int main(int argc, char **argv) { @@ -155,7 +155,7 @@ main(int argc, char **argv) } printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec, ctime(&time_reg)); - + return 0; } #endif |