diff options
Diffstat (limited to 'e2fsprogs')
108 files changed, 862 insertions, 862 deletions
diff --git a/e2fsprogs/Config.in b/e2fsprogs/Config.in index 225e5aaaf..91e873e3a 100644 --- a/e2fsprogs/Config.in +++ b/e2fsprogs/Config.in | |||
@@ -17,7 +17,7 @@ config CONFIG_E2FSCK | |||
17 | help | 17 | help |
18 | e2fsck is used to check Linux second extended file systems (ext2fs). | 18 | e2fsck is used to check Linux second extended file systems (ext2fs). |
19 | e2fsck also supports ext2 filesystems countaining a journal (ext3). | 19 | e2fsck also supports ext2 filesystems countaining a journal (ext3). |
20 | The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also | 20 | The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also |
21 | provided. | 21 | provided. |
22 | 22 | ||
23 | config CONFIG_FSCK | 23 | config CONFIG_FSCK |
@@ -25,7 +25,7 @@ config CONFIG_FSCK | |||
25 | default n | 25 | default n |
26 | help | 26 | help |
27 | fsck is used to check and optionally repair one or more filesystems. | 27 | fsck is used to check and optionally repair one or more filesystems. |
28 | In actuality, fsck is simply a front-end for the various file system | 28 | In actuality, fsck is simply a front-end for the various file system |
29 | checkers (fsck.fstype) available under Linux. | 29 | checkers (fsck.fstype) available under Linux. |
30 | 30 | ||
31 | config CONFIG_LSATTR | 31 | config CONFIG_LSATTR |
@@ -38,14 +38,14 @@ config CONFIG_MKE2FS | |||
38 | bool "mke2fs" | 38 | bool "mke2fs" |
39 | default n | 39 | default n |
40 | help | 40 | help |
41 | mke2fs is used to create an ext2/ext3 filesystem. The normal compat | 41 | mke2fs is used to create an ext2/ext3 filesystem. The normal compat |
42 | symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided. | 42 | symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided. |
43 | 43 | ||
44 | config CONFIG_TUNE2FS | 44 | config CONFIG_TUNE2FS |
45 | bool "tune2fs" | 45 | bool "tune2fs" |
46 | default n | 46 | default n |
47 | help | 47 | help |
48 | tune2fs allows the system administrator to adjust various tunable | 48 | tune2fs allows the system administrator to adjust various tunable |
49 | filesystem parameters on Linux ext2/ext3 filesystems. | 49 | filesystem parameters on Linux ext2/ext3 filesystems. |
50 | 50 | ||
51 | config CONFIG_E2LABEL | 51 | config CONFIG_E2LABEL |
@@ -53,7 +53,7 @@ config CONFIG_E2LABEL | |||
53 | default n | 53 | default n |
54 | depends on CONFIG_TUNE2FS | 54 | depends on CONFIG_TUNE2FS |
55 | help | 55 | help |
56 | e2label will display or change the filesystem label on the ext2 | 56 | e2label will display or change the filesystem label on the ext2 |
57 | filesystem located on device. | 57 | filesystem located on device. |
58 | 58 | ||
59 | config CONFIG_FINDFS | 59 | config CONFIG_FINDFS |
@@ -61,7 +61,7 @@ config CONFIG_FINDFS | |||
61 | default n | 61 | default n |
62 | depends on CONFIG_TUNE2FS | 62 | depends on CONFIG_TUNE2FS |
63 | help | 63 | help |
64 | findfs will search the disks in the system looking for a filesystem | 64 | findfs will search the disks in the system looking for a filesystem |
65 | which has a label matching label or a UUID equal to uuid. | 65 | which has a label matching label or a UUID equal to uuid. |
66 | 66 | ||
67 | endmenu | 67 | endmenu |
diff --git a/e2fsprogs/blkid/blkid.h b/e2fsprogs/blkid/blkid.h index 3ea94ac80..3bb0e78d8 100644 --- a/e2fsprogs/blkid/blkid.h +++ b/e2fsprogs/blkid/blkid.h | |||
@@ -34,13 +34,13 @@ typedef struct blkid_struct_dev_iterate *blkid_dev_iterate; | |||
34 | * Flags for blkid_get_dev | 34 | * Flags for blkid_get_dev |
35 | * | 35 | * |
36 | * BLKID_DEV_CREATE Create an empty device structure if not found | 36 | * BLKID_DEV_CREATE Create an empty device structure if not found |
37 | * in the cache. | 37 | * in the cache. |
38 | * BLKID_DEV_VERIFY Make sure the device structure corresponds | 38 | * BLKID_DEV_VERIFY Make sure the device structure corresponds |
39 | * with reality. | 39 | * with reality. |
40 | * BLKID_DEV_FIND Just look up a device entry, and return NULL | 40 | * BLKID_DEV_FIND Just look up a device entry, and return NULL |
41 | * if it is not found. | 41 | * if it is not found. |
42 | * BLKID_DEV_NORMAL Get a valid device structure, either from the | 42 | * BLKID_DEV_NORMAL Get a valid device structure, either from the |
43 | * cache or by probing the device. | 43 | * cache or by probing the device. |
44 | */ | 44 | */ |
45 | #define BLKID_DEV_FIND 0x0000 | 45 | #define BLKID_DEV_FIND 0x0000 |
46 | #define BLKID_DEV_CREATE 0x0001 | 46 | #define BLKID_DEV_CREATE 0x0001 |
diff --git a/e2fsprogs/blkid/blkid_getsize.c b/e2fsprogs/blkid/blkid_getsize.c index 9458c08bf..58cc7352a 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) | |||
70 | { | 70 | { |
71 | int valid_blkgetsize64 = 1; | 71 | int valid_blkgetsize64 = 1; |
72 | #ifdef __linux__ | 72 | #ifdef __linux__ |
73 | struct utsname ut; | 73 | struct utsname ut; |
74 | #endif | 74 | #endif |
75 | unsigned long long size64; | 75 | unsigned long long size64; |
76 | unsigned long size; | 76 | unsigned long size; |
diff --git a/e2fsprogs/blkid/cache.c b/e2fsprogs/blkid/cache.c index 0dd1b6286..87be1269f 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) | |||
47 | if (!filename) | 47 | if (!filename) |
48 | filename = BLKID_CACHE_FILE; | 48 | filename = BLKID_CACHE_FILE; |
49 | cache->bic_filename = blkid_strdup(filename); | 49 | cache->bic_filename = blkid_strdup(filename); |
50 | 50 | ||
51 | blkid_read_cache(cache); | 51 | blkid_read_cache(cache); |
52 | 52 | ||
53 | *ret_cache = cache; | 53 | *ret_cache = cache; |
54 | return 0; | 54 | return 0; |
55 | } | 55 | } |
@@ -62,7 +62,7 @@ void blkid_put_cache(blkid_cache cache) | |||
62 | (void) blkid_flush_cache(cache); | 62 | (void) blkid_flush_cache(cache); |
63 | 63 | ||
64 | DBG(DEBUG_CACHE, printf("freeing cache struct\n")); | 64 | DBG(DEBUG_CACHE, printf("freeing cache struct\n")); |
65 | 65 | ||
66 | /* DEB_DUMP_CACHE(cache); */ | 66 | /* DEB_DUMP_CACHE(cache); */ |
67 | 67 | ||
68 | while (!list_empty(&cache->bic_devs)) { | 68 | while (!list_empty(&cache->bic_devs)) { |
@@ -79,7 +79,7 @@ void blkid_put_cache(blkid_cache cache) | |||
79 | 79 | ||
80 | while (!list_empty(&tag->bit_names)) { | 80 | while (!list_empty(&tag->bit_names)) { |
81 | blkid_tag bad = list_entry(tag->bit_names.next, | 81 | blkid_tag bad = list_entry(tag->bit_names.next, |
82 | struct blkid_struct_tag, | 82 | struct blkid_struct_tag, |
83 | bit_names); | 83 | bit_names); |
84 | 84 | ||
85 | DBG(DEBUG_CACHE, printf("warning: unfreed tag %s=%s\n", | 85 | DBG(DEBUG_CACHE, printf("warning: unfreed tag %s=%s\n", |
@@ -90,7 +90,7 @@ void blkid_put_cache(blkid_cache cache) | |||
90 | } | 90 | } |
91 | if (cache->bic_filename) | 91 | if (cache->bic_filename) |
92 | free(cache->bic_filename); | 92 | free(cache->bic_filename); |
93 | 93 | ||
94 | free(cache); | 94 | free(cache); |
95 | } | 95 | } |
96 | 96 | ||
diff --git a/e2fsprogs/blkid/dev.c b/e2fsprogs/blkid/dev.c index 0e2b4e1bc..d2e468304 100644 --- a/e2fsprogs/blkid/dev.c +++ b/e2fsprogs/blkid/dev.c | |||
@@ -73,7 +73,7 @@ extern const char *blkid_dev_devname(blkid_dev dev) | |||
73 | * This series of functions iterate over all devices in a blkid cache | 73 | * This series of functions iterate over all devices in a blkid cache |
74 | */ | 74 | */ |
75 | #define DEV_ITERATE_MAGIC 0x01a5284c | 75 | #define DEV_ITERATE_MAGIC 0x01a5284c |
76 | 76 | ||
77 | struct blkid_struct_dev_iterate { | 77 | struct blkid_struct_dev_iterate { |
78 | int magic; | 78 | int magic; |
79 | blkid_cache cache; | 79 | blkid_cache cache; |
diff --git a/e2fsprogs/blkid/devname.c b/e2fsprogs/blkid/devname.c index b5db29e30..1e016a55d 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) | |||
54 | if (strcmp(tmp->bid_name, devname)) | 54 | if (strcmp(tmp->bid_name, devname)) |
55 | continue; | 55 | continue; |
56 | 56 | ||
57 | DBG(DEBUG_DEVNAME, | 57 | DBG(DEBUG_DEVNAME, |
58 | printf("found devname %s in cache\n", tmp->bid_name)); | 58 | printf("found devname %s in cache\n", tmp->bid_name)); |
59 | dev = tmp; | 59 | dev = tmp; |
60 | break; | 60 | break; |
@@ -113,7 +113,7 @@ static void probe_one(blkid_cache cache, const char *ptname, | |||
113 | dev->bid_devno == devno) | 113 | dev->bid_devno == devno) |
114 | goto set_pri; | 114 | goto set_pri; |
115 | 115 | ||
116 | if (stat(device, &st) == 0 && S_ISBLK(st.st_mode) && | 116 | if (stat(device, &st) == 0 && S_ISBLK(st.st_mode) && |
117 | st.st_rdev == devno) { | 117 | st.st_rdev == devno) { |
118 | devname = blkid_strdup(device); | 118 | devname = blkid_strdup(device); |
119 | break; | 119 | break; |
diff --git a/e2fsprogs/blkid/devno.c b/e2fsprogs/blkid/devno.c index 93a57fd86..7d083e76f 100644 --- a/e2fsprogs/blkid/devno.c +++ b/e2fsprogs/blkid/devno.c | |||
@@ -171,13 +171,13 @@ char *blkid_devno_to_devname(dev_t devno) | |||
171 | 171 | ||
172 | if (!devname) { | 172 | if (!devname) { |
173 | DBG(DEBUG_DEVNO, | 173 | DBG(DEBUG_DEVNO, |
174 | printf("blkid: couldn't find devno 0x%04lx\n", | 174 | printf("blkid: couldn't find devno 0x%04lx\n", |
175 | (unsigned long) devno)); | 175 | (unsigned long) devno)); |
176 | } else { | 176 | } else { |
177 | DBG(DEBUG_DEVNO, | 177 | DBG(DEBUG_DEVNO, |
178 | printf("found devno 0x%04Lx as %s\n", devno, devname)); | 178 | printf("found devno 0x%04Lx as %s\n", devno, devname)); |
179 | } | 179 | } |
180 | 180 | ||
181 | 181 | ||
182 | return devname; | 182 | return devname; |
183 | } | 183 | } |
diff --git a/e2fsprogs/blkid/probe.c b/e2fsprogs/blkid/probe.c index cb21c1070..2aaa50885 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) | |||
41 | struct mdp_superblock_s *md; | 41 | struct mdp_superblock_s *md; |
42 | blkid_loff_t offset; | 42 | blkid_loff_t offset; |
43 | char buf[4096]; | 43 | char buf[4096]; |
44 | 44 | ||
45 | if (fd < 0) | 45 | if (fd < 0) |
46 | return -BLKID_ERR_PARAM; | 46 | return -BLKID_ERR_PARAM; |
47 | 47 | ||
@@ -83,7 +83,7 @@ static void get_ext2_info(blkid_dev dev, unsigned char *buf) | |||
83 | struct ext2_super_block *es = (struct ext2_super_block *) buf; | 83 | struct ext2_super_block *es = (struct ext2_super_block *) buf; |
84 | const char *label = 0; | 84 | const char *label = 0; |
85 | 85 | ||
86 | DBG(DEBUG_PROBE, printf("ext2_sb.compat = %08X:%08X:%08X\n", | 86 | DBG(DEBUG_PROBE, printf("ext2_sb.compat = %08X:%08X:%08X\n", |
87 | blkid_le32(es->s_feature_compat), | 87 | blkid_le32(es->s_feature_compat), |
88 | blkid_le32(es->s_feature_incompat), | 88 | blkid_le32(es->s_feature_incompat), |
89 | blkid_le32(es->s_feature_ro_compat))); | 89 | blkid_le32(es->s_feature_ro_compat))); |
@@ -95,8 +95,8 @@ static void get_ext2_info(blkid_dev dev, unsigned char *buf) | |||
95 | set_uuid(dev, es->s_uuid); | 95 | set_uuid(dev, es->s_uuid); |
96 | } | 96 | } |
97 | 97 | ||
98 | static int probe_ext3(int fd __BLKID_ATTR((unused)), | 98 | static int probe_ext3(int fd __BLKID_ATTR((unused)), |
99 | blkid_cache cache __BLKID_ATTR((unused)), | 99 | blkid_cache cache __BLKID_ATTR((unused)), |
100 | blkid_dev dev, | 100 | blkid_dev dev, |
101 | const struct blkid_magic *id, unsigned char *buf) | 101 | const struct blkid_magic *id, unsigned char *buf) |
102 | { | 102 | { |
@@ -105,7 +105,7 @@ static int probe_ext3(int fd __BLKID_ATTR((unused)), | |||
105 | es = (struct ext2_super_block *)buf; | 105 | es = (struct ext2_super_block *)buf; |
106 | 106 | ||
107 | /* Distinguish between jbd and ext2/3 fs */ | 107 | /* Distinguish between jbd and ext2/3 fs */ |
108 | if (blkid_le32(es->s_feature_incompat) & | 108 | if (blkid_le32(es->s_feature_incompat) & |
109 | EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) | 109 | EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) |
110 | return -BLKID_ERR_PARAM; | 110 | return -BLKID_ERR_PARAM; |
111 | 111 | ||
@@ -121,8 +121,8 @@ static int probe_ext3(int fd __BLKID_ATTR((unused)), | |||
121 | return 0; | 121 | return 0; |
122 | } | 122 | } |
123 | 123 | ||
124 | static int probe_ext2(int fd __BLKID_ATTR((unused)), | 124 | static int probe_ext2(int fd __BLKID_ATTR((unused)), |
125 | blkid_cache cache __BLKID_ATTR((unused)), | 125 | blkid_cache cache __BLKID_ATTR((unused)), |
126 | blkid_dev dev, | 126 | blkid_dev dev, |
127 | const struct blkid_magic *id, unsigned char *buf) | 127 | const struct blkid_magic *id, unsigned char *buf) |
128 | { | 128 | { |
@@ -132,7 +132,7 @@ static int probe_ext2(int fd __BLKID_ATTR((unused)), | |||
132 | es = (struct ext2_super_block *)buf; | 132 | es = (struct ext2_super_block *)buf; |
133 | 133 | ||
134 | /* Distinguish between jbd and ext2/3 fs */ | 134 | /* Distinguish between jbd and ext2/3 fs */ |
135 | if (blkid_le32(es->s_feature_incompat) & | 135 | if (blkid_le32(es->s_feature_incompat) & |
136 | EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) | 136 | EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) |
137 | return -BLKID_ERR_PARAM; | 137 | return -BLKID_ERR_PARAM; |
138 | 138 | ||
@@ -141,10 +141,10 @@ static int probe_ext2(int fd __BLKID_ATTR((unused)), | |||
141 | return 0; | 141 | return 0; |
142 | } | 142 | } |
143 | 143 | ||
144 | static int probe_jbd(int fd __BLKID_ATTR((unused)), | 144 | static int probe_jbd(int fd __BLKID_ATTR((unused)), |
145 | blkid_cache cache __BLKID_ATTR((unused)), | 145 | blkid_cache cache __BLKID_ATTR((unused)), |
146 | blkid_dev dev, | 146 | blkid_dev dev, |
147 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 147 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
148 | unsigned char *buf) | 148 | unsigned char *buf) |
149 | { | 149 | { |
150 | struct ext2_super_block *es = (struct ext2_super_block *) buf; | 150 | struct ext2_super_block *es = (struct ext2_super_block *) buf; |
@@ -158,10 +158,10 @@ static int probe_jbd(int fd __BLKID_ATTR((unused)), | |||
158 | return 0; | 158 | return 0; |
159 | } | 159 | } |
160 | 160 | ||
161 | static int probe_vfat(int fd __BLKID_ATTR((unused)), | 161 | static int probe_vfat(int fd __BLKID_ATTR((unused)), |
162 | blkid_cache cache __BLKID_ATTR((unused)), | 162 | blkid_cache cache __BLKID_ATTR((unused)), |
163 | blkid_dev dev, | 163 | blkid_dev dev, |
164 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 164 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
165 | unsigned char *buf) | 165 | unsigned char *buf) |
166 | { | 166 | { |
167 | struct vfat_super_block *vs; | 167 | struct vfat_super_block *vs; |
@@ -191,10 +191,10 @@ static int probe_vfat(int fd __BLKID_ATTR((unused)), | |||
191 | return 0; | 191 | return 0; |
192 | } | 192 | } |
193 | 193 | ||
194 | static int probe_msdos(int fd __BLKID_ATTR((unused)), | 194 | static int probe_msdos(int fd __BLKID_ATTR((unused)), |
195 | blkid_cache cache __BLKID_ATTR((unused)), | 195 | blkid_cache cache __BLKID_ATTR((unused)), |
196 | blkid_dev dev, | 196 | blkid_dev dev, |
197 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 197 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
198 | unsigned char *buf) | 198 | unsigned char *buf) |
199 | { | 199 | { |
200 | struct msdos_super_block *ms = (struct msdos_super_block *) buf; | 200 | struct msdos_super_block *ms = (struct msdos_super_block *) buf; |
@@ -223,10 +223,10 @@ static int probe_msdos(int fd __BLKID_ATTR((unused)), | |||
223 | return 0; | 223 | return 0; |
224 | } | 224 | } |
225 | 225 | ||
226 | static int probe_xfs(int fd __BLKID_ATTR((unused)), | 226 | static int probe_xfs(int fd __BLKID_ATTR((unused)), |
227 | blkid_cache cache __BLKID_ATTR((unused)), | 227 | blkid_cache cache __BLKID_ATTR((unused)), |
228 | blkid_dev dev, | 228 | blkid_dev dev, |
229 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 229 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
230 | unsigned char *buf) | 230 | unsigned char *buf) |
231 | { | 231 | { |
232 | struct xfs_super_block *xs; | 232 | struct xfs_super_block *xs; |
@@ -241,8 +241,8 @@ static int probe_xfs(int fd __BLKID_ATTR((unused)), | |||
241 | return 0; | 241 | return 0; |
242 | } | 242 | } |
243 | 243 | ||
244 | static int probe_reiserfs(int fd __BLKID_ATTR((unused)), | 244 | static int probe_reiserfs(int fd __BLKID_ATTR((unused)), |
245 | blkid_cache cache __BLKID_ATTR((unused)), | 245 | blkid_cache cache __BLKID_ATTR((unused)), |
246 | blkid_dev dev, | 246 | blkid_dev dev, |
247 | const struct blkid_magic *id, unsigned char *buf) | 247 | const struct blkid_magic *id, unsigned char *buf) |
248 | { | 248 | { |
@@ -268,10 +268,10 @@ static int probe_reiserfs(int fd __BLKID_ATTR((unused)), | |||
268 | return 0; | 268 | return 0; |
269 | } | 269 | } |
270 | 270 | ||
271 | static int probe_jfs(int fd __BLKID_ATTR((unused)), | 271 | static int probe_jfs(int fd __BLKID_ATTR((unused)), |
272 | blkid_cache cache __BLKID_ATTR((unused)), | 272 | blkid_cache cache __BLKID_ATTR((unused)), |
273 | blkid_dev dev, | 273 | blkid_dev dev, |
274 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 274 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
275 | unsigned char *buf) | 275 | unsigned char *buf) |
276 | { | 276 | { |
277 | struct jfs_super_block *js; | 277 | struct jfs_super_block *js; |
@@ -286,10 +286,10 @@ static int probe_jfs(int fd __BLKID_ATTR((unused)), | |||
286 | return 0; | 286 | return 0; |
287 | } | 287 | } |
288 | 288 | ||
289 | static int probe_romfs(int fd __BLKID_ATTR((unused)), | 289 | static int probe_romfs(int fd __BLKID_ATTR((unused)), |
290 | blkid_cache cache __BLKID_ATTR((unused)), | 290 | blkid_cache cache __BLKID_ATTR((unused)), |
291 | blkid_dev dev, | 291 | blkid_dev dev, |
292 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 292 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
293 | unsigned char *buf) | 293 | unsigned char *buf) |
294 | { | 294 | { |
295 | struct romfs_super_block *ros; | 295 | struct romfs_super_block *ros; |
@@ -340,7 +340,7 @@ static int probe_swap1(int fd, | |||
340 | /* arbitrary sanity check.. is there any garbage down there? */ | 340 | /* arbitrary sanity check.. is there any garbage down there? */ |
341 | if (sws->sws_pad[32] == 0 && sws->sws_pad[33] == 0) { | 341 | if (sws->sws_pad[32] == 0 && sws->sws_pad[33] == 0) { |
342 | if (sws->sws_volume[0]) | 342 | if (sws->sws_volume[0]) |
343 | blkid_set_tag(dev, "LABEL", sws->sws_volume, | 343 | blkid_set_tag(dev, "LABEL", sws->sws_volume, |
344 | sizeof(sws->sws_volume)); | 344 | sizeof(sws->sws_volume)); |
345 | if (sws->sws_uuid[0]) | 345 | if (sws->sws_uuid[0]) |
346 | set_uuid(dev, sws->sws_uuid); | 346 | set_uuid(dev, sws->sws_uuid); |
@@ -354,9 +354,9 @@ static const char | |||
354 | * const udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02", | 354 | * const udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02", |
355 | "NSR03", "TEA01", 0 }; | 355 | "NSR03", "TEA01", 0 }; |
356 | 356 | ||
357 | static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)), | 357 | static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)), |
358 | blkid_dev dev __BLKID_ATTR((unused)), | 358 | blkid_dev dev __BLKID_ATTR((unused)), |
359 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 359 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
360 | unsigned char *buf __BLKID_ATTR((unused))) | 360 | unsigned char *buf __BLKID_ATTR((unused))) |
361 | { | 361 | { |
362 | int j, bs; | 362 | int j, bs; |
@@ -396,10 +396,10 @@ static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)), | |||
396 | return 1; | 396 | return 1; |
397 | } | 397 | } |
398 | 398 | ||
399 | static int probe_ocfs(int fd __BLKID_ATTR((unused)), | 399 | static int probe_ocfs(int fd __BLKID_ATTR((unused)), |
400 | blkid_cache cache __BLKID_ATTR((unused)), | 400 | blkid_cache cache __BLKID_ATTR((unused)), |
401 | blkid_dev dev, | 401 | blkid_dev dev, |
402 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 402 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
403 | unsigned char *buf) | 403 | unsigned char *buf) |
404 | { | 404 | { |
405 | struct ocfs_volume_header ovh; | 405 | struct ocfs_volume_header ovh; |
@@ -414,17 +414,17 @@ static int probe_ocfs(int fd __BLKID_ATTR((unused)), | |||
414 | blkid_set_tag(dev,"SEC_TYPE","ocfs1",sizeof("ocfs1")); | 414 | blkid_set_tag(dev,"SEC_TYPE","ocfs1",sizeof("ocfs1")); |
415 | else if (major >= 9) | 415 | else if (major >= 9) |
416 | blkid_set_tag(dev,"SEC_TYPE","ntocfs",sizeof("ntocfs")); | 416 | blkid_set_tag(dev,"SEC_TYPE","ntocfs",sizeof("ntocfs")); |
417 | 417 | ||
418 | blkid_set_tag(dev, "LABEL", ovl.label, ocfslabellen(ovl)); | 418 | blkid_set_tag(dev, "LABEL", ovl.label, ocfslabellen(ovl)); |
419 | blkid_set_tag(dev, "MOUNT", ovh.mount, ocfsmountlen(ovh)); | 419 | blkid_set_tag(dev, "MOUNT", ovh.mount, ocfsmountlen(ovh)); |
420 | set_uuid(dev, ovl.vol_id); | 420 | set_uuid(dev, ovl.vol_id); |
421 | return 0; | 421 | return 0; |
422 | } | 422 | } |
423 | 423 | ||
424 | static int probe_ocfs2(int fd __BLKID_ATTR((unused)), | 424 | static int probe_ocfs2(int fd __BLKID_ATTR((unused)), |
425 | blkid_cache cache __BLKID_ATTR((unused)), | 425 | blkid_cache cache __BLKID_ATTR((unused)), |
426 | blkid_dev dev, | 426 | blkid_dev dev, |
427 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 427 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
428 | unsigned char *buf) | 428 | unsigned char *buf) |
429 | { | 429 | { |
430 | struct ocfs2_super_block *osb; | 430 | struct ocfs2_super_block *osb; |
@@ -436,10 +436,10 @@ static int probe_ocfs2(int fd __BLKID_ATTR((unused)), | |||
436 | return 0; | 436 | return 0; |
437 | } | 437 | } |
438 | 438 | ||
439 | static int probe_oracleasm(int fd __BLKID_ATTR((unused)), | 439 | static int probe_oracleasm(int fd __BLKID_ATTR((unused)), |
440 | blkid_cache cache __BLKID_ATTR((unused)), | 440 | blkid_cache cache __BLKID_ATTR((unused)), |
441 | blkid_dev dev, | 441 | blkid_dev dev, |
442 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 442 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
443 | unsigned char *buf) | 443 | unsigned char *buf) |
444 | { | 444 | { |
445 | struct oracle_asm_disk_label *dl; | 445 | struct oracle_asm_disk_label *dl; |
@@ -548,13 +548,13 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) | |||
548 | diff = now - dev->bid_time; | 548 | diff = now - dev->bid_time; |
549 | 549 | ||
550 | if ((now < dev->bid_time) || | 550 | if ((now < dev->bid_time) || |
551 | (diff < BLKID_PROBE_MIN) || | 551 | (diff < BLKID_PROBE_MIN) || |
552 | (dev->bid_flags & BLKID_BID_FL_VERIFIED && | 552 | (dev->bid_flags & BLKID_BID_FL_VERIFIED && |
553 | diff < BLKID_PROBE_INTERVAL)) | 553 | diff < BLKID_PROBE_INTERVAL)) |
554 | return dev; | 554 | return dev; |
555 | 555 | ||
556 | DBG(DEBUG_PROBE, | 556 | DBG(DEBUG_PROBE, |
557 | printf("need to revalidate %s (time since last check %lu)\n", | 557 | printf("need to revalidate %s (time since last check %lu)\n", |
558 | dev->bid_name, diff)); | 558 | dev->bid_name, diff)); |
559 | 559 | ||
560 | if (((fd = open(dev->bid_name, O_RDONLY)) < 0) || | 560 | if (((fd = open(dev->bid_name, O_RDONLY)) < 0) || |
@@ -571,12 +571,12 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) | |||
571 | } | 571 | } |
572 | 572 | ||
573 | memset(bufs, 0, sizeof(bufs)); | 573 | memset(bufs, 0, sizeof(bufs)); |
574 | 574 | ||
575 | /* | 575 | /* |
576 | * Iterate over the type array. If we already know the type, | 576 | * Iterate over the type array. If we already know the type, |
577 | * then try that first. If it doesn't work, then blow away | 577 | * then try that first. If it doesn't work, then blow away |
578 | * the type information, and try again. | 578 | * the type information, and try again. |
579 | * | 579 | * |
580 | */ | 580 | */ |
581 | try_again: | 581 | try_again: |
582 | type = 0; | 582 | type = 0; |
@@ -637,7 +637,7 @@ try_again: | |||
637 | blkid_free_dev(dev); | 637 | blkid_free_dev(dev); |
638 | return NULL; | 638 | return NULL; |
639 | } | 639 | } |
640 | 640 | ||
641 | found_type: | 641 | found_type: |
642 | if (dev && type) { | 642 | if (dev && type) { |
643 | dev->bid_devno = st.st_rdev; | 643 | dev->bid_devno = st.st_rdev; |
@@ -646,7 +646,7 @@ found_type: | |||
646 | cache->bic_flags |= BLKID_BIC_FL_CHANGED; | 646 | cache->bic_flags |= BLKID_BIC_FL_CHANGED; |
647 | 647 | ||
648 | blkid_set_tag(dev, "TYPE", type, 0); | 648 | blkid_set_tag(dev, "TYPE", type, 0); |
649 | 649 | ||
650 | DBG(DEBUG_PROBE, printf("%s: devno 0x%04Lx, type %s\n", | 650 | DBG(DEBUG_PROBE, printf("%s: devno 0x%04Lx, type %s\n", |
651 | dev->bid_name, st.st_rdev, type)); | 651 | dev->bid_name, st.st_rdev, type)); |
652 | } | 652 | } |
@@ -696,7 +696,7 @@ int main(int argc, char **argv) | |||
696 | printf("\tlabel is '%s'\n", dev->bid_label); | 696 | printf("\tlabel is '%s'\n", dev->bid_label); |
697 | if (dev->bid_uuid) | 697 | if (dev->bid_uuid) |
698 | printf("\tuuid is %s\n", dev->bid_uuid); | 698 | printf("\tuuid is %s\n", dev->bid_uuid); |
699 | 699 | ||
700 | blkid_free_dev(dev); | 700 | blkid_free_dev(dev); |
701 | return (0); | 701 | return (0); |
702 | } | 702 | } |
diff --git a/e2fsprogs/blkid/probe.h b/e2fsprogs/blkid/probe.h index 10af5d518..530b8efe2 100644 --- a/e2fsprogs/blkid/probe.h +++ b/e2fsprogs/blkid/probe.h | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | struct blkid_magic; | 19 | struct blkid_magic; |
20 | 20 | ||
21 | typedef int (*blkid_probe_t)(int fd, blkid_cache cache, blkid_dev dev, | 21 | typedef int (*blkid_probe_t)(int fd, blkid_cache cache, blkid_dev dev, |
22 | const struct blkid_magic *id, unsigned char *buf); | 22 | const struct blkid_magic *id, unsigned char *buf); |
23 | 23 | ||
24 | struct blkid_magic { | 24 | struct blkid_magic { |
@@ -222,16 +222,16 @@ struct ocfs_volume_header { | |||
222 | 222 | ||
223 | struct ocfs_volume_label { | 223 | struct ocfs_volume_label { |
224 | unsigned char disk_lock[48]; | 224 | unsigned char disk_lock[48]; |
225 | unsigned char label[64]; | 225 | unsigned char label[64]; |
226 | unsigned char label_len[2]; | 226 | unsigned char label_len[2]; |
227 | unsigned char vol_id[16]; | 227 | unsigned char vol_id[16]; |
228 | unsigned char vol_id_len[2]; | 228 | unsigned char vol_id_len[2]; |
229 | }; | 229 | }; |
230 | 230 | ||
231 | #define ocfsmajor(o) ((__u32)o.major_version[0] \ | 231 | #define ocfsmajor(o) ((__u32)o.major_version[0] \ |
232 | + (((__u32) o.major_version[1]) << 8) \ | 232 | + (((__u32) o.major_version[1]) << 8) \ |
233 | + (((__u32) o.major_version[2]) << 16) \ | 233 | + (((__u32) o.major_version[2]) << 16) \ |
234 | + (((__u32) o.major_version[3]) << 24)) | 234 | + (((__u32) o.major_version[3]) << 24)) |
235 | #define ocfslabellen(o) ((__u32)o.label_len[0] + (((__u32) o.label_len[1]) << 8)) | 235 | #define ocfslabellen(o) ((__u32)o.label_len[0] + (((__u32) o.label_len[1]) << 8)) |
236 | #define ocfsmountlen(o) ((__u32)o.mount_len[0] + (((__u32) o.mount_len[1])<<8)) | 236 | #define ocfsmountlen(o) ((__u32)o.mount_len[0] + (((__u32) o.mount_len[1])<<8)) |
237 | 237 | ||
@@ -334,7 +334,7 @@ _INLINE_ __u64 blkid_swab64(__u64 val) | |||
334 | return (blkid_swab32(val >> 32) | | 334 | return (blkid_swab32(val >> 32) | |
335 | (((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32)); | 335 | (((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32)); |
336 | } | 336 | } |
337 | #endif | 337 | #endif |
338 | 338 | ||
339 | 339 | ||
340 | 340 | ||
diff --git a/e2fsprogs/blkid/read.c b/e2fsprogs/blkid/read.c index 78464145d..08a3162f3 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) | |||
302 | return ret; | 302 | return ret; |
303 | 303 | ||
304 | /* Some tags are stored directly in the device struct */ | 304 | /* Some tags are stored directly in the device struct */ |
305 | if (!strcmp(name, "DEVNO")) | 305 | if (!strcmp(name, "DEVNO")) |
306 | dev->bid_devno = STRTOULL(value, 0, 0); | 306 | dev->bid_devno = STRTOULL(value, 0, 0); |
307 | else if (!strcmp(name, "PRI")) | 307 | else if (!strcmp(name, "PRI")) |
308 | dev->bid_pri = strtol(value, 0, 0); | 308 | dev->bid_pri = strtol(value, 0, 0); |
@@ -389,7 +389,7 @@ void blkid_read_cache(blkid_cache cache) | |||
389 | cache->bic_filename)); | 389 | cache->bic_filename)); |
390 | goto errout; | 390 | goto errout; |
391 | } | 391 | } |
392 | 392 | ||
393 | DBG(DEBUG_CACHE, printf("reading cache file %s\n", | 393 | DBG(DEBUG_CACHE, printf("reading cache file %s\n", |
394 | cache->bic_filename)); | 394 | cache->bic_filename)); |
395 | 395 | ||
diff --git a/e2fsprogs/blkid/resolve.c b/e2fsprogs/blkid/resolve.c index 625782d44..591b63057 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, | |||
69 | 69 | ||
70 | if (!token) | 70 | if (!token) |
71 | return NULL; | 71 | return NULL; |
72 | 72 | ||
73 | if (!cache) { | 73 | if (!cache) { |
74 | if (blkid_get_cache(&c, NULL) < 0) | 74 | if (blkid_get_cache(&c, NULL) < 0) |
75 | return NULL; | 75 | return NULL; |
@@ -125,7 +125,7 @@ int main(int argc, char **argv) | |||
125 | fprintf(stderr, "Couldn't get blkid cache\n"); | 125 | fprintf(stderr, "Couldn't get blkid cache\n"); |
126 | exit(1); | 126 | exit(1); |
127 | } | 127 | } |
128 | 128 | ||
129 | if (argv[2]) { | 129 | if (argv[2]) { |
130 | value = blkid_get_tag_value(cache, argv[1], argv[2]); | 130 | value = blkid_get_tag_value(cache, argv[1], argv[2]); |
131 | printf("%s has tag %s=%s\n", argv[2], argv[1], | 131 | printf("%s has tag %s=%s\n", argv[2], argv[1], |
diff --git a/e2fsprogs/blkid/save.c b/e2fsprogs/blkid/save.c index 3fba2450a..cc406ebfb 100644 --- a/e2fsprogs/blkid/save.c +++ b/e2fsprogs/blkid/save.c | |||
@@ -176,7 +176,7 @@ int main(int argc, char **argv) | |||
176 | exit(1); | 176 | exit(1); |
177 | } | 177 | } |
178 | cache->bic_filename = blkid_strdup(argv[1]); | 178 | cache->bic_filename = blkid_strdup(argv[1]); |
179 | 179 | ||
180 | if ((ret = blkid_flush_cache(cache)) < 0) { | 180 | if ((ret = blkid_flush_cache(cache)) < 0) { |
181 | fprintf(stderr, "error (%d) saving cache\n", ret); | 181 | fprintf(stderr, "error (%d) saving cache\n", ret); |
182 | exit(1); | 182 | exit(1); |
diff --git a/e2fsprogs/blkid/tag.c b/e2fsprogs/blkid/tag.c index 699d0fb46..e2c785cf0 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) | |||
96 | 96 | ||
97 | /* | 97 | /* |
98 | * Set a tag on an existing device. | 98 | * Set a tag on an existing device. |
99 | * | 99 | * |
100 | * If value is NULL, then delete the tagsfrom the device. | 100 | * If value is NULL, then delete the tagsfrom the device. |
101 | */ | 101 | */ |
102 | int blkid_set_tag(blkid_dev dev, const char *name, | 102 | int blkid_set_tag(blkid_dev dev, const char *name, |
@@ -131,7 +131,7 @@ int blkid_set_tag(blkid_dev dev, const char *name, | |||
131 | t->bit_dev = dev; | 131 | t->bit_dev = dev; |
132 | 132 | ||
133 | list_add_tail(&t->bit_tags, &dev->bid_tags); | 133 | list_add_tail(&t->bit_tags, &dev->bid_tags); |
134 | 134 | ||
135 | if (dev->bid_cache) { | 135 | if (dev->bid_cache) { |
136 | head = blkid_find_head_cache(dev->bid_cache, | 136 | head = blkid_find_head_cache(dev->bid_cache, |
137 | t->bit_name); | 137 | t->bit_name); |
@@ -151,7 +151,7 @@ int blkid_set_tag(blkid_dev dev, const char *name, | |||
151 | list_add_tail(&t->bit_names, &head->bit_names); | 151 | list_add_tail(&t->bit_names, &head->bit_names); |
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | /* Link common tags directly to the device struct */ | 155 | /* Link common tags directly to the device struct */ |
156 | if (!strcmp(name, "TYPE")) | 156 | if (!strcmp(name, "TYPE")) |
157 | dev->bid_type = val; | 157 | dev->bid_type = val; |
@@ -159,7 +159,7 @@ int blkid_set_tag(blkid_dev dev, const char *name, | |||
159 | dev->bid_label = val; | 159 | dev->bid_label = val; |
160 | else if (!strcmp(name, "UUID")) | 160 | else if (!strcmp(name, "UUID")) |
161 | dev->bid_uuid = val; | 161 | dev->bid_uuid = val; |
162 | 162 | ||
163 | if (dev->bid_cache) | 163 | if (dev->bid_cache) |
164 | dev->bid_cache->bic_flags |= BLKID_BIC_FL_CHANGED; | 164 | dev->bid_cache->bic_flags |= BLKID_BIC_FL_CHANGED; |
165 | return 0; | 165 | return 0; |
@@ -235,7 +235,7 @@ errout: | |||
235 | * This series of functions iterate over all tags in a device | 235 | * This series of functions iterate over all tags in a device |
236 | */ | 236 | */ |
237 | #define TAG_ITERATE_MAGIC 0x01a5284c | 237 | #define TAG_ITERATE_MAGIC 0x01a5284c |
238 | 238 | ||
239 | struct blkid_struct_tag_iterate { | 239 | struct blkid_struct_tag_iterate { |
240 | int magic; | 240 | int magic; |
241 | blkid_dev dev; | 241 | blkid_dev dev; |
@@ -260,7 +260,7 @@ extern int blkid_tag_next(blkid_tag_iterate iter, | |||
260 | const char **type, const char **value) | 260 | const char **type, const char **value) |
261 | { | 261 | { |
262 | blkid_tag tag; | 262 | blkid_tag tag; |
263 | 263 | ||
264 | *type = 0; | 264 | *type = 0; |
265 | *value = 0; | 265 | *value = 0; |
266 | if (!iter || iter->magic != TAG_ITERATE_MAGIC || | 266 | if (!iter || iter->magic != TAG_ITERATE_MAGIC || |
@@ -303,9 +303,9 @@ extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache, | |||
303 | return NULL; | 303 | return NULL; |
304 | 304 | ||
305 | blkid_read_cache(cache); | 305 | blkid_read_cache(cache); |
306 | 306 | ||
307 | DBG(DEBUG_TAG, printf("looking for %s=%s in cache\n", type, value)); | 307 | DBG(DEBUG_TAG, printf("looking for %s=%s in cache\n", type, value)); |
308 | 308 | ||
309 | try_again: | 309 | try_again: |
310 | pri = -1; | 310 | pri = -1; |
311 | dev = 0; | 311 | dev = 0; |
@@ -313,7 +313,7 @@ try_again: | |||
313 | 313 | ||
314 | if (head) { | 314 | if (head) { |
315 | list_for_each(p, &head->bit_names) { | 315 | list_for_each(p, &head->bit_names) { |
316 | blkid_tag tmp = list_entry(p, struct blkid_struct_tag, | 316 | blkid_tag tmp = list_entry(p, struct blkid_struct_tag, |
317 | bit_names); | 317 | bit_names); |
318 | 318 | ||
319 | if (!strcmp(tmp->bit_val, value) && | 319 | if (!strcmp(tmp->bit_val, value) && |
diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c index 66838e642..c39003821 100644 --- a/e2fsprogs/chattr.c +++ b/e2fsprogs/chattr.c | |||
@@ -161,8 +161,8 @@ skip_setflags: | |||
161 | iterate_on_dir(name, chattr_dir_proc, NULL); | 161 | iterate_on_dir(name, chattr_dir_proc, NULL); |
162 | } | 162 | } |
163 | 163 | ||
164 | static int chattr_dir_proc(const char *dir_name, struct dirent *de, | 164 | static int chattr_dir_proc(const char *dir_name, struct dirent *de, |
165 | void *private EXT2FS_ATTR((unused))) | 165 | void *private EXT2FS_ATTR((unused))) |
166 | { | 166 | { |
167 | /*if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {*/ | 167 | /*if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {*/ |
168 | if (de->d_name[0] == '.' && (de->d_name[1] == '\0' || \ | 168 | if (de->d_name[0] == '.' && (de->d_name[1] == '\0' || \ |
diff --git a/e2fsprogs/e2fsck.c b/e2fsprogs/e2fsck.c index b31b19414..1c97cf4bb 100644 --- a/e2fsprogs/e2fsck.c +++ b/e2fsprogs/e2fsck.c | |||
@@ -11797,8 +11797,8 @@ static int count_tags(struct buffer_head *bh, int size) | |||
11797 | 11797 | ||
11798 | 11798 | ||
11799 | /* Make sure we wrap around the log correctly! */ | 11799 | /* Make sure we wrap around the log correctly! */ |
11800 | #define wrap(journal, var) \ | 11800 | #define wrap(journal, var) \ |
11801 | do { \ | 11801 | do { \ |
11802 | if (var >= (journal)->j_last) \ | 11802 | if (var >= (journal)->j_last) \ |
11803 | var -= ((journal)->j_last - (journal)->j_first); \ | 11803 | var -= ((journal)->j_last - (journal)->j_first); \ |
11804 | } while (0) | 11804 | } while (0) |
diff --git a/e2fsprogs/e2p/feature.c b/e2fsprogs/e2p/feature.c index fe6016102..0a9058384 100644 --- a/e2fsprogs/e2p/feature.c +++ b/e2fsprogs/e2p/feature.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * feature.c --- convert between features and strings | 2 | * feature.c --- convert between features and strings |
3 | * | 3 | * |
4 | * Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu> | 4 | * Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu> |
5 | * | 5 | * |
6 | * This file can be redistributed under the terms of the GNU Library General | 6 | * This file can be redistributed under the terms of the GNU Library General |
7 | * Public License | 7 | * Public License |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <stdio.h> | 11 | #include <stdio.h> |
diff --git a/e2fsprogs/e2p/fgetsetversion.c b/e2fsprogs/e2p/fgetsetversion.c index dcf127c26..8227ab3be 100644 --- a/e2fsprogs/e2p/fgetsetversion.c +++ b/e2fsprogs/e2p/fgetsetversion.c | |||
@@ -33,11 +33,11 @@ | |||
33 | #define OPEN_FLAGS (O_RDONLY|O_NONBLOCK) | 33 | #define OPEN_FLAGS (O_RDONLY|O_NONBLOCK) |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | /* | 36 | /* |
37 | To do fsetversion: unsigned long *ptr_version must be set to NULL. | 37 | To do fsetversion: unsigned long *ptr_version must be set to NULL. |
38 | and unsigned long version must be set to a value | 38 | and unsigned long version must be set to a value |
39 | To do fgetversion: unsigned long *ptr_version must NOT be set to NULL | 39 | To do fgetversion: unsigned long *ptr_version must NOT be set to NULL |
40 | and unsigned long version is ignored. | 40 | and unsigned long version is ignored. |
41 | TITO. | 41 | TITO. |
42 | */ | 42 | */ |
43 | 43 | ||
diff --git a/e2fsprogs/e2p/hashstr.c b/e2fsprogs/e2p/hashstr.c index c4b3f9fd5..705f63ae0 100644 --- a/e2fsprogs/e2p/hashstr.c +++ b/e2fsprogs/e2p/hashstr.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * feature.c --- convert between features and strings | 2 | * feature.c --- convert between features and strings |
3 | * | 3 | * |
4 | * Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu> | 4 | * Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu> |
5 | * | 5 | * |
6 | * This file can be redistributed under the terms of the GNU Library General | 6 | * This file can be redistributed under the terms of the GNU Library General |
7 | * Public License | 7 | * Public License |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <stdio.h> | 11 | #include <stdio.h> |
diff --git a/e2fsprogs/e2p/ls.c b/e2fsprogs/e2p/ls.c index 71f8f5126..0c91345e1 100644 --- a/e2fsprogs/e2p/ls.c +++ b/e2fsprogs/e2p/ls.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Universite Pierre et Marie Curie (Paris VI) | 6 | * Universite Pierre et Marie Curie (Paris VI) |
7 | * | 7 | * |
8 | * Copyright (C) 1995, 1996, 1997 Theodore Ts'o <tytso@mit.edu> | 8 | * Copyright (C) 1995, 1996, 1997 Theodore Ts'o <tytso@mit.edu> |
9 | * | 9 | * |
10 | * This file can be redistributed under the terms of the GNU Library General | 10 | * This file can be redistributed under the terms of the GNU Library General |
11 | * Public License | 11 | * Public License |
12 | */ | 12 | */ |
@@ -190,11 +190,11 @@ void list_super2(struct ext2_super_block * sb, FILE *f) | |||
190 | "Block size: %u\n" | 190 | "Block size: %u\n" |
191 | "Fragment size: %u\n", | 191 | "Fragment size: %u\n", |
192 | str, sb->s_inodes_count, sb->s_blocks_count, sb->s_r_blocks_count, | 192 | str, sb->s_inodes_count, sb->s_blocks_count, sb->s_r_blocks_count, |
193 | sb->s_free_blocks_count, sb->s_free_inodes_count, | 193 | sb->s_free_blocks_count, sb->s_free_inodes_count, |
194 | sb->s_first_data_block, EXT2_BLOCK_SIZE(sb), EXT2_FRAG_SIZE(sb)); | 194 | sb->s_first_data_block, EXT2_BLOCK_SIZE(sb), EXT2_FRAG_SIZE(sb)); |
195 | free(str); | 195 | free(str); |
196 | if (sb->s_reserved_gdt_blocks) | 196 | if (sb->s_reserved_gdt_blocks) |
197 | fprintf(f, "Reserved GDT blocks: %u\n", | 197 | fprintf(f, "Reserved GDT blocks: %u\n", |
198 | sb->s_reserved_gdt_blocks); | 198 | sb->s_reserved_gdt_blocks); |
199 | fprintf(f, | 199 | fprintf(f, |
200 | "Blocks per group: %u\n" | 200 | "Blocks per group: %u\n" |
diff --git a/e2fsprogs/e2p/mntopts.c b/e2fsprogs/e2p/mntopts.c index 562a9ccc1..b27f78ed9 100644 --- a/e2fsprogs/e2p/mntopts.c +++ b/e2fsprogs/e2p/mntopts.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * mountopts.c --- convert between default mount options and strings | 2 | * mountopts.c --- convert between default mount options and strings |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Theodore Ts'o <tytso@mit.edu> | 4 | * Copyright (C) 2002 Theodore Ts'o <tytso@mit.edu> |
5 | * | 5 | * |
6 | * This file can be redistributed under the terms of the GNU Library General | 6 | * This file can be redistributed under the terms of the GNU Library General |
7 | * Public License | 7 | * Public License |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <stdio.h> | 11 | #include <stdio.h> |
diff --git a/e2fsprogs/e2p/ostype.c b/e2fsprogs/e2p/ostype.c index 1084abde2..46230631e 100644 --- a/e2fsprogs/e2p/ostype.c +++ b/e2fsprogs/e2p/ostype.c | |||
@@ -11,10 +11,10 @@ | |||
11 | #include <string.h> | 11 | #include <string.h> |
12 | 12 | ||
13 | static const char * const os_tab[] = | 13 | static const char * const os_tab[] = |
14 | { "Linux", | 14 | { "Linux", |
15 | "Hurd", | 15 | "Hurd", |
16 | "Masix", | 16 | "Masix", |
17 | "FreeBSD", | 17 | "FreeBSD", |
18 | "Lites", | 18 | "Lites", |
19 | 0 }; | 19 | 0 }; |
20 | 20 | ||
@@ -53,7 +53,7 @@ int e2p_string2os(char *str) | |||
53 | #ifdef TEST_PROGRAM | 53 | #ifdef TEST_PROGRAM |
54 | int main(int argc, char **argv) | 54 | int main(int argc, char **argv) |
55 | { | 55 | { |
56 | char *s; | 56 | char *s; |
57 | int i, os; | 57 | int i, os; |
58 | 58 | ||
59 | for (i=0; i <= EXT2_OS_LITES; i++) { | 59 | for (i=0; i <= EXT2_OS_LITES; i++) { |
diff --git a/e2fsprogs/e2p/parse_num.c b/e2fsprogs/e2p/parse_num.c index 3910e70de..81c160544 100644 --- a/e2fsprogs/e2p/parse_num.c +++ b/e2fsprogs/e2p/parse_num.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * parse_num.c - Parse the number of blocks | 2 | * parse_num.c - Parse the number of blocks |
3 | * | 3 | * |
4 | * Copyright (C) 2004,2005 Theodore Ts'o <tytso@mit.edu> | 4 | * Copyright (C) 2004,2005 Theodore Ts'o <tytso@mit.edu> |
5 | * | 5 | * |
6 | * This file can be redistributed under the terms of the GNU Library General | 6 | * This file can be redistributed under the terms of the GNU Library General |
7 | * Public License | 7 | * Public License |
8 | */ | 8 | */ |
@@ -18,25 +18,25 @@ unsigned long parse_num_blocks(const char *arg, int log_block_size) | |||
18 | 18 | ||
19 | num = strtoull(arg, &p, 0); | 19 | num = strtoull(arg, &p, 0); |
20 | 20 | ||
21 | if (p[0] && p[1]) | 21 | if (p[0] && p[1]) |
22 | return 0; | 22 | return 0; |
23 | 23 | ||
24 | switch (*p) { /* Using fall-through logic */ | 24 | switch (*p) { /* Using fall-through logic */ |
25 | case 'T': case 't': | 25 | case 'T': case 't': |
26 | num <<= 10; | 26 | num <<= 10; |
27 | case 'G': case 'g': | 27 | case 'G': case 'g': |
28 | num <<= 10; | 28 | num <<= 10; |
29 | case 'M': case 'm': | 29 | case 'M': case 'm': |
30 | num <<= 10; | 30 | num <<= 10; |
31 | case 'K': case 'k': | 31 | case 'K': case 'k': |
32 | num >>= log_block_size; | 32 | num >>= log_block_size; |
33 | break; | 33 | break; |
34 | case 's': | 34 | case 's': |
35 | num >>= 1; | 35 | num >>= 1; |
36 | break; | 36 | break; |
37 | case '\0': | 37 | case '\0': |
38 | break; | 38 | break; |
39 | default: | 39 | default: |
40 | return 0; | 40 | return 0; |
41 | } | 41 | } |
42 | return num; | 42 | return num; |
diff --git a/e2fsprogs/e2p/pf.c b/e2fsprogs/e2p/pf.c index 2194ac6bf..da8357a46 100644 --- a/e2fsprogs/e2p/pf.c +++ b/e2fsprogs/e2p/pf.c | |||
@@ -41,7 +41,7 @@ static const struct flags_name flags_array[] = { | |||
41 | { EXT2_ECOMPR_FL, "E", "Compression_Error" }, | 41 | { EXT2_ECOMPR_FL, "E", "Compression_Error" }, |
42 | #endif | 42 | #endif |
43 | { EXT3_JOURNAL_DATA_FL, "j", "Journaled_Data" }, | 43 | { EXT3_JOURNAL_DATA_FL, "j", "Journaled_Data" }, |
44 | { EXT2_INDEX_FL, "I", "Indexed_direcctory" }, | 44 | { EXT2_INDEX_FL, "I", "Indexed_direcctory" }, |
45 | { EXT2_NOTAIL_FL, "t", "No_Tailmerging" }, | 45 | { EXT2_NOTAIL_FL, "t", "No_Tailmerging" }, |
46 | { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" }, | 46 | { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" }, |
47 | { 0, NULL, NULL } | 47 | { 0, NULL, NULL } |
diff --git a/e2fsprogs/e2p/uuid.c b/e2fsprogs/e2p/uuid.c index 9feca4cfa..cb4ec8072 100644 --- a/e2fsprogs/e2p/uuid.c +++ b/e2fsprogs/e2p/uuid.c | |||
@@ -19,7 +19,7 @@ struct uuid { | |||
19 | /* Returns 1 if the uuid is the NULL uuid */ | 19 | /* Returns 1 if the uuid is the NULL uuid */ |
20 | int e2p_is_null_uuid(void *uu) | 20 | int e2p_is_null_uuid(void *uu) |
21 | { | 21 | { |
22 | __u8 *cp; | 22 | __u8 *cp; |
23 | int i; | 23 | int i; |
24 | 24 | ||
25 | for (i=0, cp = uu; i < 16; i++) | 25 | for (i=0, cp = uu; i < 16; i++) |
@@ -42,7 +42,7 @@ static void e2p_unpack_uuid(void *in, struct uuid *uu) | |||
42 | tmp = *ptr++; | 42 | tmp = *ptr++; |
43 | tmp = (tmp << 8) | *ptr++; | 43 | tmp = (tmp << 8) | *ptr++; |
44 | uu->time_mid = tmp; | 44 | uu->time_mid = tmp; |
45 | 45 | ||
46 | tmp = *ptr++; | 46 | tmp = *ptr++; |
47 | tmp = (tmp << 8) | *ptr++; | 47 | tmp = (tmp << 8) | *ptr++; |
48 | uu->time_hi_and_version = tmp; | 48 | uu->time_hi_and_version = tmp; |
diff --git a/e2fsprogs/ext2fs/alloc.c b/e2fsprogs/ext2fs/alloc.c index 7385123b8..d56ef2566 100644 --- a/e2fsprogs/ext2fs/alloc.c +++ b/e2fsprogs/ext2fs/alloc.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
9 | * %End-Header% | 9 | * %End-Header% |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <stdio.h> | 13 | #include <stdio.h> |
@@ -32,7 +32,7 @@ | |||
32 | * | 32 | * |
33 | * Should have a special policy for directories. | 33 | * Should have a special policy for directories. |
34 | */ | 34 | */ |
35 | errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, | 35 | errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, |
36 | int mode EXT2FS_ATTR((unused)), | 36 | int mode EXT2FS_ATTR((unused)), |
37 | ext2fs_inode_bitmap map, ext2_ino_t *ret) | 37 | ext2fs_inode_bitmap map, ext2_ino_t *ret) |
38 | { | 38 | { |
@@ -41,13 +41,13 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, | |||
41 | ext2_ino_t start_inode; | 41 | ext2_ino_t start_inode; |
42 | 42 | ||
43 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 43 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
44 | 44 | ||
45 | if (!map) | 45 | if (!map) |
46 | map = fs->inode_map; | 46 | map = fs->inode_map; |
47 | if (!map) | 47 | if (!map) |
48 | return EXT2_ET_NO_INODE_BITMAP; | 48 | return EXT2_ET_NO_INODE_BITMAP; |
49 | 49 | ||
50 | if (dir > 0) | 50 | if (dir > 0) |
51 | dir_group = (dir - 1) / EXT2_INODES_PER_GROUP(fs->super); | 51 | dir_group = (dir - 1) / EXT2_INODES_PER_GROUP(fs->super); |
52 | 52 | ||
53 | start_inode = (dir_group * EXT2_INODES_PER_GROUP(fs->super)) + 1; | 53 | 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, | |||
62 | if (i > fs->super->s_inodes_count) | 62 | if (i > fs->super->s_inodes_count) |
63 | i = EXT2_FIRST_INODE(fs->super); | 63 | i = EXT2_FIRST_INODE(fs->super); |
64 | } while (i != start_inode); | 64 | } while (i != start_inode); |
65 | 65 | ||
66 | if (ext2fs_test_inode_bitmap(map, i)) | 66 | if (ext2fs_test_inode_bitmap(map, i)) |
67 | return EXT2_ET_INODE_ALLOC_FAIL; | 67 | return EXT2_ET_INODE_ALLOC_FAIL; |
68 | *ret = i; | 68 | *ret = i; |
@@ -131,7 +131,7 @@ errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, | |||
131 | retval = io_channel_write_blk(fs->io, block, 1, block_buf); | 131 | retval = io_channel_write_blk(fs->io, block, 1, block_buf); |
132 | if (retval) | 132 | if (retval) |
133 | goto fail; | 133 | goto fail; |
134 | 134 | ||
135 | ext2fs_block_alloc_stats(fs, block, +1); | 135 | ext2fs_block_alloc_stats(fs, block, +1); |
136 | *ret = block; | 136 | *ret = block; |
137 | return 0; | 137 | return 0; |
diff --git a/e2fsprogs/ext2fs/alloc_sb.c b/e2fsprogs/ext2fs/alloc_sb.c index ef40b938f..aa2cd0568 100644 --- a/e2fsprogs/ext2fs/alloc_sb.c +++ b/e2fsprogs/ext2fs/alloc_sb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * alloc_sb.c --- Allocate the superblock and block group descriptors for a | 2 | * alloc_sb.c --- Allocate the superblock and block group descriptors for a |
3 | * newly initialized filesystem. Used by mke2fs when initializing a filesystem | 3 | * newly initialized filesystem. Used by mke2fs when initializing a filesystem |
4 | * | 4 | * |
5 | * Copyright (C) 1994, 1995, 1996, 2003 Theodore Ts'o. | 5 | * Copyright (C) 1994, 1995, 1996, 2003 Theodore Ts'o. |
@@ -27,20 +27,20 @@ | |||
27 | #include "ext2_fs.h" | 27 | #include "ext2_fs.h" |
28 | #include "ext2fs.h" | 28 | #include "ext2fs.h" |
29 | 29 | ||
30 | int ext2fs_reserve_super_and_bgd(ext2_filsys fs, | 30 | int ext2fs_reserve_super_and_bgd(ext2_filsys fs, |
31 | dgrp_t group, | 31 | dgrp_t group, |
32 | ext2fs_block_bitmap bmap) | 32 | ext2fs_block_bitmap bmap) |
33 | { | 33 | { |
34 | blk_t super_blk, old_desc_blk, new_desc_blk; | 34 | blk_t super_blk, old_desc_blk, new_desc_blk; |
35 | int j, old_desc_blocks, num_blocks; | 35 | int j, old_desc_blocks, num_blocks; |
36 | 36 | ||
37 | num_blocks = ext2fs_super_and_bgd_loc(fs, group, &super_blk, | 37 | num_blocks = ext2fs_super_and_bgd_loc(fs, group, &super_blk, |
38 | &old_desc_blk, &new_desc_blk, 0); | 38 | &old_desc_blk, &new_desc_blk, 0); |
39 | 39 | ||
40 | if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) | 40 | if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) |
41 | old_desc_blocks = fs->super->s_first_meta_bg; | 41 | old_desc_blocks = fs->super->s_first_meta_bg; |
42 | else | 42 | else |
43 | old_desc_blocks = | 43 | old_desc_blocks = |
44 | fs->desc_blocks + fs->super->s_reserved_gdt_blocks; | 44 | fs->desc_blocks + fs->super->s_reserved_gdt_blocks; |
45 | 45 | ||
46 | if (super_blk || (group == 0)) | 46 | if (super_blk || (group == 0)) |
diff --git a/e2fsprogs/ext2fs/alloc_stats.c b/e2fsprogs/ext2fs/alloc_stats.c index 4088f7b87..32aa0b6bc 100644 --- a/e2fsprogs/ext2fs/alloc_stats.c +++ b/e2fsprogs/ext2fs/alloc_stats.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
9 | * %End-Header% | 9 | * %End-Header% |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <stdio.h> | 13 | #include <stdio.h> |
diff --git a/e2fsprogs/ext2fs/alloc_tables.c b/e2fsprogs/ext2fs/alloc_tables.c index 0326321be..10f1f95a4 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, | |||
36 | 36 | ||
37 | group_blk = fs->super->s_first_data_block + | 37 | group_blk = fs->super->s_first_data_block + |
38 | (group * fs->super->s_blocks_per_group); | 38 | (group * fs->super->s_blocks_per_group); |
39 | 39 | ||
40 | last_blk = group_blk + fs->super->s_blocks_per_group; | 40 | last_blk = group_blk + fs->super->s_blocks_per_group; |
41 | if (last_blk >= fs->super->s_blocks_count) | 41 | if (last_blk >= fs->super->s_blocks_count) |
42 | last_blk = fs->super->s_blocks_count - 1; | 42 | last_blk = fs->super->s_blocks_count - 1; |
43 | 43 | ||
44 | if (!bmap) | 44 | if (!bmap) |
45 | bmap = fs->block_map; | 45 | bmap = fs->block_map; |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * Allocate the block and inode bitmaps, if necessary | 48 | * Allocate the block and inode bitmaps, if necessary |
49 | */ | 49 | */ |
@@ -59,7 +59,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, | |||
59 | if (!fs->group_desc[group].bg_block_bitmap) { | 59 | if (!fs->group_desc[group].bg_block_bitmap) { |
60 | retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, | 60 | retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, |
61 | 1, bmap, &new_blk); | 61 | 1, bmap, &new_blk); |
62 | if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) | 62 | if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) |
63 | retval = ext2fs_get_free_blocks(fs, group_blk, | 63 | retval = ext2fs_get_free_blocks(fs, group_blk, |
64 | last_blk, 1, bmap, &new_blk); | 64 | last_blk, 1, bmap, &new_blk); |
65 | if (retval) | 65 | if (retval) |
@@ -71,7 +71,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, | |||
71 | if (!fs->group_desc[group].bg_inode_bitmap) { | 71 | if (!fs->group_desc[group].bg_inode_bitmap) { |
72 | retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, | 72 | retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, |
73 | 1, bmap, &new_blk); | 73 | 1, bmap, &new_blk); |
74 | if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) | 74 | if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) |
75 | retval = ext2fs_get_free_blocks(fs, group_blk, | 75 | retval = ext2fs_get_free_blocks(fs, group_blk, |
76 | last_blk, 1, bmap, &new_blk); | 76 | last_blk, 1, bmap, &new_blk); |
77 | if (retval) | 77 | if (retval) |
@@ -96,11 +96,11 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, | |||
96 | fs->group_desc[group].bg_inode_table = new_blk; | 96 | fs->group_desc[group].bg_inode_table = new_blk; |
97 | } | 97 | } |
98 | 98 | ||
99 | 99 | ||
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | 104 | ||
105 | errcode_t ext2fs_allocate_tables(ext2_filsys fs) | 105 | errcode_t ext2fs_allocate_tables(ext2_filsys fs) |
106 | { | 106 | { |
diff --git a/e2fsprogs/ext2fs/badblocks.c b/e2fsprogs/ext2fs/badblocks.c index 4b76ef032..d82041126 100644 --- a/e2fsprogs/ext2fs/badblocks.c +++ b/e2fsprogs/ext2fs/badblocks.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * badblocks.c --- routines to manipulate the bad block structure | 2 | * badblocks.c --- routines to manipulate the bad block structure |
3 | * | 3 | * |
4 | * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -34,7 +34,7 @@ static errcode_t make_u32_list(int size, int num, __u32 *list, | |||
34 | { | 34 | { |
35 | ext2_u32_list bb; | 35 | ext2_u32_list bb; |
36 | errcode_t retval; | 36 | errcode_t retval; |
37 | 37 | ||
38 | retval = ext2fs_get_mem(sizeof(struct ext2_struct_u32_list), &bb); | 38 | retval = ext2fs_get_mem(sizeof(struct ext2_struct_u32_list), &bb); |
39 | if (retval) | 39 | if (retval) |
40 | return retval; | 40 | return retval; |
@@ -54,7 +54,7 @@ static errcode_t make_u32_list(int size, int num, __u32 *list, | |||
54 | *ret = bb; | 54 | *ret = bb; |
55 | return 0; | 55 | return 0; |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | /* | 59 | /* |
60 | * This procedure creates an empty u32 list. | 60 | * This procedure creates an empty u32 list. |
@@ -79,7 +79,7 @@ errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret, int size) | |||
79 | errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest) | 79 | errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest) |
80 | { | 80 | { |
81 | errcode_t retval; | 81 | errcode_t retval; |
82 | 82 | ||
83 | retval = make_u32_list(src->size, src->num, src->list, dest); | 83 | retval = make_u32_list(src->size, src->num, src->list, dest); |
84 | if (retval) | 84 | if (retval) |
85 | return retval; | 85 | return retval; |
@@ -271,11 +271,11 @@ int ext2fs_u32_list_iterate(ext2_u32_iterate iter, __u32 *blk) | |||
271 | 271 | ||
272 | if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) | 272 | if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) |
273 | return 0; | 273 | return 0; |
274 | 274 | ||
275 | if (iter->ptr < bb->num) { | 275 | if (iter->ptr < bb->num) { |
276 | *blk = bb->list[iter->ptr++]; | 276 | *blk = bb->list[iter->ptr++]; |
277 | return 1; | 277 | return 1; |
278 | } | 278 | } |
279 | *blk = 0; | 279 | *blk = 0; |
280 | return 0; | 280 | return 0; |
281 | } | 281 | } |
diff --git a/e2fsprogs/ext2fs/bb_compat.c b/e2fsprogs/ext2fs/bb_compat.c index 40f734368..5a158b34c 100644 --- a/e2fsprogs/ext2fs/bb_compat.c +++ b/e2fsprogs/ext2fs/bb_compat.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * bb_compat.c --- compatibility badblocks routines | 2 | * bb_compat.c --- compatibility badblocks routines |
3 | * | 3 | * |
4 | * Copyright (C) 1997 Theodore Ts'o. | 4 | * Copyright (C) 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
diff --git a/e2fsprogs/ext2fs/bb_inode.c b/e2fsprogs/ext2fs/bb_inode.c index dd8e7c319..9af117d8f 100644 --- a/e2fsprogs/ext2fs/bb_inode.c +++ b/e2fsprogs/ext2fs/bb_inode.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * bb_inode.c --- routines to update the bad block inode. | 2 | * bb_inode.c --- routines to update the bad block inode. |
3 | * | 3 | * |
4 | * WARNING: This routine modifies a lot of state in the filesystem; if | 4 | * WARNING: This routine modifies a lot of state in the filesystem; if |
5 | * this routine returns an error, the bad block inode may be in an | 5 | * this routine returns an error, the bad block inode may be in an |
6 | * inconsistent state. | 6 | * inconsistent state. |
7 | * | 7 | * |
8 | * Copyright (C) 1994, 1995 Theodore Ts'o. | 8 | * Copyright (C) 1994, 1995 Theodore Ts'o. |
9 | * | 9 | * |
10 | * %Begin-Header% | 10 | * %Begin-Header% |
11 | * This file may be redistributed under the terms of the GNU Public | 11 | * This file may be redistributed under the terms of the GNU Public |
12 | * License. | 12 | * License. |
@@ -49,7 +49,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, | |||
49 | e2_blkcnt_t blockcnt, | 49 | e2_blkcnt_t blockcnt, |
50 | blk_t ref_block, int ref_offset, | 50 | blk_t ref_block, int ref_offset, |
51 | void *priv_data); | 51 | void *priv_data); |
52 | 52 | ||
53 | /* | 53 | /* |
54 | * Given a bad blocks bitmap, update the bad blocks inode to reflect | 54 | * Given a bad blocks bitmap, update the bad blocks inode to reflect |
55 | * the map. | 55 | * the map. |
@@ -57,14 +57,14 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, | |||
57 | errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) | 57 | errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) |
58 | { | 58 | { |
59 | errcode_t retval; | 59 | errcode_t retval; |
60 | struct set_badblock_record rec; | 60 | struct set_badblock_record rec; |
61 | struct ext2_inode inode; | 61 | struct ext2_inode inode; |
62 | 62 | ||
63 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 63 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
64 | 64 | ||
65 | if (!fs->block_map) | 65 | if (!fs->block_map) |
66 | return EXT2_ET_NO_BLOCK_BITMAP; | 66 | return EXT2_ET_NO_BLOCK_BITMAP; |
67 | 67 | ||
68 | rec.bad_block_count = 0; | 68 | rec.bad_block_count = 0; |
69 | rec.ind_blocks_size = rec.ind_blocks_ptr = 0; | 69 | rec.ind_blocks_size = rec.ind_blocks_ptr = 0; |
70 | rec.max_ind_blocks = 10; | 70 | rec.max_ind_blocks = 10; |
@@ -78,9 +78,9 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) | |||
78 | goto cleanup; | 78 | goto cleanup; |
79 | memset(rec.block_buf, 0, fs->blocksize); | 79 | memset(rec.block_buf, 0, fs->blocksize); |
80 | rec.err = 0; | 80 | rec.err = 0; |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * First clear the old bad blocks (while saving the indirect blocks) | 83 | * First clear the old bad blocks (while saving the indirect blocks) |
84 | */ | 84 | */ |
85 | retval = ext2fs_block_iterate2(fs, EXT2_BAD_INO, | 85 | retval = ext2fs_block_iterate2(fs, EXT2_BAD_INO, |
86 | BLOCK_FLAG_DEPTH_TRAVERSE, 0, | 86 | BLOCK_FLAG_DEPTH_TRAVERSE, 0, |
@@ -91,7 +91,7 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) | |||
91 | retval = rec.err; | 91 | retval = rec.err; |
92 | goto cleanup; | 92 | goto cleanup; |
93 | } | 93 | } |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * Now set the bad blocks! | 96 | * Now set the bad blocks! |
97 | * | 97 | * |
@@ -108,22 +108,22 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) | |||
108 | BLOCK_FLAG_APPEND, 0, | 108 | BLOCK_FLAG_APPEND, 0, |
109 | set_bad_block_proc, &rec); | 109 | set_bad_block_proc, &rec); |
110 | ext2fs_badblocks_list_iterate_end(rec.bb_iter); | 110 | ext2fs_badblocks_list_iterate_end(rec.bb_iter); |
111 | if (retval) | 111 | if (retval) |
112 | goto cleanup; | 112 | goto cleanup; |
113 | if (rec.err) { | 113 | if (rec.err) { |
114 | retval = rec.err; | 114 | retval = rec.err; |
115 | goto cleanup; | 115 | goto cleanup; |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | /* | 119 | /* |
120 | * Update the bad block inode's mod time and block count | 120 | * Update the bad block inode's mod time and block count |
121 | * field. | 121 | * field. |
122 | */ | 122 | */ |
123 | retval = ext2fs_read_inode(fs, EXT2_BAD_INO, &inode); | 123 | retval = ext2fs_read_inode(fs, EXT2_BAD_INO, &inode); |
124 | if (retval) | 124 | if (retval) |
125 | goto cleanup; | 125 | goto cleanup; |
126 | 126 | ||
127 | inode.i_atime = inode.i_mtime = time(0); | 127 | inode.i_atime = inode.i_mtime = time(0); |
128 | if (!inode.i_ctime) | 128 | if (!inode.i_ctime) |
129 | inode.i_ctime = time(0); | 129 | inode.i_ctime = time(0); |
@@ -133,7 +133,7 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) | |||
133 | retval = ext2fs_write_inode(fs, EXT2_BAD_INO, &inode); | 133 | retval = ext2fs_write_inode(fs, EXT2_BAD_INO, &inode); |
134 | if (retval) | 134 | if (retval) |
135 | goto cleanup; | 135 | goto cleanup; |
136 | 136 | ||
137 | cleanup: | 137 | cleanup: |
138 | ext2fs_free_mem(&rec.ind_blocks); | 138 | ext2fs_free_mem(&rec.ind_blocks); |
139 | ext2fs_free_mem(&rec.block_buf); | 139 | ext2fs_free_mem(&rec.block_buf); |
@@ -158,7 +158,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, | |||
158 | struct set_badblock_record *rec = (struct set_badblock_record *) | 158 | struct set_badblock_record *rec = (struct set_badblock_record *) |
159 | priv_data; | 159 | priv_data; |
160 | errcode_t retval; | 160 | errcode_t retval; |
161 | unsigned long old_size; | 161 | unsigned long old_size; |
162 | 162 | ||
163 | if (!*block_nr) | 163 | if (!*block_nr) |
164 | return 0; | 164 | return 0; |
@@ -176,7 +176,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, | |||
176 | if (rec->ind_blocks_size >= rec->max_ind_blocks) { | 176 | if (rec->ind_blocks_size >= rec->max_ind_blocks) { |
177 | old_size = rec->max_ind_blocks * sizeof(blk_t); | 177 | old_size = rec->max_ind_blocks * sizeof(blk_t); |
178 | rec->max_ind_blocks += 10; | 178 | rec->max_ind_blocks += 10; |
179 | retval = ext2fs_resize_mem(old_size, | 179 | retval = ext2fs_resize_mem(old_size, |
180 | rec->max_ind_blocks * sizeof(blk_t), | 180 | rec->max_ind_blocks * sizeof(blk_t), |
181 | &rec->ind_blocks); | 181 | &rec->ind_blocks); |
182 | if (retval) { | 182 | if (retval) { |
@@ -192,12 +192,12 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, | |||
192 | * Mark the block as unused, and update accounting information | 192 | * Mark the block as unused, and update accounting information |
193 | */ | 193 | */ |
194 | ext2fs_block_alloc_stats(fs, *block_nr, -1); | 194 | ext2fs_block_alloc_stats(fs, *block_nr, -1); |
195 | 195 | ||
196 | *block_nr = 0; | 196 | *block_nr = 0; |
197 | return BLOCK_CHANGED; | 197 | return BLOCK_CHANGED; |
198 | } | 198 | } |
199 | 199 | ||
200 | 200 | ||
201 | /* | 201 | /* |
202 | * Helper function for update_bb_inode() | 202 | * Helper function for update_bb_inode() |
203 | * | 203 | * |
@@ -250,12 +250,12 @@ static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr, | |||
250 | return BLOCK_ABORT; | 250 | return BLOCK_ABORT; |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | /* | 254 | /* |
255 | * Update block counts | 255 | * Update block counts |
256 | */ | 256 | */ |
257 | ext2fs_block_alloc_stats(fs, blk, +1); | 257 | ext2fs_block_alloc_stats(fs, blk, +1); |
258 | 258 | ||
259 | *block_nr = blk; | 259 | *block_nr = blk; |
260 | return BLOCK_CHANGED; | 260 | return BLOCK_CHANGED; |
261 | } | 261 | } |
diff --git a/e2fsprogs/ext2fs/bitmaps.c b/e2fsprogs/ext2fs/bitmaps.c index 7edd28d7b..932c345fa 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, | |||
35 | errcode_t retval; | 35 | errcode_t retval; |
36 | size_t size; | 36 | size_t size; |
37 | 37 | ||
38 | retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap), | 38 | retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap), |
39 | &bitmap); | 39 | &bitmap); |
40 | if (retval) | 40 | if (retval) |
41 | return retval; | 41 | return retval; |
@@ -106,7 +106,7 @@ void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map) | |||
106 | ext2fs_set_bit(j, map->bitmap); | 106 | ext2fs_set_bit(j, map->bitmap); |
107 | 107 | ||
108 | return; | 108 | return; |
109 | } | 109 | } |
110 | 110 | ||
111 | errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, | 111 | errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, |
112 | const char *descr, | 112 | const char *descr, |
@@ -128,11 +128,11 @@ errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, | |||
128 | descr, &bitmap); | 128 | descr, &bitmap); |
129 | if (retval) | 129 | if (retval) |
130 | return retval; | 130 | return retval; |
131 | 131 | ||
132 | bitmap->magic = EXT2_ET_MAGIC_INODE_BITMAP; | 132 | bitmap->magic = EXT2_ET_MAGIC_INODE_BITMAP; |
133 | bitmap->fs = fs; | 133 | bitmap->fs = fs; |
134 | bitmap->base_error_code = EXT2_ET_BAD_INODE_MARK; | 134 | bitmap->base_error_code = EXT2_ET_BAD_INODE_MARK; |
135 | 135 | ||
136 | *ret = bitmap; | 136 | *ret = bitmap; |
137 | return 0; | 137 | return 0; |
138 | } | 138 | } |
@@ -151,9 +151,9 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, | |||
151 | 151 | ||
152 | start = fs->super->s_first_data_block; | 152 | start = fs->super->s_first_data_block; |
153 | end = fs->super->s_blocks_count-1; | 153 | end = fs->super->s_blocks_count-1; |
154 | real_end = (EXT2_BLOCKS_PER_GROUP(fs->super) | 154 | real_end = (EXT2_BLOCKS_PER_GROUP(fs->super) |
155 | * fs->group_desc_count)-1 + start; | 155 | * fs->group_desc_count)-1 + start; |
156 | 156 | ||
157 | retval = ext2fs_allocate_generic_bitmap(start, end, real_end, | 157 | retval = ext2fs_allocate_generic_bitmap(start, end, real_end, |
158 | descr, &bitmap); | 158 | descr, &bitmap); |
159 | if (retval) | 159 | if (retval) |
@@ -162,7 +162,7 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, | |||
162 | bitmap->magic = EXT2_ET_MAGIC_BLOCK_BITMAP; | 162 | bitmap->magic = EXT2_ET_MAGIC_BLOCK_BITMAP; |
163 | bitmap->fs = fs; | 163 | bitmap->fs = fs; |
164 | bitmap->base_error_code = EXT2_ET_BAD_BLOCK_MARK; | 164 | bitmap->base_error_code = EXT2_ET_BAD_BLOCK_MARK; |
165 | 165 | ||
166 | *ret = bitmap; | 166 | *ret = bitmap; |
167 | return 0; | 167 | return 0; |
168 | } | 168 | } |
@@ -171,7 +171,7 @@ errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap, | |||
171 | ext2_ino_t end, ext2_ino_t *oend) | 171 | ext2_ino_t end, ext2_ino_t *oend) |
172 | { | 172 | { |
173 | EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_INODE_BITMAP); | 173 | EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_INODE_BITMAP); |
174 | 174 | ||
175 | if (end > bitmap->real_end) | 175 | if (end > bitmap->real_end) |
176 | return EXT2_ET_FUDGE_INODE_BITMAP_END; | 176 | return EXT2_ET_FUDGE_INODE_BITMAP_END; |
177 | if (oend) | 177 | if (oend) |
@@ -184,7 +184,7 @@ errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap, | |||
184 | blk_t end, blk_t *oend) | 184 | blk_t end, blk_t *oend) |
185 | { | 185 | { |
186 | EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_BLOCK_BITMAP); | 186 | EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_BLOCK_BITMAP); |
187 | 187 | ||
188 | if (end > bitmap->real_end) | 188 | if (end > bitmap->real_end) |
189 | return EXT2_ET_FUDGE_BLOCK_BITMAP_END; | 189 | return EXT2_ET_FUDGE_BLOCK_BITMAP_END; |
190 | if (oend) | 190 | if (oend) |
diff --git a/e2fsprogs/ext2fs/bitops.c b/e2fsprogs/ext2fs/bitops.c index 207c44d92..e44e10cf4 100644 --- a/e2fsprogs/ext2fs/bitops.c +++ b/e2fsprogs/ext2fs/bitops.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * bitops.c --- Bitmap frobbing code. See bitops.h for the inlined | 2 | * bitops.c --- Bitmap frobbing code. See bitops.h for the inlined |
3 | * routines. | 3 | * routines. |
4 | * | 4 | * |
5 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 5 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
diff --git a/e2fsprogs/ext2fs/bitops.h b/e2fsprogs/ext2fs/bitops.h index b6446efa2..4dba050c8 100644 --- a/e2fsprogs/ext2fs/bitops.h +++ b/e2fsprogs/ext2fs/bitops.h | |||
@@ -1,14 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * bitops.h --- Bitmap frobbing code. The byte swapping routines are | 2 | * bitops.h --- Bitmap frobbing code. The byte swapping routines are |
3 | * also included here. | 3 | * also included here. |
4 | * | 4 | * |
5 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 5 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
8 | * This file may be redistributed under the terms of the GNU Public | 8 | * This file may be redistributed under the terms of the GNU Public |
9 | * License. | 9 | * License. |
10 | * %End-Header% | 10 | * %End-Header% |
11 | * | 11 | * |
12 | * i386 bitops operations taken from <asm/bitops.h>, Copyright 1992, | 12 | * i386 bitops operations taken from <asm/bitops.h>, Copyright 1992, |
13 | * Linus Torvalds. | 13 | * Linus Torvalds. |
14 | */ | 14 | */ |
diff --git a/e2fsprogs/ext2fs/block.c b/e2fsprogs/ext2fs/block.c index 7685680df..18be2a5e8 100644 --- a/e2fsprogs/ext2fs/block.c +++ b/e2fsprogs/ext2fs/block.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * block.c --- iterate over all blocks in an inode | 2 | * block.c --- iterate over all blocks in an inode |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -59,7 +59,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, | |||
59 | ret |= BLOCK_ERROR; | 59 | ret |= BLOCK_ERROR; |
60 | return ret; | 60 | return ret; |
61 | } | 61 | } |
62 | ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block, | 62 | ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block, |
63 | ctx->ind_buf); | 63 | ctx->ind_buf); |
64 | if (ctx->errcode) { | 64 | if (ctx->errcode) { |
65 | ret |= BLOCK_ERROR; | 65 | ret |= BLOCK_ERROR; |
@@ -71,7 +71,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, | |||
71 | if (ctx->flags & BLOCK_FLAG_APPEND) { | 71 | if (ctx->flags & BLOCK_FLAG_APPEND) { |
72 | for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) { | 72 | for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) { |
73 | flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount, | 73 | flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount, |
74 | *ind_block, offset, | 74 | *ind_block, offset, |
75 | ctx->priv_data); | 75 | ctx->priv_data); |
76 | changed |= flags; | 76 | changed |= flags; |
77 | if (flags & BLOCK_ABORT) { | 77 | if (flags & BLOCK_ABORT) { |
@@ -85,7 +85,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, | |||
85 | if (*block_nr == 0) | 85 | if (*block_nr == 0) |
86 | continue; | 86 | continue; |
87 | flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount, | 87 | flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount, |
88 | *ind_block, offset, | 88 | *ind_block, offset, |
89 | ctx->priv_data); | 89 | ctx->priv_data); |
90 | changed |= flags; | 90 | changed |= flags; |
91 | if (flags & BLOCK_ABORT) { | 91 | if (flags & BLOCK_ABORT) { |
@@ -109,7 +109,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, | |||
109 | ref_offset, ctx->priv_data); | 109 | ref_offset, ctx->priv_data); |
110 | return ret; | 110 | return ret; |
111 | } | 111 | } |
112 | 112 | ||
113 | static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, | 113 | static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, |
114 | int ref_offset, struct block_context *ctx) | 114 | int ref_offset, struct block_context *ctx) |
115 | { | 115 | { |
@@ -133,7 +133,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, | |||
133 | ret |= BLOCK_ERROR; | 133 | ret |= BLOCK_ERROR; |
134 | return ret; | 134 | return ret; |
135 | } | 135 | } |
136 | ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block, | 136 | ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block, |
137 | ctx->dind_buf); | 137 | ctx->dind_buf); |
138 | if (ctx->errcode) { | 138 | if (ctx->errcode) { |
139 | ret |= BLOCK_ERROR; | 139 | ret |= BLOCK_ERROR; |
@@ -185,7 +185,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, | |||
185 | ref_offset, ctx->priv_data); | 185 | ref_offset, ctx->priv_data); |
186 | return ret; | 186 | return ret; |
187 | } | 187 | } |
188 | 188 | ||
189 | static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, | 189 | static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, |
190 | int ref_offset, struct block_context *ctx) | 190 | int ref_offset, struct block_context *ctx) |
191 | { | 191 | { |
@@ -209,7 +209,7 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, | |||
209 | ret |= BLOCK_ERROR; | 209 | ret |= BLOCK_ERROR; |
210 | return ret; | 210 | return ret; |
211 | } | 211 | } |
212 | ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block, | 212 | ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block, |
213 | ctx->tind_buf); | 213 | ctx->tind_buf); |
214 | if (ctx->errcode) { | 214 | if (ctx->errcode) { |
215 | ret |= BLOCK_ERROR; | 215 | ret |= BLOCK_ERROR; |
@@ -259,10 +259,10 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, | |||
259 | ret |= (*ctx->func)(ctx->fs, tind_block, | 259 | ret |= (*ctx->func)(ctx->fs, tind_block, |
260 | BLOCK_COUNT_TIND, ref_block, | 260 | BLOCK_COUNT_TIND, ref_block, |
261 | ref_offset, ctx->priv_data); | 261 | ref_offset, ctx->priv_data); |
262 | 262 | ||
263 | return ret; | 263 | return ret; |
264 | } | 264 | } |
265 | 265 | ||
266 | errcode_t ext2fs_block_iterate2(ext2_filsys fs, | 266 | errcode_t ext2fs_block_iterate2(ext2_filsys fs, |
267 | ext2_ino_t ino, | 267 | ext2_ino_t ino, |
268 | int flags, | 268 | int flags, |
@@ -338,7 +338,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, | |||
338 | goto abort_exit; | 338 | goto abort_exit; |
339 | } | 339 | } |
340 | } | 340 | } |
341 | 341 | ||
342 | /* | 342 | /* |
343 | * Iterate over normal data blocks | 343 | * Iterate over normal data blocks |
344 | */ | 344 | */ |
@@ -427,7 +427,7 @@ errcode_t ext2fs_block_iterate(ext2_filsys fs, | |||
427 | void *priv_data) | 427 | void *priv_data) |
428 | { | 428 | { |
429 | struct xlate xl; | 429 | struct xlate xl; |
430 | 430 | ||
431 | xl.real_private = priv_data; | 431 | xl.real_private = priv_data; |
432 | xl.func = func; | 432 | xl.func = func; |
433 | 433 | ||
diff --git a/e2fsprogs/ext2fs/bmap.c b/e2fsprogs/ext2fs/bmap.c index e84004476..45d49f929 100644 --- a/e2fsprogs/ext2fs/bmap.c +++ b/e2fsprogs/ext2fs/bmap.c | |||
@@ -25,14 +25,14 @@ | |||
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, | 27 | extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, |
28 | struct ext2_inode *inode, | 28 | struct ext2_inode *inode, |
29 | char *block_buf, int bmap_flags, | 29 | char *block_buf, int bmap_flags, |
30 | blk_t block, blk_t *phys_blk); | 30 | blk_t block, blk_t *phys_blk); |
31 | 31 | ||
32 | #define inode_bmap(inode, nr) ((inode)->i_block[(nr)]) | 32 | #define inode_bmap(inode, nr) ((inode)->i_block[(nr)]) |
33 | 33 | ||
34 | static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, | 34 | static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, |
35 | blk_t ind, char *block_buf, | 35 | blk_t ind, char *block_buf, |
36 | int *blocks_alloc, | 36 | int *blocks_alloc, |
37 | blk_t nr, blk_t *ret_blk) | 37 | blk_t nr, blk_t *ret_blk) |
38 | { | 38 | { |
@@ -95,17 +95,17 @@ static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, | |||
95 | } | 95 | } |
96 | 96 | ||
97 | static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags, | 97 | static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags, |
98 | blk_t dind, char *block_buf, | 98 | blk_t dind, char *block_buf, |
99 | int *blocks_alloc, | 99 | int *blocks_alloc, |
100 | blk_t nr, blk_t *ret_blk) | 100 | blk_t nr, blk_t *ret_blk) |
101 | { | 101 | { |
102 | blk_t b; | 102 | blk_t b; |
103 | errcode_t retval; | 103 | errcode_t retval; |
104 | blk_t addr_per_block; | 104 | blk_t addr_per_block; |
105 | 105 | ||
106 | addr_per_block = (blk_t) fs->blocksize >> 2; | 106 | addr_per_block = (blk_t) fs->blocksize >> 2; |
107 | 107 | ||
108 | retval = block_ind_bmap(fs, flags & ~BMAP_SET, dind, block_buf, | 108 | retval = block_ind_bmap(fs, flags & ~BMAP_SET, dind, block_buf, |
109 | blocks_alloc, nr / addr_per_block, &b); | 109 | blocks_alloc, nr / addr_per_block, &b); |
110 | if (retval) | 110 | if (retval) |
111 | return retval; | 111 | return retval; |
@@ -115,17 +115,17 @@ static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags, | |||
115 | } | 115 | } |
116 | 116 | ||
117 | static _BMAP_INLINE_ errcode_t block_tind_bmap(ext2_filsys fs, int flags, | 117 | static _BMAP_INLINE_ errcode_t block_tind_bmap(ext2_filsys fs, int flags, |
118 | blk_t tind, char *block_buf, | 118 | blk_t tind, char *block_buf, |
119 | int *blocks_alloc, | 119 | int *blocks_alloc, |
120 | blk_t nr, blk_t *ret_blk) | 120 | blk_t nr, blk_t *ret_blk) |
121 | { | 121 | { |
122 | blk_t b; | 122 | blk_t b; |
123 | errcode_t retval; | 123 | errcode_t retval; |
124 | blk_t addr_per_block; | 124 | blk_t addr_per_block; |
125 | 125 | ||
126 | addr_per_block = (blk_t) fs->blocksize >> 2; | 126 | addr_per_block = (blk_t) fs->blocksize >> 2; |
127 | 127 | ||
128 | retval = block_dind_bmap(fs, flags & ~BMAP_SET, tind, block_buf, | 128 | retval = block_dind_bmap(fs, flags & ~BMAP_SET, tind, block_buf, |
129 | blocks_alloc, nr / addr_per_block, &b); | 129 | blocks_alloc, nr / addr_per_block, &b); |
130 | if (retval) | 130 | if (retval) |
131 | return retval; | 131 | return retval; |
@@ -179,7 +179,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, | |||
179 | 179 | ||
180 | *phys_blk = inode_bmap(inode, block); | 180 | *phys_blk = inode_bmap(inode, block); |
181 | b = block ? inode_bmap(inode, block-1) : 0; | 181 | b = block ? inode_bmap(inode, block-1) : 0; |
182 | 182 | ||
183 | if ((*phys_blk == 0) && (bmap_flags & BMAP_ALLOC)) { | 183 | if ((*phys_blk == 0) && (bmap_flags & BMAP_ALLOC)) { |
184 | retval = ext2fs_alloc_block(fs, b, block_buf, &b); | 184 | retval = ext2fs_alloc_block(fs, b, block_buf, &b); |
185 | if (retval) | 185 | if (retval) |
@@ -190,7 +190,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, | |||
190 | } | 190 | } |
191 | goto done; | 191 | goto done; |
192 | } | 192 | } |
193 | 193 | ||
194 | /* Indirect block */ | 194 | /* Indirect block */ |
195 | block -= EXT2_NDIR_BLOCKS; | 195 | block -= EXT2_NDIR_BLOCKS; |
196 | if (block < addr_per_block) { | 196 | if (block < addr_per_block) { |
@@ -203,17 +203,17 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, | |||
203 | } | 203 | } |
204 | 204 | ||
205 | b = inode_bmap(inode, EXT2_IND_BLOCK-1); | 205 | b = inode_bmap(inode, EXT2_IND_BLOCK-1); |
206 | retval = ext2fs_alloc_block(fs, b, block_buf, &b); | 206 | retval = ext2fs_alloc_block(fs, b, block_buf, &b); |
207 | if (retval) | 207 | if (retval) |
208 | goto done; | 208 | goto done; |
209 | inode_bmap(inode, EXT2_IND_BLOCK) = b; | 209 | inode_bmap(inode, EXT2_IND_BLOCK) = b; |
210 | blocks_alloc++; | 210 | blocks_alloc++; |
211 | } | 211 | } |
212 | retval = block_ind_bmap(fs, bmap_flags, b, block_buf, | 212 | retval = block_ind_bmap(fs, bmap_flags, b, block_buf, |
213 | &blocks_alloc, block, phys_blk); | 213 | &blocks_alloc, block, phys_blk); |
214 | goto done; | 214 | goto done; |
215 | } | 215 | } |
216 | 216 | ||
217 | /* Doubly indirect block */ | 217 | /* Doubly indirect block */ |
218 | block -= addr_per_block; | 218 | block -= addr_per_block; |
219 | if (block < addr_per_block * addr_per_block) { | 219 | 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, | |||
226 | } | 226 | } |
227 | 227 | ||
228 | b = inode_bmap(inode, EXT2_IND_BLOCK); | 228 | b = inode_bmap(inode, EXT2_IND_BLOCK); |
229 | retval = ext2fs_alloc_block(fs, b, block_buf, &b); | 229 | retval = ext2fs_alloc_block(fs, b, block_buf, &b); |
230 | if (retval) | 230 | if (retval) |
231 | goto done; | 231 | goto done; |
232 | inode_bmap(inode, EXT2_DIND_BLOCK) = b; | 232 | inode_bmap(inode, EXT2_DIND_BLOCK) = b; |
233 | blocks_alloc++; | 233 | blocks_alloc++; |
234 | } | 234 | } |
235 | retval = block_dind_bmap(fs, bmap_flags, b, block_buf, | 235 | retval = block_dind_bmap(fs, bmap_flags, b, block_buf, |
236 | &blocks_alloc, block, phys_blk); | 236 | &blocks_alloc, block, phys_blk); |
237 | goto done; | 237 | goto done; |
238 | } | 238 | } |
@@ -254,7 +254,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, | |||
254 | inode_bmap(inode, EXT2_TIND_BLOCK) = b; | 254 | inode_bmap(inode, EXT2_TIND_BLOCK) = b; |
255 | blocks_alloc++; | 255 | blocks_alloc++; |
256 | } | 256 | } |
257 | retval = block_tind_bmap(fs, bmap_flags, b, block_buf, | 257 | retval = block_tind_bmap(fs, bmap_flags, b, block_buf, |
258 | &blocks_alloc, block, phys_blk); | 258 | &blocks_alloc, block, phys_blk); |
259 | done: | 259 | done: |
260 | if (buf) | 260 | if (buf) |
diff --git a/e2fsprogs/ext2fs/bmove.c b/e2fsprogs/ext2fs/bmove.c index 0b2ebb183..fb319f8c3 100644 --- a/e2fsprogs/ext2fs/bmove.c +++ b/e2fsprogs/ext2fs/bmove.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * bmove.c --- Move blocks around to make way for a particular | 2 | * bmove.c --- Move blocks around to make way for a particular |
3 | * filesystem structure. | 3 | * filesystem structure. |
4 | * | 4 | * |
5 | * Copyright (C) 1997 Theodore Ts'o. This file may be redistributed | 5 | * Copyright (C) 1997 Theodore Ts'o. This file may be redistributed |
6 | * under the terms of the GNU Public License. | 6 | * under the terms of the GNU Public License. |
@@ -44,7 +44,7 @@ static int process_block(ext2_filsys fs, blk_t *block_nr, | |||
44 | pb = (struct process_block_struct *) priv_data; | 44 | pb = (struct process_block_struct *) priv_data; |
45 | block = orig = *block_nr; | 45 | block = orig = *block_nr; |
46 | ret = 0; | 46 | ret = 0; |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Let's see if this is one which we need to relocate | 49 | * Let's see if this is one which we need to relocate |
50 | */ | 50 | */ |
@@ -98,7 +98,7 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, | |||
98 | struct process_block_struct pb; | 98 | struct process_block_struct pb; |
99 | ext2_inode_scan scan; | 99 | ext2_inode_scan scan; |
100 | char *block_buf; | 100 | char *block_buf; |
101 | 101 | ||
102 | retval = ext2fs_open_inode_scan(fs, 0, &scan); | 102 | retval = ext2fs_open_inode_scan(fs, 0, &scan); |
103 | if (retval) | 103 | if (retval) |
104 | return retval; | 104 | return retval; |
@@ -107,7 +107,7 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, | |||
107 | pb.error = 0; | 107 | pb.error = 0; |
108 | pb.alloc_map = alloc_map ? alloc_map : fs->block_map; | 108 | pb.alloc_map = alloc_map ? alloc_map : fs->block_map; |
109 | pb.flags = flags; | 109 | pb.flags = flags; |
110 | 110 | ||
111 | retval = ext2fs_get_mem(fs->blocksize * 4, &block_buf); | 111 | retval = ext2fs_get_mem(fs->blocksize * 4, &block_buf); |
112 | if (retval) | 112 | if (retval) |
113 | return retval; | 113 | return retval; |
@@ -131,12 +131,12 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, | |||
131 | retval = ext2fs_get_next_inode(scan, &ino, &inode); | 131 | retval = ext2fs_get_next_inode(scan, &ino, &inode); |
132 | if (retval) | 132 | if (retval) |
133 | return retval; | 133 | return retval; |
134 | 134 | ||
135 | while (ino) { | 135 | while (ino) { |
136 | if ((inode.i_links_count == 0) || | 136 | if ((inode.i_links_count == 0) || |
137 | !ext2fs_inode_has_valid_blocks(&inode)) | 137 | !ext2fs_inode_has_valid_blocks(&inode)) |
138 | goto next; | 138 | goto next; |
139 | 139 | ||
140 | pb.ino = ino; | 140 | pb.ino = ino; |
141 | pb.inode = &inode; | 141 | pb.inode = &inode; |
142 | 142 | ||
diff --git a/e2fsprogs/ext2fs/brel.h b/e2fsprogs/ext2fs/brel.h index be97243ca..a7f977658 100644 --- a/e2fsprogs/ext2fs/brel.h +++ b/e2fsprogs/ext2fs/brel.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * brel.h | 2 | * brel.h |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -47,7 +47,7 @@ struct ext2_block_relocation_table { | |||
47 | * Initialize for iterating over the block relocation entries. | 47 | * Initialize for iterating over the block relocation entries. |
48 | */ | 48 | */ |
49 | errcode_t (*start_iter)(ext2_brel brel); | 49 | errcode_t (*start_iter)(ext2_brel brel); |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * The iterator function for the inode relocation entries. | 52 | * The iterator function for the inode relocation entries. |
53 | * Returns an inode number of 0 when out of entries. | 53 | * 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 d422bb2e9..4dcfded37 100644 --- a/e2fsprogs/ext2fs/brel_ma.c +++ b/e2fsprogs/ext2fs/brel_ma.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * brel_ma.c | 2 | * brel_ma.c |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * TODO: rewrite to not use a direct array!!! (Fortunately this | 6 | * 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, | |||
48 | { | 48 | { |
49 | ext2_brel brel = 0; | 49 | ext2_brel brel = 0; |
50 | errcode_t retval; | 50 | errcode_t retval; |
51 | struct brel_ma *ma = 0; | 51 | struct brel_ma *ma = 0; |
52 | size_t size; | 52 | size_t size; |
53 | 53 | ||
54 | *new_brel = 0; | 54 | *new_brel = 0; |
@@ -61,18 +61,18 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, | |||
61 | if (retval) | 61 | if (retval) |
62 | goto errout; | 62 | goto errout; |
63 | memset(brel, 0, sizeof(struct ext2_block_relocation_table)); | 63 | memset(brel, 0, sizeof(struct ext2_block_relocation_table)); |
64 | 64 | ||
65 | retval = ext2fs_get_mem(strlen(name)+1, &brel->name); | 65 | retval = ext2fs_get_mem(strlen(name)+1, &brel->name); |
66 | if (retval) | 66 | if (retval) |
67 | goto errout; | 67 | goto errout; |
68 | strcpy(brel->name, name); | 68 | strcpy(brel->name, name); |
69 | 69 | ||
70 | retval = ext2fs_get_mem(sizeof(struct brel_ma), &ma); | 70 | retval = ext2fs_get_mem(sizeof(struct brel_ma), &ma); |
71 | if (retval) | 71 | if (retval) |
72 | goto errout; | 72 | goto errout; |
73 | memset(ma, 0, sizeof(struct brel_ma)); | 73 | memset(ma, 0, sizeof(struct brel_ma)); |
74 | brel->priv_data = ma; | 74 | brel->priv_data = ma; |
75 | 75 | ||
76 | size = (size_t) (sizeof(struct ext2_block_relocate_entry) * | 76 | size = (size_t) (sizeof(struct ext2_block_relocate_entry) * |
77 | (max_block+1)); | 77 | (max_block+1)); |
78 | retval = ext2fs_get_mem(size, &ma->entries); | 78 | retval = ext2fs_get_mem(size, &ma->entries); |
@@ -91,7 +91,7 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, | |||
91 | brel->move = bma_move; | 91 | brel->move = bma_move; |
92 | brel->delete = bma_delete; | 92 | brel->delete = bma_delete; |
93 | brel->free = bma_free; | 93 | brel->free = bma_free; |
94 | 94 | ||
95 | *new_brel = brel; | 95 | *new_brel = brel; |
96 | return 0; | 96 | return 0; |
97 | 97 | ||
@@ -103,7 +103,7 @@ errout: | |||
103 | static errcode_t bma_put(ext2_brel brel, blk_t old, | 103 | static errcode_t bma_put(ext2_brel brel, blk_t old, |
104 | struct ext2_block_relocate_entry *ent) | 104 | struct ext2_block_relocate_entry *ent) |
105 | { | 105 | { |
106 | struct brel_ma *ma; | 106 | struct brel_ma *ma; |
107 | 107 | ||
108 | ma = brel->priv_data; | 108 | ma = brel->priv_data; |
109 | if (old > ma->max_block) | 109 | if (old > ma->max_block) |
@@ -115,7 +115,7 @@ static errcode_t bma_put(ext2_brel brel, blk_t old, | |||
115 | static errcode_t bma_get(ext2_brel brel, blk_t old, | 115 | static errcode_t bma_get(ext2_brel brel, blk_t old, |
116 | struct ext2_block_relocate_entry *ent) | 116 | struct ext2_block_relocate_entry *ent) |
117 | { | 117 | { |
118 | struct brel_ma *ma; | 118 | struct brel_ma *ma; |
119 | 119 | ||
120 | ma = brel->priv_data; | 120 | ma = brel->priv_data; |
121 | if (old > ma->max_block) | 121 | if (old > ma->max_block) |
@@ -135,7 +135,7 @@ static errcode_t bma_start_iter(ext2_brel brel) | |||
135 | static errcode_t bma_next(ext2_brel brel, blk_t *old, | 135 | static errcode_t bma_next(ext2_brel brel, blk_t *old, |
136 | struct ext2_block_relocate_entry *ent) | 136 | struct ext2_block_relocate_entry *ent) |
137 | { | 137 | { |
138 | struct brel_ma *ma; | 138 | struct brel_ma *ma; |
139 | 139 | ||
140 | ma = brel->priv_data; | 140 | ma = brel->priv_data; |
141 | while (++brel->current < ma->max_block) { | 141 | while (++brel->current < ma->max_block) { |
@@ -151,7 +151,7 @@ static errcode_t bma_next(ext2_brel brel, blk_t *old, | |||
151 | 151 | ||
152 | static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) | 152 | static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) |
153 | { | 153 | { |
154 | struct brel_ma *ma; | 154 | struct brel_ma *ma; |
155 | 155 | ||
156 | ma = brel->priv_data; | 156 | ma = brel->priv_data; |
157 | if ((old > ma->max_block) || (new > ma->max_block)) | 157 | 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) | |||
165 | 165 | ||
166 | static errcode_t bma_delete(ext2_brel brel, blk_t old) | 166 | static errcode_t bma_delete(ext2_brel brel, blk_t old) |
167 | { | 167 | { |
168 | struct brel_ma *ma; | 168 | struct brel_ma *ma; |
169 | 169 | ||
170 | ma = brel->priv_data; | 170 | ma = brel->priv_data; |
171 | if (old > ma->max_block) | 171 | if (old > ma->max_block) |
@@ -178,7 +178,7 @@ static errcode_t bma_delete(ext2_brel brel, blk_t old) | |||
178 | 178 | ||
179 | static errcode_t bma_free(ext2_brel brel) | 179 | static errcode_t bma_free(ext2_brel brel) |
180 | { | 180 | { |
181 | struct brel_ma *ma; | 181 | struct brel_ma *ma; |
182 | 182 | ||
183 | if (!brel) | 183 | if (!brel) |
184 | return 0; | 184 | return 0; |
diff --git a/e2fsprogs/ext2fs/check_desc.c b/e2fsprogs/ext2fs/check_desc.c index 2a754c7f6..eab8c7bc8 100644 --- a/e2fsprogs/ext2fs/check_desc.c +++ b/e2fsprogs/ext2fs/check_desc.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * check_desc.c --- Check the group descriptors of an ext2 filesystem | 2 | * check_desc.c --- Check the group descriptors of an ext2 filesystem |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -61,7 +61,7 @@ errcode_t ext2fs_check_desc(ext2_filsys fs) | |||
61 | ((fs->group_desc[i].bg_inode_table + | 61 | ((fs->group_desc[i].bg_inode_table + |
62 | fs->inode_blocks_per_group) >= next)) | 62 | fs->inode_blocks_per_group) >= next)) |
63 | return EXT2_ET_GDESC_BAD_INODE_TABLE; | 63 | return EXT2_ET_GDESC_BAD_INODE_TABLE; |
64 | 64 | ||
65 | block = next; | 65 | block = next; |
66 | } | 66 | } |
67 | return 0; | 67 | return 0; |
diff --git a/e2fsprogs/ext2fs/closefs.c b/e2fsprogs/ext2fs/closefs.c index 23e6332db..da0016b0e 100644 --- a/e2fsprogs/ext2fs/closefs.c +++ b/e2fsprogs/ext2fs/closefs.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * closefs.c --- close an ext2 filesystem | 2 | * closefs.c --- close an ext2 filesystem |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -45,7 +45,7 @@ int ext2fs_bg_has_super(ext2_filsys fs, int group_block) | |||
45 | return 0; | 45 | return 0; |
46 | } | 46 | } |
47 | 47 | ||
48 | int ext2fs_super_and_bgd_loc(ext2_filsys fs, | 48 | int ext2fs_super_and_bgd_loc(ext2_filsys fs, |
49 | dgrp_t group, | 49 | dgrp_t group, |
50 | blk_t *ret_super_blk, | 50 | blk_t *ret_super_blk, |
51 | blk_t *ret_old_desc_blk, | 51 | blk_t *ret_old_desc_blk, |
@@ -63,7 +63,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, | |||
63 | if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) | 63 | if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) |
64 | old_desc_blocks = fs->super->s_first_meta_bg; | 64 | old_desc_blocks = fs->super->s_first_meta_bg; |
65 | else | 65 | else |
66 | old_desc_blocks = | 66 | old_desc_blocks = |
67 | fs->desc_blocks + fs->super->s_reserved_gdt_blocks; | 67 | fs->desc_blocks + fs->super->s_reserved_gdt_blocks; |
68 | 68 | ||
69 | if (group == fs->group_desc_count-1) { | 69 | if (group == fs->group_desc_count-1) { |
@@ -100,7 +100,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, | |||
100 | numblocks--; | 100 | numblocks--; |
101 | } | 101 | } |
102 | } | 102 | } |
103 | 103 | ||
104 | numblocks -= 2 + fs->inode_blocks_per_group; | 104 | numblocks -= 2 + fs->inode_blocks_per_group; |
105 | 105 | ||
106 | if (ret_super_blk) | 106 | if (ret_super_blk) |
@@ -188,7 +188,7 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group, | |||
188 | struct ext2_super_block *super_shadow) | 188 | struct ext2_super_block *super_shadow) |
189 | { | 189 | { |
190 | dgrp_t sgrp = group; | 190 | dgrp_t sgrp = group; |
191 | 191 | ||
192 | if (sgrp > ((1 << 16) - 1)) | 192 | if (sgrp > ((1 << 16) - 1)) |
193 | sgrp = (1 << 16) - 1; | 193 | sgrp = (1 << 16) - 1; |
194 | #ifdef EXT2FS_ENABLE_SWAPFS | 194 | #ifdef EXT2FS_ENABLE_SWAPFS |
@@ -198,7 +198,7 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group, | |||
198 | #endif | 198 | #endif |
199 | fs->super->s_block_group_nr = sgrp; | 199 | fs->super->s_block_group_nr = sgrp; |
200 | 200 | ||
201 | return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE, | 201 | return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE, |
202 | super_shadow); | 202 | super_shadow); |
203 | } | 203 | } |
204 | 204 | ||
@@ -217,7 +217,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) | |||
217 | dgrp_t j; | 217 | dgrp_t j; |
218 | struct ext2_group_desc *s, *t; | 218 | struct ext2_group_desc *s, *t; |
219 | #endif | 219 | #endif |
220 | 220 | ||
221 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 221 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
222 | 222 | ||
223 | fs_state = fs->super->s_state; | 223 | fs_state = fs->super->s_state; |
@@ -252,7 +252,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) | |||
252 | super_shadow = fs->super; | 252 | super_shadow = fs->super; |
253 | group_shadow = fs->group_desc; | 253 | group_shadow = fs->group_desc; |
254 | #endif | 254 | #endif |
255 | 255 | ||
256 | /* | 256 | /* |
257 | * If this is an external journal device, don't write out the | 257 | * If this is an external journal device, don't write out the |
258 | * block group descriptors or any of the backup superblocks | 258 | * block group descriptors or any of the backup superblocks |
@@ -289,7 +289,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) | |||
289 | blk_t super_blk, old_desc_blk, new_desc_blk; | 289 | blk_t super_blk, old_desc_blk, new_desc_blk; |
290 | int meta_bg; | 290 | int meta_bg; |
291 | 291 | ||
292 | ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk, | 292 | ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk, |
293 | &new_desc_blk, &meta_bg); | 293 | &new_desc_blk, &meta_bg); |
294 | 294 | ||
295 | if (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) &&i && super_blk) { | 295 | if (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) &&i && super_blk) { |
@@ -300,7 +300,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) | |||
300 | } | 300 | } |
301 | if (fs->flags & EXT2_FLAG_SUPER_ONLY) | 301 | if (fs->flags & EXT2_FLAG_SUPER_ONLY) |
302 | continue; | 302 | continue; |
303 | if ((old_desc_blk) && | 303 | if ((old_desc_blk) && |
304 | (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) || (i == 0))) { | 304 | (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) || (i == 0))) { |
305 | retval = io_channel_write_blk(fs->io, | 305 | retval = io_channel_write_blk(fs->io, |
306 | old_desc_blk, old_desc_blocks, group_ptr); | 306 | old_desc_blk, old_desc_blocks, group_ptr); |
@@ -365,7 +365,7 @@ errout: | |||
365 | errcode_t ext2fs_close(ext2_filsys fs) | 365 | errcode_t ext2fs_close(ext2_filsys fs) |
366 | { | 366 | { |
367 | errcode_t retval; | 367 | errcode_t retval; |
368 | 368 | ||
369 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 369 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
370 | 370 | ||
371 | if (fs->flags & EXT2_FLAG_DIRTY) { | 371 | if (fs->flags & EXT2_FLAG_DIRTY) { |
diff --git a/e2fsprogs/ext2fs/cmp_bitmaps.c b/e2fsprogs/ext2fs/cmp_bitmaps.c index 51cc3d0a5..fa45a4331 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, | |||
30 | ext2fs_block_bitmap bm2) | 30 | ext2fs_block_bitmap bm2) |
31 | { | 31 | { |
32 | blk_t i; | 32 | blk_t i; |
33 | 33 | ||
34 | EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_BLOCK_BITMAP); | 34 | EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_BLOCK_BITMAP); |
35 | EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_BLOCK_BITMAP); | 35 | EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_BLOCK_BITMAP); |
36 | 36 | ||
@@ -52,7 +52,7 @@ errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1, | |||
52 | ext2fs_inode_bitmap bm2) | 52 | ext2fs_inode_bitmap bm2) |
53 | { | 53 | { |
54 | ext2_ino_t i; | 54 | ext2_ino_t i; |
55 | 55 | ||
56 | EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_INODE_BITMAP); | 56 | EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_INODE_BITMAP); |
57 | EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_INODE_BITMAP); | 57 | EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_INODE_BITMAP); |
58 | 58 | ||
diff --git a/e2fsprogs/ext2fs/dblist.c b/e2fsprogs/ext2fs/dblist.c index d5833d728..0cf5698fa 100644 --- a/e2fsprogs/ext2fs/dblist.c +++ b/e2fsprogs/ext2fs/dblist.c | |||
@@ -1,13 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * dblist.c -- directory block list functions | 2 | * dblist.c -- directory block list functions |
3 | * | 3 | * |
4 | * Copyright 1997 by Theodore Ts'o | 4 | * Copyright 1997 by Theodore Ts'o |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
9 | * %End-Header% | 9 | * %End-Header% |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <stdio.h> | 13 | #include <stdio.h> |
@@ -33,7 +33,7 @@ errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs) | |||
33 | ext2_ino_t num_dirs, max_dirs; | 33 | ext2_ino_t num_dirs, max_dirs; |
34 | 34 | ||
35 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 35 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
36 | 36 | ||
37 | num_dirs = 0; | 37 | num_dirs = 0; |
38 | max_dirs = fs->super->s_inodes_per_group; | 38 | max_dirs = fs->super->s_inodes_per_group; |
39 | for (i = 0; i < fs->group_desc_count; i++) { | 39 | 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, | |||
88 | retval = ext2fs_get_mem(len, &dblist->list); | 88 | retval = ext2fs_get_mem(len, &dblist->list); |
89 | if (retval) | 89 | if (retval) |
90 | goto cleanup; | 90 | goto cleanup; |
91 | 91 | ||
92 | if (list) | 92 | if (list) |
93 | memcpy(dblist->list, list, len); | 93 | memcpy(dblist->list, list, len); |
94 | else | 94 | else |
@@ -155,10 +155,10 @@ errcode_t ext2fs_copy_dblist(ext2_dblist src, ext2_dblist *dest) | |||
155 | errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk, | 155 | errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk, |
156 | int blockcnt) | 156 | int blockcnt) |
157 | { | 157 | { |
158 | struct ext2_db_entry *new_entry; | 158 | struct ext2_db_entry *new_entry; |
159 | errcode_t retval; | 159 | errcode_t retval; |
160 | unsigned long old_size; | 160 | unsigned long old_size; |
161 | 161 | ||
162 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); | 162 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); |
163 | 163 | ||
164 | if (dblist->count >= dblist->size) { | 164 | 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, | |||
189 | int blockcnt) | 189 | int blockcnt) |
190 | { | 190 | { |
191 | dgrp_t i; | 191 | dgrp_t i; |
192 | 192 | ||
193 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); | 193 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); |
194 | 194 | ||
195 | for (i=0; i < dblist->count; i++) { | 195 | for (i=0; i < dblist->count; i++) { |
@@ -225,7 +225,7 @@ errcode_t ext2fs_dblist_iterate(ext2_dblist dblist, | |||
225 | { | 225 | { |
226 | ext2_ino_t i; | 226 | ext2_ino_t i; |
227 | int ret; | 227 | int ret; |
228 | 228 | ||
229 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); | 229 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); |
230 | 230 | ||
231 | if (!dblist->sorted) | 231 | if (!dblist->sorted) |
@@ -247,7 +247,7 @@ static EXT2_QSORT_TYPE dir_block_cmp(const void *a, const void *b) | |||
247 | 247 | ||
248 | if (db_a->blk != db_b->blk) | 248 | if (db_a->blk != db_b->blk) |
249 | return (int) (db_a->blk - db_b->blk); | 249 | return (int) (db_a->blk - db_b->blk); |
250 | 250 | ||
251 | if (db_a->ino != db_b->ino) | 251 | if (db_a->ino != db_b->ino) |
252 | return (int) (db_a->ino - db_b->ino); | 252 | return (int) (db_a->ino - db_b->ino); |
253 | 253 | ||
diff --git a/e2fsprogs/ext2fs/dblist_dir.c b/e2fsprogs/ext2fs/dblist_dir.c index f2e17a61d..20b1cde46 100644 --- a/e2fsprogs/ext2fs/dblist_dir.c +++ b/e2fsprogs/ext2fs/dblist_dir.c | |||
@@ -2,12 +2,12 @@ | |||
2 | * dblist_dir.c --- iterate by directory entry | 2 | * dblist_dir.c --- iterate by directory entry |
3 | * | 3 | * |
4 | * Copyright 1997 by Theodore Ts'o | 4 | * Copyright 1997 by Theodore Ts'o |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
9 | * %End-Header% | 9 | * %End-Header% |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <stdio.h> | 13 | #include <stdio.h> |
@@ -54,7 +54,7 @@ errcode_t ext2fs_dblist_dir_iterate(ext2_dblist dblist, | |||
54 | ctx.errcode = 0; | 54 | ctx.errcode = 0; |
55 | 55 | ||
56 | retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx); | 56 | retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx); |
57 | 57 | ||
58 | if (!block_buf) | 58 | if (!block_buf) |
59 | ext2fs_free_mem(&ctx.buf); | 59 | ext2fs_free_mem(&ctx.buf); |
60 | if (retval) | 60 | if (retval) |
@@ -69,7 +69,7 @@ static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info, | |||
69 | 69 | ||
70 | ctx = (struct dir_context *) priv_data; | 70 | ctx = (struct dir_context *) priv_data; |
71 | ctx->dir = db_info->ino; | 71 | ctx->dir = db_info->ino; |
72 | 72 | ||
73 | return ext2fs_process_dir_block(fs, &db_info->blk, | 73 | return ext2fs_process_dir_block(fs, &db_info->blk, |
74 | db_info->blockcnt, 0, 0, priv_data); | 74 | db_info->blockcnt, 0, 0, priv_data); |
75 | } | 75 | } |
diff --git a/e2fsprogs/ext2fs/dir_iterate.c b/e2fsprogs/ext2fs/dir_iterate.c index 003c0a3bd..df820feaa 100644 --- a/e2fsprogs/ext2fs/dir_iterate.c +++ b/e2fsprogs/ext2fs/dir_iterate.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * dir_iterate.c --- ext2fs directory iteration operations | 2 | * dir_iterate.c --- ext2fs directory iteration operations |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1994, 1995, 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1994, 1995, 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -32,7 +32,7 @@ | |||
32 | static int ext2fs_validate_entry(char *buf, int offset, int final_offset) | 32 | static int ext2fs_validate_entry(char *buf, int offset, int final_offset) |
33 | { | 33 | { |
34 | struct ext2_dir_entry *dirent; | 34 | struct ext2_dir_entry *dirent; |
35 | 35 | ||
36 | while (offset < final_offset) { | 36 | while (offset < final_offset) { |
37 | dirent = (struct ext2_dir_entry *)(buf + offset); | 37 | dirent = (struct ext2_dir_entry *)(buf + offset); |
38 | offset += dirent->rec_len; | 38 | offset += dirent->rec_len; |
@@ -59,13 +59,13 @@ errcode_t ext2fs_dir_iterate2(ext2_filsys fs, | |||
59 | { | 59 | { |
60 | struct dir_context ctx; | 60 | struct dir_context ctx; |
61 | errcode_t retval; | 61 | errcode_t retval; |
62 | 62 | ||
63 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 63 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
64 | 64 | ||
65 | retval = ext2fs_check_directory(fs, dir); | 65 | retval = ext2fs_check_directory(fs, dir); |
66 | if (retval) | 66 | if (retval) |
67 | return retval; | 67 | return retval; |
68 | 68 | ||
69 | ctx.dir = dir; | 69 | ctx.dir = dir; |
70 | ctx.flags = flags; | 70 | ctx.flags = flags; |
71 | if (block_buf) | 71 | if (block_buf) |
@@ -106,7 +106,7 @@ static int xlate_func(ext2_ino_t dir EXT2FS_ATTR((unused)), | |||
106 | return (*xl->func)(dirent, offset, blocksize, buf, xl->real_private); | 106 | return (*xl->func)(dirent, offset, blocksize, buf, xl->real_private); |
107 | } | 107 | } |
108 | 108 | ||
109 | extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, | 109 | extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, |
110 | ext2_ino_t dir, | 110 | ext2_ino_t dir, |
111 | int flags, | 111 | int flags, |
112 | char *block_buf, | 112 | char *block_buf, |
@@ -118,7 +118,7 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, | |||
118 | void *priv_data) | 118 | void *priv_data) |
119 | { | 119 | { |
120 | struct xlate xl; | 120 | struct xlate xl; |
121 | 121 | ||
122 | xl.real_private = priv_data; | 122 | xl.real_private = priv_data; |
123 | xl.func = func; | 123 | xl.func = func; |
124 | 124 | ||
@@ -151,7 +151,7 @@ int ext2fs_process_dir_block(ext2_filsys fs, | |||
151 | return 0; | 151 | return 0; |
152 | 152 | ||
153 | entry = blockcnt ? DIRENT_OTHER_FILE : DIRENT_DOT_FILE; | 153 | entry = blockcnt ? DIRENT_OTHER_FILE : DIRENT_DOT_FILE; |
154 | 154 | ||
155 | ctx->errcode = ext2fs_read_dir_block(fs, *blocknr, ctx->buf); | 155 | ctx->errcode = ext2fs_read_dir_block(fs, *blocknr, ctx->buf); |
156 | if (ctx->errcode) | 156 | if (ctx->errcode) |
157 | return BLOCK_ABORT; | 157 | return BLOCK_ABORT; |
@@ -177,18 +177,18 @@ int ext2fs_process_dir_block(ext2_filsys fs, | |||
177 | ctx->priv_data); | 177 | ctx->priv_data); |
178 | if (entry < DIRENT_OTHER_FILE) | 178 | if (entry < DIRENT_OTHER_FILE) |
179 | entry++; | 179 | entry++; |
180 | 180 | ||
181 | if (ret & DIRENT_CHANGED) | 181 | if (ret & DIRENT_CHANGED) |
182 | changed++; | 182 | changed++; |
183 | if (ret & DIRENT_ABORT) { | 183 | if (ret & DIRENT_ABORT) { |
184 | do_abort++; | 184 | do_abort++; |
185 | break; | 185 | break; |
186 | } | 186 | } |
187 | next: | 187 | next: |
188 | if (next_real_entry == offset) | 188 | if (next_real_entry == offset) |
189 | next_real_entry += dirent->rec_len; | 189 | next_real_entry += dirent->rec_len; |
190 | 190 | ||
191 | if (ctx->flags & DIRENT_FLAG_INCLUDE_REMOVED) { | 191 | if (ctx->flags & DIRENT_FLAG_INCLUDE_REMOVED) { |
192 | size = ((dirent->name_len & 0xFF) + 11) & ~3; | 192 | size = ((dirent->name_len & 0xFF) + 11) & ~3; |
193 | 193 | ||
194 | if (dirent->rec_len != size) { | 194 | if (dirent->rec_len != size) { |
diff --git a/e2fsprogs/ext2fs/dirblock.c b/e2fsprogs/ext2fs/dirblock.c index 5d66ad194..9f82b5002 100644 --- a/e2fsprogs/ext2fs/dirblock.c +++ b/e2fsprogs/ext2fs/dirblock.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * dirblock.c --- directory block routines. | 2 | * dirblock.c --- directory block routines. |
3 | * | 3 | * |
4 | * Copyright (C) 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -28,9 +28,9 @@ errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block, | |||
28 | unsigned int name_len, rec_len; | 28 | unsigned int name_len, rec_len; |
29 | #ifdef EXT2FS_ENABLE_SWAPFS | 29 | #ifdef EXT2FS_ENABLE_SWAPFS |
30 | unsigned int do_swap; | 30 | unsigned int do_swap; |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | retval = io_channel_read_blk(fs->io, block, 1, buf); | 33 | retval = io_channel_read_blk(fs->io, block, 1, buf); |
34 | if (retval) | 34 | if (retval) |
35 | return retval; | 35 | return retval; |
36 | #ifdef EXT2FS_ENABLE_SWAPFS | 36 | #ifdef EXT2FS_ENABLE_SWAPFS |
@@ -110,16 +110,16 @@ errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block, | |||
110 | dirent->rec_len = ext2fs_swab16(dirent->rec_len); | 110 | dirent->rec_len = ext2fs_swab16(dirent->rec_len); |
111 | dirent->name_len = ext2fs_swab16(dirent->name_len); | 111 | dirent->name_len = ext2fs_swab16(dirent->name_len); |
112 | } | 112 | } |
113 | #ifdef WORDS_BIGENDIAN | 113 | #ifdef WORDS_BIGENDIAN |
114 | if (flags & EXT2_DIRBLOCK_V2_STRUCT) | 114 | if (flags & EXT2_DIRBLOCK_V2_STRUCT) |
115 | dirent->name_len = ext2fs_swab16(dirent->name_len); | 115 | dirent->name_len = ext2fs_swab16(dirent->name_len); |
116 | #endif | 116 | #endif |
117 | } | 117 | } |
118 | retval = io_channel_write_blk(fs->io, block, 1, buf); | 118 | retval = io_channel_write_blk(fs->io, block, 1, buf); |
119 | ext2fs_free_mem(&buf); | 119 | ext2fs_free_mem(&buf); |
120 | return retval; | 120 | return retval; |
121 | #else | 121 | #else |
122 | return io_channel_write_blk(fs->io, block, 1, (char *) inbuf); | 122 | return io_channel_write_blk(fs->io, block, 1, (char *) inbuf); |
123 | #endif | 123 | #endif |
124 | } | 124 | } |
125 | 125 | ||
diff --git a/e2fsprogs/ext2fs/dirhash.c b/e2fsprogs/ext2fs/dirhash.c index 4d18593f5..39678a628 100644 --- a/e2fsprogs/ext2fs/dirhash.c +++ b/e2fsprogs/ext2fs/dirhash.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * dirhash.c -- Calculate the hash of a directory entry | 2 | * dirhash.c -- Calculate the hash of a directory entry |
3 | * | 3 | * |
4 | * Copyright (c) 2001 Daniel Phillips | 4 | * Copyright (c) 2001 Daniel Phillips |
5 | * | 5 | * |
6 | * Copyright (c) 2002 Theodore Ts'o. | 6 | * Copyright (c) 2002 Theodore Ts'o. |
7 | * | 7 | * |
8 | * %Begin-Header% | 8 | * %Begin-Header% |
@@ -25,7 +25,7 @@ | |||
25 | * (see Applied Cryptography, 2nd edition, p448). | 25 | * (see Applied Cryptography, 2nd edition, p448). |
26 | * | 26 | * |
27 | * Jeremy Fitzhardinge <jeremy@zip.com.au> 1998 | 27 | * Jeremy Fitzhardinge <jeremy@zip.com.au> 1998 |
28 | * | 28 | * |
29 | * This code is made available under the terms of the GPL | 29 | * This code is made available under the terms of the GPL |
30 | */ | 30 | */ |
31 | #define DELTA 0x9E3779B9 | 31 | #define DELTA 0x9E3779B9 |
@@ -37,10 +37,10 @@ static void TEA_transform(__u32 buf[4], __u32 const in[]) | |||
37 | __u32 a = in[0], b = in[1], c = in[2], d = in[3]; | 37 | __u32 a = in[0], b = in[1], c = in[2], d = in[3]; |
38 | int n = 16; | 38 | int n = 16; |
39 | 39 | ||
40 | do { | 40 | do { |
41 | sum += DELTA; | 41 | sum += DELTA; |
42 | b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); | 42 | b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); |
43 | b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); | 43 | b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); |
44 | } while(--n); | 44 | } while(--n); |
45 | 45 | ||
46 | buf[0] += b0; | 46 | buf[0] += b0; |
@@ -121,7 +121,7 @@ static ext2_dirhash_t dx_hack_hash (const char *name, int len) | |||
121 | __u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; | 121 | __u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; |
122 | while (len--) { | 122 | while (len--) { |
123 | __u32 hash = hash1 + (hash0 ^ (*name++ * 7152373)); | 123 | __u32 hash = hash1 + (hash0 ^ (*name++ * 7152373)); |
124 | 124 | ||
125 | if (hash & 0x80000000) hash -= 0x7fffffff; | 125 | if (hash & 0x80000000) hash -= 0x7fffffff; |
126 | hash1 = hash0; | 126 | hash1 = hash0; |
127 | hash0 = hash; | 127 | hash0 = hash; |
@@ -160,11 +160,11 @@ static void str2hashbuf(const char *msg, int len, __u32 *buf, int num) | |||
160 | * Returns the hash of a filename. If len is 0 and name is NULL, then | 160 | * Returns the hash of a filename. If len is 0 and name is NULL, then |
161 | * this function can be used to test whether or not a hash version is | 161 | * this function can be used to test whether or not a hash version is |
162 | * supported. | 162 | * supported. |
163 | * | 163 | * |
164 | * The seed is an 4 longword (32 bits) "secret" which can be used to | 164 | * The seed is an 4 longword (32 bits) "secret" which can be used to |
165 | * uniquify a hash. If the seed is all zero's, then some default seed | 165 | * uniquify a hash. If the seed is all zero's, then some default seed |
166 | * may be used. | 166 | * may be used. |
167 | * | 167 | * |
168 | * A particular hash version specifies whether or not the seed is | 168 | * A particular hash version specifies whether or not the seed is |
169 | * represented, and whether or not the returned hash is 32 bits or 64 | 169 | * represented, and whether or not the returned hash is 32 bits or 64 |
170 | * bits. 32 bit hashes will return 0 for the minor hash. | 170 | * 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, | |||
178 | __u32 minor_hash = 0; | 178 | __u32 minor_hash = 0; |
179 | const char *p; | 179 | const char *p; |
180 | int i; | 180 | int i; |
181 | __u32 in[8], buf[4]; | 181 | __u32 in[8], buf[4]; |
182 | 182 | ||
183 | /* Initialize the default seed for the hash checksum functions */ | 183 | /* Initialize the default seed for the hash checksum functions */ |
184 | buf[0] = 0x67452301; | 184 | buf[0] = 0x67452301; |
@@ -195,7 +195,7 @@ errcode_t ext2fs_dirhash(int version, const char *name, int len, | |||
195 | if (i < 4) | 195 | if (i < 4) |
196 | memcpy(buf, seed, sizeof(buf)); | 196 | memcpy(buf, seed, sizeof(buf)); |
197 | } | 197 | } |
198 | 198 | ||
199 | switch (version) { | 199 | switch (version) { |
200 | case EXT2_HASH_LEGACY: | 200 | case EXT2_HASH_LEGACY: |
201 | hash = dx_hack_hash(name, len); | 201 | hash = dx_hack_hash(name, len); |
diff --git a/e2fsprogs/ext2fs/dupfs.c b/e2fsprogs/ext2fs/dupfs.c index f8919c222..2009ef701 100644 --- a/e2fsprogs/ext2fs/dupfs.c +++ b/e2fsprogs/ext2fs/dupfs.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * dupfs.c --- duplicate a ext2 filesystem handle | 2 | * dupfs.c --- duplicate a ext2 filesystem handle |
3 | * | 3 | * |
4 | * Copyright (C) 1997, 1998, 2001, 2003, 2005 by Theodore Ts'o. | 4 | * Copyright (C) 1997, 1998, 2001, 2003, 2005 by Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -25,7 +25,7 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest) | |||
25 | errcode_t retval; | 25 | errcode_t retval; |
26 | 26 | ||
27 | EXT2_CHECK_MAGIC(src, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 27 | EXT2_CHECK_MAGIC(src, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
28 | 28 | ||
29 | retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); | 29 | retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); |
30 | if (retval) | 30 | if (retval) |
31 | return retval; | 31 | return retval; |
@@ -91,6 +91,6 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest) | |||
91 | errout: | 91 | errout: |
92 | ext2fs_free(fs); | 92 | ext2fs_free(fs); |
93 | return retval; | 93 | return retval; |
94 | 94 | ||
95 | } | 95 | } |
96 | 96 | ||
diff --git a/e2fsprogs/ext2fs/e2image.h b/e2fsprogs/ext2fs/e2image.h index e12b7d69b..c05d43e22 100644 --- a/e2fsprogs/ext2fs/e2image.h +++ b/e2fsprogs/ext2fs/e2image.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * e2image.h --- header file describing the ext2 image format | 2 | * e2image.h --- header file describing the ext2 image format |
3 | * | 3 | * |
4 | * Copyright (C) 2000 Theodore Ts'o. | 4 | * Copyright (C) 2000 Theodore Ts'o. |
5 | * | 5 | * |
6 | * Note: this uses the POSIX IO interfaces, unlike most of the other | 6 | * Note: this uses the POSIX IO interfaces, unlike most of the other |
7 | * functions in this library. So sue me. | 7 | * functions in this library. So sue me. |
8 | * | 8 | * |
9 | * %Begin-Header% | 9 | * %Begin-Header% |
10 | * This file may be redistributed under the terms of the GNU Public | 10 | * This file may be redistributed under the terms of the GNU Public |
@@ -24,7 +24,7 @@ struct ext2_image_hdr { | |||
24 | char fs_uuid[16]; /* UUID of filesystem */ | 24 | char fs_uuid[16]; /* UUID of filesystem */ |
25 | __u32 fs_blocksize; /* Block size of the filesystem */ | 25 | __u32 fs_blocksize; /* Block size of the filesystem */ |
26 | __u32 fs_reserved[8]; | 26 | __u32 fs_reserved[8]; |
27 | 27 | ||
28 | __u32 image_device; /* Device number of image file */ | 28 | __u32 image_device; /* Device number of image file */ |
29 | __u32 image_inode; /* Inode number of image file */ | 29 | __u32 image_inode; /* Inode number of image file */ |
30 | __u32 image_time; /* Time of image creation */ | 30 | __u32 image_time; /* Time of image creation */ |
@@ -37,15 +37,15 @@ struct ext2_image_hdr { | |||
37 | __u32 offset_reserved[8]; | 37 | __u32 offset_reserved[8]; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | 40 | ||
41 | 41 | ||
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | 51 | ||
diff --git a/e2fsprogs/ext2fs/expanddir.c b/e2fsprogs/ext2fs/expanddir.c index 10a5149cf..c148b93aa 100644 --- a/e2fsprogs/ext2fs/expanddir.c +++ b/e2fsprogs/ext2fs/expanddir.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * expand.c --- expand an ext2fs directory | 2 | * expand.c --- expand an ext2fs directory |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -36,7 +36,7 @@ static int expand_dir_proc(ext2_filsys fs, | |||
36 | static blk_t last_blk = 0; | 36 | static blk_t last_blk = 0; |
37 | char *block; | 37 | char *block; |
38 | errcode_t retval; | 38 | errcode_t retval; |
39 | 39 | ||
40 | if (*blocknr) { | 40 | if (*blocknr) { |
41 | last_blk = *blocknr; | 41 | last_blk = *blocknr; |
42 | return 0; | 42 | return 0; |
@@ -62,7 +62,7 @@ static int expand_dir_proc(ext2_filsys fs, | |||
62 | } | 62 | } |
63 | memset(block, 0, fs->blocksize); | 63 | memset(block, 0, fs->blocksize); |
64 | retval = io_channel_write_blk(fs->io, new_blk, 1, block); | 64 | retval = io_channel_write_blk(fs->io, new_blk, 1, block); |
65 | } | 65 | } |
66 | if (retval) { | 66 | if (retval) { |
67 | es->err = retval; | 67 | es->err = retval; |
68 | return BLOCK_ABORT; | 68 | return BLOCK_ABORT; |
@@ -83,7 +83,7 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) | |||
83 | errcode_t retval; | 83 | errcode_t retval; |
84 | struct expand_dir_struct es; | 84 | struct expand_dir_struct es; |
85 | struct ext2_inode inode; | 85 | struct ext2_inode inode; |
86 | 86 | ||
87 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 87 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
88 | 88 | ||
89 | if (!(fs->flags & EXT2_FLAG_RW)) | 89 | if (!(fs->flags & EXT2_FLAG_RW)) |
@@ -95,11 +95,11 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) | |||
95 | retval = ext2fs_check_directory(fs, dir); | 95 | retval = ext2fs_check_directory(fs, dir); |
96 | if (retval) | 96 | if (retval) |
97 | return retval; | 97 | return retval; |
98 | 98 | ||
99 | es.done = 0; | 99 | es.done = 0; |
100 | es.err = 0; | 100 | es.err = 0; |
101 | es.newblocks = 0; | 101 | es.newblocks = 0; |
102 | 102 | ||
103 | retval = ext2fs_block_iterate2(fs, dir, BLOCK_FLAG_APPEND, | 103 | retval = ext2fs_block_iterate2(fs, dir, BLOCK_FLAG_APPEND, |
104 | 0, expand_dir_proc, &es); | 104 | 0, expand_dir_proc, &es); |
105 | 105 | ||
@@ -114,7 +114,7 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) | |||
114 | retval = ext2fs_read_inode(fs, dir, &inode); | 114 | retval = ext2fs_read_inode(fs, dir, &inode); |
115 | if (retval) | 115 | if (retval) |
116 | return retval; | 116 | return retval; |
117 | 117 | ||
118 | inode.i_size += fs->blocksize; | 118 | inode.i_size += fs->blocksize; |
119 | inode.i_blocks += (fs->blocksize / 512) * es.newblocks; | 119 | inode.i_blocks += (fs->blocksize / 512) * es.newblocks; |
120 | 120 | ||
diff --git a/e2fsprogs/ext2fs/ext2_fs.h b/e2fsprogs/ext2fs/ext2_fs.h index 7a9890320..400587324 100644 --- a/e2fsprogs/ext2fs/ext2_fs.h +++ b/e2fsprogs/ext2fs/ext2_fs.h | |||
@@ -231,9 +231,9 @@ struct ext2_dx_countlimit { | |||
231 | #define EXT2_IMAGIC_FL 0x00002000 | 231 | #define EXT2_IMAGIC_FL 0x00002000 |
232 | #define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ | 232 | #define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ |
233 | #define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ | 233 | #define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ |
234 | #define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */ | 234 | #define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */ |
235 | #define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ | 235 | #define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ |
236 | #define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */ | 236 | #define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */ |
237 | #define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ | 237 | #define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ |
238 | 238 | ||
239 | #define EXT2_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ | 239 | #define EXT2_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ |
@@ -501,12 +501,12 @@ struct ext2_super_block { | |||
501 | __u32 s_last_orphan; /* start of list of inodes to delete */ | 501 | __u32 s_last_orphan; /* start of list of inodes to delete */ |
502 | __u32 s_hash_seed[4]; /* HTREE hash seed */ | 502 | __u32 s_hash_seed[4]; /* HTREE hash seed */ |
503 | __u8 s_def_hash_version; /* Default hash version to use */ | 503 | __u8 s_def_hash_version; /* Default hash version to use */ |
504 | __u8 s_jnl_backup_type; /* Default type of journal backup */ | 504 | __u8 s_jnl_backup_type; /* Default type of journal backup */ |
505 | __u16 s_reserved_word_pad; | 505 | __u16 s_reserved_word_pad; |
506 | __u32 s_default_mount_opts; | 506 | __u32 s_default_mount_opts; |
507 | __u32 s_first_meta_bg; /* First metablock group */ | 507 | __u32 s_first_meta_bg; /* First metablock group */ |
508 | __u32 s_mkfs_time; /* When the filesystem was created */ | 508 | __u32 s_mkfs_time; /* When the filesystem was created */ |
509 | __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ | 509 | __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ |
510 | __u32 s_reserved[172]; /* Padding to the end of the block */ | 510 | __u32 s_reserved[172]; /* Padding to the end of the block */ |
511 | }; | 511 | }; |
512 | 512 | ||
@@ -585,7 +585,7 @@ struct ext2_super_block { | |||
585 | #define EXT2_DEFM_XATTR_USER 0x0004 | 585 | #define EXT2_DEFM_XATTR_USER 0x0004 |
586 | #define EXT2_DEFM_ACL 0x0008 | 586 | #define EXT2_DEFM_ACL 0x0008 |
587 | #define EXT2_DEFM_UID16 0x0010 | 587 | #define EXT2_DEFM_UID16 0x0010 |
588 | #define EXT3_DEFM_JMODE 0x0060 | 588 | #define EXT3_DEFM_JMODE 0x0060 |
589 | #define EXT3_DEFM_JMODE_DATA 0x0020 | 589 | #define EXT3_DEFM_JMODE_DATA 0x0020 |
590 | #define EXT3_DEFM_JMODE_ORDERED 0x0040 | 590 | #define EXT3_DEFM_JMODE_ORDERED 0x0040 |
591 | #define EXT3_DEFM_JMODE_WBACK 0x0060 | 591 | #define EXT3_DEFM_JMODE_WBACK 0x0060 |
diff --git a/e2fsprogs/ext2fs/ext2fs.h b/e2fsprogs/ext2fs/ext2fs.h index e2e86579b..7d2a43695 100644 --- a/e2fsprogs/ext2fs/ext2fs.h +++ b/e2fsprogs/ext2fs/ext2fs.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ext2fs.h --- ext2fs | 2 | * ext2fs.h --- ext2fs |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -46,7 +46,7 @@ extern "C" { | |||
46 | * 1032 bytes long). | 46 | * 1032 bytes long). |
47 | */ | 47 | */ |
48 | #define SUPERBLOCK_OFFSET 1024 | 48 | #define SUPERBLOCK_OFFSET 1024 |
49 | #define SUPERBLOCK_SIZE 1024 | 49 | #define SUPERBLOCK_SIZE 1024 |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * The last ext2fs revision level that this version of the library is | 52 | * The last ext2fs revision level that this version of the library is |
@@ -87,7 +87,7 @@ typedef struct struct_ext2_filsys *ext2_filsys; | |||
87 | 87 | ||
88 | struct ext2fs_struct_generic_bitmap { | 88 | struct ext2fs_struct_generic_bitmap { |
89 | errcode_t magic; | 89 | errcode_t magic; |
90 | ext2_filsys fs; | 90 | ext2_filsys fs; |
91 | __u32 start, end; | 91 | __u32 start, end; |
92 | __u32 real_end; | 92 | __u32 real_end; |
93 | char * description; | 93 | char * description; |
@@ -96,8 +96,8 @@ struct ext2fs_struct_generic_bitmap { | |||
96 | __u32 reserved[7]; | 96 | __u32 reserved[7]; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | #define EXT2FS_MARK_ERROR 0 | 99 | #define EXT2FS_MARK_ERROR 0 |
100 | #define EXT2FS_UNMARK_ERROR 1 | 100 | #define EXT2FS_UNMARK_ERROR 1 |
101 | #define EXT2FS_TEST_ERROR 2 | 101 | #define EXT2FS_TEST_ERROR 2 |
102 | 102 | ||
103 | typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap; | 103 | typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap; |
@@ -194,7 +194,7 @@ struct struct_ext2_filsys { | |||
194 | io_channel io; | 194 | io_channel io; |
195 | int flags; | 195 | int flags; |
196 | char * device_name; | 196 | char * device_name; |
197 | struct ext2_super_block * super; | 197 | struct ext2_super_block * super; |
198 | unsigned int blocksize; | 198 | unsigned int blocksize; |
199 | int fragsize; | 199 | int fragsize; |
200 | dgrp_t group_desc_count; | 200 | dgrp_t group_desc_count; |
@@ -250,7 +250,7 @@ struct struct_ext2_filsys { | |||
250 | * This is used by ext2fs_expand_dir() to be able to add a new block | 250 | * This is used by ext2fs_expand_dir() to be able to add a new block |
251 | * to an inode. It can also be used for programs that want to be able | 251 | * to an inode. It can also be used for programs that want to be able |
252 | * to deal with files that contain "holes". | 252 | * to deal with files that contain "holes". |
253 | * | 253 | * |
254 | * BLOCK_FLAG_TRAVERSE indicates that the iterator function for the | 254 | * BLOCK_FLAG_TRAVERSE indicates that the iterator function for the |
255 | * indirect, doubly indirect, etc. blocks should be called after all | 255 | * indirect, doubly indirect, etc. blocks should be called after all |
256 | * of the blocks containined in the indirect blocks are processed. | 256 | * of the blocks containined in the indirect blocks are processed. |
@@ -282,7 +282,7 @@ struct struct_ext2_filsys { | |||
282 | /* | 282 | /* |
283 | * Flags for ext2fs_move_blocks | 283 | * Flags for ext2fs_move_blocks |
284 | */ | 284 | */ |
285 | #define EXT2_BMOVE_GET_DBLIST 0x0001 | 285 | #define EXT2_BMOVE_GET_DBLIST 0x0001 |
286 | #define EXT2_BMOVE_DEBUG 0x0002 | 286 | #define EXT2_BMOVE_DEBUG 0x0002 |
287 | #endif | 287 | #endif |
288 | 288 | ||
@@ -457,7 +457,7 @@ extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, | |||
457 | char *block_buf, blk_t *ret); | 457 | char *block_buf, blk_t *ret); |
458 | 458 | ||
459 | /* alloc_sb.c */ | 459 | /* alloc_sb.c */ |
460 | extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs, | 460 | extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs, |
461 | dgrp_t group, | 461 | dgrp_t group, |
462 | ext2fs_block_bitmap bmap); | 462 | ext2fs_block_bitmap bmap); |
463 | 463 | ||
@@ -567,7 +567,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, | |||
567 | 567 | ||
568 | /* bmap.c */ | 568 | /* bmap.c */ |
569 | extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, | 569 | extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, |
570 | struct ext2_inode *inode, | 570 | struct ext2_inode *inode, |
571 | char *block_buf, int bmap_flags, | 571 | char *block_buf, int bmap_flags, |
572 | blk_t block, blk_t *phys_blk); | 572 | blk_t block, blk_t *phys_blk); |
573 | 573 | ||
@@ -587,7 +587,7 @@ extern errcode_t ext2fs_check_desc(ext2_filsys fs); | |||
587 | extern errcode_t ext2fs_close(ext2_filsys fs); | 587 | extern errcode_t ext2fs_close(ext2_filsys fs); |
588 | extern errcode_t ext2fs_flush(ext2_filsys fs); | 588 | extern errcode_t ext2fs_flush(ext2_filsys fs); |
589 | extern int ext2fs_bg_has_super(ext2_filsys fs, int group_block); | 589 | extern int ext2fs_bg_has_super(ext2_filsys fs, int group_block); |
590 | extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, | 590 | extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, |
591 | dgrp_t group, | 591 | dgrp_t group, |
592 | blk_t *ret_super_blk, | 592 | blk_t *ret_super_blk, |
593 | blk_t *ret_old_desc_blk, | 593 | blk_t *ret_old_desc_blk, |
@@ -652,7 +652,7 @@ extern errcode_t ext2fs_dirhash(int version, const char *name, int len, | |||
652 | 652 | ||
653 | 653 | ||
654 | /* dir_iterate.c */ | 654 | /* dir_iterate.c */ |
655 | extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, | 655 | extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, |
656 | ext2_ino_t dir, | 656 | ext2_ino_t dir, |
657 | int flags, | 657 | int flags, |
658 | char *block_buf, | 658 | char *block_buf, |
@@ -662,7 +662,7 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, | |||
662 | char *buf, | 662 | char *buf, |
663 | void *priv_data), | 663 | void *priv_data), |
664 | void *priv_data); | 664 | void *priv_data); |
665 | extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs, | 665 | extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs, |
666 | ext2_ino_t dir, | 666 | ext2_ino_t dir, |
667 | int flags, | 667 | int flags, |
668 | char *block_buf, | 668 | char *block_buf, |
@@ -751,10 +751,10 @@ extern errcode_t ext2fs_initialize(const char *name, int flags, | |||
751 | 751 | ||
752 | /* icount.c */ | 752 | /* icount.c */ |
753 | extern void ext2fs_free_icount(ext2_icount_t icount); | 753 | extern void ext2fs_free_icount(ext2_icount_t icount); |
754 | extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, | 754 | extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, |
755 | unsigned int size, | 755 | unsigned int size, |
756 | ext2_icount_t hint, ext2_icount_t *ret); | 756 | ext2_icount_t hint, ext2_icount_t *ret); |
757 | extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, | 757 | extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, |
758 | unsigned int size, | 758 | unsigned int size, |
759 | ext2_icount_t *ret); | 759 | ext2_icount_t *ret); |
760 | extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, | 760 | 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 *); | |||
770 | 770 | ||
771 | /* inode.c */ | 771 | /* inode.c */ |
772 | extern errcode_t ext2fs_flush_icache(ext2_filsys fs); | 772 | extern errcode_t ext2fs_flush_icache(ext2_filsys fs); |
773 | extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, | 773 | extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, |
774 | ext2_ino_t *ino, | 774 | ext2_ino_t *ino, |
775 | struct ext2_inode *inode, | 775 | struct ext2_inode *inode, |
776 | int bufsize); | 776 | int bufsize); |
777 | extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, | 777 | extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, |
778 | ext2_inode_scan *ret_scan); | 778 | ext2_inode_scan *ret_scan); |
@@ -791,12 +791,12 @@ extern void ext2fs_set_inode_callback | |||
791 | extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags, | 791 | extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags, |
792 | int clear_flags); | 792 | int clear_flags); |
793 | extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, | 793 | extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, |
794 | struct ext2_inode * inode, | 794 | struct ext2_inode * inode, |
795 | int bufsize); | 795 | int bufsize); |
796 | extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino, | 796 | extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino, |
797 | struct ext2_inode * inode); | 797 | struct ext2_inode * inode); |
798 | extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, | 798 | extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, |
799 | struct ext2_inode * inode, | 799 | struct ext2_inode * inode, |
800 | int bufsize); | 800 | int bufsize); |
801 | extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, | 801 | extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, |
802 | struct ext2_inode * inode); | 802 | struct ext2_inode * inode); |
@@ -807,12 +807,12 @@ extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino); | |||
807 | 807 | ||
808 | /* inode_io.c */ | 808 | /* inode_io.c */ |
809 | extern io_manager inode_io_manager; | 809 | extern io_manager inode_io_manager; |
810 | extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, | 810 | extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, |
811 | char **name); | 811 | char **name); |
812 | extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, | 812 | extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, |
813 | struct ext2_inode *inode, | 813 | struct ext2_inode *inode, |
814 | char **name); | 814 | char **name); |
815 | 815 | ||
816 | /* ismounted.c */ | 816 | /* ismounted.c */ |
817 | extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags); | 817 | extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags); |
818 | extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, | 818 | 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, | |||
852 | extern errcode_t ext2fs_open(const char *name, int flags, int superblock, | 852 | extern errcode_t ext2fs_open(const char *name, int flags, int superblock, |
853 | unsigned int block_size, io_manager manager, | 853 | unsigned int block_size, io_manager manager, |
854 | ext2_filsys *ret_fs); | 854 | ext2_filsys *ret_fs); |
855 | extern errcode_t ext2fs_open2(const char *name, const char *io_options, | 855 | extern errcode_t ext2fs_open2(const char *name, const char *io_options, |
856 | int flags, int superblock, | 856 | int flags, int superblock, |
857 | unsigned int block_size, io_manager manager, | 857 | unsigned int block_size, io_manager manager, |
858 | ext2_filsys *ret_fs); | 858 | ext2_filsys *ret_fs); |
859 | extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, | 859 | extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, |
860 | dgrp_t i); | 860 | dgrp_t i); |
861 | errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io); | 861 | errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io); |
862 | errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io); | 862 | 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, | |||
877 | ext2_badblocks_list *bb_list); | 877 | ext2_badblocks_list *bb_list); |
878 | 878 | ||
879 | /* read_bb_file.c */ | 879 | /* read_bb_file.c */ |
880 | extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, | 880 | extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, |
881 | ext2_badblocks_list *bb_list, | 881 | ext2_badblocks_list *bb_list, |
882 | void *priv_data, | 882 | void *priv_data, |
883 | void (*invalid)(ext2_filsys fs, | 883 | void (*invalid)(ext2_filsys fs, |
884 | blk_t blk, | 884 | blk_t blk, |
885 | char *badstr, | 885 | char *badstr, |
886 | void *priv_data)); | 886 | void *priv_data)); |
887 | extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, | 887 | extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, |
888 | ext2_badblocks_list *bb_list, | 888 | ext2_badblocks_list *bb_list, |
889 | void (*invalid)(ext2_filsys fs, | 889 | void (*invalid)(ext2_filsys fs, |
890 | blk_t blk)); | 890 | blk_t blk)); |
@@ -904,7 +904,7 @@ extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src, | |||
904 | ext2fs_generic_bitmap *dest); | 904 | ext2fs_generic_bitmap *dest); |
905 | 905 | ||
906 | /* swapfs.c */ | 906 | /* swapfs.c */ |
907 | extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, | 907 | extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, |
908 | int has_header); | 908 | int has_header); |
909 | extern void ext2fs_swap_super(struct ext2_super_block * super); | 909 | extern void ext2fs_swap_super(struct ext2_super_block * super); |
910 | extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp); | 910 | extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp); |
diff --git a/e2fsprogs/ext2fs/ext2fsP.h b/e2fsprogs/ext2fs/ext2fsP.h index eea32d632..90b081232 100644 --- a/e2fsprogs/ext2fs/ext2fsP.h +++ b/e2fsprogs/ext2fs/ext2fsP.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ext2fsP.h --- private header file for ext2 library | 2 | * ext2fsP.h --- private header file for ext2 library |
3 | * | 3 | * |
4 | * Copyright (C) 1997 Theodore Ts'o. | 4 | * Copyright (C) 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -78,7 +78,7 @@ struct ext2_inode_cache_ent { | |||
78 | 78 | ||
79 | /* Function prototypes */ | 79 | /* Function prototypes */ |
80 | 80 | ||
81 | extern int ext2fs_process_dir_block(ext2_filsys fs, | 81 | extern int ext2fs_process_dir_block(ext2_filsys fs, |
82 | blk_t *blocknr, | 82 | blk_t *blocknr, |
83 | e2_blkcnt_t blockcnt, | 83 | e2_blkcnt_t blockcnt, |
84 | blk_t ref_block, | 84 | blk_t ref_block, |
diff --git a/e2fsprogs/ext2fs/ext2fs_inline.c b/e2fsprogs/ext2fs/ext2fs_inline.c index f14e7b22f..2fa9a9ed2 100644 --- a/e2fsprogs/ext2fs/ext2fs_inline.c +++ b/e2fsprogs/ext2fs/ext2fs_inline.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ext2fs.h --- ext2fs | 2 | * ext2fs.h --- ext2fs |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -36,7 +36,7 @@ errcode_t ext2fs_free_mem(void *ptr) | |||
36 | *pp = 0; | 36 | *pp = 0; |
37 | return 0; | 37 | return 0; |
38 | } | 38 | } |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * Resize memory | 41 | * Resize memory |
42 | */ | 42 | */ |
@@ -154,7 +154,7 @@ blk_t ext2fs_inode_data_blocks(ext2_filsys fs, | |||
154 | struct ext2_inode *inode) | 154 | struct ext2_inode *inode) |
155 | { | 155 | { |
156 | return inode->i_blocks - | 156 | return inode->i_blocks - |
157 | (inode->i_file_acl ? fs->blocksize >> 9 : 0); | 157 | (inode->i_file_acl ? fs->blocksize >> 9 : 0); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
@@ -179,7 +179,7 @@ __u32 ext2fs_swab32(__u32 val) | |||
179 | int ext2fs_find_first_bit_set(void * addr, unsigned size) | 179 | int ext2fs_find_first_bit_set(void * addr, unsigned size) |
180 | { | 180 | { |
181 | char *cp = (unsigned char *) addr; | 181 | char *cp = (unsigned char *) addr; |
182 | int res = 0, d0; | 182 | int res = 0, d0; |
183 | 183 | ||
184 | if (!size) | 184 | if (!size) |
185 | return 0; | 185 | return 0; |
@@ -191,7 +191,7 @@ int ext2fs_find_first_bit_set(void * addr, unsigned size) | |||
191 | d0 = ffs(*cp); | 191 | d0 = ffs(*cp); |
192 | if (d0 == 0) | 192 | if (d0 == 0) |
193 | return size; | 193 | return size; |
194 | 194 | ||
195 | return res + d0 - 1; | 195 | return res + d0 - 1; |
196 | } | 196 | } |
197 | 197 | ||
@@ -199,10 +199,10 @@ int ext2fs_find_next_bit_set (void * addr, int size, int offset) | |||
199 | { | 199 | { |
200 | unsigned char * p; | 200 | unsigned char * p; |
201 | int set = 0, bit = offset & 7, res = 0, d0; | 201 | int set = 0, bit = offset & 7, res = 0, d0; |
202 | 202 | ||
203 | res = offset >> 3; | 203 | res = offset >> 3; |
204 | p = ((unsigned char *) addr) + res; | 204 | p = ((unsigned char *) addr) + res; |
205 | 205 | ||
206 | if (bit) { | 206 | if (bit) { |
207 | set = ffs(*p & ~((1 << bit) - 1)); | 207 | set = ffs(*p & ~((1 << bit) - 1)); |
208 | if (set) | 208 | if (set) |
@@ -245,35 +245,35 @@ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, | |||
245 | int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, | 245 | int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, |
246 | blk_t block) | 246 | blk_t block) |
247 | { | 247 | { |
248 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 248 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
249 | block); | 249 | block); |
250 | } | 250 | } |
251 | 251 | ||
252 | int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, | 252 | int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, |
253 | blk_t block) | 253 | blk_t block) |
254 | { | 254 | { |
255 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 255 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
256 | block); | 256 | block); |
257 | } | 257 | } |
258 | 258 | ||
259 | int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, | 259 | int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
260 | ext2_ino_t inode) | 260 | ext2_ino_t inode) |
261 | { | 261 | { |
262 | return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 262 | return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
263 | inode); | 263 | inode); |
264 | } | 264 | } |
265 | 265 | ||
266 | int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, | 266 | int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
267 | ext2_ino_t inode) | 267 | ext2_ino_t inode) |
268 | { | 268 | { |
269 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 269 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
270 | inode); | 270 | inode); |
271 | } | 271 | } |
272 | 272 | ||
273 | int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, | 273 | int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, |
274 | ext2_ino_t inode) | 274 | ext2_ino_t inode) |
275 | { | 275 | { |
276 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 276 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
277 | inode); | 277 | inode); |
278 | } | 278 | } |
279 | 279 | ||
@@ -286,7 +286,7 @@ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, | |||
286 | bitmap->description); | 286 | bitmap->description); |
287 | return; | 287 | return; |
288 | } | 288 | } |
289 | #endif | 289 | #endif |
290 | ext2fs_set_bit(block - bitmap->start, bitmap->bitmap); | 290 | ext2fs_set_bit(block - bitmap->start, bitmap->bitmap); |
291 | } | 291 | } |
292 | 292 | ||
@@ -415,7 +415,7 @@ void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, | |||
415 | blk_t block, int num) | 415 | blk_t block, int num) |
416 | { | 416 | { |
417 | int i; | 417 | int i; |
418 | 418 | ||
419 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { | 419 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { |
420 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, | 420 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, |
421 | bitmap->description); | 421 | bitmap->description); |
@@ -429,14 +429,14 @@ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, | |||
429 | blk_t block, int num) | 429 | blk_t block, int num) |
430 | { | 430 | { |
431 | int i; | 431 | int i; |
432 | 432 | ||
433 | #ifdef EXT2FS_DEBUG_FAST_OPS | 433 | #ifdef EXT2FS_DEBUG_FAST_OPS |
434 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { | 434 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { |
435 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, | 435 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, |
436 | bitmap->description); | 436 | bitmap->description); |
437 | return; | 437 | return; |
438 | } | 438 | } |
439 | #endif | 439 | #endif |
440 | for (i=0; i < num; i++) | 440 | for (i=0; i < num; i++) |
441 | ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap); | 441 | ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap); |
442 | } | 442 | } |
@@ -445,7 +445,7 @@ void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, | |||
445 | blk_t block, int num) | 445 | blk_t block, int num) |
446 | { | 446 | { |
447 | int i; | 447 | int i; |
448 | 448 | ||
449 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { | 449 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { |
450 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, | 450 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, |
451 | bitmap->description); | 451 | bitmap->description); |
@@ -459,14 +459,14 @@ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, | |||
459 | blk_t block, int num) | 459 | blk_t block, int num) |
460 | { | 460 | { |
461 | int i; | 461 | int i; |
462 | 462 | ||
463 | #ifdef EXT2FS_DEBUG_FAST_OPS | 463 | #ifdef EXT2FS_DEBUG_FAST_OPS |
464 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { | 464 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { |
465 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, | 465 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, |
466 | bitmap->description); | 466 | bitmap->description); |
467 | return; | 467 | return; |
468 | } | 468 | } |
469 | #endif | 469 | #endif |
470 | for (i=0; i < num; i++) | 470 | for (i=0; i < num; i++) |
471 | ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap); | 471 | ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap); |
472 | } | 472 | } |
diff --git a/e2fsprogs/ext2fs/ext_attr.c b/e2fsprogs/ext2fs/ext_attr.c index 08211c316..10b8bfd9d 100644 --- a/e2fsprogs/ext2fs/ext_attr.c +++ b/e2fsprogs/ext2fs/ext_attr.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ext_attr.c --- extended attribute blocks | 2 | * ext_attr.c --- extended attribute blocks |
3 | * | 3 | * |
4 | * Copyright (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org> | 4 | * Copyright (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org> |
5 | * | 5 | * |
6 | * Copyright (C) 2002 Theodore Ts'o. | 6 | * Copyright (C) 2002 Theodore Ts'o. |
@@ -27,7 +27,7 @@ errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf) | |||
27 | { | 27 | { |
28 | errcode_t retval; | 28 | errcode_t retval; |
29 | 29 | ||
30 | retval = io_channel_read_blk(fs->io, block, 1, buf); | 30 | retval = io_channel_read_blk(fs->io, block, 1, buf); |
31 | if (retval) | 31 | if (retval) |
32 | return retval; | 32 | return retval; |
33 | #ifdef EXT2FS_ENABLE_SWAPFS | 33 | #ifdef EXT2FS_ENABLE_SWAPFS |
@@ -55,7 +55,7 @@ errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *inbuf) | |||
55 | } else | 55 | } else |
56 | #endif | 56 | #endif |
57 | write_buf = (char *) inbuf; | 57 | write_buf = (char *) inbuf; |
58 | retval = io_channel_write_blk(fs->io, block, 1, write_buf); | 58 | retval = io_channel_write_blk(fs->io, block, 1, write_buf); |
59 | if (buf) | 59 | if (buf) |
60 | ext2fs_free_mem(&buf); | 60 | ext2fs_free_mem(&buf); |
61 | if (!retval) | 61 | if (!retval) |
diff --git a/e2fsprogs/ext2fs/fileio.c b/e2fsprogs/ext2fs/fileio.c index 3e42cbc32..669e80c65 100644 --- a/e2fsprogs/ext2fs/fileio.c +++ b/e2fsprogs/ext2fs/fileio.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * fileio.c --- Simple file I/O routines | 2 | * fileio.c --- Simple file I/O routines |
3 | * | 3 | * |
4 | * Copyright (C) 1997 Theodore Ts'o. | 4 | * Copyright (C) 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -20,14 +20,14 @@ | |||
20 | 20 | ||
21 | struct ext2_file { | 21 | struct ext2_file { |
22 | errcode_t magic; | 22 | errcode_t magic; |
23 | ext2_filsys fs; | 23 | ext2_filsys fs; |
24 | ext2_ino_t ino; | 24 | ext2_ino_t ino; |
25 | struct ext2_inode inode; | 25 | struct ext2_inode inode; |
26 | int flags; | 26 | int flags; |
27 | __u64 pos; | 27 | __u64 pos; |
28 | blk_t blockno; | 28 | blk_t blockno; |
29 | blk_t physblock; | 29 | blk_t physblock; |
30 | char *buf; | 30 | char *buf; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | #define BMAP_BUFFER (file->buf + fs->blocksize) | 33 | #define BMAP_BUFFER (file->buf + fs->blocksize) |
@@ -36,7 +36,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, | |||
36 | struct ext2_inode *inode, | 36 | struct ext2_inode *inode, |
37 | int flags, ext2_file_t *ret) | 37 | int flags, ext2_file_t *ret) |
38 | { | 38 | { |
39 | ext2_file_t file; | 39 | ext2_file_t file; |
40 | errcode_t retval; | 40 | errcode_t retval; |
41 | 41 | ||
42 | /* | 42 | /* |
@@ -50,7 +50,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, | |||
50 | retval = ext2fs_get_mem(sizeof(struct ext2_file), &file); | 50 | retval = ext2fs_get_mem(sizeof(struct ext2_file), &file); |
51 | if (retval) | 51 | if (retval) |
52 | return retval; | 52 | return retval; |
53 | 53 | ||
54 | memset(file, 0, sizeof(struct ext2_file)); | 54 | memset(file, 0, sizeof(struct ext2_file)); |
55 | file->magic = EXT2_ET_MAGIC_EXT2_FILE; | 55 | file->magic = EXT2_ET_MAGIC_EXT2_FILE; |
56 | file->fs = fs; | 56 | file->fs = fs; |
@@ -64,14 +64,14 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, | |||
64 | if (retval) | 64 | if (retval) |
65 | goto fail; | 65 | goto fail; |
66 | } | 66 | } |
67 | 67 | ||
68 | retval = ext2fs_get_mem(fs->blocksize * 3, &file->buf); | 68 | retval = ext2fs_get_mem(fs->blocksize * 3, &file->buf); |
69 | if (retval) | 69 | if (retval) |
70 | goto fail; | 70 | goto fail; |
71 | 71 | ||
72 | *ret = file; | 72 | *ret = file; |
73 | return 0; | 73 | return 0; |
74 | 74 | ||
75 | fail: | 75 | fail: |
76 | if (file->buf) | 76 | if (file->buf) |
77 | ext2fs_free_mem(&file->buf); | 77 | ext2fs_free_mem(&file->buf); |
@@ -103,7 +103,7 @@ errcode_t ext2fs_file_flush(ext2_file_t file) | |||
103 | { | 103 | { |
104 | errcode_t retval; | 104 | errcode_t retval; |
105 | ext2_filsys fs; | 105 | ext2_filsys fs; |
106 | 106 | ||
107 | EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); | 107 | EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); |
108 | fs = file->fs; | 108 | fs = file->fs; |
109 | 109 | ||
@@ -176,7 +176,7 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill) | |||
176 | if (!dontfill) { | 176 | if (!dontfill) { |
177 | if (file->physblock) { | 177 | if (file->physblock) { |
178 | retval = io_channel_read_blk(fs->io, | 178 | retval = io_channel_read_blk(fs->io, |
179 | file->physblock, | 179 | file->physblock, |
180 | 1, file->buf); | 180 | 1, file->buf); |
181 | if (retval) | 181 | if (retval) |
182 | return retval; | 182 | return retval; |
@@ -187,16 +187,16 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill) | |||
187 | } | 187 | } |
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
190 | 190 | ||
191 | 191 | ||
192 | errcode_t ext2fs_file_close(ext2_file_t file) | 192 | errcode_t ext2fs_file_close(ext2_file_t file) |
193 | { | 193 | { |
194 | errcode_t retval; | 194 | errcode_t retval; |
195 | 195 | ||
196 | EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); | 196 | EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); |
197 | 197 | ||
198 | retval = ext2fs_file_flush(file); | 198 | retval = ext2fs_file_flush(file); |
199 | 199 | ||
200 | if (file->buf) | 200 | if (file->buf) |
201 | ext2fs_free_mem(&file->buf); | 201 | ext2fs_free_mem(&file->buf); |
202 | ext2fs_free_mem(&file); | 202 | ext2fs_free_mem(&file); |
@@ -232,14 +232,14 @@ errcode_t ext2fs_file_read(ext2_file_t file, void *buf, | |||
232 | left = EXT2_I_SIZE(&file->inode) - file->pos ; | 232 | left = EXT2_I_SIZE(&file->inode) - file->pos ; |
233 | if (c > left) | 233 | if (c > left) |
234 | c = left; | 234 | c = left; |
235 | 235 | ||
236 | memcpy(ptr, file->buf+start, c); | 236 | memcpy(ptr, file->buf+start, c); |
237 | file->pos += c; | 237 | file->pos += c; |
238 | ptr += c; | 238 | ptr += c; |
239 | count += c; | 239 | count += c; |
240 | wanted -= c; | 240 | wanted -= c; |
241 | } | 241 | } |
242 | 242 | ||
243 | fail: | 243 | fail: |
244 | if (got) | 244 | if (got) |
245 | *got = count; | 245 | *got = count; |
@@ -265,7 +265,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, | |||
265 | retval = sync_buffer_position(file); | 265 | retval = sync_buffer_position(file); |
266 | if (retval) | 266 | if (retval) |
267 | goto fail; | 267 | goto fail; |
268 | 268 | ||
269 | start = file->pos % fs->blocksize; | 269 | start = file->pos % fs->blocksize; |
270 | c = fs->blocksize - start; | 270 | c = fs->blocksize - start; |
271 | if (c > nbytes) | 271 | if (c > nbytes) |
@@ -286,7 +286,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, | |||
286 | count += c; | 286 | count += c; |
287 | nbytes -= c; | 287 | nbytes -= c; |
288 | } | 288 | } |
289 | 289 | ||
290 | fail: | 290 | fail: |
291 | if (written) | 291 | if (written) |
292 | *written = count; | 292 | *written = count; |
@@ -318,7 +318,7 @@ errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset, | |||
318 | { | 318 | { |
319 | __u64 loffset, ret_loffset; | 319 | __u64 loffset, ret_loffset; |
320 | errcode_t retval; | 320 | errcode_t retval; |
321 | 321 | ||
322 | loffset = offset; | 322 | loffset = offset; |
323 | retval = ext2fs_file_llseek(file, loffset, whence, &ret_loffset); | 323 | retval = ext2fs_file_llseek(file, loffset, whence, &ret_loffset); |
324 | if (ret_pos) | 324 | if (ret_pos) |
@@ -354,14 +354,14 @@ ext2_off_t ext2fs_file_get_size(ext2_file_t file) | |||
354 | 354 | ||
355 | /* | 355 | /* |
356 | * This function sets the size of the file, truncating it if necessary | 356 | * This function sets the size of the file, truncating it if necessary |
357 | * | 357 | * |
358 | * XXX still need to call truncate | 358 | * XXX still need to call truncate |
359 | */ | 359 | */ |
360 | errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size) | 360 | errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size) |
361 | { | 361 | { |
362 | errcode_t retval; | 362 | errcode_t retval; |
363 | EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); | 363 | EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); |
364 | 364 | ||
365 | file->inode.i_size = size; | 365 | file->inode.i_size = size; |
366 | file->inode.i_size_high = 0; | 366 | file->inode.i_size_high = 0; |
367 | if (file->ino) { | 367 | if (file->ino) { |
@@ -370,7 +370,7 @@ errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size) | |||
370 | return retval; | 370 | return retval; |
371 | } | 371 | } |
372 | 372 | ||
373 | /* | 373 | /* |
374 | * XXX truncate inode if necessary | 374 | * XXX truncate inode if necessary |
375 | */ | 375 | */ |
376 | 376 | ||
diff --git a/e2fsprogs/ext2fs/finddev.c b/e2fsprogs/ext2fs/finddev.c index c459c0833..552aa79c3 100644 --- a/e2fsprogs/ext2fs/finddev.c +++ b/e2fsprogs/ext2fs/finddev.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * finddev.c -- this routine attempts to find a particular device in | 2 | * finddev.c -- this routine attempts to find a particular device in |
3 | * /dev | 3 | * /dev |
4 | * | 4 | * |
5 | * Copyright (C) 2000 Theodore Ts'o. | 5 | * Copyright (C) 2000 Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
@@ -124,7 +124,7 @@ char *ext2fs_find_block_device(dev_t device) | |||
124 | add_to_dirlist("/devices", &list); | 124 | add_to_dirlist("/devices", &list); |
125 | add_to_dirlist("/devfs", &list); | 125 | add_to_dirlist("/devfs", &list); |
126 | add_to_dirlist("/dev", &list); | 126 | add_to_dirlist("/dev", &list); |
127 | 127 | ||
128 | while (list) { | 128 | while (list) { |
129 | current = list; | 129 | current = list; |
130 | list = list->next; | 130 | list = list->next; |
@@ -150,7 +150,7 @@ char *ext2fs_find_block_device(dev_t device) | |||
150 | return ret_path; | 150 | return ret_path; |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | #ifdef DEBUG | 154 | #ifdef DEBUG |
155 | int main(int argc, char** argv) | 155 | int main(int argc, char** argv) |
156 | { | 156 | { |
@@ -194,5 +194,5 @@ int main(int argc, char** argv) | |||
194 | } | 194 | } |
195 | return 0; | 195 | return 0; |
196 | } | 196 | } |
197 | 197 | ||
198 | #endif | 198 | #endif |
diff --git a/e2fsprogs/ext2fs/flushb.c b/e2fsprogs/ext2fs/flushb.c index 18827955f..9f04647ec 100644 --- a/e2fsprogs/ext2fs/flushb.c +++ b/e2fsprogs/ext2fs/flushb.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * flushb.c --- Hides system-dependent information for both syncing a | 2 | * flushb.c --- Hides system-dependent information for both syncing a |
3 | * device to disk and to flush any buffers from disk cache. | 3 | * device to disk and to flush any buffers from disk cache. |
4 | * | 4 | * |
5 | * Copyright (C) 2000 Theodore Ts'o. | 5 | * Copyright (C) 2000 Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
@@ -29,7 +29,7 @@ | |||
29 | #include "ext2fs.h" | 29 | #include "ext2fs.h" |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * For Linux, define BLKFLSBUF and FDFLUSH if necessary, since | 32 | * For Linux, define BLKFLSBUF and FDFLUSH if necessary, since |
33 | * not all portable header file does so for us. This really should be | 33 | * not all portable header file does so for us. This really should be |
34 | * fixed in the glibc header files. (Recent glibcs appear to define | 34 | * fixed in the glibc header files. (Recent glibcs appear to define |
35 | * BLKFLSBUF in sys/mount.h, but FDFLUSH still doesn't seem to be | 35 | * 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 029ffaae1..3fd51f257 100644 --- a/e2fsprogs/ext2fs/freefs.c +++ b/e2fsprogs/ext2fs/freefs.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * freefs.c --- free an ext2 filesystem | 2 | * freefs.c --- free an ext2 filesystem |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -52,7 +52,7 @@ void ext2fs_free(ext2_filsys fs) | |||
52 | 52 | ||
53 | if (fs->icache) | 53 | if (fs->icache) |
54 | ext2fs_free_inode_cache(fs->icache); | 54 | ext2fs_free_inode_cache(fs->icache); |
55 | 55 | ||
56 | fs->magic = 0; | 56 | fs->magic = 0; |
57 | 57 | ||
58 | ext2fs_free_mem(&fs); | 58 | ext2fs_free_mem(&fs); |
diff --git a/e2fsprogs/ext2fs/gen_bitmap.c b/e2fsprogs/ext2fs/gen_bitmap.c index 700affa19..3f15ce6a7 100644 --- a/e2fsprogs/ext2fs/gen_bitmap.c +++ b/e2fsprogs/ext2fs/gen_bitmap.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * gen_bitmap.c --- Generic bitmap routines that used to be inlined. | 2 | * gen_bitmap.c --- Generic bitmap routines that used to be inlined. |
3 | * | 3 | * |
4 | * Copyright (C) 2001 Theodore Ts'o. | 4 | * Copyright (C) 2001 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
diff --git a/e2fsprogs/ext2fs/get_pathname.c b/e2fsprogs/ext2fs/get_pathname.c index 23f593f67..594090da0 100644 --- a/e2fsprogs/ext2fs/get_pathname.c +++ b/e2fsprogs/ext2fs/get_pathname.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * get_pathname.c --- do directry/inode -> name translation | 2 | * get_pathname.c --- do directry/inode -> name translation |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -8,14 +8,14 @@ | |||
8 | * License. | 8 | * License. |
9 | * %End-Header% | 9 | * %End-Header% |
10 | * | 10 | * |
11 | * ext2fs_get_pathname(fs, dir, ino, name) | 11 | * ext2fs_get_pathname(fs, dir, ino, name) |
12 | * | ||
13 | * This function translates takes two inode numbers into a | ||
14 | * string, placing the result in <name>. <dir> is the containing | ||
15 | * directory inode, and <ino> is the inode number itself. If | ||
16 | * <ino> is zero, then ext2fs_get_pathname will return pathname | ||
17 | * of the the directory <dir>. | ||
12 | * | 18 | * |
13 | * This function translates takes two inode numbers into a | ||
14 | * string, placing the result in <name>. <dir> is the containing | ||
15 | * directory inode, and <ino> is the inode number itself. If | ||
16 | * <ino> is zero, then ext2fs_get_pathname will return pathname | ||
17 | * of the the directory <dir>. | ||
18 | * | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <stdio.h> | 21 | #include <stdio.h> |
@@ -65,8 +65,8 @@ static int get_pathname_proc(struct ext2_dir_entry *dirent, | |||
65 | return 0; | 65 | return 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, | 68 | static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, |
69 | ext2_ino_t ino, int maxdepth, | 69 | ext2_ino_t ino, int maxdepth, |
70 | char *buf, char **name) | 70 | char *buf, char **name) |
71 | { | 71 | { |
72 | struct get_pathname_struct gp; | 72 | struct get_pathname_struct gp; |
@@ -93,7 +93,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, | |||
93 | gp.parent = 0; | 93 | gp.parent = 0; |
94 | gp.name = 0; | 94 | gp.name = 0; |
95 | gp.errcode = 0; | 95 | gp.errcode = 0; |
96 | 96 | ||
97 | retval = ext2fs_dir_iterate(fs, dir, 0, buf, get_pathname_proc, &gp); | 97 | retval = ext2fs_dir_iterate(fs, dir, 0, buf, get_pathname_proc, &gp); |
98 | if (retval) | 98 | if (retval) |
99 | goto cleanup; | 99 | goto cleanup; |
@@ -110,15 +110,15 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, | |||
110 | *name = parent_name; | 110 | *name = parent_name; |
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
113 | 113 | ||
114 | if (gp.name) | 114 | if (gp.name) |
115 | retval = ext2fs_get_mem(strlen(parent_name)+strlen(gp.name)+2, | 115 | retval = ext2fs_get_mem(strlen(parent_name)+strlen(gp.name)+2, |
116 | &ret); | 116 | &ret); |
117 | else | 117 | else |
118 | retval = ext2fs_get_mem(strlen(parent_name)+5, &ret); | 118 | retval = ext2fs_get_mem(strlen(parent_name)+5, &ret); |
119 | if (retval) | 119 | if (retval) |
120 | goto cleanup; | 120 | goto cleanup; |
121 | 121 | ||
122 | ret[0] = 0; | 122 | ret[0] = 0; |
123 | if (parent_name[1]) | 123 | if (parent_name[1]) |
124 | strcat(ret, parent_name); | 124 | strcat(ret, parent_name); |
@@ -130,7 +130,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, | |||
130 | *name = ret; | 130 | *name = ret; |
131 | ext2fs_free_mem(&parent_name); | 131 | ext2fs_free_mem(&parent_name); |
132 | retval = 0; | 132 | retval = 0; |
133 | 133 | ||
134 | cleanup: | 134 | cleanup: |
135 | if (gp.name) | 135 | if (gp.name) |
136 | ext2fs_free_mem(&gp.name); | 136 | 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, | |||
153 | retval = ext2fs_get_pathname_int(fs, dir, ino, 32, buf, name); | 153 | retval = ext2fs_get_pathname_int(fs, dir, ino, 32, buf, name); |
154 | ext2fs_free_mem(&buf); | 154 | ext2fs_free_mem(&buf); |
155 | return retval; | 155 | return retval; |
156 | 156 | ||
157 | } | 157 | } |
diff --git a/e2fsprogs/ext2fs/getsectsize.c b/e2fsprogs/ext2fs/getsectsize.c index 77a9e3da7..b561660ba 100644 --- a/e2fsprogs/ext2fs/getsectsize.c +++ b/e2fsprogs/ext2fs/getsectsize.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * getsectsize.c --- get the sector size of a device. | 2 | * getsectsize.c --- get the sector size of a device. |
3 | * | 3 | * |
4 | * Copyright (C) 1995, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1995, 1995 Theodore Ts'o. |
5 | * Copyright (C) 2003 VMware, Inc. | 5 | * Copyright (C) 2003 VMware, Inc. |
6 | * | 6 | * |
diff --git a/e2fsprogs/ext2fs/getsize.c b/e2fsprogs/ext2fs/getsize.c index 036d9260c..bfafdf2ba 100644 --- a/e2fsprogs/ext2fs/getsize.c +++ b/e2fsprogs/ext2fs/getsize.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * getsize.c --- get the size of a partition. | 2 | * getsize.c --- get the size of a partition. |
3 | * | 3 | * |
4 | * Copyright (C) 1995, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1995, 1995 Theodore Ts'o. |
5 | * Copyright (C) 2003 VMware, Inc. | 5 | * Copyright (C) 2003 VMware, Inc. |
6 | * | 6 | * |
7 | * Windows version of ext2fs_get_device_size by Chris Li, VMware. | 7 | * Windows version of ext2fs_get_device_size by Chris Li, VMware. |
8 | * | 8 | * |
9 | * %Begin-Header% | 9 | * %Begin-Header% |
10 | * This file may be redistributed under the terms of the GNU Public | 10 | * This file may be redistributed under the terms of the GNU Public |
11 | * License. | 11 | * License. |
@@ -75,10 +75,10 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize, | |||
75 | DWORD filesize; | 75 | DWORD filesize; |
76 | #endif /* HAVE_GET_FILE_SIZE_EX */ | 76 | #endif /* HAVE_GET_FILE_SIZE_EX */ |
77 | 77 | ||
78 | dev = CreateFile(file, GENERIC_READ, | 78 | dev = CreateFile(file, GENERIC_READ, |
79 | FILE_SHARE_READ | FILE_SHARE_WRITE , | 79 | FILE_SHARE_READ | FILE_SHARE_WRITE , |
80 | NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); | 80 | NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); |
81 | 81 | ||
82 | if (dev == INVALID_HANDLE_VALUE) | 82 | if (dev == INVALID_HANDLE_VALUE) |
83 | return EBADF; | 83 | return EBADF; |
84 | if (DeviceIoControl(dev, IOCTL_DISK_GET_PARTITION_INFO, | 84 | if (DeviceIoControl(dev, IOCTL_DISK_GET_PARTITION_INFO, |
@@ -87,7 +87,7 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize, | |||
87 | &retbytes, NULL)) { | 87 | &retbytes, NULL)) { |
88 | 88 | ||
89 | *retblocks = pi.PartitionLength.QuadPart / blocksize; | 89 | *retblocks = pi.PartitionLength.QuadPart / blocksize; |
90 | 90 | ||
91 | } else if (DeviceIoControl(dev, IOCTL_DISK_GET_DRIVE_GEOMETRY, | 91 | } else if (DeviceIoControl(dev, IOCTL_DISK_GET_DRIVE_GEOMETRY, |
92 | &gi, sizeof(DISK_GEOMETRY), | 92 | &gi, sizeof(DISK_GEOMETRY), |
93 | &gi, sizeof(DISK_GEOMETRY), | 93 | &gi, sizeof(DISK_GEOMETRY), |
@@ -137,7 +137,7 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize, | |||
137 | int fd; | 137 | int fd; |
138 | int valid_blkgetsize64 = 1; | 138 | int valid_blkgetsize64 = 1; |
139 | #ifdef __linux__ | 139 | #ifdef __linux__ |
140 | struct utsname ut; | 140 | struct utsname ut; |
141 | #endif | 141 | #endif |
142 | unsigned long long size64; | 142 | unsigned long long size64; |
143 | unsigned long size; | 143 | unsigned long size; |
@@ -272,7 +272,7 @@ int main(int argc, char **argv) | |||
272 | { | 272 | { |
273 | blk_t blocks; | 273 | blk_t blocks; |
274 | int retval; | 274 | int retval; |
275 | 275 | ||
276 | if (argc < 2) { | 276 | if (argc < 2) { |
277 | fprintf(stderr, "Usage: %s device\n", argv[0]); | 277 | fprintf(stderr, "Usage: %s device\n", argv[0]); |
278 | exit(1); | 278 | exit(1); |
diff --git a/e2fsprogs/ext2fs/icount.c b/e2fsprogs/ext2fs/icount.c index 59977928b..01677775f 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, | |||
81 | if (hint->size > size) | 81 | if (hint->size > size) |
82 | size = (size_t) hint->size; | 82 | size = (size_t) hint->size; |
83 | } | 83 | } |
84 | 84 | ||
85 | retval = ext2fs_get_mem(sizeof(struct ext2_icount), &icount); | 85 | retval = ext2fs_get_mem(sizeof(struct ext2_icount), &icount); |
86 | if (retval) | 86 | if (retval) |
87 | return retval; | 87 | return retval; |
88 | memset(icount, 0, sizeof(struct ext2_icount)); | 88 | memset(icount, 0, sizeof(struct ext2_icount)); |
89 | 89 | ||
90 | retval = ext2fs_allocate_inode_bitmap(fs, 0, | 90 | retval = ext2fs_allocate_inode_bitmap(fs, 0, |
91 | &icount->single); | 91 | &icount->single); |
92 | if (retval) | 92 | if (retval) |
93 | goto errout; | 93 | goto errout; |
94 | 94 | ||
95 | if (flags & EXT2_ICOUNT_OPT_INCREMENT) { | 95 | if (flags & EXT2_ICOUNT_OPT_INCREMENT) { |
96 | retval = ext2fs_allocate_inode_bitmap(fs, 0, | 96 | retval = ext2fs_allocate_inode_bitmap(fs, 0, |
97 | &icount->multiple); | 97 | &icount->multiple); |
98 | if (retval) | 98 | if (retval) |
99 | goto errout; | 99 | goto errout; |
@@ -113,7 +113,7 @@ errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size, | |||
113 | goto errout; | 113 | goto errout; |
114 | icount->size += fs->super->s_inodes_count / 50; | 114 | icount->size += fs->super->s_inodes_count / 50; |
115 | } | 115 | } |
116 | 116 | ||
117 | bytes = (size_t) (icount->size * sizeof(struct ext2_icount_el)); | 117 | bytes = (size_t) (icount->size * sizeof(struct ext2_icount_el)); |
118 | #if 0 | 118 | #if 0 |
119 | printf("Icount allocated %d entries, %d bytes.\n", | 119 | printf("Icount allocated %d entries, %d bytes.\n", |
@@ -148,7 +148,7 @@ errout: | |||
148 | return(retval); | 148 | return(retval); |
149 | } | 149 | } |
150 | 150 | ||
151 | errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, | 151 | errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, |
152 | unsigned int size, | 152 | unsigned int size, |
153 | ext2_icount_t *ret) | 153 | ext2_icount_t *ret) |
154 | { | 154 | { |
@@ -157,12 +157,12 @@ errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, | |||
157 | 157 | ||
158 | /* | 158 | /* |
159 | * insert_icount_el() --- Insert a new entry into the sorted list at a | 159 | * insert_icount_el() --- Insert a new entry into the sorted list at a |
160 | * specified position. | 160 | * specified position. |
161 | */ | 161 | */ |
162 | static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, | 162 | static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, |
163 | ext2_ino_t ino, int pos) | 163 | ext2_ino_t ino, int pos) |
164 | { | 164 | { |
165 | struct ext2_icount_el *el; | 165 | struct ext2_icount_el *el; |
166 | errcode_t retval; | 166 | errcode_t retval; |
167 | ext2_ino_t new_size = 0; | 167 | ext2_ino_t new_size = 0; |
168 | int num; | 168 | int num; |
@@ -170,14 +170,14 @@ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, | |||
170 | if (icount->count >= icount->size) { | 170 | if (icount->count >= icount->size) { |
171 | if (icount->count) { | 171 | if (icount->count) { |
172 | new_size = icount->list[(unsigned)icount->count-1].ino; | 172 | new_size = icount->list[(unsigned)icount->count-1].ino; |
173 | new_size = (ext2_ino_t) (icount->count * | 173 | new_size = (ext2_ino_t) (icount->count * |
174 | ((float) icount->num_inodes / new_size)); | 174 | ((float) icount->num_inodes / new_size)); |
175 | } | 175 | } |
176 | if (new_size < (icount->size + 100)) | 176 | if (new_size < (icount->size + 100)) |
177 | new_size = icount->size + 100; | 177 | new_size = icount->size + 100; |
178 | #if 0 | 178 | #if 0 |
179 | printf("Reallocating icount %d entries...\n", new_size); | 179 | printf("Reallocating icount %d entries...\n", new_size); |
180 | #endif | 180 | #endif |
181 | retval = ext2fs_resize_mem((size_t) icount->size * | 181 | retval = ext2fs_resize_mem((size_t) icount->size * |
182 | sizeof(struct ext2_icount_el), | 182 | sizeof(struct ext2_icount_el), |
183 | (size_t) new_size * | 183 | (size_t) new_size * |
@@ -203,8 +203,8 @@ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, | |||
203 | 203 | ||
204 | /* | 204 | /* |
205 | * get_icount_el() --- given an inode number, try to find icount | 205 | * get_icount_el() --- given an inode number, try to find icount |
206 | * information in the sorted list. If the create flag is set, | 206 | * information in the sorted list. If the create flag is set, |
207 | * and we can't find an entry, create one in the sorted list. | 207 | * and we can't find an entry, create one in the sorted list. |
208 | */ | 208 | */ |
209 | static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, | 209 | static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, |
210 | ext2_ino_t ino, int create) | 210 | ext2_ino_t ino, int create) |
@@ -222,7 +222,7 @@ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, | |||
222 | } | 222 | } |
223 | if (icount->count == 0) | 223 | if (icount->count == 0) |
224 | return 0; | 224 | return 0; |
225 | 225 | ||
226 | if (icount->cursor >= icount->count) | 226 | if (icount->cursor >= icount->count) |
227 | icount->cursor = 0; | 227 | icount->cursor = 0; |
228 | if (ino == icount->list[icount->cursor].ino) | 228 | if (ino == icount->list[icount->cursor].ino) |
@@ -247,7 +247,7 @@ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, | |||
247 | range = 0; | 247 | range = 0; |
248 | else if (ino > highval) | 248 | else if (ino > highval) |
249 | range = 1; | 249 | range = 1; |
250 | else | 250 | else |
251 | range = ((float) (ino - lowval)) / | 251 | range = ((float) (ino - lowval)) / |
252 | (highval - lowval); | 252 | (highval - lowval); |
253 | mid = low + ((int) (range * (high-low))); | 253 | mid = low + ((int) (range * (high-low))); |
@@ -276,7 +276,7 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out) | |||
276 | errcode_t ret = 0; | 276 | errcode_t ret = 0; |
277 | unsigned int i; | 277 | unsigned int i; |
278 | const char *bad = "bad icount"; | 278 | const char *bad = "bad icount"; |
279 | 279 | ||
280 | EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); | 280 | EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); |
281 | 281 | ||
282 | if (icount->count > icount->size) { | 282 | if (icount->count > icount->size) { |
@@ -297,7 +297,7 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out) | |||
297 | errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, __u16 *ret) | 297 | errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, __u16 *ret) |
298 | { | 298 | { |
299 | struct ext2_icount_el *el; | 299 | struct ext2_icount_el *el; |
300 | 300 | ||
301 | EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); | 301 | EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); |
302 | 302 | ||
303 | if (!ino || (ino > icount->num_inodes)) | 303 | if (!ino || (ino > icount->num_inodes)) |
@@ -413,7 +413,7 @@ errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino, | |||
413 | if (icount->multiple && | 413 | if (icount->multiple && |
414 | !ext2fs_test_inode_bitmap(icount->multiple, ino)) | 414 | !ext2fs_test_inode_bitmap(icount->multiple, ino)) |
415 | return EXT2_ET_INVALID_ARGUMENT; | 415 | return EXT2_ET_INVALID_ARGUMENT; |
416 | 416 | ||
417 | el = get_icount_el(icount, ino, 0); | 417 | el = get_icount_el(icount, ino, 0); |
418 | if (!el || el->count == 0) | 418 | if (!el || el->count == 0) |
419 | return EXT2_ET_INVALID_ARGUMENT; | 419 | return EXT2_ET_INVALID_ARGUMENT; |
diff --git a/e2fsprogs/ext2fs/imager.c b/e2fsprogs/ext2fs/imager.c index 3f2826b82..00eb71723 100644 --- a/e2fsprogs/ext2fs/imager.c +++ b/e2fsprogs/ext2fs/imager.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * image.c --- writes out the critical parts of the filesystem as a | 2 | * image.c --- writes out the critical parts of the filesystem as a |
3 | * flat file. | 3 | * flat file. |
4 | * | 4 | * |
5 | * Copyright (C) 2000 Theodore Ts'o. | 5 | * Copyright (C) 2000 Theodore Ts'o. |
6 | * | 6 | * |
7 | * Note: this uses the POSIX IO interfaces, unlike most of the other | 7 | * Note: this uses the POSIX IO interfaces, unlike most of the other |
8 | * functions in this library. So sue me. | 8 | * functions in this library. So sue me. |
9 | * | 9 | * |
10 | * %Begin-Header% | 10 | * %Begin-Header% |
11 | * This file may be redistributed under the terms of the GNU Public | 11 | * 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) | |||
67 | errcode_t retval; | 67 | errcode_t retval; |
68 | 68 | ||
69 | buf = xmalloc(fs->blocksize * BUF_BLOCKS); | 69 | buf = xmalloc(fs->blocksize * BUF_BLOCKS); |
70 | 70 | ||
71 | for (group = 0; group < fs->group_desc_count; group++) { | 71 | for (group = 0; group < fs->group_desc_count; group++) { |
72 | blk = fs->group_desc[(unsigned)group].bg_inode_table; | 72 | blk = fs->group_desc[(unsigned)group].bg_inode_table; |
73 | if (!blk) | 73 | if (!blk) |
@@ -127,7 +127,7 @@ errout: | |||
127 | /* | 127 | /* |
128 | * Read in the inode table and stuff it into place | 128 | * Read in the inode table and stuff it into place |
129 | */ | 129 | */ |
130 | errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, | 130 | errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, |
131 | int flags EXT2FS_ATTR((unused))) | 131 | int flags EXT2FS_ATTR((unused))) |
132 | { | 132 | { |
133 | unsigned int group, c, left; | 133 | unsigned int group, c, left; |
@@ -137,7 +137,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, | |||
137 | errcode_t retval; | 137 | errcode_t retval; |
138 | 138 | ||
139 | buf = xmalloc(fs->blocksize * BUF_BLOCKS); | 139 | buf = xmalloc(fs->blocksize * BUF_BLOCKS); |
140 | 140 | ||
141 | for (group = 0; group < fs->group_desc_count; group++) { | 141 | for (group = 0; group < fs->group_desc_count; group++) { |
142 | blk = fs->group_desc[(unsigned)group].bg_inode_table; | 142 | blk = fs->group_desc[(unsigned)group].bg_inode_table; |
143 | if (!blk) { | 143 | if (!blk) { |
@@ -161,7 +161,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, | |||
161 | retval = io_channel_write_blk(fs->io, blk, c, buf); | 161 | retval = io_channel_write_blk(fs->io, blk, c, buf); |
162 | if (retval) | 162 | if (retval) |
163 | goto errout; | 163 | goto errout; |
164 | 164 | ||
165 | blk += c; | 165 | blk += c; |
166 | left -= c; | 166 | left -= c; |
167 | } | 167 | } |
@@ -176,7 +176,7 @@ errout: | |||
176 | /* | 176 | /* |
177 | * Write out superblock and group descriptors | 177 | * Write out superblock and group descriptors |
178 | */ | 178 | */ |
179 | errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, | 179 | errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, |
180 | int flags EXT2FS_ATTR((unused))) | 180 | int flags EXT2FS_ATTR((unused))) |
181 | { | 181 | { |
182 | char *buf, *cp; | 182 | char *buf, *cp; |
@@ -213,7 +213,7 @@ errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, | |||
213 | retval = EXT2_ET_SHORT_WRITE; | 213 | retval = EXT2_ET_SHORT_WRITE; |
214 | goto errout; | 214 | goto errout; |
215 | } | 215 | } |
216 | 216 | ||
217 | retval = 0; | 217 | retval = 0; |
218 | 218 | ||
219 | errout: | 219 | errout: |
@@ -224,7 +224,7 @@ errout: | |||
224 | /* | 224 | /* |
225 | * Read the superblock and group descriptors and overwrite them. | 225 | * Read the superblock and group descriptors and overwrite them. |
226 | */ | 226 | */ |
227 | errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, | 227 | errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, |
228 | int flags EXT2FS_ATTR((unused))) | 228 | int flags EXT2FS_ATTR((unused))) |
229 | { | 229 | { |
230 | char *buf; | 230 | char *buf; |
@@ -368,7 +368,7 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags) | |||
368 | goto errout; | 368 | goto errout; |
369 | } | 369 | } |
370 | memcpy(ptr, buf, size); | 370 | memcpy(ptr, buf, size); |
371 | 371 | ||
372 | retval = 0; | 372 | retval = 0; |
373 | errout: | 373 | errout: |
374 | if (buf) | 374 | if (buf) |
diff --git a/e2fsprogs/ext2fs/ind_block.c b/e2fsprogs/ext2fs/ind_block.c index c9fd86aae..3e6cdc138 100644 --- a/e2fsprogs/ext2fs/ind_block.c +++ b/e2fsprogs/ext2fs/ind_block.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * ind_block.c --- indirect block I/O routines | 2 | * ind_block.c --- indirect block I/O routines |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, | 4 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, |
5 | * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. | 5 | * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
8 | * This file may be redistributed under the terms of the GNU Public | 8 | * 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 82cd9f1da..3d326b577 100644 --- a/e2fsprogs/ext2fs/initialize.c +++ b/e2fsprogs/ext2fs/initialize.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * initialize.c --- initialize a filesystem handle given superblock | 2 | * initialize.c --- initialize a filesystem handle given superblock |
3 | * parameters. Used by mke2fs when initializing a filesystem. | 3 | * parameters. Used by mke2fs when initializing a filesystem. |
4 | * | 4 | * |
5 | * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. | 5 | * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
8 | * This file may be redistributed under the terms of the GNU Public | 8 | * This file may be redistributed under the terms of the GNU Public |
9 | * License. | 9 | * License. |
@@ -36,7 +36,7 @@ | |||
36 | #if defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) | 36 | #if defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) |
37 | #define CREATOR_OS EXT2_OS_FREEBSD | 37 | #define CREATOR_OS EXT2_OS_FREEBSD |
38 | #else | 38 | #else |
39 | #if defined(LITES) && defined(EXT2_OS_LITES) | 39 | #if defined(LITES) && defined(EXT2_OS_LITES) |
40 | #define CREATOR_OS EXT2_OS_LITES | 40 | #define CREATOR_OS EXT2_OS_LITES |
41 | #else | 41 | #else |
42 | #define CREATOR_OS EXT2_OS_LINUX /* by default */ | 42 | #define CREATOR_OS EXT2_OS_LINUX /* by default */ |
@@ -44,13 +44,13 @@ | |||
44 | #endif /* defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) */ | 44 | #endif /* defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) */ |
45 | #endif /* defined(__GNU__) && defined(EXT2_OS_HURD) */ | 45 | #endif /* defined(__GNU__) && defined(EXT2_OS_HURD) */ |
46 | #endif /* defined(__linux__) && defined(EXT2_OS_LINUX) */ | 46 | #endif /* defined(__linux__) && defined(EXT2_OS_LINUX) */ |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Note we override the kernel include file's idea of what the default | 49 | * Note we override the kernel include file's idea of what the default |
50 | * check interval (never) should be. It's a good idea to check at | 50 | * check interval (never) should be. It's a good idea to check at |
51 | * least *occasionally*, specially since servers will never rarely get | 51 | * least *occasionally*, specially since servers will never rarely get |
52 | * to reboot, since Linux is so robust these days. :-) | 52 | * to reboot, since Linux is so robust these days. :-) |
53 | * | 53 | * |
54 | * 180 days (six months) seems like a good value. | 54 | * 180 days (six months) seems like a good value. |
55 | */ | 55 | */ |
56 | #ifdef EXT2_DFL_CHECKINTERVAL | 56 | #ifdef EXT2_DFL_CHECKINTERVAL |
@@ -108,11 +108,11 @@ errcode_t ext2fs_initialize(const char *name, int flags, | |||
108 | 108 | ||
109 | if (!param || !param->s_blocks_count) | 109 | if (!param || !param->s_blocks_count) |
110 | return EXT2_ET_INVALID_ARGUMENT; | 110 | return EXT2_ET_INVALID_ARGUMENT; |
111 | 111 | ||
112 | retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); | 112 | retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); |
113 | if (retval) | 113 | if (retval) |
114 | return retval; | 114 | return retval; |
115 | 115 | ||
116 | memset(fs, 0, sizeof(struct struct_ext2_filsys)); | 116 | memset(fs, 0, sizeof(struct struct_ext2_filsys)); |
117 | fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; | 117 | fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; |
118 | fs->flags = flags | EXT2_FLAG_RW; | 118 | fs->flags = flags | EXT2_FLAG_RW; |
@@ -181,7 +181,7 @@ errcode_t ext2fs_initialize(const char *name, int flags, | |||
181 | if (super->s_blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(super)) | 181 | if (super->s_blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(super)) |
182 | super->s_blocks_per_group = EXT2_MAX_BLOCKS_PER_GROUP(super); | 182 | super->s_blocks_per_group = EXT2_MAX_BLOCKS_PER_GROUP(super); |
183 | super->s_frags_per_group = super->s_blocks_per_group * frags_per_block; | 183 | super->s_frags_per_group = super->s_blocks_per_group * frags_per_block; |
184 | 184 | ||
185 | super->s_blocks_count = param->s_blocks_count; | 185 | super->s_blocks_count = param->s_blocks_count; |
186 | super->s_r_blocks_count = param->s_r_blocks_count; | 186 | super->s_r_blocks_count = param->s_r_blocks_count; |
187 | if (super->s_r_blocks_count >= param->s_blocks_count) { | 187 | if (super->s_r_blocks_count >= param->s_blocks_count) { |
@@ -222,7 +222,7 @@ retry: | |||
222 | */ | 222 | */ |
223 | if (super->s_inodes_count < EXT2_FIRST_INODE(super)+1) | 223 | if (super->s_inodes_count < EXT2_FIRST_INODE(super)+1) |
224 | super->s_inodes_count = EXT2_FIRST_INODE(super)+1; | 224 | super->s_inodes_count = EXT2_FIRST_INODE(super)+1; |
225 | 225 | ||
226 | /* | 226 | /* |
227 | * There should be at least as many inodes as the user | 227 | * There should be at least as many inodes as the user |
228 | * requested. Figure out how many inodes per group that | 228 | * requested. Figure out how many inodes per group that |
@@ -332,12 +332,12 @@ retry: | |||
332 | retval = ext2fs_get_mem(strlen(fs->device_name) + 80, &buf); | 332 | retval = ext2fs_get_mem(strlen(fs->device_name) + 80, &buf); |
333 | if (retval) | 333 | if (retval) |
334 | goto cleanup; | 334 | goto cleanup; |
335 | 335 | ||
336 | sprintf(buf, "block bitmap for %s", fs->device_name); | 336 | sprintf(buf, "block bitmap for %s", fs->device_name); |
337 | retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map); | 337 | retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map); |
338 | if (retval) | 338 | if (retval) |
339 | goto cleanup; | 339 | goto cleanup; |
340 | 340 | ||
341 | sprintf(buf, "inode bitmap for %s", fs->device_name); | 341 | sprintf(buf, "inode bitmap for %s", fs->device_name); |
342 | retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map); | 342 | retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map); |
343 | if (retval) | 343 | if (retval) |
@@ -369,14 +369,14 @@ retry: | |||
369 | fs->group_desc[i].bg_free_inodes_count = | 369 | fs->group_desc[i].bg_free_inodes_count = |
370 | fs->super->s_inodes_per_group; | 370 | fs->super->s_inodes_per_group; |
371 | fs->group_desc[i].bg_used_dirs_count = 0; | 371 | fs->group_desc[i].bg_used_dirs_count = 0; |
372 | 372 | ||
373 | group_block += super->s_blocks_per_group; | 373 | group_block += super->s_blocks_per_group; |
374 | } | 374 | } |
375 | 375 | ||
376 | ext2fs_mark_super_dirty(fs); | 376 | ext2fs_mark_super_dirty(fs); |
377 | ext2fs_mark_bb_dirty(fs); | 377 | ext2fs_mark_bb_dirty(fs); |
378 | ext2fs_mark_ib_dirty(fs); | 378 | ext2fs_mark_ib_dirty(fs); |
379 | 379 | ||
380 | io_channel_set_blksize(fs->io, fs->blocksize); | 380 | io_channel_set_blksize(fs->io, fs->blocksize); |
381 | 381 | ||
382 | *ret_fs = fs; | 382 | *ret_fs = fs; |
diff --git a/e2fsprogs/ext2fs/inline.c b/e2fsprogs/ext2fs/inline.c index 5833b1d9d..9c3a6c0d3 100644 --- a/e2fsprogs/ext2fs/inline.c +++ b/e2fsprogs/ext2fs/inline.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * inline.c --- Includes the inlined functions defined in the header | 2 | * inline.c --- Includes the inlined functions defined in the header |
3 | * files as standalone functions, in case the application program | 3 | * files as standalone functions, in case the application program |
4 | * is compiled with inlining turned off. | 4 | * is compiled with inlining turned off. |
5 | * | 5 | * |
6 | * Copyright (C) 1993, 1994 Theodore Ts'o. | 6 | * Copyright (C) 1993, 1994 Theodore Ts'o. |
7 | * | 7 | * |
8 | * %Begin-Header% | 8 | * %Begin-Header% |
diff --git a/e2fsprogs/ext2fs/inode.c b/e2fsprogs/ext2fs/inode.c index 30580bf6d..e50bece40 100644 --- a/e2fsprogs/ext2fs/inode.c +++ b/e2fsprogs/ext2fs/inode.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * inode.c --- utility routines to read and write inodes | 2 | * inode.c --- utility routines to read and write inodes |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -59,7 +59,7 @@ struct ext2_struct_inode_scan { | |||
59 | errcode_t ext2fs_flush_icache(ext2_filsys fs) | 59 | errcode_t ext2fs_flush_icache(ext2_filsys fs) |
60 | { | 60 | { |
61 | int i; | 61 | int i; |
62 | 62 | ||
63 | if (!fs->icache) | 63 | if (!fs->icache) |
64 | return 0; | 64 | return 0; |
65 | 65 | ||
@@ -73,7 +73,7 @@ errcode_t ext2fs_flush_icache(ext2_filsys fs) | |||
73 | static errcode_t create_icache(ext2_filsys fs) | 73 | static errcode_t create_icache(ext2_filsys fs) |
74 | { | 74 | { |
75 | errcode_t retval; | 75 | errcode_t retval; |
76 | 76 | ||
77 | if (fs->icache) | 77 | if (fs->icache) |
78 | return 0; | 78 | return 0; |
79 | retval = ext2fs_get_mem(sizeof(struct ext2_inode_cache), &fs->icache); | 79 | 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, | |||
146 | group_desc[scan->current_group].bg_inode_table; | 146 | group_desc[scan->current_group].bg_inode_table; |
147 | scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super); | 147 | scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super); |
148 | scan->blocks_left = scan->fs->inode_blocks_per_group; | 148 | scan->blocks_left = scan->fs->inode_blocks_per_group; |
149 | retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks * | 149 | retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks * |
150 | fs->blocksize), | 150 | fs->blocksize), |
151 | &scan->inode_buffer); | 151 | &scan->inode_buffer); |
152 | scan->done_group = 0; | 152 | scan->done_group = 0; |
@@ -172,7 +172,7 @@ void ext2fs_close_inode_scan(ext2_inode_scan scan) | |||
172 | { | 172 | { |
173 | if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) | 173 | if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) |
174 | return; | 174 | return; |
175 | 175 | ||
176 | ext2fs_free_mem(&scan->inode_buffer); | 176 | ext2fs_free_mem(&scan->inode_buffer); |
177 | scan->inode_buffer = NULL; | 177 | scan->inode_buffer = NULL; |
178 | ext2fs_free_mem(&scan->temp_buffer); | 178 | ext2fs_free_mem(&scan->temp_buffer); |
@@ -190,7 +190,7 @@ void ext2fs_set_inode_callback(ext2_inode_scan scan, | |||
190 | { | 190 | { |
191 | if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) | 191 | if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) |
192 | return; | 192 | return; |
193 | 193 | ||
194 | scan->done_group = done_group; | 194 | scan->done_group = done_group; |
195 | scan->done_group_data = done_group_data; | 195 | scan->done_group_data = done_group_data; |
196 | } | 196 | } |
@@ -217,7 +217,7 @@ static errcode_t get_next_blockgroup(ext2_inode_scan scan) | |||
217 | { | 217 | { |
218 | scan->current_group++; | 218 | scan->current_group++; |
219 | scan->groups_left--; | 219 | scan->groups_left--; |
220 | 220 | ||
221 | scan->current_block = scan->fs-> | 221 | scan->current_block = scan->fs-> |
222 | group_desc[scan->current_group].bg_inode_table; | 222 | group_desc[scan->current_group].bg_inode_table; |
223 | 223 | ||
@@ -335,7 +335,7 @@ static errcode_t get_next_blocks(ext2_inode_scan scan) | |||
335 | if (retval) | 335 | if (retval) |
336 | return retval; | 336 | return retval; |
337 | } | 337 | } |
338 | 338 | ||
339 | if ((scan->scan_flags & EXT2_SF_BAD_INODE_BLK) || | 339 | if ((scan->scan_flags & EXT2_SF_BAD_INODE_BLK) || |
340 | (scan->current_block == 0)) { | 340 | (scan->current_block == 0)) { |
341 | memset(scan->inode_buffer, 0, | 341 | memset(scan->inode_buffer, 0, |
@@ -367,7 +367,7 @@ static errcode_t get_next_blocks(ext2_inode_scan scan) | |||
367 | static inline int is_empty_scan(ext2_inode_scan scan) | 367 | static inline int is_empty_scan(ext2_inode_scan scan) |
368 | { | 368 | { |
369 | int i; | 369 | int i; |
370 | 370 | ||
371 | if (scan->bytes_left == 0) | 371 | if (scan->bytes_left == 0) |
372 | return 0; | 372 | return 0; |
373 | 373 | ||
@@ -383,7 +383,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, | |||
383 | { | 383 | { |
384 | errcode_t retval; | 384 | errcode_t retval; |
385 | int extra_bytes = 0; | 385 | int extra_bytes = 0; |
386 | 386 | ||
387 | EXT2_CHECK_MAGIC(scan, EXT2_ET_MAGIC_INODE_SCAN); | 387 | EXT2_CHECK_MAGIC(scan, EXT2_ET_MAGIC_INODE_SCAN); |
388 | 388 | ||
389 | /* | 389 | /* |
@@ -416,7 +416,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, | |||
416 | } else | 416 | } else |
417 | return EXT2_ET_MISSING_INODE_TABLE; | 417 | return EXT2_ET_MISSING_INODE_TABLE; |
418 | } | 418 | } |
419 | 419 | ||
420 | 420 | ||
421 | /* | 421 | /* |
422 | * Have we run out of space in the inode buffer? If so, we | 422 | * 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, | |||
449 | #ifdef EXT2FS_ENABLE_SWAPFS | 449 | #ifdef EXT2FS_ENABLE_SWAPFS |
450 | if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || | 450 | if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || |
451 | (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) | 451 | (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) |
452 | ext2fs_swap_inode_full(scan->fs, | 452 | ext2fs_swap_inode_full(scan->fs, |
453 | (struct ext2_inode_large *) inode, | 453 | (struct ext2_inode_large *) inode, |
454 | (struct ext2_inode_large *) scan->temp_buffer, | 454 | (struct ext2_inode_large *) scan->temp_buffer, |
455 | 0, bufsize); | 455 | 0, bufsize); |
456 | else | 456 | else |
457 | #endif | 457 | #endif |
@@ -463,7 +463,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, | |||
463 | #ifdef EXT2FS_ENABLE_SWAPFS | 463 | #ifdef EXT2FS_ENABLE_SWAPFS |
464 | if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || | 464 | if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || |
465 | (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) | 465 | (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) |
466 | ext2fs_swap_inode_full(scan->fs, | 466 | ext2fs_swap_inode_full(scan->fs, |
467 | (struct ext2_inode_large *) inode, | 467 | (struct ext2_inode_large *) inode, |
468 | (struct ext2_inode_large *) scan->ptr, | 468 | (struct ext2_inode_large *) scan->ptr, |
469 | 0, bufsize); | 469 | 0, bufsize); |
@@ -495,10 +495,10 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino, | |||
495 | errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, | 495 | errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, |
496 | struct ext2_inode * inode, int bufsize) | 496 | struct ext2_inode * inode, int bufsize) |
497 | { | 497 | { |
498 | unsigned long group, block, block_nr, offset; | 498 | unsigned long group, block, block_nr, offset; |
499 | char *ptr; | 499 | char *ptr; |
500 | errcode_t retval; | 500 | errcode_t retval; |
501 | int clen, i, inodes_per_block, length; | 501 | int clen, i, inodes_per_block, length; |
502 | io_channel io; | 502 | io_channel io; |
503 | 503 | ||
504 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 504 | 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, | |||
541 | block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super); | 541 | block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super); |
542 | if (!fs->group_desc[(unsigned)group].bg_inode_table) | 542 | if (!fs->group_desc[(unsigned)group].bg_inode_table) |
543 | return EXT2_ET_MISSING_INODE_TABLE; | 543 | return EXT2_ET_MISSING_INODE_TABLE; |
544 | block_nr = fs->group_desc[(unsigned)group].bg_inode_table + | 544 | block_nr = fs->group_desc[(unsigned)group].bg_inode_table + |
545 | block; | 545 | block; |
546 | io = fs->io; | 546 | io = fs->io; |
547 | } | 547 | } |
@@ -577,8 +577,8 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
577 | #ifdef EXT2FS_ENABLE_SWAPFS | 577 | #ifdef EXT2FS_ENABLE_SWAPFS |
578 | if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || | 578 | if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || |
579 | (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) | 579 | (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) |
580 | ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode, | 580 | ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode, |
581 | (struct ext2_inode_large *) inode, | 581 | (struct ext2_inode_large *) inode, |
582 | 0, length); | 582 | 0, length); |
583 | #endif | 583 | #endif |
584 | 584 | ||
@@ -587,7 +587,7 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
587 | fs->icache->cache_size; | 587 | fs->icache->cache_size; |
588 | fs->icache->cache[fs->icache->cache_last].ino = ino; | 588 | fs->icache->cache[fs->icache->cache_last].ino = ino; |
589 | fs->icache->cache[fs->icache->cache_last].inode = *inode; | 589 | fs->icache->cache[fs->icache->cache_last].inode = *inode; |
590 | 590 | ||
591 | return 0; | 591 | return 0; |
592 | } | 592 | } |
593 | 593 | ||
@@ -629,7 +629,7 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
629 | if (retval) | 629 | if (retval) |
630 | return retval; | 630 | return retval; |
631 | } | 631 | } |
632 | 632 | ||
633 | if (!(fs->flags & EXT2_FLAG_RW)) | 633 | if (!(fs->flags & EXT2_FLAG_RW)) |
634 | return EXT2_ET_RO_FILSYS; | 634 | return EXT2_ET_RO_FILSYS; |
635 | 635 | ||
@@ -649,13 +649,13 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
649 | #ifdef EXT2FS_ENABLE_SWAPFS | 649 | #ifdef EXT2FS_ENABLE_SWAPFS |
650 | if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || | 650 | if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || |
651 | (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) | 651 | (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) |
652 | ext2fs_swap_inode_full(fs, w_inode, | 652 | ext2fs_swap_inode_full(fs, w_inode, |
653 | (struct ext2_inode_large *) inode, | 653 | (struct ext2_inode_large *) inode, |
654 | 1, bufsize); | 654 | 1, bufsize); |
655 | else | 655 | else |
656 | #endif | 656 | #endif |
657 | memcpy(w_inode, inode, bufsize); | 657 | memcpy(w_inode, inode, bufsize); |
658 | 658 | ||
659 | group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super); | 659 | group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super); |
660 | offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) * | 660 | offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) * |
661 | EXT2_INODE_SIZE(fs->super); | 661 | EXT2_INODE_SIZE(fs->super); |
@@ -685,11 +685,11 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
685 | fs->icache->buffer_blk = block_nr; | 685 | fs->icache->buffer_blk = block_nr; |
686 | } | 686 | } |
687 | 687 | ||
688 | 688 | ||
689 | memcpy((char *) fs->icache->buffer + (unsigned) offset, | 689 | memcpy((char *) fs->icache->buffer + (unsigned) offset, |
690 | ptr, clen); | 690 | ptr, clen); |
691 | 691 | ||
692 | retval = io_channel_write_blk(fs->io, block_nr, 1, | 692 | retval = io_channel_write_blk(fs->io, block_nr, 1, |
693 | fs->icache->buffer); | 693 | fs->icache->buffer); |
694 | if (retval) | 694 | if (retval) |
695 | goto errout; | 695 | goto errout; |
@@ -699,7 +699,7 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
699 | length -= clen; | 699 | length -= clen; |
700 | block_nr++; | 700 | block_nr++; |
701 | } | 701 | } |
702 | 702 | ||
703 | fs->flags |= EXT2_FLAG_CHANGED; | 703 | fs->flags |= EXT2_FLAG_CHANGED; |
704 | errout: | 704 | errout: |
705 | if (w_inode && w_inode != &temp_inode) | 705 | if (w_inode && w_inode != &temp_inode) |
@@ -714,7 +714,7 @@ errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, | |||
714 | sizeof(struct ext2_inode)); | 714 | sizeof(struct ext2_inode)); |
715 | } | 715 | } |
716 | 716 | ||
717 | /* | 717 | /* |
718 | * This function should be called when writing a new inode. It makes | 718 | * This function should be called when writing a new inode. It makes |
719 | * sure that extra part of large inodes is initialized properly. | 719 | * sure that extra part of large inodes is initialized properly. |
720 | */ | 720 | */ |
@@ -722,7 +722,7 @@ errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino, | |||
722 | struct ext2_inode *inode) | 722 | struct ext2_inode *inode) |
723 | { | 723 | { |
724 | struct ext2_inode *buf; | 724 | struct ext2_inode *buf; |
725 | int size = EXT2_INODE_SIZE(fs->super); | 725 | int size = EXT2_INODE_SIZE(fs->super); |
726 | struct ext2_inode_large *large_inode; | 726 | struct ext2_inode_large *large_inode; |
727 | 727 | ||
728 | if (size == sizeof(struct ext2_inode)) | 728 | if (size == sizeof(struct ext2_inode)) |
@@ -735,19 +735,19 @@ errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino, | |||
735 | *buf = *inode; | 735 | *buf = *inode; |
736 | 736 | ||
737 | large_inode = (struct ext2_inode_large *) buf; | 737 | large_inode = (struct ext2_inode_large *) buf; |
738 | large_inode->i_extra_isize = sizeof(struct ext2_inode_large) - | 738 | large_inode->i_extra_isize = sizeof(struct ext2_inode_large) - |
739 | EXT2_GOOD_OLD_INODE_SIZE; | 739 | EXT2_GOOD_OLD_INODE_SIZE; |
740 | 740 | ||
741 | return ext2fs_write_inode_full(fs, ino, buf, size); | 741 | return ext2fs_write_inode_full(fs, ino, buf, size); |
742 | } | 742 | } |
743 | 743 | ||
744 | 744 | ||
745 | errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks) | 745 | errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks) |
746 | { | 746 | { |
747 | struct ext2_inode inode; | 747 | struct ext2_inode inode; |
748 | int i; | 748 | int i; |
749 | errcode_t retval; | 749 | errcode_t retval; |
750 | 750 | ||
751 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 751 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
752 | 752 | ||
753 | if (ino > fs->super->s_inodes_count) | 753 | if (ino > fs->super->s_inodes_count) |
@@ -769,7 +769,7 @@ errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino) | |||
769 | { | 769 | { |
770 | struct ext2_inode inode; | 770 | struct ext2_inode inode; |
771 | errcode_t retval; | 771 | errcode_t retval; |
772 | 772 | ||
773 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 773 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
774 | 774 | ||
775 | if (ino > fs->super->s_inodes_count) | 775 | if (ino > fs->super->s_inodes_count) |
diff --git a/e2fsprogs/ext2fs/inode_io.c b/e2fsprogs/ext2fs/inode_io.c index b5c08b90a..deaa95562 100644 --- a/e2fsprogs/ext2fs/inode_io.c +++ b/e2fsprogs/ext2fs/inode_io.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * inode_io.c --- This is allows an inode in an ext2 filesystem image | 2 | * inode_io.c --- This is allows an inode in an ext2 filesystem image |
3 | * to be accessed via the I/O manager interface. | 3 | * to be accessed via the I/O manager interface. |
4 | * | 4 | * |
5 | * Copyright (C) 2002 Theodore Ts'o. | 5 | * Copyright (C) 2002 Theodore Ts'o. |
6 | * | 6 | * |
@@ -35,7 +35,7 @@ struct inode_private_data { | |||
35 | char name[32]; | 35 | char name[32]; |
36 | ext2_file_t file; | 36 | ext2_file_t file; |
37 | ext2_filsys fs; | 37 | ext2_filsys fs; |
38 | ext2_ino_t ino; | 38 | ext2_ino_t ino; |
39 | struct ext2_inode inode; | 39 | struct ext2_inode inode; |
40 | int flags; | 40 | int flags; |
41 | struct inode_private_data *next; | 41 | struct inode_private_data *next; |
@@ -75,7 +75,7 @@ errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, | |||
75 | struct ext2_inode *inode, | 75 | struct ext2_inode *inode, |
76 | char **name) | 76 | char **name) |
77 | { | 77 | { |
78 | struct inode_private_data *data; | 78 | struct inode_private_data *data; |
79 | errcode_t retval; | 79 | errcode_t retval; |
80 | 80 | ||
81 | if ((retval = ext2fs_get_mem(sizeof(struct inode_private_data), | 81 | 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) | |||
150 | &data->file); | 150 | &data->file); |
151 | if (retval) | 151 | if (retval) |
152 | goto cleanup; | 152 | goto cleanup; |
153 | 153 | ||
154 | *channel = io; | 154 | *channel = io; |
155 | return 0; | 155 | return 0; |
156 | 156 | ||
@@ -176,7 +176,7 @@ static errcode_t inode_close(io_channel channel) | |||
176 | return 0; | 176 | return 0; |
177 | 177 | ||
178 | retval = ext2fs_file_close(data->file); | 178 | retval = ext2fs_file_close(data->file); |
179 | 179 | ||
180 | ext2fs_free_mem(&channel->private_data); | 180 | ext2fs_free_mem(&channel->private_data); |
181 | if (channel->name) | 181 | if (channel->name) |
182 | ext2fs_free_mem(&channel->name); | 182 | ext2fs_free_mem(&channel->name); |
@@ -255,12 +255,12 @@ static errcode_t inode_write_byte(io_channel channel, unsigned long offset, | |||
255 | } | 255 | } |
256 | 256 | ||
257 | /* | 257 | /* |
258 | * Flush data buffers to disk. | 258 | * Flush data buffers to disk. |
259 | */ | 259 | */ |
260 | static errcode_t inode_flush(io_channel channel) | 260 | static errcode_t inode_flush(io_channel channel) |
261 | { | 261 | { |
262 | struct inode_private_data *data; | 262 | struct inode_private_data *data; |
263 | 263 | ||
264 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); | 264 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); |
265 | data = (struct inode_private_data *) channel->private_data; | 265 | data = (struct inode_private_data *) channel->private_data; |
266 | EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL); | 266 | 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 e50d7e414..3d0987bc1 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, | |||
61 | { | 61 | { |
62 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); | 62 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); |
63 | 63 | ||
64 | if (channel->manager->write_byte) | 64 | if (channel->manager->write_byte) |
65 | return channel->manager->write_byte(channel, offset, | 65 | return channel->manager->write_byte(channel, offset, |
66 | count, data); | 66 | count, data); |
67 | 67 | ||
68 | return EXT2_ET_UNIMPLEMENTED; | 68 | return EXT2_ET_UNIMPLEMENTED; |
diff --git a/e2fsprogs/ext2fs/irel.h b/e2fsprogs/ext2fs/irel.h index 9b943ced1..45e031beb 100644 --- a/e2fsprogs/ext2fs/irel.h +++ b/e2fsprogs/ext2fs/irel.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * irel.h | 2 | * irel.h |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
diff --git a/e2fsprogs/ext2fs/irel_ma.c b/e2fsprogs/ext2fs/irel_ma.c index eedbe55c8..d9e73f73c 100644 --- a/e2fsprogs/ext2fs/irel_ma.c +++ b/e2fsprogs/ext2fs/irel_ma.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * irel_ma.c | 2 | * irel_ma.c |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -64,7 +64,7 @@ errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode, | |||
64 | { | 64 | { |
65 | ext2_irel irel = 0; | 65 | ext2_irel irel = 0; |
66 | errcode_t retval; | 66 | errcode_t retval; |
67 | struct irel_ma *ma = 0; | 67 | struct irel_ma *ma = 0; |
68 | size_t size; | 68 | size_t size; |
69 | 69 | ||
70 | *new_irel = 0; | 70 | *new_irel = 0; |
@@ -77,18 +77,18 @@ errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode, | |||
77 | if (retval) | 77 | if (retval) |
78 | goto errout; | 78 | goto errout; |
79 | memset(irel, 0, sizeof(struct ext2_inode_relocation_table)); | 79 | memset(irel, 0, sizeof(struct ext2_inode_relocation_table)); |
80 | 80 | ||
81 | retval = ext2fs_get_mem(strlen(name)+1, &irel->name); | 81 | retval = ext2fs_get_mem(strlen(name)+1, &irel->name); |
82 | if (retval) | 82 | if (retval) |
83 | goto errout; | 83 | goto errout; |
84 | strcpy(irel->name, name); | 84 | strcpy(irel->name, name); |
85 | 85 | ||
86 | retval = ext2fs_get_mem(sizeof(struct irel_ma), &ma); | 86 | retval = ext2fs_get_mem(sizeof(struct irel_ma), &ma); |
87 | if (retval) | 87 | if (retval) |
88 | goto errout; | 88 | goto errout; |
89 | memset(ma, 0, sizeof(struct irel_ma)); | 89 | memset(ma, 0, sizeof(struct irel_ma)); |
90 | irel->priv_data = ma; | 90 | irel->priv_data = ma; |
91 | 91 | ||
92 | size = (size_t) (sizeof(ext2_ino_t) * (max_inode+1)); | 92 | size = (size_t) (sizeof(ext2_ino_t) * (max_inode+1)); |
93 | retval = ext2fs_get_mem(size, &ma->orig_map); | 93 | retval = ext2fs_get_mem(size, &ma->orig_map); |
94 | if (retval) | 94 | if (retval) |
@@ -124,7 +124,7 @@ errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode, | |||
124 | irel->move = ima_move; | 124 | irel->move = ima_move; |
125 | irel->delete = ima_delete; | 125 | irel->delete = ima_delete; |
126 | irel->free = ima_free; | 126 | irel->free = ima_free; |
127 | 127 | ||
128 | *new_irel = irel; | 128 | *new_irel = irel; |
129 | return 0; | 129 | return 0; |
130 | 130 | ||
@@ -137,7 +137,7 @@ static errcode_t ima_put(ext2_irel irel, ext2_ino_t old, | |||
137 | struct ext2_inode_relocate_entry *ent) | 137 | struct ext2_inode_relocate_entry *ent) |
138 | { | 138 | { |
139 | struct inode_reference_entry *ref_ent; | 139 | struct inode_reference_entry *ref_ent; |
140 | struct irel_ma *ma; | 140 | struct irel_ma *ma; |
141 | errcode_t retval; | 141 | errcode_t retval; |
142 | size_t size, old_size; | 142 | size_t size, old_size; |
143 | 143 | ||
@@ -153,7 +153,7 @@ static errcode_t ima_put(ext2_irel irel, ext2_ino_t old, | |||
153 | ent->orig = old; | 153 | ent->orig = old; |
154 | else | 154 | else |
155 | ent->orig = ma->entries[(unsigned) old].orig; | 155 | ent->orig = ma->entries[(unsigned) old].orig; |
156 | 156 | ||
157 | /* | 157 | /* |
158 | * If max_refs has changed, reallocate the refs array | 158 | * If max_refs has changed, reallocate the refs array |
159 | */ | 159 | */ |
@@ -176,7 +176,7 @@ static errcode_t ima_put(ext2_irel irel, ext2_ino_t old, | |||
176 | static errcode_t ima_get(ext2_irel irel, ext2_ino_t old, | 176 | static errcode_t ima_get(ext2_irel irel, ext2_ino_t old, |
177 | struct ext2_inode_relocate_entry *ent) | 177 | struct ext2_inode_relocate_entry *ent) |
178 | { | 178 | { |
179 | struct irel_ma *ma; | 179 | struct irel_ma *ma; |
180 | 180 | ||
181 | ma = irel->priv_data; | 181 | ma = irel->priv_data; |
182 | if (old > ma->max_inode) | 182 | if (old > ma->max_inode) |
@@ -190,7 +190,7 @@ static errcode_t ima_get(ext2_irel irel, ext2_ino_t old, | |||
190 | static errcode_t ima_get_by_orig(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old, | 190 | static errcode_t ima_get_by_orig(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old, |
191 | struct ext2_inode_relocate_entry *ent) | 191 | struct ext2_inode_relocate_entry *ent) |
192 | { | 192 | { |
193 | struct irel_ma *ma; | 193 | struct irel_ma *ma; |
194 | ext2_ino_t ino; | 194 | ext2_ino_t ino; |
195 | 195 | ||
196 | ma = irel->priv_data; | 196 | ma = irel->priv_data; |
@@ -213,7 +213,7 @@ static errcode_t ima_start_iter(ext2_irel irel) | |||
213 | static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old, | 213 | static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old, |
214 | struct ext2_inode_relocate_entry *ent) | 214 | struct ext2_inode_relocate_entry *ent) |
215 | { | 215 | { |
216 | struct irel_ma *ma; | 216 | struct irel_ma *ma; |
217 | 217 | ||
218 | ma = irel->priv_data; | 218 | ma = irel->priv_data; |
219 | while (++irel->current < ma->max_inode) { | 219 | while (++irel->current < ma->max_inode) { |
@@ -230,7 +230,7 @@ static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old, | |||
230 | static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, | 230 | static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, |
231 | struct ext2_inode_reference *ref) | 231 | struct ext2_inode_reference *ref) |
232 | { | 232 | { |
233 | struct irel_ma *ma; | 233 | struct irel_ma *ma; |
234 | size_t size; | 234 | size_t size; |
235 | struct inode_reference_entry *ref_ent; | 235 | struct inode_reference_entry *ref_ent; |
236 | struct ext2_inode_relocate_entry *ent; | 236 | struct ext2_inode_relocate_entry *ent; |
@@ -242,12 +242,12 @@ static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, | |||
242 | 242 | ||
243 | ref_ent = ma->ref_entries + (unsigned) ino; | 243 | ref_ent = ma->ref_entries + (unsigned) ino; |
244 | ent = ma->entries + (unsigned) ino; | 244 | ent = ma->entries + (unsigned) ino; |
245 | 245 | ||
246 | /* | 246 | /* |
247 | * If the inode reference array doesn't exist, create it. | 247 | * If the inode reference array doesn't exist, create it. |
248 | */ | 248 | */ |
249 | if (ref_ent->refs == 0) { | 249 | if (ref_ent->refs == 0) { |
250 | size = (size_t) ((sizeof(struct ext2_inode_reference) * | 250 | size = (size_t) ((sizeof(struct ext2_inode_reference) * |
251 | ent->max_refs)); | 251 | ent->max_refs)); |
252 | retval = ext2fs_get_mem(size, &ref_ent->refs); | 252 | retval = ext2fs_get_mem(size, &ref_ent->refs); |
253 | if (retval) | 253 | if (retval) |
@@ -265,7 +265,7 @@ static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, | |||
265 | 265 | ||
266 | static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino) | 266 | static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino) |
267 | { | 267 | { |
268 | struct irel_ma *ma; | 268 | struct irel_ma *ma; |
269 | 269 | ||
270 | ma = irel->priv_data; | 270 | ma = irel->priv_data; |
271 | if (ino > ma->max_inode) | 271 | if (ino > ma->max_inode) |
@@ -280,11 +280,11 @@ static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino) | |||
280 | static errcode_t ima_next_ref(ext2_irel irel, | 280 | static errcode_t ima_next_ref(ext2_irel irel, |
281 | struct ext2_inode_reference *ref) | 281 | struct ext2_inode_reference *ref) |
282 | { | 282 | { |
283 | struct irel_ma *ma; | 283 | struct irel_ma *ma; |
284 | struct inode_reference_entry *ref_ent; | 284 | struct inode_reference_entry *ref_ent; |
285 | 285 | ||
286 | ma = irel->priv_data; | 286 | ma = irel->priv_data; |
287 | 287 | ||
288 | ref_ent = ma->ref_entries + ma->ref_current; | 288 | ref_ent = ma->ref_entries + ma->ref_current; |
289 | 289 | ||
290 | if ((ref_ent->refs == NULL) || | 290 | if ((ref_ent->refs == NULL) || |
@@ -300,19 +300,19 @@ static errcode_t ima_next_ref(ext2_irel irel, | |||
300 | 300 | ||
301 | static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new) | 301 | static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new) |
302 | { | 302 | { |
303 | struct irel_ma *ma; | 303 | struct irel_ma *ma; |
304 | 304 | ||
305 | ma = irel->priv_data; | 305 | ma = irel->priv_data; |
306 | if ((old > ma->max_inode) || (new > ma->max_inode)) | 306 | if ((old > ma->max_inode) || (new > ma->max_inode)) |
307 | return EXT2_ET_INVALID_ARGUMENT; | 307 | return EXT2_ET_INVALID_ARGUMENT; |
308 | if (ma->entries[(unsigned) old].new == 0) | 308 | if (ma->entries[(unsigned) old].new == 0) |
309 | return ENOENT; | 309 | return ENOENT; |
310 | 310 | ||
311 | ma->entries[(unsigned) new] = ma->entries[(unsigned) old]; | 311 | ma->entries[(unsigned) new] = ma->entries[(unsigned) old]; |
312 | if (ma->ref_entries[(unsigned) new].refs) | 312 | if (ma->ref_entries[(unsigned) new].refs) |
313 | ext2fs_free_mem(&ma->ref_entries[(unsigned) new].refs); | 313 | ext2fs_free_mem(&ma->ref_entries[(unsigned) new].refs); |
314 | ma->ref_entries[(unsigned) new] = ma->ref_entries[(unsigned) old]; | 314 | ma->ref_entries[(unsigned) new] = ma->ref_entries[(unsigned) old]; |
315 | 315 | ||
316 | ma->entries[(unsigned) old].new = 0; | 316 | ma->entries[(unsigned) old].new = 0; |
317 | ma->ref_entries[(unsigned) old].num = 0; | 317 | ma->ref_entries[(unsigned) old].num = 0; |
318 | ma->ref_entries[(unsigned) old].refs = 0; | 318 | 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) | |||
323 | 323 | ||
324 | static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old) | 324 | static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old) |
325 | { | 325 | { |
326 | struct irel_ma *ma; | 326 | struct irel_ma *ma; |
327 | 327 | ||
328 | ma = irel->priv_data; | 328 | ma = irel->priv_data; |
329 | if (old > ma->max_inode) | 329 | if (old > ma->max_inode) |
330 | return EXT2_ET_INVALID_ARGUMENT; | 330 | return EXT2_ET_INVALID_ARGUMENT; |
331 | if (ma->entries[(unsigned) old].new == 0) | 331 | if (ma->entries[(unsigned) old].new == 0) |
332 | return ENOENT; | 332 | return ENOENT; |
333 | 333 | ||
334 | ma->entries[old].new = 0; | 334 | ma->entries[old].new = 0; |
335 | if (ma->ref_entries[(unsigned) old].refs) | 335 | if (ma->ref_entries[(unsigned) old].refs) |
336 | ext2fs_free_mem(&ma->ref_entries[(unsigned) old].refs); | 336 | ext2fs_free_mem(&ma->ref_entries[(unsigned) old].refs); |
337 | ma->orig_map[ma->entries[(unsigned) old].orig] = 0; | 337 | ma->orig_map[ma->entries[(unsigned) old].orig] = 0; |
338 | 338 | ||
339 | ma->ref_entries[(unsigned) old].num = 0; | 339 | ma->ref_entries[(unsigned) old].num = 0; |
340 | ma->ref_entries[(unsigned) old].refs = 0; | 340 | ma->ref_entries[(unsigned) old].refs = 0; |
341 | return 0; | 341 | return 0; |
@@ -343,7 +343,7 @@ static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old) | |||
343 | 343 | ||
344 | static errcode_t ima_free(ext2_irel irel) | 344 | static errcode_t ima_free(ext2_irel irel) |
345 | { | 345 | { |
346 | struct irel_ma *ma; | 346 | struct irel_ma *ma; |
347 | ext2_ino_t ino; | 347 | ext2_ino_t ino; |
348 | 348 | ||
349 | if (!irel) | 349 | if (!irel) |
diff --git a/e2fsprogs/ext2fs/ismounted.c b/e2fsprogs/ext2fs/ismounted.c index 3f2241d23..2395ccaed 100644 --- a/e2fsprogs/ext2fs/ismounted.c +++ b/e2fsprogs/ext2fs/ismounted.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ismounted.c --- Check to see if the filesystem was mounted | 2 | * ismounted.c --- Check to see if the filesystem was mounted |
3 | * | 3 | * |
4 | * Copyright (C) 1995,1996,1997,1998,1999,2000 Theodore Ts'o. | 4 | * Copyright (C) 1995,1996,1997,1998,1999,2000 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -38,17 +38,17 @@ | |||
38 | /* | 38 | /* |
39 | * Helper function which checks a file in /etc/mtab format to see if a | 39 | * Helper function which checks a file in /etc/mtab format to see if a |
40 | * filesystem is mounted. Returns an error if the file doesn't exist | 40 | * filesystem is mounted. Returns an error if the file doesn't exist |
41 | * or can't be opened. | 41 | * or can't be opened. |
42 | */ | 42 | */ |
43 | static errcode_t check_mntent_file(const char *mtab_file, const char *file, | 43 | static errcode_t check_mntent_file(const char *mtab_file, const char *file, |
44 | int *mount_flags, char *mtpt, int mtlen) | 44 | int *mount_flags, char *mtpt, int mtlen) |
45 | { | 45 | { |
46 | struct mntent *mnt; | 46 | struct mntent *mnt; |
47 | struct stat st_buf; | 47 | struct stat st_buf; |
48 | errcode_t retval = 0; | 48 | errcode_t retval = 0; |
49 | dev_t file_dev=0, file_rdev=0; | 49 | dev_t file_dev=0, file_rdev=0; |
50 | ino_t file_ino=0; | 50 | ino_t file_ino=0; |
51 | FILE *f; | 51 | FILE *f; |
52 | int fd; | 52 | int fd; |
53 | 53 | ||
54 | *mount_flags = 0; | 54 | *mount_flags = 0; |
@@ -103,7 +103,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, | |||
103 | } | 103 | } |
104 | #ifndef __GNU__ /* The GNU hurd is deficient; what else is new? */ | 104 | #ifndef __GNU__ /* The GNU hurd is deficient; what else is new? */ |
105 | /* Validate the entry in case /etc/mtab is out of date */ | 105 | /* Validate the entry in case /etc/mtab is out of date */ |
106 | /* | 106 | /* |
107 | * We need to be paranoid, because some broken distributions | 107 | * We need to be paranoid, because some broken distributions |
108 | * (read: Slackware) don't initialize /etc/mtab before checking | 108 | * (read: Slackware) don't initialize /etc/mtab before checking |
109 | * all of the non-root filesystems on the disk. | 109 | * 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, | |||
128 | } | 128 | } |
129 | #endif /* __GNU__ */ | 129 | #endif /* __GNU__ */ |
130 | *mount_flags = EXT2_MF_MOUNTED; | 130 | *mount_flags = EXT2_MF_MOUNTED; |
131 | 131 | ||
132 | #ifdef MNTOPT_RO | 132 | #ifdef MNTOPT_RO |
133 | /* Check to see if the ro option is set */ | 133 | /* Check to see if the ro option is set */ |
134 | if (hasmntopt(mnt, MNTOPT_RO)) | 134 | if (hasmntopt(mnt, MNTOPT_RO)) |
@@ -145,7 +145,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, | |||
145 | */ | 145 | */ |
146 | if (!strcmp(mnt->mnt_dir, "/")) { | 146 | if (!strcmp(mnt->mnt_dir, "/")) { |
147 | is_root: | 147 | is_root: |
148 | #define TEST_FILE "/.ismount-test-file" | 148 | #define TEST_FILE "/.ismount-test-file" |
149 | *mount_flags |= EXT2_MF_ISROOT; | 149 | *mount_flags |= EXT2_MF_ISROOT; |
150 | fd = open(TEST_FILE, O_RDWR|O_CREAT); | 150 | fd = open(TEST_FILE, O_RDWR|O_CREAT); |
151 | if (fd < 0) { | 151 | if (fd < 0) { |
@@ -184,7 +184,7 @@ static errcode_t check_mntent(const char *file, int *mount_flags, | |||
184 | #endif /* MOUNTED */ | 184 | #endif /* MOUNTED */ |
185 | retval = check_mntent_file(MOUNTED, file, mount_flags, mtpt, mtlen); | 185 | retval = check_mntent_file(MOUNTED, file, mount_flags, mtpt, mtlen); |
186 | return retval; | 186 | return retval; |
187 | #else | 187 | #else |
188 | *mount_flags = 0; | 188 | *mount_flags = 0; |
189 | return 0; | 189 | return 0; |
190 | #endif /* defined(MOUNTED) || defined(_PATH_MOUNTED) */ | 190 | #endif /* defined(MOUNTED) || defined(_PATH_MOUNTED) */ |
@@ -197,31 +197,31 @@ static errcode_t check_getmntinfo(const char *file, int *mount_flags, | |||
197 | char *mtpt, int mtlen) | 197 | char *mtpt, int mtlen) |
198 | { | 198 | { |
199 | struct statfs *mp; | 199 | struct statfs *mp; |
200 | int len, n; | 200 | int len, n; |
201 | const char *s1; | 201 | const char *s1; |
202 | char *s2; | 202 | char *s2; |
203 | 203 | ||
204 | n = getmntinfo(&mp, MNT_NOWAIT); | 204 | n = getmntinfo(&mp, MNT_NOWAIT); |
205 | if (n == 0) | 205 | if (n == 0) |
206 | return errno; | 206 | return errno; |
207 | 207 | ||
208 | len = sizeof(_PATH_DEV) - 1; | 208 | len = sizeof(_PATH_DEV) - 1; |
209 | s1 = file; | 209 | s1 = file; |
210 | if (strncmp(_PATH_DEV, s1, len) == 0) | 210 | if (strncmp(_PATH_DEV, s1, len) == 0) |
211 | s1 += len; | 211 | s1 += len; |
212 | 212 | ||
213 | *mount_flags = 0; | 213 | *mount_flags = 0; |
214 | while (--n >= 0) { | 214 | while (--n >= 0) { |
215 | s2 = mp->f_mntfromname; | 215 | s2 = mp->f_mntfromname; |
216 | if (strncmp(_PATH_DEV, s2, len) == 0) { | 216 | if (strncmp(_PATH_DEV, s2, len) == 0) { |
217 | s2 += len - 1; | 217 | s2 += len - 1; |
218 | *s2 = 'r'; | 218 | *s2 = 'r'; |
219 | } | 219 | } |
220 | if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0) { | 220 | if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0) { |
221 | *mount_flags = EXT2_MF_MOUNTED; | 221 | *mount_flags = EXT2_MF_MOUNTED; |
222 | break; | 222 | break; |
223 | } | 223 | } |
224 | ++mp; | 224 | ++mp; |
225 | } | 225 | } |
226 | if (mtpt) | 226 | if (mtpt) |
227 | strncpy(mtpt, mp->f_mntonname, mtlen); | 227 | strncpy(mtpt, mp->f_mntonname, mtlen); |
@@ -270,7 +270,7 @@ static int is_swap_device(const char *file) | |||
270 | ret++; | 270 | ret++; |
271 | break; | 271 | break; |
272 | } | 272 | } |
273 | #endif /* __GNU__ */ | 273 | #endif /* __GNU__ */ |
274 | } | 274 | } |
275 | fclose(f); | 275 | fclose(f); |
276 | return ret; | 276 | return ret; |
@@ -296,7 +296,7 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, | |||
296 | } | 296 | } |
297 | #ifdef HAVE_MNTENT_H | 297 | #ifdef HAVE_MNTENT_H |
298 | return check_mntent(device, mount_flags, mtpt, mtlen); | 298 | return check_mntent(device, mount_flags, mtpt, mtlen); |
299 | #else | 299 | #else |
300 | #ifdef HAVE_GETMNTINFO | 300 | #ifdef HAVE_GETMNTINFO |
301 | return check_getmntinfo(device, mount_flags, mtpt, mtlen); | 301 | return check_getmntinfo(device, mount_flags, mtpt, mtlen); |
302 | #else | 302 | #else |
@@ -312,7 +312,7 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, | |||
312 | /* | 312 | /* |
313 | * ext2fs_check_if_mounted() sets the mount_flags EXT2_MF_MOUNTED, | 313 | * ext2fs_check_if_mounted() sets the mount_flags EXT2_MF_MOUNTED, |
314 | * EXT2_MF_READONLY, and EXT2_MF_ROOT | 314 | * EXT2_MF_READONLY, and EXT2_MF_ROOT |
315 | * | 315 | * |
316 | */ | 316 | */ |
317 | errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags) | 317 | errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags) |
318 | { | 318 | { |
@@ -324,7 +324,7 @@ int main(int argc, char **argv) | |||
324 | { | 324 | { |
325 | int retval, mount_flags; | 325 | int retval, mount_flags; |
326 | char mntpt[80]; | 326 | char mntpt[80]; |
327 | 327 | ||
328 | if (argc < 2) { | 328 | if (argc < 2) { |
329 | fprintf(stderr, "Usage: %s device\n", argv[0]); | 329 | fprintf(stderr, "Usage: %s device\n", argv[0]); |
330 | exit(1); | 330 | exit(1); |
@@ -347,12 +347,12 @@ int main(int argc, char **argv) | |||
347 | 347 | ||
348 | if (mount_flags & EXT2_MF_READONLY) | 348 | if (mount_flags & EXT2_MF_READONLY) |
349 | printf("\t%s is read-only.\n", argv[1]); | 349 | printf("\t%s is read-only.\n", argv[1]); |
350 | 350 | ||
351 | if (mount_flags & EXT2_MF_ISROOT) | 351 | if (mount_flags & EXT2_MF_ISROOT) |
352 | printf("\t%s is the root filesystem.\n", argv[1]); | 352 | printf("\t%s is the root filesystem.\n", argv[1]); |
353 | if (mntpt[0]) | 353 | if (mntpt[0]) |
354 | printf("\t%s is mounted on %s.\n", argv[1], mntpt); | 354 | printf("\t%s is mounted on %s.\n", argv[1], mntpt); |
355 | 355 | ||
356 | exit(0); | 356 | exit(0); |
357 | } | 357 | } |
358 | #endif /* DEBUG */ | 358 | #endif /* DEBUG */ |
diff --git a/e2fsprogs/ext2fs/jfs_dat.h b/e2fsprogs/ext2fs/jfs_dat.h index d6ad9c489..8ec5d3841 100644 --- a/e2fsprogs/ext2fs/jfs_dat.h +++ b/e2fsprogs/ext2fs/jfs_dat.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * jfs_dat.h --- stripped down header file which only contains the JFS | 2 | * jfs_dat.h --- stripped down header file which only contains the JFS |
3 | * on-disk data structures | 3 | * on-disk data structures |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */ | 6 | #define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */ |
@@ -9,7 +9,7 @@ | |||
9 | * On-disk structures | 9 | * On-disk structures |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /* | 12 | /* |
13 | * Descriptor block types: | 13 | * Descriptor block types: |
14 | */ | 14 | */ |
15 | 15 | ||
@@ -28,8 +28,8 @@ typedef struct journal_header_s | |||
28 | } journal_header_t; | 28 | } journal_header_t; |
29 | 29 | ||
30 | 30 | ||
31 | /* | 31 | /* |
32 | * The block tag: used to describe a single buffer in the journal | 32 | * The block tag: used to describe a single buffer in the journal |
33 | */ | 33 | */ |
34 | typedef struct journal_block_tag_s | 34 | typedef struct journal_block_tag_s |
35 | { | 35 | { |
@@ -55,10 +55,10 @@ typedef struct journal_superblock_s | |||
55 | __u32 s_blocksize; /* journal device blocksize */ | 55 | __u32 s_blocksize; /* journal device blocksize */ |
56 | __u32 s_maxlen; /* total blocks in journal file */ | 56 | __u32 s_maxlen; /* total blocks in journal file */ |
57 | __u32 s_first; /* first block of log information */ | 57 | __u32 s_first; /* first block of log information */ |
58 | 58 | ||
59 | /* Dynamic information describing the current state of the log */ | 59 | /* Dynamic information describing the current state of the log */ |
60 | __u32 s_sequence; /* first commit ID expected in log */ | 60 | __u32 s_sequence; /* first commit ID expected in log */ |
61 | __u32 s_start; /* blocknr of start of log */ | 61 | __u32 s_start; /* blocknr of start of log */ |
62 | 62 | ||
63 | } journal_superblock_t; | 63 | } journal_superblock_t; |
64 | 64 | ||
diff --git a/e2fsprogs/ext2fs/kernel-jbd.h b/e2fsprogs/ext2fs/kernel-jbd.h index d0efdb3f7..8a5de5e3e 100644 --- a/e2fsprogs/ext2fs/kernel-jbd.h +++ b/e2fsprogs/ext2fs/kernel-jbd.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * linux/include/linux/jbd.h | 2 | * linux/include/linux/jbd.h |
3 | * | 3 | * |
4 | * Written by Stephen C. Tweedie <sct@redhat.com> | 4 | * Written by Stephen C. Tweedie <sct@redhat.com> |
5 | * | 5 | * |
6 | * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved | 6 | * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved |
@@ -51,7 +51,7 @@ extern int journal_enable_debug; | |||
51 | if ((n) <= journal_enable_debug) { \ | 51 | if ((n) <= journal_enable_debug) { \ |
52 | printk (KERN_DEBUG "(%s, %d): %s: ", \ | 52 | printk (KERN_DEBUG "(%s, %d): %s: ", \ |
53 | __FILE__, __LINE__, __FUNCTION__); \ | 53 | __FILE__, __LINE__, __FUNCTION__); \ |
54 | printk (f, ## a); \ | 54 | printk (f, ## a); \ |
55 | } \ | 55 | } \ |
56 | } while (0) | 56 | } while (0) |
57 | #else | 57 | #else |
@@ -59,7 +59,7 @@ extern int journal_enable_debug; | |||
59 | #define jbd_debug(f, a...) /**/ | 59 | #define jbd_debug(f, a...) /**/ |
60 | #else | 60 | #else |
61 | #define jbd_debug(f, ...) /**/ | 61 | #define jbd_debug(f, ...) /**/ |
62 | #endif | 62 | #endif |
63 | #endif | 63 | #endif |
64 | #else | 64 | #else |
65 | #define jbd_debug(x) /* AIX doesn't do STDC */ | 65 | #define jbd_debug(x) /* AIX doesn't do STDC */ |
@@ -88,7 +88,7 @@ typedef struct journal_s journal_t; /* Journal control structure */ | |||
88 | * On-disk structures | 88 | * On-disk structures |
89 | */ | 89 | */ |
90 | 90 | ||
91 | /* | 91 | /* |
92 | * Descriptor block types: | 92 | * Descriptor block types: |
93 | */ | 93 | */ |
94 | 94 | ||
@@ -109,8 +109,8 @@ typedef struct journal_header_s | |||
109 | } journal_header_t; | 109 | } journal_header_t; |
110 | 110 | ||
111 | 111 | ||
112 | /* | 112 | /* |
113 | * The block tag: used to describe a single buffer in the journal | 113 | * The block tag: used to describe a single buffer in the journal |
114 | */ | 114 | */ |
115 | typedef struct journal_block_tag_s | 115 | typedef struct journal_block_tag_s |
116 | { | 116 | { |
@@ -118,9 +118,9 @@ typedef struct journal_block_tag_s | |||
118 | __u32 t_flags; /* See below */ | 118 | __u32 t_flags; /* See below */ |
119 | } journal_block_tag_t; | 119 | } journal_block_tag_t; |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * The revoke descriptor: used on disk to describe a series of blocks to | 122 | * The revoke descriptor: used on disk to describe a series of blocks to |
123 | * be revoked from the log | 123 | * be revoked from the log |
124 | */ | 124 | */ |
125 | typedef struct journal_revoke_header_s | 125 | typedef struct journal_revoke_header_s |
126 | { | 126 | { |
@@ -149,7 +149,7 @@ typedef struct journal_superblock_s | |||
149 | __u32 s_blocksize; /* journal device blocksize */ | 149 | __u32 s_blocksize; /* journal device blocksize */ |
150 | __u32 s_maxlen; /* total blocks in journal file */ | 150 | __u32 s_maxlen; /* total blocks in journal file */ |
151 | __u32 s_first; /* first block of log information */ | 151 | __u32 s_first; /* first block of log information */ |
152 | 152 | ||
153 | /* 0x0018 */ | 153 | /* 0x0018 */ |
154 | /* Dynamic information describing the current state of the log */ | 154 | /* Dynamic information describing the current state of the log */ |
155 | __u32 s_sequence; /* first commit ID expected in log */ | 155 | __u32 s_sequence; /* first commit ID expected in log */ |
@@ -161,17 +161,17 @@ typedef struct journal_superblock_s | |||
161 | 161 | ||
162 | /* 0x0024 */ | 162 | /* 0x0024 */ |
163 | /* Remaining fields are only valid in a version-2 superblock */ | 163 | /* Remaining fields are only valid in a version-2 superblock */ |
164 | __u32 s_feature_compat; /* compatible feature set */ | 164 | __u32 s_feature_compat; /* compatible feature set */ |
165 | __u32 s_feature_incompat; /* incompatible feature set */ | 165 | __u32 s_feature_incompat; /* incompatible feature set */ |
166 | __u32 s_feature_ro_compat; /* readonly-compatible feature set */ | 166 | __u32 s_feature_ro_compat; /* readonly-compatible feature set */ |
167 | /* 0x0030 */ | 167 | /* 0x0030 */ |
168 | __u8 s_uuid[16]; /* 128-bit uuid for journal */ | 168 | __u8 s_uuid[16]; /* 128-bit uuid for journal */ |
169 | 169 | ||
170 | /* 0x0040 */ | 170 | /* 0x0040 */ |
171 | __u32 s_nr_users; /* Nr of filesystems sharing log */ | 171 | __u32 s_nr_users; /* Nr of filesystems sharing log */ |
172 | 172 | ||
173 | __u32 s_dynsuper; /* Blocknr of dynamic superblock copy*/ | 173 | __u32 s_dynsuper; /* Blocknr of dynamic superblock copy*/ |
174 | 174 | ||
175 | /* 0x0048 */ | 175 | /* 0x0048 */ |
176 | __u32 s_max_transaction; /* Limit of journal blocks per trans.*/ | 176 | __u32 s_max_transaction; /* Limit of journal blocks per trans.*/ |
177 | __u32 s_max_trans_data; /* Limit of data blocks per trans. */ | 177 | __u32 s_max_trans_data; /* Limit of data blocks per trans. */ |
@@ -276,7 +276,7 @@ struct jbd_revoke_table_s; | |||
276 | * the transaction, so that at all times we know how many buffers the | 276 | * the transaction, so that at all times we know how many buffers the |
277 | * outstanding updates on a transaction might possibly touch. */ | 277 | * outstanding updates on a transaction might possibly touch. */ |
278 | 278 | ||
279 | struct handle_s | 279 | struct handle_s |
280 | { | 280 | { |
281 | /* Which compound transaction is this update a part of? */ | 281 | /* Which compound transaction is this update a part of? */ |
282 | transaction_t * h_transaction; | 282 | transaction_t * h_transaction; |
@@ -314,14 +314,14 @@ struct handle_s | |||
314 | * flushed to home for finished transactions. | 314 | * flushed to home for finished transactions. |
315 | */ | 315 | */ |
316 | 316 | ||
317 | struct transaction_s | 317 | struct transaction_s |
318 | { | 318 | { |
319 | /* Pointer to the journal for this transaction. */ | 319 | /* Pointer to the journal for this transaction. */ |
320 | journal_t * t_journal; | 320 | journal_t * t_journal; |
321 | 321 | ||
322 | /* Sequence number for this transaction */ | 322 | /* Sequence number for this transaction */ |
323 | tid_t t_tid; | 323 | tid_t t_tid; |
324 | 324 | ||
325 | /* Transaction's current state */ | 325 | /* Transaction's current state */ |
326 | enum { | 326 | enum { |
327 | T_RUNNING, | 327 | T_RUNNING, |
@@ -329,74 +329,74 @@ struct transaction_s | |||
329 | T_RUNDOWN, | 329 | T_RUNDOWN, |
330 | T_FLUSH, | 330 | T_FLUSH, |
331 | T_COMMIT, | 331 | T_COMMIT, |
332 | T_FINISHED | 332 | T_FINISHED |
333 | } t_state; | 333 | } t_state; |
334 | 334 | ||
335 | /* Where in the log does this transaction's commit start? */ | 335 | /* Where in the log does this transaction's commit start? */ |
336 | unsigned long t_log_start; | 336 | unsigned long t_log_start; |
337 | 337 | ||
338 | /* Doubly-linked circular list of all inodes owned by this | 338 | /* Doubly-linked circular list of all inodes owned by this |
339 | transaction */ /* AKPM: unused */ | 339 | transaction */ /* AKPM: unused */ |
340 | struct inode * t_ilist; | 340 | struct inode * t_ilist; |
341 | 341 | ||
342 | /* Number of buffers on the t_buffers list */ | 342 | /* Number of buffers on the t_buffers list */ |
343 | int t_nr_buffers; | 343 | int t_nr_buffers; |
344 | 344 | ||
345 | /* Doubly-linked circular list of all buffers reserved but not | 345 | /* Doubly-linked circular list of all buffers reserved but not |
346 | yet modified by this transaction */ | 346 | yet modified by this transaction */ |
347 | struct journal_head * t_reserved_list; | 347 | struct journal_head * t_reserved_list; |
348 | 348 | ||
349 | /* Doubly-linked circular list of all metadata buffers owned by this | 349 | /* Doubly-linked circular list of all metadata buffers owned by this |
350 | transaction */ | 350 | transaction */ |
351 | struct journal_head * t_buffers; | 351 | struct journal_head * t_buffers; |
352 | 352 | ||
353 | /* | 353 | /* |
354 | * Doubly-linked circular list of all data buffers still to be | 354 | * Doubly-linked circular list of all data buffers still to be |
355 | * flushed before this transaction can be committed. | 355 | * flushed before this transaction can be committed. |
356 | * Protected by journal_datalist_lock. | 356 | * Protected by journal_datalist_lock. |
357 | */ | 357 | */ |
358 | struct journal_head * t_sync_datalist; | 358 | struct journal_head * t_sync_datalist; |
359 | 359 | ||
360 | /* | 360 | /* |
361 | * Doubly-linked circular list of all writepage data buffers | 361 | * Doubly-linked circular list of all writepage data buffers |
362 | * still to be written before this transaction can be committed. | 362 | * still to be written before this transaction can be committed. |
363 | * Protected by journal_datalist_lock. | 363 | * Protected by journal_datalist_lock. |
364 | */ | 364 | */ |
365 | struct journal_head * t_async_datalist; | 365 | struct journal_head * t_async_datalist; |
366 | 366 | ||
367 | /* Doubly-linked circular list of all forget buffers (superceded | 367 | /* Doubly-linked circular list of all forget buffers (superceded |
368 | buffers which we can un-checkpoint once this transaction | 368 | buffers which we can un-checkpoint once this transaction |
369 | commits) */ | 369 | commits) */ |
370 | struct journal_head * t_forget; | 370 | struct journal_head * t_forget; |
371 | 371 | ||
372 | /* | 372 | /* |
373 | * Doubly-linked circular list of all buffers still to be | 373 | * Doubly-linked circular list of all buffers still to be |
374 | * flushed before this transaction can be checkpointed. | 374 | * flushed before this transaction can be checkpointed. |
375 | */ | 375 | */ |
376 | /* Protected by journal_datalist_lock */ | 376 | /* Protected by journal_datalist_lock */ |
377 | struct journal_head * t_checkpoint_list; | 377 | struct journal_head * t_checkpoint_list; |
378 | 378 | ||
379 | /* Doubly-linked circular list of temporary buffers currently | 379 | /* Doubly-linked circular list of temporary buffers currently |
380 | undergoing IO in the log */ | 380 | undergoing IO in the log */ |
381 | struct journal_head * t_iobuf_list; | 381 | struct journal_head * t_iobuf_list; |
382 | 382 | ||
383 | /* Doubly-linked circular list of metadata buffers being | 383 | /* Doubly-linked circular list of metadata buffers being |
384 | shadowed by log IO. The IO buffers on the iobuf list and the | 384 | shadowed by log IO. The IO buffers on the iobuf list and the |
385 | shadow buffers on this list match each other one for one at | 385 | shadow buffers on this list match each other one for one at |
386 | all times. */ | 386 | all times. */ |
387 | struct journal_head * t_shadow_list; | 387 | struct journal_head * t_shadow_list; |
388 | 388 | ||
389 | /* Doubly-linked circular list of control buffers being written | 389 | /* Doubly-linked circular list of control buffers being written |
390 | to the log. */ | 390 | to the log. */ |
391 | struct journal_head * t_log_list; | 391 | struct journal_head * t_log_list; |
392 | 392 | ||
393 | /* Number of outstanding updates running on this transaction */ | 393 | /* Number of outstanding updates running on this transaction */ |
394 | int t_updates; | 394 | int t_updates; |
395 | 395 | ||
396 | /* Number of buffers reserved for use by all handles in this | 396 | /* Number of buffers reserved for use by all handles in this |
397 | * transaction handle but not yet modified. */ | 397 | * transaction handle but not yet modified. */ |
398 | int t_outstanding_credits; | 398 | int t_outstanding_credits; |
399 | 399 | ||
400 | /* | 400 | /* |
401 | * Forward and backward links for the circular list of all | 401 | * Forward and backward links for the circular list of all |
402 | * transactions awaiting checkpoint. | 402 | * transactions awaiting checkpoint. |
@@ -415,7 +415,7 @@ struct transaction_s | |||
415 | 415 | ||
416 | /* The journal_t maintains all of the journaling state information for a | 416 | /* The journal_t maintains all of the journaling state information for a |
417 | * single filesystem. It is linked to from the fs superblock structure. | 417 | * single filesystem. It is linked to from the fs superblock structure. |
418 | * | 418 | * |
419 | * We use the journal_t to keep track of all outstanding transaction | 419 | * We use the journal_t to keep track of all outstanding transaction |
420 | * activity on the filesystem, and to manage the state of the log | 420 | * activity on the filesystem, and to manage the state of the log |
421 | * writing process. */ | 421 | * writing process. */ |
@@ -428,7 +428,7 @@ struct journal_s | |||
428 | /* Is there an outstanding uncleared error on the journal (from | 428 | /* Is there an outstanding uncleared error on the journal (from |
429 | * a prior abort)? */ | 429 | * a prior abort)? */ |
430 | int j_errno; | 430 | int j_errno; |
431 | 431 | ||
432 | /* The superblock buffer */ | 432 | /* The superblock buffer */ |
433 | struct buffer_head * j_sb_buffer; | 433 | struct buffer_head * j_sb_buffer; |
434 | journal_superblock_t * j_superblock; | 434 | journal_superblock_t * j_superblock; |
@@ -438,49 +438,49 @@ struct journal_s | |||
438 | 438 | ||
439 | /* Number of processes waiting to create a barrier lock */ | 439 | /* Number of processes waiting to create a barrier lock */ |
440 | int j_barrier_count; | 440 | int j_barrier_count; |
441 | 441 | ||
442 | /* The barrier lock itself */ | 442 | /* The barrier lock itself */ |
443 | struct semaphore j_barrier; | 443 | struct semaphore j_barrier; |
444 | 444 | ||
445 | /* Transactions: The current running transaction... */ | 445 | /* Transactions: The current running transaction... */ |
446 | transaction_t * j_running_transaction; | 446 | transaction_t * j_running_transaction; |
447 | 447 | ||
448 | /* ... the transaction we are pushing to disk ... */ | 448 | /* ... the transaction we are pushing to disk ... */ |
449 | transaction_t * j_committing_transaction; | 449 | transaction_t * j_committing_transaction; |
450 | 450 | ||
451 | /* ... and a linked circular list of all transactions waiting | 451 | /* ... and a linked circular list of all transactions waiting |
452 | * for checkpointing. */ | 452 | * for checkpointing. */ |
453 | /* Protected by journal_datalist_lock */ | 453 | /* Protected by journal_datalist_lock */ |
454 | transaction_t * j_checkpoint_transactions; | 454 | transaction_t * j_checkpoint_transactions; |
455 | 455 | ||
456 | /* Wait queue for waiting for a locked transaction to start | 456 | /* Wait queue for waiting for a locked transaction to start |
457 | committing, or for a barrier lock to be released */ | 457 | committing, or for a barrier lock to be released */ |
458 | wait_queue_head_t j_wait_transaction_locked; | 458 | wait_queue_head_t j_wait_transaction_locked; |
459 | 459 | ||
460 | /* Wait queue for waiting for checkpointing to complete */ | 460 | /* Wait queue for waiting for checkpointing to complete */ |
461 | wait_queue_head_t j_wait_logspace; | 461 | wait_queue_head_t j_wait_logspace; |
462 | 462 | ||
463 | /* Wait queue for waiting for commit to complete */ | 463 | /* Wait queue for waiting for commit to complete */ |
464 | wait_queue_head_t j_wait_done_commit; | 464 | wait_queue_head_t j_wait_done_commit; |
465 | 465 | ||
466 | /* Wait queue to trigger checkpointing */ | 466 | /* Wait queue to trigger checkpointing */ |
467 | wait_queue_head_t j_wait_checkpoint; | 467 | wait_queue_head_t j_wait_checkpoint; |
468 | 468 | ||
469 | /* Wait queue to trigger commit */ | 469 | /* Wait queue to trigger commit */ |
470 | wait_queue_head_t j_wait_commit; | 470 | wait_queue_head_t j_wait_commit; |
471 | 471 | ||
472 | /* Wait queue to wait for updates to complete */ | 472 | /* Wait queue to wait for updates to complete */ |
473 | wait_queue_head_t j_wait_updates; | 473 | wait_queue_head_t j_wait_updates; |
474 | 474 | ||
475 | /* Semaphore for locking against concurrent checkpoints */ | 475 | /* Semaphore for locking against concurrent checkpoints */ |
476 | struct semaphore j_checkpoint_sem; | 476 | struct semaphore j_checkpoint_sem; |
477 | 477 | ||
478 | /* The main journal lock, used by lock_journal() */ | 478 | /* The main journal lock, used by lock_journal() */ |
479 | struct semaphore j_sem; | 479 | struct semaphore j_sem; |
480 | 480 | ||
481 | /* Journal head: identifies the first unused block in the journal. */ | 481 | /* Journal head: identifies the first unused block in the journal. */ |
482 | unsigned long j_head; | 482 | unsigned long j_head; |
483 | 483 | ||
484 | /* Journal tail: identifies the oldest still-used block in the | 484 | /* Journal tail: identifies the oldest still-used block in the |
485 | * journal. */ | 485 | * journal. */ |
486 | unsigned long j_tail; | 486 | unsigned long j_tail; |
@@ -546,12 +546,12 @@ struct journal_s | |||
546 | struct list_head j_all_journals; | 546 | struct list_head j_all_journals; |
547 | 547 | ||
548 | /* The revoke table: maintains the list of revoked blocks in the | 548 | /* The revoke table: maintains the list of revoked blocks in the |
549 | current transaction. */ | 549 | current transaction. */ |
550 | struct jbd_revoke_table_s *j_revoke; | 550 | struct jbd_revoke_table_s *j_revoke; |
551 | }; | 551 | }; |
552 | 552 | ||
553 | /* | 553 | /* |
554 | * Journal flag definitions | 554 | * Journal flag definitions |
555 | */ | 555 | */ |
556 | #define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ | 556 | #define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ |
557 | #define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ | 557 | #define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ |
@@ -559,7 +559,7 @@ struct journal_s | |||
559 | #define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */ | 559 | #define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */ |
560 | #define JFS_LOADED 0x010 /* The journal superblock has been loaded */ | 560 | #define JFS_LOADED 0x010 /* The journal superblock has been loaded */ |
561 | 561 | ||
562 | /* | 562 | /* |
563 | * Function declarations for the journaling transaction and buffer | 563 | * Function declarations for the journaling transaction and buffer |
564 | * management | 564 | * management |
565 | */ | 565 | */ |
@@ -589,7 +589,7 @@ extern void journal_insert_checkpoint(struct journal_head *, transaction_t *); | |||
589 | extern void __journal_insert_checkpoint(struct journal_head *,transaction_t *); | 589 | extern void __journal_insert_checkpoint(struct journal_head *,transaction_t *); |
590 | 590 | ||
591 | /* Buffer IO */ | 591 | /* Buffer IO */ |
592 | extern int | 592 | extern int |
593 | journal_write_metadata_buffer(transaction_t *transaction, | 593 | journal_write_metadata_buffer(transaction_t *transaction, |
594 | struct journal_head *jh_in, | 594 | struct journal_head *jh_in, |
595 | struct journal_head **jh_out, | 595 | struct journal_head **jh_out, |
@@ -603,7 +603,7 @@ extern void __wait_on_journal (journal_t *); | |||
603 | * | 603 | * |
604 | * We need to lock the journal during transaction state changes so that | 604 | * We need to lock the journal during transaction state changes so that |
605 | * nobody ever tries to take a handle on the running transaction while | 605 | * nobody ever tries to take a handle on the running transaction while |
606 | * we are in the middle of moving it to the commit phase. | 606 | * we are in the middle of moving it to the commit phase. |
607 | * | 607 | * |
608 | * Note that the locking is completely interrupt unsafe. We never touch | 608 | * Note that the locking is completely interrupt unsafe. We never touch |
609 | * journal structures from interrupts. | 609 | * journal structures from interrupts. |
@@ -637,7 +637,7 @@ static inline handle_t *journal_current_handle(void) | |||
637 | /* The journaling code user interface: | 637 | /* The journaling code user interface: |
638 | * | 638 | * |
639 | * Create and destroy handles | 639 | * Create and destroy handles |
640 | * Register buffer modifications against the current transaction. | 640 | * Register buffer modifications against the current transaction. |
641 | */ | 641 | */ |
642 | 642 | ||
643 | extern handle_t *journal_start(journal_t *, int nblocks); | 643 | 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, | |||
665 | int start, int len, int bsize); | 665 | int start, int len, int bsize); |
666 | extern journal_t * journal_init_inode (struct inode *); | 666 | extern journal_t * journal_init_inode (struct inode *); |
667 | extern int journal_update_format (journal_t *); | 667 | extern int journal_update_format (journal_t *); |
668 | extern int journal_check_used_features | 668 | extern int journal_check_used_features |
669 | (journal_t *, unsigned long, unsigned long, unsigned long); | 669 | (journal_t *, unsigned long, unsigned long, unsigned long); |
670 | extern int journal_check_available_features | 670 | extern int journal_check_available_features |
671 | (journal_t *, unsigned long, unsigned long, unsigned long); | 671 | (journal_t *, unsigned long, unsigned long, unsigned long); |
672 | extern int journal_set_features | 672 | extern int journal_set_features |
673 | (journal_t *, unsigned long, unsigned long, unsigned long); | 673 | (journal_t *, unsigned long, unsigned long, unsigned long); |
674 | extern int journal_create (journal_t *); | 674 | extern int journal_create (journal_t *); |
675 | extern int journal_load (journal_t *journal); | 675 | extern int journal_load (journal_t *journal); |
@@ -747,7 +747,7 @@ do { \ | |||
747 | * bit, when set, indicates that we have had a fatal error somewhere, | 747 | * bit, when set, indicates that we have had a fatal error somewhere, |
748 | * either inside the journaling layer or indicated to us by the client | 748 | * either inside the journaling layer or indicated to us by the client |
749 | * (eg. ext3), and that we and should not commit any further | 749 | * (eg. ext3), and that we and should not commit any further |
750 | * transactions. | 750 | * transactions. |
751 | */ | 751 | */ |
752 | 752 | ||
753 | static inline int is_journal_aborted(journal_t *journal) | 753 | static inline int is_journal_aborted(journal_t *journal) |
@@ -770,7 +770,7 @@ static inline void journal_abort_handle(handle_t *handle) | |||
770 | /* Not all architectures define BUG() */ | 770 | /* Not all architectures define BUG() */ |
771 | #ifndef BUG | 771 | #ifndef BUG |
772 | #define BUG() do { \ | 772 | #define BUG() do { \ |
773 | printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ | 773 | printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ |
774 | * ((char *) 0) = 0; \ | 774 | * ((char *) 0) = 0; \ |
775 | } while (0) | 775 | } while (0) |
776 | #endif /* BUG */ | 776 | #endif /* BUG */ |
@@ -826,7 +826,7 @@ extern int journal_blocks_per_page(struct inode *inode); | |||
826 | #define BJ_LogCtl 7 /* Buffer contains log descriptors */ | 826 | #define BJ_LogCtl 7 /* Buffer contains log descriptors */ |
827 | #define BJ_Reserved 8 /* Buffer is reserved for access by journal */ | 827 | #define BJ_Reserved 8 /* Buffer is reserved for access by journal */ |
828 | #define BJ_Types 9 | 828 | #define BJ_Types 9 |
829 | 829 | ||
830 | extern int jbd_blocks_per_page(struct inode *inode); | 830 | extern int jbd_blocks_per_page(struct inode *inode); |
831 | 831 | ||
832 | #ifdef __KERNEL__ | 832 | #ifdef __KERNEL__ |
diff --git a/e2fsprogs/ext2fs/kernel-list.h b/e2fsprogs/ext2fs/kernel-list.h index 24e6ab4a1..fa62ff138 100644 --- a/e2fsprogs/ext2fs/kernel-list.h +++ b/e2fsprogs/ext2fs/kernel-list.h | |||
@@ -29,7 +29,7 @@ struct list_head { | |||
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Insert a new entry between two known consecutive entries. | 32 | * Insert a new entry between two known consecutive entries. |
33 | * | 33 | * |
34 | * This is only for internal list manipulation where we know | 34 | * This is only for internal list manipulation where we know |
35 | * the prev/next entries already! | 35 | * the prev/next entries already! |
@@ -107,6 +107,6 @@ static __inline__ void list_splice(struct list_head *list, struct list_head *hea | |||
107 | ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) | 107 | ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) |
108 | 108 | ||
109 | #define list_for_each(pos, head) \ | 109 | #define list_for_each(pos, head) \ |
110 | for (pos = (head)->next; pos != (head); pos = pos->next) | 110 | for (pos = (head)->next; pos != (head); pos = pos->next) |
111 | 111 | ||
112 | #endif | 112 | #endif |
diff --git a/e2fsprogs/ext2fs/link.c b/e2fsprogs/ext2fs/link.c index 5e0f4f3c0..281ad065f 100644 --- a/e2fsprogs/ext2fs/link.c +++ b/e2fsprogs/ext2fs/link.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * link.c --- create links in a ext2fs directory | 2 | * link.c --- create links in a ext2fs directory |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -25,7 +25,7 @@ struct link_struct { | |||
25 | int flags; | 25 | int flags; |
26 | int done; | 26 | int done; |
27 | struct ext2_super_block *sb; | 27 | struct ext2_super_block *sb; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | static int link_proc(struct ext2_dir_entry *dirent, | 30 | static int link_proc(struct ext2_dir_entry *dirent, |
31 | int offset, | 31 | int offset, |
@@ -94,7 +94,7 @@ static int link_proc(struct ext2_dir_entry *dirent, | |||
94 | #ifdef __TURBOC__ | 94 | #ifdef __TURBOC__ |
95 | #pragma argsused | 95 | #pragma argsused |
96 | #endif | 96 | #endif |
97 | errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, | 97 | errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, |
98 | ext2_ino_t ino, int flags) | 98 | ext2_ino_t ino, int flags) |
99 | { | 99 | { |
100 | errcode_t retval; | 100 | errcode_t retval; |
diff --git a/e2fsprogs/ext2fs/lookup.c b/e2fsprogs/ext2fs/lookup.c index 1745f33ab..9cb97f1b5 100644 --- a/e2fsprogs/ext2fs/lookup.c +++ b/e2fsprogs/ext2fs/lookup.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * lookup.c --- ext2fs directory lookup operations | 2 | * lookup.c --- ext2fs directory lookup operations |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -23,7 +23,7 @@ struct lookup_struct { | |||
23 | int len; | 23 | int len; |
24 | ext2_ino_t *inode; | 24 | ext2_ino_t *inode; |
25 | int found; | 25 | int found; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | #ifdef __TURBOC__ | 28 | #ifdef __TURBOC__ |
29 | #pragma argsused | 29 | #pragma argsused |
diff --git a/e2fsprogs/ext2fs/mkdir.c b/e2fsprogs/ext2fs/mkdir.c index 81e7aea58..bf46e5050 100644 --- a/e2fsprogs/ext2fs/mkdir.c +++ b/e2fsprogs/ext2fs/mkdir.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * mkdir.c --- make a directory in the filesystem | 2 | * mkdir.c --- make a directory in the filesystem |
3 | * | 3 | * |
4 | * Copyright (C) 1994, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1994, 1995 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -94,7 +94,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, | |||
94 | retval = ext2fs_write_dir_block(fs, blk, block); | 94 | retval = ext2fs_write_dir_block(fs, blk, block); |
95 | if (retval) | 95 | if (retval) |
96 | goto cleanup; | 96 | goto cleanup; |
97 | retval = ext2fs_write_new_inode(fs, ino, &inode); | 97 | retval = ext2fs_write_new_inode(fs, ino, &inode); |
98 | if (retval) | 98 | if (retval) |
99 | goto cleanup; | 99 | goto cleanup; |
100 | 100 | ||
@@ -125,7 +125,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, | |||
125 | if (retval) | 125 | if (retval) |
126 | goto cleanup; | 126 | goto cleanup; |
127 | } | 127 | } |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * Update accounting.... | 130 | * Update accounting.... |
131 | */ | 131 | */ |
diff --git a/e2fsprogs/ext2fs/mkjournal.c b/e2fsprogs/ext2fs/mkjournal.c index b748918b6..0a9ae7a4d 100644 --- a/e2fsprogs/ext2fs/mkjournal.c +++ b/e2fsprogs/ext2fs/mkjournal.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * mkjournal.c --- make a journal for a filesystem | 2 | * mkjournal.c --- make a journal for a filesystem |
3 | * | 3 | * |
4 | * Copyright (C) 2000 Theodore Ts'o. | 4 | * Copyright (C) 2000 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
@@ -155,7 +155,7 @@ static int mkjournal_proc(ext2_filsys fs, | |||
155 | blk_t new_blk; | 155 | blk_t new_blk; |
156 | static blk_t last_blk = 0; | 156 | static blk_t last_blk = 0; |
157 | errcode_t retval; | 157 | errcode_t retval; |
158 | 158 | ||
159 | if (*blocknr) { | 159 | if (*blocknr) { |
160 | last_blk = *blocknr; | 160 | last_blk = *blocknr; |
161 | return 0; | 161 | return 0; |
@@ -186,7 +186,7 @@ static int mkjournal_proc(ext2_filsys fs, | |||
186 | return (BLOCK_CHANGED | BLOCK_ABORT); | 186 | return (BLOCK_CHANGED | BLOCK_ABORT); |
187 | else | 187 | else |
188 | return BLOCK_CHANGED; | 188 | return BLOCK_CHANGED; |
189 | 189 | ||
190 | } | 190 | } |
191 | 191 | ||
192 | /* | 192 | /* |
@@ -202,7 +202,7 @@ static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino, | |||
202 | 202 | ||
203 | if ((retval = ext2fs_create_journal_superblock(fs, size, flags, &buf))) | 203 | if ((retval = ext2fs_create_journal_superblock(fs, size, flags, &buf))) |
204 | return retval; | 204 | return retval; |
205 | 205 | ||
206 | if ((retval = ext2fs_read_bitmaps(fs))) | 206 | if ((retval = ext2fs_read_bitmaps(fs))) |
207 | return retval; | 207 | return retval; |
208 | 208 | ||
@@ -227,7 +227,7 @@ static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino, | |||
227 | if ((retval = ext2fs_read_inode(fs, journal_ino, &inode))) | 227 | if ((retval = ext2fs_read_inode(fs, journal_ino, &inode))) |
228 | goto errout; | 228 | goto errout; |
229 | 229 | ||
230 | inode.i_size += fs->blocksize * size; | 230 | inode.i_size += fs->blocksize * size; |
231 | inode.i_blocks += (fs->blocksize / 512) * es.newblocks; | 231 | inode.i_blocks += (fs->blocksize / 512) * es.newblocks; |
232 | inode.i_mtime = inode.i_ctime = time(0); | 232 | inode.i_mtime = inode.i_ctime = time(0); |
233 | inode.i_links_count = 1; | 233 | inode.i_links_count = 1; |
@@ -262,7 +262,7 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev) | |||
262 | /* Make sure the device exists and is a block device */ | 262 | /* Make sure the device exists and is a block device */ |
263 | if (stat(journal_dev->device_name, &st) < 0) | 263 | if (stat(journal_dev->device_name, &st) < 0) |
264 | return errno; | 264 | return errno; |
265 | 265 | ||
266 | if (!S_ISBLK(st.st_mode)) | 266 | if (!S_ISBLK(st.st_mode)) |
267 | return EXT2_ET_JOURNAL_NOT_BLOCK; /* Must be a block device */ | 267 | return EXT2_ET_JOURNAL_NOT_BLOCK; /* Must be a block device */ |
268 | 268 | ||
@@ -297,7 +297,7 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev) | |||
297 | /* Writeback the journal superblock */ | 297 | /* Writeback the journal superblock */ |
298 | if ((retval = io_channel_write_blk(journal_dev->io, start, -1024, buf))) | 298 | if ((retval = io_channel_write_blk(journal_dev->io, start, -1024, buf))) |
299 | return retval; | 299 | return retval; |
300 | 300 | ||
301 | fs->super->s_journal_inum = 0; | 301 | fs->super->s_journal_inum = 0; |
302 | fs->super->s_journal_dev = st.st_rdev; | 302 | fs->super->s_journal_dev = st.st_rdev; |
303 | memcpy(fs->super->s_journal_uuid, jsb->s_uuid, | 303 | 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) | |||
328 | strcat(jfile, "/.journal"); | 328 | strcat(jfile, "/.journal"); |
329 | 329 | ||
330 | /* | 330 | /* |
331 | * If .../.journal already exists, make sure any | 331 | * If .../.journal already exists, make sure any |
332 | * immutable or append-only flags are cleared. | 332 | * immutable or append-only flags are cleared. |
333 | */ | 333 | */ |
334 | #if defined(HAVE_CHFLAGS) && defined(UF_NODUMP) | 334 | #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) | |||
350 | 350 | ||
351 | if ((retval = write_journal_file(fs, jfile, size, flags))) | 351 | if ((retval = write_journal_file(fs, jfile, size, flags))) |
352 | goto errout; | 352 | goto errout; |
353 | 353 | ||
354 | /* Get inode number of the journal file */ | 354 | /* Get inode number of the journal file */ |
355 | if (fstat(fd, &st) < 0) | 355 | if (fstat(fd, &st) < 0) |
356 | goto errout; | 356 | goto errout; |
@@ -365,7 +365,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) | |||
365 | #endif | 365 | #endif |
366 | if (retval) | 366 | if (retval) |
367 | goto errout; | 367 | goto errout; |
368 | 368 | ||
369 | close(fd); | 369 | close(fd); |
370 | journal_ino = st.st_ino; | 370 | journal_ino = st.st_ino; |
371 | } else { | 371 | } else { |
@@ -374,7 +374,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) | |||
374 | size, flags))) | 374 | size, flags))) |
375 | return retval; | 375 | return retval; |
376 | } | 376 | } |
377 | 377 | ||
378 | fs->super->s_journal_inum = journal_ino; | 378 | fs->super->s_journal_inum = journal_ino; |
379 | fs->super->s_journal_dev = 0; | 379 | fs->super->s_journal_dev = 0; |
380 | memset(fs->super->s_journal_uuid, 0, | 380 | memset(fs->super->s_journal_uuid, 0, |
@@ -393,14 +393,14 @@ main(int argc, char **argv) | |||
393 | { | 393 | { |
394 | errcode_t retval; | 394 | errcode_t retval; |
395 | char *device_name; | 395 | char *device_name; |
396 | ext2_filsys fs; | 396 | ext2_filsys fs; |
397 | 397 | ||
398 | if (argc < 2) { | 398 | if (argc < 2) { |
399 | fprintf(stderr, "Usage: %s filesystem\n", argv[0]); | 399 | fprintf(stderr, "Usage: %s filesystem\n", argv[0]); |
400 | exit(1); | 400 | exit(1); |
401 | } | 401 | } |
402 | device_name = argv[1]; | 402 | device_name = argv[1]; |
403 | 403 | ||
404 | retval = ext2fs_open (device_name, EXT2_FLAG_RW, 0, 0, | 404 | retval = ext2fs_open (device_name, EXT2_FLAG_RW, 0, 0, |
405 | unix_io_manager, &fs); | 405 | unix_io_manager, &fs); |
406 | if (retval) { | 406 | if (retval) { |
@@ -420,6 +420,6 @@ main(int argc, char **argv) | |||
420 | } | 420 | } |
421 | ext2fs_close(fs); | 421 | ext2fs_close(fs); |
422 | exit(0); | 422 | exit(0); |
423 | 423 | ||
424 | } | 424 | } |
425 | #endif | 425 | #endif |
diff --git a/e2fsprogs/ext2fs/namei.c b/e2fsprogs/ext2fs/namei.c index 13d13adfe..6ce4bb363 100644 --- a/e2fsprogs/ext2fs/namei.c +++ b/e2fsprogs/ext2fs/namei.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * namei.c --- ext2fs directory lookup operations | 2 | * namei.c --- ext2fs directory lookup operations |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -36,7 +36,7 @@ static errcode_t follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, | |||
36 | #ifdef NAMEI_DEBUG | 36 | #ifdef NAMEI_DEBUG |
37 | printf("follow_link: root=%lu, dir=%lu, inode=%lu, lc=%d\n", | 37 | printf("follow_link: root=%lu, dir=%lu, inode=%lu, lc=%d\n", |
38 | root, dir, inode, link_count); | 38 | root, dir, inode, link_count); |
39 | 39 | ||
40 | #endif | 40 | #endif |
41 | retval = ext2fs_read_inode (fs, inode, &ei); | 41 | retval = ext2fs_read_inode (fs, inode, &ei); |
42 | if (retval) return retval; | 42 | if (retval) return retval; |
@@ -85,12 +85,12 @@ static errcode_t dir_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, | |||
85 | errcode_t retval; | 85 | errcode_t retval; |
86 | 86 | ||
87 | if ((c = *pathname) == '/') { | 87 | if ((c = *pathname) == '/') { |
88 | dir = root; | 88 | dir = root; |
89 | pathname++; | 89 | pathname++; |
90 | pathlen--; | 90 | pathlen--; |
91 | } | 91 | } |
92 | while (1) { | 92 | while (1) { |
93 | thisname = pathname; | 93 | thisname = pathname; |
94 | for (len=0; --pathlen >= 0;len++) { | 94 | for (len=0; --pathlen >= 0;len++) { |
95 | c = *(pathname++); | 95 | c = *(pathname++); |
96 | if (c == '/') | 96 | if (c == '/') |
@@ -100,10 +100,10 @@ static errcode_t dir_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, | |||
100 | break; | 100 | break; |
101 | retval = ext2fs_lookup (fs, dir, thisname, len, buf, &inode); | 101 | retval = ext2fs_lookup (fs, dir, thisname, len, buf, &inode); |
102 | if (retval) return retval; | 102 | if (retval) return retval; |
103 | retval = follow_link (fs, root, dir, inode, | 103 | retval = follow_link (fs, root, dir, inode, |
104 | link_count, buf, &dir); | 104 | link_count, buf, &dir); |
105 | if (retval) return retval; | 105 | if (retval) return retval; |
106 | } | 106 | } |
107 | *name = thisname; | 107 | *name = thisname; |
108 | *namelen = len; | 108 | *namelen = len; |
109 | *res_inode = dir; | 109 | *res_inode = dir; |
@@ -152,13 +152,13 @@ errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, | |||
152 | { | 152 | { |
153 | char *buf; | 153 | char *buf; |
154 | errcode_t retval; | 154 | errcode_t retval; |
155 | 155 | ||
156 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 156 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
157 | 157 | ||
158 | retval = ext2fs_get_mem(fs->blocksize, &buf); | 158 | retval = ext2fs_get_mem(fs->blocksize, &buf); |
159 | if (retval) | 159 | if (retval) |
160 | return retval; | 160 | return retval; |
161 | 161 | ||
162 | retval = open_namei(fs, root, cwd, name, strlen(name), 0, 0, | 162 | retval = open_namei(fs, root, cwd, name, strlen(name), 0, 0, |
163 | buf, inode); | 163 | buf, inode); |
164 | 164 | ||
@@ -171,13 +171,13 @@ errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, | |||
171 | { | 171 | { |
172 | char *buf; | 172 | char *buf; |
173 | errcode_t retval; | 173 | errcode_t retval; |
174 | 174 | ||
175 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 175 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
176 | 176 | ||
177 | retval = ext2fs_get_mem(fs->blocksize, &buf); | 177 | retval = ext2fs_get_mem(fs->blocksize, &buf); |
178 | if (retval) | 178 | if (retval) |
179 | return retval; | 179 | return retval; |
180 | 180 | ||
181 | retval = open_namei(fs, root, cwd, name, strlen(name), 1, 0, | 181 | retval = open_namei(fs, root, cwd, name, strlen(name), 1, 0, |
182 | buf, inode); | 182 | buf, inode); |
183 | 183 | ||
@@ -190,7 +190,7 @@ errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, | |||
190 | { | 190 | { |
191 | char *buf; | 191 | char *buf; |
192 | errcode_t retval; | 192 | errcode_t retval; |
193 | 193 | ||
194 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 194 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
195 | 195 | ||
196 | retval = ext2fs_get_mem(fs->blocksize, &buf); | 196 | retval = ext2fs_get_mem(fs->blocksize, &buf); |
diff --git a/e2fsprogs/ext2fs/newdir.c b/e2fsprogs/ext2fs/newdir.c index 3904d9112..27c718ea5 100644 --- a/e2fsprogs/ext2fs/newdir.c +++ b/e2fsprogs/ext2fs/newdir.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * newdir.c --- create a new directory block | 2 | * newdir.c --- create a new directory block |
3 | * | 3 | * |
4 | * Copyright (C) 1994, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1994, 1995 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -28,7 +28,7 @@ | |||
28 | errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, | 28 | errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, |
29 | ext2_ino_t parent_ino, char **block) | 29 | ext2_ino_t parent_ino, char **block) |
30 | { | 30 | { |
31 | struct ext2_dir_entry *dir = NULL; | 31 | struct ext2_dir_entry *dir = NULL; |
32 | errcode_t retval; | 32 | errcode_t retval; |
33 | char *buf; | 33 | char *buf; |
34 | int rec_len; | 34 | int rec_len; |
@@ -65,7 +65,7 @@ errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, | |||
65 | dir->name_len = 2 | filetype; | 65 | dir->name_len = 2 | filetype; |
66 | dir->name[0] = '.'; | 66 | dir->name[0] = '.'; |
67 | dir->name[1] = '.'; | 67 | dir->name[1] = '.'; |
68 | 68 | ||
69 | } | 69 | } |
70 | *block = buf; | 70 | *block = buf; |
71 | return 0; | 71 | return 0; |
diff --git a/e2fsprogs/ext2fs/openfs.c b/e2fsprogs/ext2fs/openfs.c index e8f16495d..aa603337d 100644 --- a/e2fsprogs/ext2fs/openfs.c +++ b/e2fsprogs/ext2fs/openfs.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * openfs.c --- open an ext2 filesystem | 2 | * openfs.c --- open an ext2 filesystem |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
@@ -42,7 +42,7 @@ blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i) | |||
42 | bg = (fs->blocksize / sizeof (struct ext2_group_desc)) * i; | 42 | bg = (fs->blocksize / sizeof (struct ext2_group_desc)) * i; |
43 | if (ext2fs_bg_has_super(fs, bg)) | 43 | if (ext2fs_bg_has_super(fs, bg)) |
44 | has_super = 1; | 44 | has_super = 1; |
45 | ret_blk = (fs->super->s_first_data_block + has_super + | 45 | ret_blk = (fs->super->s_first_data_block + has_super + |
46 | (bg * fs->super->s_blocks_per_group)); | 46 | (bg * fs->super->s_blocks_per_group)); |
47 | /* | 47 | /* |
48 | * If group_block is not the normal value, we're trying to use | 48 | * 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) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | errcode_t ext2fs_open(const char *name, int flags, int superblock, | 62 | errcode_t ext2fs_open(const char *name, int flags, int superblock, |
63 | unsigned int block_size, io_manager manager, | 63 | unsigned int block_size, io_manager manager, |
64 | ext2_filsys *ret_fs) | 64 | ext2_filsys *ret_fs) |
65 | { | 65 | { |
66 | return ext2fs_open2(name, 0, flags, superblock, block_size, | 66 | return ext2fs_open2(name, 0, flags, superblock, block_size, |
67 | manager, ret_fs); | 67 | manager, ret_fs); |
68 | } | 68 | } |
69 | 69 | ||
70 | /* | 70 | /* |
71 | * Note: if superblock is non-zero, block-size must also be non-zero. | 71 | * Note: if superblock is non-zero, block-size must also be non-zero. |
72 | * Superblock and block_size can be zero to use the default size. | 72 | * Superblock and block_size can be zero to use the default size. |
73 | * | 73 | * |
74 | * Valid flags for ext2fs_open() | 74 | * Valid flags for ext2fs_open() |
75 | * | 75 | * |
76 | * EXT2_FLAG_RW - Open the filesystem for read/write. | 76 | * EXT2_FLAG_RW - Open the filesystem for read/write. |
77 | * EXT2_FLAG_FORCE - Open the filesystem even if some of the | 77 | * EXT2_FLAG_FORCE - Open the filesystem even if some of the |
78 | * features aren't supported. | 78 | * features aren't supported. |
79 | * EXT2_FLAG_JOURNAL_DEV_OK - Open an ext3 journal device | 79 | * EXT2_FLAG_JOURNAL_DEV_OK - Open an ext3 journal device |
80 | */ | 80 | */ |
81 | errcode_t ext2fs_open2(const char *name, const char *io_options, | 81 | errcode_t ext2fs_open2(const char *name, const char *io_options, |
82 | int flags, int superblock, | 82 | int flags, int superblock, |
83 | unsigned int block_size, io_manager manager, | 83 | unsigned int block_size, io_manager manager, |
84 | ext2_filsys *ret_fs) | 84 | ext2_filsys *ret_fs) |
85 | { | 85 | { |
86 | ext2_filsys fs; | 86 | ext2_filsys fs; |
@@ -93,13 +93,13 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, | |||
93 | int j; | 93 | int j; |
94 | struct ext2_group_desc *gdp; | 94 | struct ext2_group_desc *gdp; |
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER); | 97 | EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER); |
98 | 98 | ||
99 | retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); | 99 | retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); |
100 | if (retval) | 100 | if (retval) |
101 | return retval; | 101 | return retval; |
102 | 102 | ||
103 | memset(fs, 0, sizeof(struct struct_ext2_filsys)); | 103 | memset(fs, 0, sizeof(struct struct_ext2_filsys)); |
104 | fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; | 104 | fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; |
105 | fs->flags = flags; | 105 | fs->flags = flags; |
@@ -113,13 +113,13 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, | |||
113 | *cp++ = 0; | 113 | *cp++ = 0; |
114 | io_options = cp; | 114 | io_options = cp; |
115 | } | 115 | } |
116 | 116 | ||
117 | retval = manager->open(fs->device_name, | 117 | retval = manager->open(fs->device_name, |
118 | (flags & EXT2_FLAG_RW) ? IO_FLAG_RW : 0, | 118 | (flags & EXT2_FLAG_RW) ? IO_FLAG_RW : 0, |
119 | &fs->io); | 119 | &fs->io); |
120 | if (retval) | 120 | if (retval) |
121 | goto cleanup; | 121 | goto cleanup; |
122 | if (io_options && | 122 | if (io_options && |
123 | (retval = io_channel_set_options(fs->io, io_options))) | 123 | (retval = io_channel_set_options(fs->io, io_options))) |
124 | goto cleanup; | 124 | goto cleanup; |
125 | fs->image_io = fs->io; | 125 | fs->image_io = fs->io; |
@@ -183,7 +183,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, | |||
183 | ext2fs_swap_super(fs->super); | 183 | ext2fs_swap_super(fs->super); |
184 | } | 184 | } |
185 | #endif | 185 | #endif |
186 | 186 | ||
187 | if (fs->super->s_magic != EXT2_SUPER_MAGIC) { | 187 | if (fs->super->s_magic != EXT2_SUPER_MAGIC) { |
188 | retval = EXT2_ET_BAD_MAGIC; | 188 | retval = EXT2_ET_BAD_MAGIC; |
189 | goto cleanup; | 189 | goto cleanup; |
@@ -215,7 +215,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, | |||
215 | goto cleanup; | 215 | goto cleanup; |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | fs->blocksize = EXT2_BLOCK_SIZE(fs->super); | 219 | fs->blocksize = EXT2_BLOCK_SIZE(fs->super); |
220 | if (fs->blocksize == 0) { | 220 | if (fs->blocksize == 0) { |
221 | retval = EXT2_ET_CORRUPT_SUPERBLOCK; | 221 | retval = EXT2_ET_CORRUPT_SUPERBLOCK; |
@@ -247,7 +247,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, | |||
247 | *ret_fs = fs; | 247 | *ret_fs = fs; |
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | 250 | ||
251 | /* | 251 | /* |
252 | * Read group descriptors | 252 | * Read group descriptors |
253 | */ | 253 | */ |
@@ -296,7 +296,7 @@ cleanup: | |||
296 | 296 | ||
297 | /* | 297 | /* |
298 | * Set/get the filesystem data I/O channel. | 298 | * Set/get the filesystem data I/O channel. |
299 | * | 299 | * |
300 | * These functions are only valid if EXT2_FLAG_IMAGE_FILE is true. | 300 | * These functions are only valid if EXT2_FLAG_IMAGE_FILE is true. |
301 | */ | 301 | */ |
302 | errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io) | 302 | 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) | |||
322 | if ((fs->flags & EXT2_FLAG_IMAGE_FILE) == 0) | 322 | if ((fs->flags & EXT2_FLAG_IMAGE_FILE) == 0) |
323 | return EXT2_ET_NOT_IMAGE_FILE; | 323 | return EXT2_ET_NOT_IMAGE_FILE; |
324 | fs->io = fs->image_io = new_io; | 324 | fs->io = fs->image_io = new_io; |
325 | fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_RW | | 325 | fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_RW | |
326 | EXT2_FLAG_BB_DIRTY | EXT2_FLAG_IB_DIRTY; | 326 | EXT2_FLAG_BB_DIRTY | EXT2_FLAG_IB_DIRTY; |
327 | fs->flags &= ~EXT2_FLAG_IMAGE_FILE; | 327 | fs->flags &= ~EXT2_FLAG_IMAGE_FILE; |
328 | return 0; | 328 | return 0; |
diff --git a/e2fsprogs/ext2fs/read_bb.c b/e2fsprogs/ext2fs/read_bb.c index c717adcd2..226c5375a 100644 --- a/e2fsprogs/ext2fs/read_bb.c +++ b/e2fsprogs/ext2fs/read_bb.c | |||
@@ -38,16 +38,16 @@ struct read_bb_record { | |||
38 | #pragma argsused | 38 | #pragma argsused |
39 | #endif | 39 | #endif |
40 | static int mark_bad_block(ext2_filsys fs, blk_t *block_nr, | 40 | static int mark_bad_block(ext2_filsys fs, blk_t *block_nr, |
41 | e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), | 41 | e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), |
42 | blk_t ref_block EXT2FS_ATTR((unused)), | 42 | blk_t ref_block EXT2FS_ATTR((unused)), |
43 | int ref_offset EXT2FS_ATTR((unused)), | 43 | int ref_offset EXT2FS_ATTR((unused)), |
44 | void *priv_data) | 44 | void *priv_data) |
45 | { | 45 | { |
46 | struct read_bb_record *rb = (struct read_bb_record *) priv_data; | 46 | struct read_bb_record *rb = (struct read_bb_record *) priv_data; |
47 | 47 | ||
48 | if (blockcnt < 0) | 48 | if (blockcnt < 0) |
49 | return 0; | 49 | return 0; |
50 | 50 | ||
51 | if ((*block_nr < fs->super->s_first_data_block) || | 51 | if ((*block_nr < fs->super->s_first_data_block) || |
52 | (*block_nr >= fs->super->s_blocks_count)) | 52 | (*block_nr >= fs->super->s_blocks_count)) |
53 | return 0; /* Ignore illegal blocks */ | 53 | return 0; /* Ignore illegal blocks */ |
diff --git a/e2fsprogs/ext2fs/read_bb_file.c b/e2fsprogs/ext2fs/read_bb_file.c index 40c34ee3c..f7851f143 100644 --- a/e2fsprogs/ext2fs/read_bb_file.c +++ b/e2fsprogs/ext2fs/read_bb_file.c | |||
@@ -29,7 +29,7 @@ | |||
29 | /* | 29 | /* |
30 | * Reads a list of bad blocks from a FILE * | 30 | * Reads a list of bad blocks from a FILE * |
31 | */ | 31 | */ |
32 | errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, | 32 | errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, |
33 | ext2_badblocks_list *bb_list, | 33 | ext2_badblocks_list *bb_list, |
34 | void *priv_data, | 34 | void *priv_data, |
35 | void (*invalid)(ext2_filsys fs, | 35 | void (*invalid)(ext2_filsys fs, |
@@ -72,7 +72,7 @@ errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, | |||
72 | } | 72 | } |
73 | 73 | ||
74 | static void call_compat_invalid(ext2_filsys fs, blk_t blk, | 74 | static void call_compat_invalid(ext2_filsys fs, blk_t blk, |
75 | char *badstr EXT2FS_ATTR((unused)), | 75 | char *badstr EXT2FS_ATTR((unused)), |
76 | void *priv_data) | 76 | void *priv_data) |
77 | { | 77 | { |
78 | void (*invalid)(ext2_filsys, blk_t); | 78 | void (*invalid)(ext2_filsys, blk_t); |
@@ -86,7 +86,7 @@ static void call_compat_invalid(ext2_filsys fs, blk_t blk, | |||
86 | /* | 86 | /* |
87 | * Reads a list of bad blocks from a FILE * | 87 | * Reads a list of bad blocks from a FILE * |
88 | */ | 88 | */ |
89 | errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, | 89 | errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, |
90 | ext2_badblocks_list *bb_list, | 90 | ext2_badblocks_list *bb_list, |
91 | void (*invalid)(ext2_filsys fs, blk_t blk)) | 91 | void (*invalid)(ext2_filsys fs, blk_t blk)) |
92 | { | 92 | { |
diff --git a/e2fsprogs/ext2fs/rs_bitmap.c b/e2fsprogs/ext2fs/rs_bitmap.c index 46653f0ec..c2e51e021 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, | |||
53 | bmap->end = new_end; | 53 | bmap->end = new_end; |
54 | return 0; | 54 | return 0; |
55 | } | 55 | } |
56 | 56 | ||
57 | size = ((bmap->real_end - bmap->start) / 8) + 1; | 57 | size = ((bmap->real_end - bmap->start) / 8) + 1; |
58 | new_size = ((new_real_end - bmap->start) / 8) + 1; | 58 | new_size = ((new_real_end - bmap->start) / 8) + 1; |
59 | 59 | ||
@@ -74,7 +74,7 @@ errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end, | |||
74 | ext2fs_inode_bitmap bmap) | 74 | ext2fs_inode_bitmap bmap) |
75 | { | 75 | { |
76 | errcode_t retval; | 76 | errcode_t retval; |
77 | 77 | ||
78 | if (!bmap) | 78 | if (!bmap) |
79 | return EXT2_ET_INVALID_ARGUMENT; | 79 | return EXT2_ET_INVALID_ARGUMENT; |
80 | 80 | ||
@@ -91,7 +91,7 @@ errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end, | |||
91 | ext2fs_block_bitmap bmap) | 91 | ext2fs_block_bitmap bmap) |
92 | { | 92 | { |
93 | errcode_t retval; | 93 | errcode_t retval; |
94 | 94 | ||
95 | if (!bmap) | 95 | if (!bmap) |
96 | return EXT2_ET_INVALID_ARGUMENT; | 96 | return EXT2_ET_INVALID_ARGUMENT; |
97 | 97 | ||
diff --git a/e2fsprogs/ext2fs/rw_bitmaps.c b/e2fsprogs/ext2fs/rw_bitmaps.c index b67a92599..ae7b6e0cf 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) | |||
45 | { | 45 | { |
46 | __u32 *p = (__u32 *) bitmap; | 46 | __u32 *p = (__u32 *) bitmap; |
47 | int n; | 47 | int n; |
48 | 48 | ||
49 | for (n = nbytes / sizeof(__u32); n > 0; --n, ++p) | 49 | for (n = nbytes / sizeof(__u32); n > 0; --n, ++p) |
50 | *p = ext2fs_swab32(*p); | 50 | *p = ext2fs_swab32(*p); |
51 | } | 51 | } |
@@ -53,7 +53,7 @@ static void ext2fs_swap_bitmap(ext2_filsys fs, char *bitmap, int nbytes) | |||
53 | 53 | ||
54 | errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) | 54 | errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) |
55 | { | 55 | { |
56 | dgrp_t i; | 56 | dgrp_t i; |
57 | size_t nbytes; | 57 | size_t nbytes; |
58 | errcode_t retval; | 58 | errcode_t retval; |
59 | char * inode_bitmap = fs->inode_map->bitmap; | 59 | char * inode_bitmap = fs->inode_map->bitmap; |
@@ -67,7 +67,7 @@ errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) | |||
67 | if (!inode_bitmap) | 67 | if (!inode_bitmap) |
68 | return 0; | 68 | return 0; |
69 | nbytes = (size_t) ((EXT2_INODES_PER_GROUP(fs->super)+7) / 8); | 69 | nbytes = (size_t) ((EXT2_INODES_PER_GROUP(fs->super)+7) / 8); |
70 | 70 | ||
71 | retval = ext2fs_get_mem(fs->blocksize, &bitmap_block); | 71 | retval = ext2fs_get_mem(fs->blocksize, &bitmap_block); |
72 | if (retval) | 72 | if (retval) |
73 | return retval; | 73 | return retval; |
@@ -95,7 +95,7 @@ errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) | |||
95 | 95 | ||
96 | errcode_t ext2fs_write_block_bitmap (ext2_filsys fs) | 96 | errcode_t ext2fs_write_block_bitmap (ext2_filsys fs) |
97 | { | 97 | { |
98 | dgrp_t i; | 98 | dgrp_t i; |
99 | unsigned int j; | 99 | unsigned int j; |
100 | int nbytes; | 100 | int nbytes; |
101 | unsigned int nbits; | 101 | unsigned int nbits; |
@@ -195,7 +195,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block) | |||
195 | if (block_bitmap) { | 195 | if (block_bitmap) { |
196 | blk = (fs->image_header->offset_blockmap / | 196 | blk = (fs->image_header->offset_blockmap / |
197 | fs->blocksize); | 197 | fs->blocksize); |
198 | retval = io_channel_read_blk(fs->image_io, blk, | 198 | retval = io_channel_read_blk(fs->image_io, blk, |
199 | -(block_nbytes * fs->group_desc_count), | 199 | -(block_nbytes * fs->group_desc_count), |
200 | block_bitmap); | 200 | block_bitmap); |
201 | if (retval) | 201 | if (retval) |
@@ -243,7 +243,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block) | |||
243 | } | 243 | } |
244 | } | 244 | } |
245 | return 0; | 245 | return 0; |
246 | 246 | ||
247 | cleanup: | 247 | cleanup: |
248 | if (do_block) { | 248 | if (do_block) { |
249 | ext2fs_free_mem(&fs->block_map); | 249 | ext2fs_free_mem(&fs->block_map); |
@@ -296,5 +296,5 @@ errcode_t ext2fs_write_bitmaps(ext2_filsys fs) | |||
296 | return retval; | 296 | return retval; |
297 | } | 297 | } |
298 | return 0; | 298 | return 0; |
299 | } | 299 | } |
300 | 300 | ||
diff --git a/e2fsprogs/ext2fs/swapfs.c b/e2fsprogs/ext2fs/swapfs.c index 8a0899515..af8b6eb87 100644 --- a/e2fsprogs/ext2fs/swapfs.c +++ b/e2fsprogs/ext2fs/swapfs.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * swapfs.c --- swap ext2 filesystem data structures | 2 | * swapfs.c --- swap ext2 filesystem data structures |
3 | * | 3 | * |
4 | * Copyright (C) 1995, 1996, 2002 Theodore Ts'o. | 4 | * Copyright (C) 1995, 1996, 2002 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -23,7 +23,7 @@ | |||
23 | #ifdef EXT2FS_ENABLE_SWAPFS | 23 | #ifdef EXT2FS_ENABLE_SWAPFS |
24 | void ext2fs_swap_super(struct ext2_super_block * sb) | 24 | void ext2fs_swap_super(struct ext2_super_block * sb) |
25 | { | 25 | { |
26 | int i; | 26 | int i; |
27 | sb->s_inodes_count = ext2fs_swab32(sb->s_inodes_count); | 27 | sb->s_inodes_count = ext2fs_swab32(sb->s_inodes_count); |
28 | sb->s_blocks_count = ext2fs_swab32(sb->s_blocks_count); | 28 | sb->s_blocks_count = ext2fs_swab32(sb->s_blocks_count); |
29 | sb->s_r_blocks_count = ext2fs_swab32(sb->s_r_blocks_count); | 29 | 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) | |||
108 | } | 108 | } |
109 | 109 | ||
110 | while ((char *)from_entry < from_end && *(__u32 *)from_entry) { | 110 | while ((char *)from_entry < from_end && *(__u32 *)from_entry) { |
111 | to_entry->e_value_offs = | 111 | to_entry->e_value_offs = |
112 | ext2fs_swab16(from_entry->e_value_offs); | 112 | ext2fs_swab16(from_entry->e_value_offs); |
113 | to_entry->e_value_block = | 113 | to_entry->e_value_block = |
114 | ext2fs_swab32(from_entry->e_value_block); | 114 | ext2fs_swab32(from_entry->e_value_block); |
115 | to_entry->e_value_size = | 115 | to_entry->e_value_size = |
116 | ext2fs_swab32(from_entry->e_value_size); | 116 | ext2fs_swab32(from_entry->e_value_size); |
117 | from_entry = EXT2_EXT_ATTR_NEXT(from_entry); | 117 | from_entry = EXT2_EXT_ATTR_NEXT(from_entry); |
118 | to_entry = EXT2_EXT_ATTR_NEXT(to_entry); | 118 | to_entry = EXT2_EXT_ATTR_NEXT(to_entry); |
diff --git a/e2fsprogs/ext2fs/test_io.c b/e2fsprogs/ext2fs/test_io.c index 6a3b248e9..d4b36532f 100644 --- a/e2fsprogs/ext2fs/test_io.c +++ b/e2fsprogs/ext2fs/test_io.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #define EXT2_CHECK_MAGIC(struct, code) \ | 33 | #define EXT2_CHECK_MAGIC(struct, code) \ |
34 | if ((struct)->magic != (code)) return (code) | 34 | if ((struct)->magic != (code)) return (code) |
35 | 35 | ||
36 | struct test_private_data { | 36 | struct test_private_data { |
37 | int magic; | 37 | int magic; |
38 | io_channel real; | 38 | io_channel real; |
@@ -56,7 +56,7 @@ static errcode_t test_write_blk(io_channel channel, unsigned long block, | |||
56 | static errcode_t test_flush(io_channel channel); | 56 | static errcode_t test_flush(io_channel channel); |
57 | static errcode_t test_write_byte(io_channel channel, unsigned long offset, | 57 | static errcode_t test_write_byte(io_channel channel, unsigned long offset, |
58 | int count, const void *buf); | 58 | int count, const void *buf); |
59 | static errcode_t test_set_option(io_channel channel, const char *option, | 59 | static errcode_t test_set_option(io_channel channel, const char *option, |
60 | const char *arg); | 60 | const char *arg); |
61 | 61 | ||
62 | static struct struct_io_manager struct_test_manager = { | 62 | 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) | |||
172 | goto cleanup; | 172 | goto cleanup; |
173 | } else | 173 | } else |
174 | data->real = 0; | 174 | data->real = 0; |
175 | data->read_blk = test_io_cb_read_blk; | 175 | data->read_blk = test_io_cb_read_blk; |
176 | data->write_blk = test_io_cb_write_blk; | 176 | data->write_blk = test_io_cb_write_blk; |
177 | data->set_blksize = test_io_cb_set_blksize; | 177 | data->set_blksize = test_io_cb_set_blksize; |
178 | data->write_byte = test_io_cb_write_byte; | 178 | data->write_byte = test_io_cb_write_byte; |
179 | 179 | ||
180 | data->outfile = NULL; | 180 | data->outfile = NULL; |
181 | if ((value = getenv("TEST_IO_LOGFILE")) != NULL) | 181 | if ((value = getenv("TEST_IO_LOGFILE")) != NULL) |
@@ -186,7 +186,7 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) | |||
186 | data->flags = 0; | 186 | data->flags = 0; |
187 | if ((value = getenv("TEST_IO_FLAGS")) != NULL) | 187 | if ((value = getenv("TEST_IO_FLAGS")) != NULL) |
188 | data->flags = strtoul(value, NULL, 0); | 188 | data->flags = strtoul(value, NULL, 0); |
189 | 189 | ||
190 | data->block = 0; | 190 | data->block = 0; |
191 | if ((value = getenv("TEST_IO_BLOCK")) != NULL) | 191 | if ((value = getenv("TEST_IO_BLOCK")) != NULL) |
192 | data->block = strtoul(value, NULL, 0); | 192 | data->block = strtoul(value, NULL, 0); |
@@ -198,7 +198,7 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) | |||
198 | data->write_abort_count = 0; | 198 | data->write_abort_count = 0; |
199 | if ((value = getenv("TEST_IO_WRITE_ABORT")) != NULL) | 199 | if ((value = getenv("TEST_IO_WRITE_ABORT")) != NULL) |
200 | data->write_abort_count = strtoul(value, NULL, 0); | 200 | data->write_abort_count = strtoul(value, NULL, 0); |
201 | 201 | ||
202 | *channel = io; | 202 | *channel = io; |
203 | return 0; | 203 | return 0; |
204 | 204 | ||
@@ -221,13 +221,13 @@ static errcode_t test_close(io_channel channel) | |||
221 | 221 | ||
222 | if (--channel->refcount > 0) | 222 | if (--channel->refcount > 0) |
223 | return 0; | 223 | return 0; |
224 | 224 | ||
225 | if (data->real) | 225 | if (data->real) |
226 | retval = io_channel_close(data->real); | 226 | retval = io_channel_close(data->real); |
227 | 227 | ||
228 | if (data->outfile && data->outfile != stderr) | 228 | if (data->outfile && data->outfile != stderr) |
229 | fclose(data->outfile); | 229 | fclose(data->outfile); |
230 | 230 | ||
231 | ext2fs_free_mem(&channel->private_data); | 231 | ext2fs_free_mem(&channel->private_data); |
232 | if (channel->name) | 232 | if (channel->name) |
233 | ext2fs_free_mem(&channel->name); | 233 | ext2fs_free_mem(&channel->name); |
@@ -280,7 +280,7 @@ static errcode_t test_read_blk(io_channel channel, unsigned long block, | |||
280 | test_dump_block(channel, data, block, buf); | 280 | test_dump_block(channel, data, block, buf); |
281 | if (--data->read_abort_count == 0) | 281 | if (--data->read_abort_count == 0) |
282 | test_abort(channel, block); | 282 | test_abort(channel, block); |
283 | } | 283 | } |
284 | return retval; | 284 | return retval; |
285 | } | 285 | } |
286 | 286 | ||
@@ -339,22 +339,22 @@ static errcode_t test_flush(io_channel channel) | |||
339 | { | 339 | { |
340 | struct test_private_data *data; | 340 | struct test_private_data *data; |
341 | errcode_t retval = 0; | 341 | errcode_t retval = 0; |
342 | 342 | ||
343 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); | 343 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); |
344 | data = (struct test_private_data *) channel->private_data; | 344 | data = (struct test_private_data *) channel->private_data; |
345 | EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL); | 345 | EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL); |
346 | 346 | ||
347 | if (data->real) | 347 | if (data->real) |
348 | retval = io_channel_flush(data->real); | 348 | retval = io_channel_flush(data->real); |
349 | 349 | ||
350 | if (data->flags & TEST_FLAG_FLUSH) | 350 | if (data->flags & TEST_FLAG_FLUSH) |
351 | fprintf(data->outfile, "Test_io: flush() returned %s\n", | 351 | fprintf(data->outfile, "Test_io: flush() returned %s\n", |
352 | retval ? error_message(retval) : "OK"); | 352 | retval ? error_message(retval) : "OK"); |
353 | 353 | ||
354 | return retval; | 354 | return retval; |
355 | } | 355 | } |
356 | 356 | ||
357 | static errcode_t test_set_option(io_channel channel, const char *option, | 357 | static errcode_t test_set_option(io_channel channel, const char *option, |
358 | const char *arg) | 358 | const char *arg) |
359 | { | 359 | { |
360 | struct test_private_data *data; | 360 | struct test_private_data *data; |
@@ -366,10 +366,10 @@ static errcode_t test_set_option(io_channel channel, const char *option, | |||
366 | 366 | ||
367 | 367 | ||
368 | if (data->flags & TEST_FLAG_SET_OPTION) | 368 | if (data->flags & TEST_FLAG_SET_OPTION) |
369 | fprintf(data->outfile, "Test_io: set_option(%s, %s) ", | 369 | fprintf(data->outfile, "Test_io: set_option(%s, %s) ", |
370 | option, arg); | 370 | option, arg); |
371 | if (data->real && data->real->manager->set_option) { | 371 | if (data->real && data->real->manager->set_option) { |
372 | retval = (data->real->manager->set_option)(data->real, | 372 | retval = (data->real->manager->set_option)(data->real, |
373 | option, arg); | 373 | option, arg); |
374 | if (data->flags & TEST_FLAG_SET_OPTION) | 374 | if (data->flags & TEST_FLAG_SET_OPTION) |
375 | fprintf(data->outfile, "returned %s\n", | 375 | fprintf(data->outfile, "returned %s\n", |
diff --git a/e2fsprogs/ext2fs/unix_io.c b/e2fsprogs/ext2fs/unix_io.c index 5bc7a6abe..36b222577 100644 --- a/e2fsprogs/ext2fs/unix_io.c +++ b/e2fsprogs/ext2fs/unix_io.c | |||
@@ -1,13 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * unix_io.c --- This is the Unix (well, really POSIX) implementation | 2 | * unix_io.c --- This is the Unix (well, really POSIX) implementation |
3 | * of the I/O manager. | 3 | * of the I/O manager. |
4 | * | 4 | * |
5 | * Implements a one-block write-through cache. | 5 | * Implements a one-block write-through cache. |
6 | * | 6 | * |
7 | * Includes support for Windows NT support under Cygwin. | 7 | * Includes support for Windows NT support under Cygwin. |
8 | * | 8 | * |
9 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, | 9 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, |
10 | * 2002 by Theodore Ts'o. | 10 | * 2002 by Theodore Ts'o. |
11 | * | 11 | * |
12 | * %Begin-Header% | 12 | * %Begin-Header% |
13 | * This file may be redistributed under the terms of the GNU Public | 13 | * 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, | |||
79 | static errcode_t unix_flush(io_channel channel); | 79 | static errcode_t unix_flush(io_channel channel); |
80 | static errcode_t unix_write_byte(io_channel channel, unsigned long offset, | 80 | static errcode_t unix_write_byte(io_channel channel, unsigned long offset, |
81 | int size, const void *data); | 81 | int size, const void *data); |
82 | static errcode_t unix_set_option(io_channel channel, const char *option, | 82 | static errcode_t unix_set_option(io_channel channel, const char *option, |
83 | const char *arg); | 83 | const char *arg); |
84 | 84 | ||
85 | static void reuse_cache(io_channel channel, struct unix_private_data *data, | 85 | 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, | |||
140 | goto error_out; | 140 | goto error_out; |
141 | } | 141 | } |
142 | return 0; | 142 | return 0; |
143 | 143 | ||
144 | error_out: | 144 | error_out: |
145 | memset((char *) buf+actual, 0, size-actual); | 145 | memset((char *) buf+actual, 0, size-actual); |
146 | if (channel->read_error) | 146 | if (channel->read_error) |
@@ -168,7 +168,7 @@ static errcode_t raw_read_blk(io_channel channel, | |||
168 | location = ((ext2_loff_t) block * channel->block_size) + data->offset; | 168 | location = ((ext2_loff_t) block * channel->block_size) + data->offset; |
169 | #ifdef DEBUG | 169 | #ifdef DEBUG |
170 | printf("count=%d, size=%d, block=%d, blk_size=%d, location=%lx\n", | 170 | printf("count=%d, size=%d, block=%d, blk_size=%d, location=%lx\n", |
171 | count, size, block, channel->block_size, location); | 171 | count, size, block, channel->block_size, location); |
172 | #endif | 172 | #endif |
173 | if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) { | 173 | if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) { |
174 | retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; | 174 | retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; |
@@ -227,14 +227,14 @@ static errcode_t raw_write_blk(io_channel channel, | |||
227 | retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; | 227 | retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; |
228 | goto error_out; | 228 | goto error_out; |
229 | } | 229 | } |
230 | 230 | ||
231 | actual = write(data->dev, buf, size); | 231 | actual = write(data->dev, buf, size); |
232 | if (actual != size) { | 232 | if (actual != size) { |
233 | retval = EXT2_ET_SHORT_WRITE; | 233 | retval = EXT2_ET_SHORT_WRITE; |
234 | goto error_out; | 234 | goto error_out; |
235 | } | 235 | } |
236 | return 0; | 236 | return 0; |
237 | 237 | ||
238 | error_out: | 238 | error_out: |
239 | if (channel->write_error) | 239 | if (channel->write_error) |
240 | retval = (channel->write_error)(channel, block, count, buf, | 240 | retval = (channel->write_error)(channel, block, count, buf, |
@@ -254,7 +254,7 @@ static errcode_t alloc_cache(io_channel channel, | |||
254 | errcode_t retval; | 254 | errcode_t retval; |
255 | struct unix_cache *cache; | 255 | struct unix_cache *cache; |
256 | int i; | 256 | int i; |
257 | 257 | ||
258 | data->access_time = 0; | 258 | data->access_time = 0; |
259 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { | 259 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { |
260 | cache->block = 0; | 260 | cache->block = 0; |
@@ -273,7 +273,7 @@ static void free_cache(struct unix_private_data *data) | |||
273 | { | 273 | { |
274 | struct unix_cache *cache; | 274 | struct unix_cache *cache; |
275 | int i; | 275 | int i; |
276 | 276 | ||
277 | data->access_time = 0; | 277 | data->access_time = 0; |
278 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { | 278 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { |
279 | cache->block = 0; | 279 | cache->block = 0; |
@@ -298,7 +298,7 @@ static struct unix_cache *find_cached_block(struct unix_private_data *data, | |||
298 | { | 298 | { |
299 | struct unix_cache *cache, *unused_cache, *oldest_cache; | 299 | struct unix_cache *cache, *unused_cache, *oldest_cache; |
300 | int i; | 300 | int i; |
301 | 301 | ||
302 | unused_cache = oldest_cache = 0; | 302 | unused_cache = oldest_cache = 0; |
303 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { | 303 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { |
304 | if (!cache->in_use) { | 304 | if (!cache->in_use) { |
@@ -345,18 +345,18 @@ static errcode_t flush_cached_blocks(io_channel channel, | |||
345 | struct unix_cache *cache; | 345 | struct unix_cache *cache; |
346 | errcode_t retval, retval2; | 346 | errcode_t retval, retval2; |
347 | int i; | 347 | int i; |
348 | 348 | ||
349 | retval2 = 0; | 349 | retval2 = 0; |
350 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { | 350 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { |
351 | if (!cache->in_use) | 351 | if (!cache->in_use) |
352 | continue; | 352 | continue; |
353 | 353 | ||
354 | if (invalidate) | 354 | if (invalidate) |
355 | cache->in_use = 0; | 355 | cache->in_use = 0; |
356 | 356 | ||
357 | if (!cache->dirty) | 357 | if (!cache->dirty) |
358 | continue; | 358 | continue; |
359 | 359 | ||
360 | retval = raw_write_blk(channel, data, | 360 | retval = raw_write_blk(channel, data, |
361 | cache->block, 1, cache->buf); | 361 | cache->block, 1, cache->buf); |
362 | if (retval) | 362 | if (retval) |
@@ -376,7 +376,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) | |||
376 | int open_flags; | 376 | int open_flags; |
377 | struct stat st; | 377 | struct stat st; |
378 | #ifdef __linux__ | 378 | #ifdef __linux__ |
379 | struct utsname ut; | 379 | struct utsname ut; |
380 | #endif | 380 | #endif |
381 | 381 | ||
382 | if (name == 0) | 382 | if (name == 0) |
@@ -431,7 +431,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) | |||
431 | * block devices are wrongly getting hit by the filesize | 431 | * block devices are wrongly getting hit by the filesize |
432 | * limit. This workaround isn't perfect, since it won't work | 432 | * limit. This workaround isn't perfect, since it won't work |
433 | * if glibc wasn't built against 2.2 header files. (Sigh.) | 433 | * if glibc wasn't built against 2.2 header files. (Sigh.) |
434 | * | 434 | * |
435 | */ | 435 | */ |
436 | if ((flags & IO_FLAG_RW) && | 436 | if ((flags & IO_FLAG_RW) && |
437 | (uname(&ut) == 0) && | 437 | (uname(&ut) == 0) && |
@@ -442,7 +442,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) | |||
442 | (fstat(data->dev, &st) == 0) && | 442 | (fstat(data->dev, &st) == 0) && |
443 | (S_ISBLK(st.st_mode))) { | 443 | (S_ISBLK(st.st_mode))) { |
444 | struct rlimit rlim; | 444 | struct rlimit rlim; |
445 | 445 | ||
446 | rlim.rlim_cur = rlim.rlim_max = (unsigned long) RLIM_INFINITY; | 446 | rlim.rlim_cur = rlim.rlim_max = (unsigned long) RLIM_INFINITY; |
447 | setrlimit(RLIMIT_FSIZE, &rlim); | 447 | setrlimit(RLIMIT_FSIZE, &rlim); |
448 | getrlimit(RLIMIT_FSIZE, &rlim); | 448 | getrlimit(RLIMIT_FSIZE, &rlim); |
@@ -507,7 +507,7 @@ static errcode_t unix_set_blksize(io_channel channel, int blksize) | |||
507 | if ((retval = flush_cached_blocks(channel, data, 0))) | 507 | if ((retval = flush_cached_blocks(channel, data, 0))) |
508 | return retval; | 508 | return retval; |
509 | #endif | 509 | #endif |
510 | 510 | ||
511 | channel->block_size = blksize; | 511 | channel->block_size = blksize; |
512 | free_cache(data); | 512 | free_cache(data); |
513 | if ((retval = alloc_cache(channel, data))) | 513 | if ((retval = alloc_cache(channel, data))) |
@@ -568,7 +568,7 @@ static errcode_t unix_read_blk(io_channel channel, unsigned long block, | |||
568 | #endif | 568 | #endif |
569 | if ((retval = raw_read_blk(channel, data, block, i, cp))) | 569 | if ((retval = raw_read_blk(channel, data, block, i, cp))) |
570 | return retval; | 570 | return retval; |
571 | 571 | ||
572 | /* Save the results in the cache */ | 572 | /* Save the results in the cache */ |
573 | for (j=0; j < i; j++) { | 573 | for (j=0; j < i; j++) { |
574 | count--; | 574 | count--; |
@@ -597,7 +597,7 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block, | |||
597 | 597 | ||
598 | #ifdef NO_IO_CACHE | 598 | #ifdef NO_IO_CACHE |
599 | return raw_write_blk(channel, data, block, count, buf); | 599 | return raw_write_blk(channel, data, block, count, buf); |
600 | #else | 600 | #else |
601 | /* | 601 | /* |
602 | * If we're doing an odd-sized write or a very large write, | 602 | * If we're doing an odd-sized write or a very large write, |
603 | * flush out the cache completely and then do a direct write. | 603 | * 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, | |||
616 | writethrough = channel->flags & CHANNEL_FLAGS_WRITETHROUGH; | 616 | writethrough = channel->flags & CHANNEL_FLAGS_WRITETHROUGH; |
617 | if (writethrough) | 617 | if (writethrough) |
618 | retval = raw_write_blk(channel, data, block, count, buf); | 618 | retval = raw_write_blk(channel, data, block, count, buf); |
619 | 619 | ||
620 | cp = buf; | 620 | cp = buf; |
621 | while (count > 0) { | 621 | while (count > 0) { |
622 | cache = find_cached_block(data, block, &reuse); | 622 | cache = find_cached_block(data, block, &reuse); |
@@ -655,7 +655,7 @@ static errcode_t unix_write_byte(io_channel channel, unsigned long offset, | |||
655 | 655 | ||
656 | if (lseek(data->dev, offset + data->offset, SEEK_SET) < 0) | 656 | if (lseek(data->dev, offset + data->offset, SEEK_SET) < 0) |
657 | return errno; | 657 | return errno; |
658 | 658 | ||
659 | actual = write(data->dev, buf, size); | 659 | actual = write(data->dev, buf, size); |
660 | if (actual != size) | 660 | if (actual != size) |
661 | return EXT2_ET_SHORT_WRITE; | 661 | return EXT2_ET_SHORT_WRITE; |
@@ -664,13 +664,13 @@ static errcode_t unix_write_byte(io_channel channel, unsigned long offset, | |||
664 | } | 664 | } |
665 | 665 | ||
666 | /* | 666 | /* |
667 | * Flush data buffers to disk. | 667 | * Flush data buffers to disk. |
668 | */ | 668 | */ |
669 | static errcode_t unix_flush(io_channel channel) | 669 | static errcode_t unix_flush(io_channel channel) |
670 | { | 670 | { |
671 | struct unix_private_data *data; | 671 | struct unix_private_data *data; |
672 | errcode_t retval = 0; | 672 | errcode_t retval = 0; |
673 | 673 | ||
674 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); | 674 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); |
675 | data = (struct unix_private_data *) channel->private_data; | 675 | data = (struct unix_private_data *) channel->private_data; |
676 | EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL); | 676 | EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL); |
@@ -682,7 +682,7 @@ static errcode_t unix_flush(io_channel channel) | |||
682 | return retval; | 682 | return retval; |
683 | } | 683 | } |
684 | 684 | ||
685 | static errcode_t unix_set_option(io_channel channel, const char *option, | 685 | static errcode_t unix_set_option(io_channel channel, const char *option, |
686 | const char *arg) | 686 | const char *arg) |
687 | { | 687 | { |
688 | struct unix_private_data *data; | 688 | struct unix_private_data *data; |
diff --git a/e2fsprogs/ext2fs/unlink.c b/e2fsprogs/ext2fs/unlink.c index e7b2182d2..a6ab53ae8 100644 --- a/e2fsprogs/ext2fs/unlink.c +++ b/e2fsprogs/ext2fs/unlink.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * unlink.c --- delete links in a ext2fs directory | 2 | * unlink.c --- delete links in a ext2fs directory |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -25,7 +25,7 @@ struct link_struct { | |||
25 | int flags; | 25 | int flags; |
26 | struct ext2_dir_entry *prev; | 26 | struct ext2_dir_entry *prev; |
27 | int done; | 27 | int done; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | #ifdef __TURBOC__ | 30 | #ifdef __TURBOC__ |
31 | #pragma argsused | 31 | #pragma argsused |
@@ -56,7 +56,7 @@ static int unlink_proc(struct ext2_dir_entry *dirent, | |||
56 | return 0; | 56 | return 0; |
57 | } | 57 | } |
58 | 58 | ||
59 | if (prev) | 59 | if (prev) |
60 | prev->rec_len += dirent->rec_len; | 60 | prev->rec_len += dirent->rec_len; |
61 | else | 61 | else |
62 | dirent->inode = 0; | 62 | dirent->inode = 0; |
@@ -89,7 +89,7 @@ errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, | |||
89 | ls.done = 0; | 89 | ls.done = 0; |
90 | ls.prev = 0; | 90 | ls.prev = 0; |
91 | 91 | ||
92 | retval = ext2fs_dir_iterate(fs, dir, DIRENT_FLAG_INCLUDE_EMPTY, | 92 | retval = ext2fs_dir_iterate(fs, dir, DIRENT_FLAG_INCLUDE_EMPTY, |
93 | 0, unlink_proc, &ls); | 93 | 0, unlink_proc, &ls); |
94 | if (retval) | 94 | if (retval) |
95 | return retval; | 95 | return retval; |
diff --git a/e2fsprogs/ext2fs/valid_blk.c b/e2fsprogs/ext2fs/valid_blk.c index 29ff27a7c..d0367e71c 100644 --- a/e2fsprogs/ext2fs/valid_blk.c +++ b/e2fsprogs/ext2fs/valid_blk.c | |||
@@ -2,12 +2,12 @@ | |||
2 | * valid_blk.c --- does the inode have valid blocks? | 2 | * valid_blk.c --- does the inode have valid blocks? |
3 | * | 3 | * |
4 | * Copyright 1997 by Theodore Ts'o | 4 | * Copyright 1997 by Theodore Ts'o |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
9 | * %End-Header% | 9 | * %End-Header% |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <stdio.h> | 13 | #include <stdio.h> |
@@ -33,7 +33,7 @@ int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode) | |||
33 | if (!LINUX_S_ISDIR(inode->i_mode) && !LINUX_S_ISREG(inode->i_mode) && | 33 | if (!LINUX_S_ISDIR(inode->i_mode) && !LINUX_S_ISREG(inode->i_mode) && |
34 | !LINUX_S_ISLNK(inode->i_mode)) | 34 | !LINUX_S_ISLNK(inode->i_mode)) |
35 | return 0; | 35 | return 0; |
36 | 36 | ||
37 | /* | 37 | /* |
38 | * If the symbolic link is a "fast symlink", then the symlink | 38 | * If the symbolic link is a "fast symlink", then the symlink |
39 | * target is stored in the block entries. | 39 | * target is stored in the block entries. |
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index 848d559bc..af76c4d21 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c | |||
@@ -104,10 +104,10 @@ struct fsck_instance { | |||
104 | * assure that we only fsck one partition on a particular drive at any | 104 | * assure that we only fsck one partition on a particular drive at any |
105 | * one time. Otherwise, the disk heads will be seeking all over the | 105 | * one time. Otherwise, the disk heads will be seeking all over the |
106 | * place. If the base device can not be determined, return NULL. | 106 | * place. If the base device can not be determined, return NULL. |
107 | * | 107 | * |
108 | * The base_device() function returns an allocated string which must | 108 | * The base_device() function returns an allocated string which must |
109 | * be freed. | 109 | * be freed. |
110 | * | 110 | * |
111 | */ | 111 | */ |
112 | 112 | ||
113 | 113 | ||
diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c index e25f36d82..b5ec8ab98 100644 --- a/e2fsprogs/lsattr.c +++ b/e2fsprogs/lsattr.c | |||
@@ -97,8 +97,8 @@ static void lsattr_args(const char *name) | |||
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | static int lsattr_dir_proc(const char *dir_name, struct dirent *de, | 100 | static int lsattr_dir_proc(const char *dir_name, struct dirent *de, |
101 | void *private EXT2FS_ATTR((unused))) | 101 | void *private EXT2FS_ATTR((unused))) |
102 | { | 102 | { |
103 | STRUCT_STAT st; | 103 | STRUCT_STAT st; |
104 | char *path; | 104 | char *path; |
diff --git a/e2fsprogs/mke2fs.c b/e2fsprogs/mke2fs.c index 9c4f1c4d0..10563e2d9 100644 --- a/e2fsprogs/mke2fs.c +++ b/e2fsprogs/mke2fs.c | |||
@@ -107,9 +107,9 @@ static const struct mke2fs_defaults settings[] = { | |||
107 | { default_str, 3, 1024, 8192 }, | 107 | { default_str, 3, 1024, 8192 }, |
108 | { "journal", 0, 4096, 8192 }, | 108 | { "journal", 0, 4096, 8192 }, |
109 | { "news", 0, 4096, 4096 }, | 109 | { "news", 0, 4096, 4096 }, |
110 | { "largefile", 0, 4096, 1024 * 1024 }, | 110 | { "largefile", 0, 4096, 1024 * 1024 }, |
111 | { "largefile4", 0, 4096, 4096 * 1024 }, | 111 | { "largefile4", 0, 4096, 4096 * 1024 }, |
112 | { 0, 0, 0, 0}, | 112 | { 0, 0, 0, 0}, |
113 | }; | 113 | }; |
114 | 114 | ||
115 | static void set_fs_defaults(const char *fs_type, | 115 | static void set_fs_defaults(const char *fs_type, |
@@ -448,7 +448,7 @@ static void write_inode_tables(ext2_filsys fs) | |||
448 | num = fs->inode_blocks_per_group; | 448 | num = fs->inode_blocks_per_group; |
449 | 449 | ||
450 | retval = zero_blocks(fs, blk, num, 0, &blk, &num); | 450 | retval = zero_blocks(fs, blk, num, 0, &blk, &num); |
451 | mke2fs_error_msg_and_die(retval, | 451 | mke2fs_error_msg_and_die(retval, |
452 | "write %d blocks in inode table starting at %d.", | 452 | "write %d blocks in inode table starting at %d.", |
453 | num, blk); | 453 | num, blk); |
454 | if (sync_kludge) { | 454 | if (sync_kludge) { |
@@ -572,7 +572,7 @@ static void zap_sector(ext2_filsys fs, int sect, int nsect) | |||
572 | 572 | ||
573 | static void create_journal_dev(ext2_filsys fs) | 573 | static void create_journal_dev(ext2_filsys fs) |
574 | { | 574 | { |
575 | struct progress_struct progress; | 575 | struct progress_struct progress; |
576 | errcode_t retval; | 576 | errcode_t retval; |
577 | char *buf; | 577 | char *buf; |
578 | char *fmt = "%s journal superblock"; | 578 | char *fmt = "%s journal superblock"; |
@@ -624,7 +624,7 @@ static void show_stats(ext2_filsys fs) | |||
624 | os, | 624 | os, |
625 | fs->blocksize, s->s_log_block_size, | 625 | fs->blocksize, s->s_log_block_size, |
626 | fs->fragsize, s->s_log_frag_size, | 626 | fs->fragsize, s->s_log_frag_size, |
627 | s->s_inodes_count, s->s_blocks_count, | 627 | s->s_inodes_count, s->s_blocks_count, |
628 | s->s_r_blocks_count, 100.0 * s->s_r_blocks_count / s->s_blocks_count, | 628 | s->s_r_blocks_count, 100.0 * s->s_r_blocks_count / s->s_blocks_count, |
629 | s->s_first_data_block); | 629 | s->s_first_data_block); |
630 | free(os); | 630 | free(os); |
@@ -679,7 +679,7 @@ static int set_os(struct ext2_super_block *sb, char *os) | |||
679 | if((sb->s_creator_os = e2p_string2os(os)) >= 0) { | 679 | if((sb->s_creator_os = e2p_string2os(os)) >= 0) { |
680 | return 1; | 680 | return 1; |
681 | } else if (!strcasecmp("GNU", os)) { | 681 | } else if (!strcasecmp("GNU", os)) { |
682 | sb->s_creator_os = EXT2_OS_HURD; | 682 | sb->s_creator_os = EXT2_OS_HURD; |
683 | return 1; | 683 | return 1; |
684 | } | 684 | } |
685 | return 0; | 685 | return 0; |
@@ -842,7 +842,7 @@ static int PRS(int argc, char *argv[]) | |||
842 | #endif | 842 | #endif |
843 | 843 | ||
844 | /* If called as mkfs.ext3, create a journal inode */ | 844 | /* If called as mkfs.ext3, create a journal inode */ |
845 | if (last_char_is(bb_applet_name, '3')) | 845 | if (last_char_is(bb_applet_name, '3')) |
846 | journal_size = -1; | 846 | journal_size = -1; |
847 | 847 | ||
848 | while ((c = getopt (argc, argv, | 848 | while ((c = getopt (argc, argv, |
@@ -886,8 +886,8 @@ BLOCKSIZE_ERROR: | |||
886 | } | 886 | } |
887 | break; | 887 | break; |
888 | case 'i': | 888 | case 'i': |
889 | if (safe_strtoi(optarg, &inode_ratio) | 889 | if (safe_strtoi(optarg, &inode_ratio) |
890 | || inode_ratio < EXT2_MIN_BLOCK_SIZE | 890 | || inode_ratio < EXT2_MIN_BLOCK_SIZE |
891 | || inode_ratio > EXT2_MAX_BLOCK_SIZE * 1024) { | 891 | || inode_ratio > EXT2_MAX_BLOCK_SIZE * 1024) { |
892 | bb_error_msg_and_die("bad inode ratio %s (min %d/max %d)", | 892 | bb_error_msg_and_die("bad inode ratio %s (min %d/max %d)", |
893 | optarg, EXT2_MIN_BLOCK_SIZE, | 893 | optarg, EXT2_MIN_BLOCK_SIZE, |
diff --git a/e2fsprogs/tune2fs.c b/e2fsprogs/tune2fs.c index f23688bc3..f228c56aa 100644 --- a/e2fsprogs/tune2fs.c +++ b/e2fsprogs/tune2fs.c | |||
@@ -163,7 +163,7 @@ no_valid_journal: | |||
163 | 163 | ||
164 | /* Helper function for remove_journal_inode */ | 164 | /* Helper function for remove_journal_inode */ |
165 | static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr, | 165 | static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr, |
166 | int blockcnt EXT2FS_ATTR((unused)), | 166 | int blockcnt EXT2FS_ATTR((unused)), |
167 | void *private EXT2FS_ATTR((unused))) | 167 | void *private EXT2FS_ATTR((unused))) |
168 | { | 168 | { |
169 | blk_t block; | 169 | blk_t block; |
@@ -187,9 +187,9 @@ static void remove_journal_inode(ext2_filsys fs) | |||
187 | ino_t ino = fs->super->s_journal_inum; | 187 | ino_t ino = fs->super->s_journal_inum; |
188 | char *msg = "to read"; | 188 | char *msg = "to read"; |
189 | char *s = "journal inode"; | 189 | char *s = "journal inode"; |
190 | 190 | ||
191 | retval = ext2fs_read_inode(fs, ino, &inode); | 191 | retval = ext2fs_read_inode(fs, ino, &inode); |
192 | if (retval) | 192 | if (retval) |
193 | goto REMOVE_JOURNAL_INODE_ERROR; | 193 | goto REMOVE_JOURNAL_INODE_ERROR; |
194 | if (ino == EXT2_JOURNAL_INO) { | 194 | if (ino == EXT2_JOURNAL_INO) { |
195 | retval = ext2fs_read_bitmaps(fs); | 195 | retval = ext2fs_read_bitmaps(fs); |
@@ -343,13 +343,13 @@ static void add_journal(ext2_filsys fs) | |||
343 | return; | 343 | return; |
344 | } | 344 | } |
345 | 345 | ||
346 | /* | 346 | /* |
347 | * Busybox stuff | 347 | * Busybox stuff |
348 | */ | 348 | */ |
349 | static char * x_blkid_get_devname(const char *token) | 349 | static char * x_blkid_get_devname(const char *token) |
350 | { | 350 | { |
351 | char * dev_name; | 351 | char * dev_name; |
352 | 352 | ||
353 | if (!(dev_name = blkid_get_devname(NULL, token, NULL))) | 353 | if (!(dev_name = blkid_get_devname(NULL, token, NULL))) |
354 | bb_error_msg_and_die("Unable to resolve '%s'", token); | 354 | bb_error_msg_and_die("Unable to resolve '%s'", token); |
355 | return dev_name; | 355 | return dev_name; |
@@ -368,11 +368,11 @@ static void parse_e2label_options(int argc, char ** argv) | |||
368 | open_flag = EXT2_FLAG_RW | EXT2_FLAG_JOURNAL_DEV_OK; | 368 | open_flag = EXT2_FLAG_RW | EXT2_FLAG_JOURNAL_DEV_OK; |
369 | L_flag = 1; | 369 | L_flag = 1; |
370 | new_label = argv[2]; | 370 | new_label = argv[2]; |
371 | } else | 371 | } else |
372 | print_label++; | 372 | print_label++; |
373 | } | 373 | } |
374 | #else | 374 | #else |
375 | #define parse_e2label_options(x,y) | 375 | #define parse_e2label_options(x,y) |
376 | #endif | 376 | #endif |
377 | 377 | ||
378 | static time_t parse_time(char *str) | 378 | static time_t parse_time(char *str) |
@@ -516,7 +516,7 @@ MOUNTS_COUNT_ERROR: | |||
516 | mntopts_cmd = optarg; | 516 | mntopts_cmd = optarg; |
517 | open_flag = EXT2_FLAG_RW; | 517 | open_flag = EXT2_FLAG_RW; |
518 | break; | 518 | break; |
519 | 519 | ||
520 | case 'O': | 520 | case 'O': |
521 | if (features_cmd) { | 521 | if (features_cmd) { |
522 | bb_error_msg_and_die("-O may only be specified once"); | 522 | bb_error_msg_and_die("-O may only be specified once"); |
@@ -594,7 +594,7 @@ int tune2fs_main(int argc, char **argv) | |||
594 | 594 | ||
595 | if (ENABLE_FEATURE_CLEAN_UP) | 595 | if (ENABLE_FEATURE_CLEAN_UP) |
596 | atexit(clean_up); | 596 | atexit(clean_up); |
597 | 597 | ||
598 | if (ENABLE_FINDFS && (bb_applet_name[0] == 'f')) /* findfs */ | 598 | if (ENABLE_FINDFS && (bb_applet_name[0] == 'f')) /* findfs */ |
599 | do_findfs(argc, argv); /* no return */ | 599 | do_findfs(argc, argv); /* no return */ |
600 | else if (ENABLE_E2LABEL && (bb_applet_name[0] == 'e')) /* e2label */ | 600 | else if (ENABLE_E2LABEL && (bb_applet_name[0] == 'e')) /* e2label */ |
@@ -603,7 +603,7 @@ int tune2fs_main(int argc, char **argv) | |||
603 | parse_tune2fs_options(argc, argv); /* tune2fs */ | 603 | parse_tune2fs_options(argc, argv); /* tune2fs */ |
604 | 604 | ||
605 | io_ptr = unix_io_manager; | 605 | io_ptr = unix_io_manager; |
606 | retval = ext2fs_open2(device_name, io_options, open_flag, | 606 | retval = ext2fs_open2(device_name, io_options, open_flag, |
607 | 0, 0, io_ptr, &fs); | 607 | 0, 0, io_ptr, &fs); |
608 | if (retval) | 608 | if (retval) |
609 | bb_error_msg_and_die("No valid superblock on %s", device_name); | 609 | bb_error_msg_and_die("No valid superblock on %s", device_name); |
diff --git a/e2fsprogs/util.c b/e2fsprogs/util.c index 7e9c09234..3902f7ef3 100644 --- a/e2fsprogs/util.c +++ b/e2fsprogs/util.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * util.c --- helper functions used by tune2fs and mke2fs | 2 | * util.c --- helper functions used by tune2fs and mke2fs |
3 | * | 3 | * |
4 | * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o. | 4 | * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -99,8 +99,8 @@ void check_mount(const char *device, int force, const char *type) | |||
99 | bb_error_msg_and_die("will not make a %s here!", type); | 99 | bb_error_msg_and_die("will not make a %s here!", type); |
100 | } | 100 | } |
101 | 101 | ||
102 | void parse_journal_opts(char **journal_device, int *journal_flags, | 102 | void parse_journal_opts(char **journal_device, int *journal_flags, |
103 | int *journal_size, const char *opts) | 103 | int *journal_size, const char *opts) |
104 | { | 104 | { |
105 | char *buf, *token, *next, *p, *arg; | 105 | char *buf, *token, *next, *p, *arg; |
106 | int journal_usage = 0; | 106 | int journal_usage = 0; |
@@ -118,7 +118,7 @@ void parse_journal_opts(char **journal_device, int *journal_flags, | |||
118 | if (p) { | 118 | if (p) { |
119 | *p = 0; | 119 | *p = 0; |
120 | next = p+1; | 120 | next = p+1; |
121 | } | 121 | } |
122 | arg = strchr(token, '='); | 122 | arg = strchr(token, '='); |
123 | if (arg) { | 123 | if (arg) { |
124 | *arg = 0; | 124 | *arg = 0; |
@@ -155,13 +155,13 @@ void parse_journal_opts(char **journal_device, int *journal_flags, | |||
155 | "\tdevice=<journal device>\n\n" | 155 | "\tdevice=<journal device>\n\n" |
156 | "The journal size must be between " | 156 | "The journal size must be between " |
157 | "1024 and 102400 filesystem blocks.\n\n"); | 157 | "1024 and 102400 filesystem blocks.\n\n"); |
158 | } | 158 | } |
159 | 159 | ||
160 | /* | 160 | /* |
161 | * Determine the number of journal blocks to use, either via | 161 | * Determine the number of journal blocks to use, either via |
162 | * user-specified # of megabytes, or via some intelligently selected | 162 | * user-specified # of megabytes, or via some intelligently selected |
163 | * defaults. | 163 | * defaults. |
164 | * | 164 | * |
165 | * Find a reasonable journal file size (in blocks) given the number of blocks | 165 | * Find a reasonable journal file size (in blocks) given the number of blocks |
166 | * in the filesystem. For very small filesystems, it is not reasonable to | 166 | * in the filesystem. For very small filesystems, it is not reasonable to |
167 | * have a journal that fills more than half of the filesystem. | 167 | * 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 | |||
214 | io_manager io_ptr; | 214 | io_manager io_ptr; |
215 | 215 | ||
216 | check_plausibility(journal_device, force); | 216 | check_plausibility(journal_device, force); |
217 | check_mount(journal_device, force, "journal"); | 217 | check_mount(journal_device, force, "journal"); |
218 | io_ptr = unix_io_manager; | 218 | io_ptr = unix_io_manager; |
219 | retval = ext2fs_open(journal_device, EXT2_FLAG_RW| | 219 | retval = ext2fs_open(journal_device, EXT2_FLAG_RW| |
220 | EXT2_FLAG_JOURNAL_DEV_OK, 0, | 220 | EXT2_FLAG_JOURNAL_DEV_OK, 0, |
221 | fs->blocksize, io_ptr, &jfs); | 221 | fs->blocksize, io_ptr, &jfs); |
@@ -236,7 +236,7 @@ void make_journal_blocks(ext2_filsys fs, int journal_size, int journal_flags, in | |||
236 | { | 236 | { |
237 | unsigned long journal_blocks; | 237 | unsigned long journal_blocks; |
238 | errcode_t retval; | 238 | errcode_t retval; |
239 | 239 | ||
240 | journal_blocks = figure_journal_size(journal_size, fs); | 240 | journal_blocks = figure_journal_size(journal_size, fs); |
241 | if (!journal_blocks) { | 241 | if (!journal_blocks) { |
242 | fs->super->s_feature_compat &= | 242 | fs->super->s_feature_compat &= |
@@ -259,9 +259,9 @@ char *e2fs_set_sbin_path(void) | |||
259 | char *oldpath = getenv("PATH"); | 259 | char *oldpath = getenv("PATH"); |
260 | /* Update our PATH to include /sbin */ | 260 | /* Update our PATH to include /sbin */ |
261 | #define PATH_SET "/sbin" | 261 | #define PATH_SET "/sbin" |
262 | if (oldpath) | 262 | if (oldpath) |
263 | oldpath = bb_xasprintf("%s:%s", PATH_SET, oldpath); | 263 | oldpath = bb_xasprintf("%s:%s", PATH_SET, oldpath); |
264 | else | 264 | else |
265 | oldpath = PATH_SET; | 265 | oldpath = PATH_SET; |
266 | putenv (oldpath); | 266 | putenv (oldpath); |
267 | return oldpath; | 267 | return oldpath; |
diff --git a/e2fsprogs/util.h b/e2fsprogs/util.h index 24d5e6545..5041046c7 100644 --- a/e2fsprogs/util.h +++ b/e2fsprogs/util.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * util.h --- header file defining prototypes for helper functions | 2 | * util.h --- header file defining prototypes for helper functions |
3 | * used by tune2fs and mke2fs | 3 | * used by tune2fs and mke2fs |
4 | * | 4 | * |
5 | * Copyright 2000 by Theodore Ts'o. | 5 | * Copyright 2000 by Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
diff --git a/e2fsprogs/uuid/compare.c b/e2fsprogs/uuid/compare.c index 83afeafbf..94c32b1d3 100644 --- a/e2fsprogs/uuid/compare.c +++ b/e2fsprogs/uuid/compare.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * compare.c --- compare whether or not two UUID's are the same | 2 | * compare.c --- compare whether or not two UUID's are the same |
3 | * | 3 | * |
4 | * Returns 0 if the two UUID's are different, and 1 if they are the same. | 4 | * Returns 0 if the two UUID's are different, and 1 if they are the same. |
5 | * | 5 | * |
6 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 6 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
7 | * | 7 | * |
8 | * %Begin-Header% | 8 | * %Begin-Header% |
@@ -18,7 +18,7 @@ | |||
18 | * 3. The name of the author may not be used to endorse or promote | 18 | * 3. The name of the author may not be used to endorse or promote |
19 | * products derived from this software without specific prior | 19 | * products derived from this software without specific prior |
20 | * written permission. | 20 | * written permission. |
21 | * | 21 | * |
22 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 22 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 24 | * 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 52328cfc4..fca3ebe91 100644 --- a/e2fsprogs/uuid/gen_uuid.c +++ b/e2fsprogs/uuid/gen_uuid.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
@@ -63,8 +63,8 @@ | |||
63 | #include "uuidP.h" | 63 | #include "uuidP.h" |
64 | 64 | ||
65 | #ifdef HAVE_SRANDOM | 65 | #ifdef HAVE_SRANDOM |
66 | #define srand(x) srandom(x) | 66 | #define srand(x) srandom(x) |
67 | #define rand() random() | 67 | #define rand() random() |
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | static int get_random_fd(void) | 70 | static int get_random_fd(void) |
@@ -111,7 +111,7 @@ static void get_random_bytes(void *buf, int nbytes) | |||
111 | lose_counter = 0; | 111 | lose_counter = 0; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * We do this all the time, but this is the only source of | 116 | * We do this all the time, but this is the only source of |
117 | * randomness if /dev/random/urandom is out to lunch. | 117 | * randomness if /dev/random/urandom is out to lunch. |
@@ -127,12 +127,12 @@ static void get_random_bytes(void *buf, int nbytes) | |||
127 | static int get_node_id(unsigned char *node_id) | 127 | static int get_node_id(unsigned char *node_id) |
128 | { | 128 | { |
129 | #ifdef HAVE_NET_IF_H | 129 | #ifdef HAVE_NET_IF_H |
130 | int sd; | 130 | int sd; |
131 | struct ifreq ifr, *ifrp; | 131 | struct ifreq ifr, *ifrp; |
132 | struct ifconf ifc; | 132 | struct ifconf ifc; |
133 | char buf[1024]; | 133 | char buf[1024]; |
134 | int n, i; | 134 | int n, i; |
135 | unsigned char *a; | 135 | unsigned char *a; |
136 | #ifdef HAVE_NET_IF_DL_H | 136 | #ifdef HAVE_NET_IF_DL_H |
137 | struct sockaddr_dl *sdlp; | 137 | struct sockaddr_dl *sdlp; |
138 | #endif | 138 | #endif |
@@ -140,7 +140,7 @@ static int get_node_id(unsigned char *node_id) | |||
140 | /* | 140 | /* |
141 | * BSD 4.4 defines the size of an ifreq to be | 141 | * BSD 4.4 defines the size of an ifreq to be |
142 | * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len | 142 | * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len |
143 | * However, under earlier systems, sa_len isn't present, so the size is | 143 | * However, under earlier systems, sa_len isn't present, so the size is |
144 | * just sizeof(struct ifreq) | 144 | * just sizeof(struct ifreq) |
145 | */ | 145 | */ |
146 | #ifdef HAVE_SA_LEN | 146 | #ifdef HAVE_SA_LEN |
@@ -214,9 +214,9 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low, uint16_t *ret_cl | |||
214 | static int adjustment = 0; | 214 | static int adjustment = 0; |
215 | static struct timeval last = {0, 0}; | 215 | static struct timeval last = {0, 0}; |
216 | static uint16_t clock_seq; | 216 | static uint16_t clock_seq; |
217 | struct timeval tv; | 217 | struct timeval tv; |
218 | unsigned long long clock_reg; | 218 | unsigned long long clock_reg; |
219 | 219 | ||
220 | try_again: | 220 | try_again: |
221 | gettimeofday(&tv, 0); | 221 | gettimeofday(&tv, 0); |
222 | if ((last.tv_sec == 0) && (last.tv_usec == 0)) { | 222 | if ((last.tv_sec == 0) && (last.tv_usec == 0)) { |
@@ -240,7 +240,7 @@ try_again: | |||
240 | adjustment = 0; | 240 | adjustment = 0; |
241 | last = tv; | 241 | last = tv; |
242 | } | 242 | } |
243 | 243 | ||
244 | clock_reg = tv.tv_usec*10 + adjustment; | 244 | clock_reg = tv.tv_usec*10 + adjustment; |
245 | clock_reg += ((unsigned long long) tv.tv_sec)*10000000; | 245 | clock_reg += ((unsigned long long) tv.tv_sec)*10000000; |
246 | clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000; | 246 | clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000; |
diff --git a/e2fsprogs/uuid/pack.c b/e2fsprogs/uuid/pack.c index 1013886e5..9d733f000 100644 --- a/e2fsprogs/uuid/pack.c +++ b/e2fsprogs/uuid/pack.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Internal routine for packing UUID's | 2 | * Internal routine for packing UUID's |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
diff --git a/e2fsprogs/uuid/parse.c b/e2fsprogs/uuid/parse.c index 07b894d11..21b29498e 100644 --- a/e2fsprogs/uuid/parse.c +++ b/e2fsprogs/uuid/parse.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * parse.c --- UUID parsing | 2 | * parse.c --- UUID parsing |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
@@ -42,7 +42,7 @@ | |||
42 | int uuid_parse(const char *in, uuid_t uu) | 42 | int uuid_parse(const char *in, uuid_t uu) |
43 | { | 43 | { |
44 | struct uuid uuid; | 44 | struct uuid uuid; |
45 | int i; | 45 | int i; |
46 | const char *cp; | 46 | const char *cp; |
47 | char buf[3]; | 47 | char buf[3]; |
48 | 48 | ||
@@ -73,7 +73,7 @@ int uuid_parse(const char *in, uuid_t uu) | |||
73 | buf[1] = *cp++; | 73 | buf[1] = *cp++; |
74 | uuid.node[i] = strtoul(buf, NULL, 16); | 74 | uuid.node[i] = strtoul(buf, NULL, 16); |
75 | } | 75 | } |
76 | 76 | ||
77 | uuid_pack(&uuid, uu); | 77 | uuid_pack(&uuid, uu); |
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
diff --git a/e2fsprogs/uuid/unpack.c b/e2fsprogs/uuid/unpack.c index d63589521..8f9c520c1 100644 --- a/e2fsprogs/uuid/unpack.c +++ b/e2fsprogs/uuid/unpack.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Internal routine for unpacking UUID | 2 | * Internal routine for unpacking UUID |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
diff --git a/e2fsprogs/uuid/unparse.c b/e2fsprogs/uuid/unparse.c index c0e08ef49..a95bbb042 100644 --- a/e2fsprogs/uuid/unparse.c +++ b/e2fsprogs/uuid/unparse.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * unparse.c -- convert a UUID to string | 2 | * unparse.c -- convert a UUID to string |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
@@ -36,10 +36,10 @@ | |||
36 | 36 | ||
37 | #include "uuidP.h" | 37 | #include "uuidP.h" |
38 | 38 | ||
39 | static const char *fmt_lower = | 39 | static const char *fmt_lower = |
40 | "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"; | 40 | "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"; |
41 | 41 | ||
42 | static const char *fmt_upper = | 42 | static const char *fmt_upper = |
43 | "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"; | 43 | "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"; |
44 | 44 | ||
45 | #ifdef UUID_UNPARSE_DEFAULT_UPPER | 45 | #ifdef UUID_UNPARSE_DEFAULT_UPPER |
diff --git a/e2fsprogs/uuid/uuid.h b/e2fsprogs/uuid/uuid.h index a05f1c690..cd97a5e78 100644 --- a/e2fsprogs/uuid/uuid.h +++ b/e2fsprogs/uuid/uuid.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Public include file for the UUID library | 2 | * Public include file for the UUID library |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997, 1998 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997, 1998 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
@@ -42,8 +42,8 @@ | |||
42 | typedef unsigned char uuid_t[16]; | 42 | typedef unsigned char uuid_t[16]; |
43 | 43 | ||
44 | /* UUID Variant definitions */ | 44 | /* UUID Variant definitions */ |
45 | #define UUID_VARIANT_NCS 0 | 45 | #define UUID_VARIANT_NCS 0 |
46 | #define UUID_VARIANT_DCE 1 | 46 | #define UUID_VARIANT_DCE 1 |
47 | #define UUID_VARIANT_MICROSOFT 2 | 47 | #define UUID_VARIANT_MICROSOFT 2 |
48 | #define UUID_VARIANT_OTHER 3 | 48 | #define UUID_VARIANT_OTHER 3 |
49 | 49 | ||
diff --git a/e2fsprogs/uuid/uuidP.h b/e2fsprogs/uuid/uuidP.h index d2e1a450a..9d30ce2f8 100644 --- a/e2fsprogs/uuid/uuidP.h +++ b/e2fsprogs/uuid/uuidP.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * uuid.h -- private header file for uuids | 2 | * uuid.h -- private header file for uuids |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * 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 d5f992b39..9ff3607d8 100644 --- a/e2fsprogs/uuid/uuid_time.c +++ b/e2fsprogs/uuid/uuid_time.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * uuid_time.c --- Interpret the time field from a uuid. This program | 2 | * uuid_time.c --- Interpret the time field from a uuid. This program |
3 | * violates the UUID abstraction barrier by reaching into the guts | 3 | * violates the UUID abstraction barrier by reaching into the guts |
4 | * of a UUID and interpreting it. | 4 | * of a UUID and interpreting it. |
5 | * | 5 | * |
6 | * Copyright (C) 1998, 1999 Theodore Ts'o. | 6 | * Copyright (C) 1998, 1999 Theodore Ts'o. |
7 | * | 7 | * |
8 | * %Begin-Header% | 8 | * %Begin-Header% |
@@ -18,7 +18,7 @@ | |||
18 | * 3. The name of the author may not be used to endorse or promote | 18 | * 3. The name of the author may not be used to endorse or promote |
19 | * products derived from this software without specific prior | 19 | * products derived from this software without specific prior |
20 | * written permission. | 20 | * written permission. |
21 | * | 21 | * |
22 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 22 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 24 | * 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) | |||
51 | unsigned long long clock_reg; | 51 | unsigned long long clock_reg; |
52 | 52 | ||
53 | uuid_unpack(uu, &uuid); | 53 | uuid_unpack(uu, &uuid); |
54 | 54 | ||
55 | high = uuid.time_mid | ((uuid.time_hi_and_version & 0xFFF) << 16); | 55 | high = uuid.time_mid | ((uuid.time_hi_and_version & 0xFFF) << 16); |
56 | clock_reg = uuid.time_low | ((unsigned long long) high << 32); | 56 | clock_reg = uuid.time_low | ((unsigned long long) high << 32); |
57 | 57 | ||
@@ -69,7 +69,7 @@ int uuid_type(const uuid_t uu) | |||
69 | { | 69 | { |
70 | struct uuid uuid; | 70 | struct uuid uuid; |
71 | 71 | ||
72 | uuid_unpack(uu, &uuid); | 72 | uuid_unpack(uu, &uuid); |
73 | return ((uuid.time_hi_and_version >> 12) & 0xF); | 73 | return ((uuid.time_hi_and_version >> 12) & 0xF); |
74 | } | 74 | } |
75 | 75 | ||
@@ -78,7 +78,7 @@ int uuid_variant(const uuid_t uu) | |||
78 | struct uuid uuid; | 78 | struct uuid uuid; |
79 | int var; | 79 | int var; |
80 | 80 | ||
81 | uuid_unpack(uu, &uuid); | 81 | uuid_unpack(uu, &uuid); |
82 | var = uuid.clock_seq; | 82 | var = uuid.clock_seq; |
83 | 83 | ||
84 | if ((var & 0x8000) == 0) | 84 | if ((var & 0x8000) == 0) |
@@ -105,7 +105,7 @@ static const char *variant_string(int variant) | |||
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | int | 109 | int |
110 | main(int argc, char **argv) | 110 | main(int argc, char **argv) |
111 | { | 111 | { |
@@ -155,7 +155,7 @@ main(int argc, char **argv) | |||
155 | } | 155 | } |
156 | printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec, | 156 | printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec, |
157 | ctime(&time_reg)); | 157 | ctime(&time_reg)); |
158 | 158 | ||
159 | return 0; | 159 | return 0; |
160 | } | 160 | } |
161 | #endif | 161 | #endif |