On 23 Jan 2022, at 15:02, Etienne Brateau <etienne.brat...@gmail.com> wrote: > > The reindent part is mainly to replace tabs characters by spaces. Maybe the > reindentation is not following the GNU convention (aka 8 spaces) but is > following the general convention of the files. I can redo it by using 8 > spaces if needed. But mu main goal was not to have half tabs and half spaces.
No it’s not, the convention of the file is the GNU convention. It is a strange convention but it is extremely consistent and does display properly when your tab width is 8. Indentation is 2 columns, every 8 spaces is replaced with a tab. This is used by Hurd, GCC, glibc, binutils, etc. Jess > Le dim. 23 janv. 2022 à 11:02, Samuel Thibault <samuel.thiba...@gnu.org> a > écrit : > Etienne Brateau, le dim. 23 janv. 2022 05:17:04 +0100, a ecrit: > > * balloc.c: reindent > > * bitmap.c: reindent > > * dir.c: reindent > > * ext2fs.c: reindent > > * getblk.c: reindent > > * hyper.c: reindent > > * ialloc.c: reindent > > * inode.c: reindent > > * msg.c: reindent > > * pager.c: reindent > > * pokel.c: reindent > > * truncate.c: reindent > > ? The code is already indented fine. > > Possibly it's your editor which doesn't know that the GNU convention is > that tabs are 8 spaces. In that case please fix your editor > configuration, all the Hurd source asummes the GNU convention. > > > --- > > ext2fs/balloc.c | 264 +++++++++--------- > > ext2fs/bitmap.c | 24 +- > > ext2fs/dir.c | 668 ++++++++++++++++++++++----------------------- > > ext2fs/ext2fs.c | 24 +- > > ext2fs/getblk.c | 92 +++---- > > ext2fs/hyper.c | 58 ++-- > > ext2fs/ialloc.c | 170 ++++++------ > > ext2fs/inode.c | 356 ++++++++++++------------ > > ext2fs/msg.c | 2 +- > > ext2fs/pager.c | 588 +++++++++++++++++++-------------------- > > ext2fs/pokel.c | 76 +++--- > > ext2fs/storeinfo.c | 94 +++---- > > ext2fs/truncate.c | 100 +++---- > > ext2fs/xattr.c | 256 ++++++++--------- > > 14 files changed, 1390 insertions(+), 1382 deletions(-) > > > > diff --git a/ext2fs/balloc.c b/ext2fs/balloc.c > > index 8ebd11cd..105aaa54 100644 > > --- a/ext2fs/balloc.c > > +++ b/ext2fs/balloc.c > > @@ -69,7 +69,7 @@ ext2_free_blocks (block_t block, unsigned long count) > > (block + count) > sblock->s_blocks_count) > > { > > ext2_error ("freeing blocks not in datazone - " > > - "block = %u, count = %lu", block, count); > > + "block = %u, count = %lu", block, count); > > pthread_spin_unlock (&global_lock); > > return; > > } > > @@ -81,37 +81,42 @@ ext2_free_blocks (block_t block, unsigned long count) > > unsigned long int gcount = count; > > > > block_group = ((block - sblock->s_first_data_block) > > - / sblock->s_blocks_per_group); > > + / sblock->s_blocks_per_group); > > bit = (block - sblock->s_first_data_block) % > > sblock->s_blocks_per_group; > > + > > + /* > > + * Check to see if we are freeing blocks accross a group > > + * boundary > > + */ > > if (bit + count > sblock->s_blocks_per_group) > > - { > > - unsigned long overflow = bit + count - sblock->s_blocks_per_group; > > - gcount -= overflow; > > - ext2_debug ("freeing blocks across group boundary - " > > - "block = %u, count = %lu", > > - block, count); > > - } > > + { > > + unsigned long overflow = bit + count - > > sblock->s_blocks_per_group; > > + gcount -= overflow; > > + ext2_debug ("freeing blocks across group boundary - " > > + "block = %u, count = %lu", > > + block, count); > > + } > > gdp = group_desc (block_group); > > bh = disk_cache_block_ref (gdp->bg_block_bitmap); > > > > if (in_range (gdp->bg_block_bitmap, block, gcount) || > > - in_range (gdp->bg_inode_bitmap, block, gcount) || > > - in_range (block, gdp->bg_inode_table, itb_per_group) || > > - in_range (block + gcount - 1, gdp->bg_inode_table, itb_per_group)) > > - ext2_panic ("freeing blocks in system zones - " > > - "block = %u, count = %lu", > > - block, count); > > + in_range (gdp->bg_inode_bitmap, block, gcount) || > > + in_range (block, gdp->bg_inode_table, itb_per_group) || > > + in_range (block + gcount - 1, gdp->bg_inode_table, > > itb_per_group)) > > + ext2_panic ("freeing blocks in system zones - " > > + "block = %u, count = %lu", > > + block, count); > > > > for (i = 0; i < gcount; i++) > > - { > > - if (!clear_bit (bit + i, bh)) > > - ext2_warning ("bit already cleared for block %lu", block + i); > > - else > > - { > > - gdp->bg_free_blocks_count++; > > - sblock->s_free_blocks_count++; > > - } > > - } > > + { > > + if (!clear_bit (bit + i, bh)) > > + ext2_warning ("bit already cleared for block %lu", block + i); > > + else > > + { > > + gdp->bg_free_blocks_count++; > > + sblock->s_free_blocks_count++; > > + } > > + } > > > > record_global_poke (bh); > > disk_cache_block_ref_ptr (gdp); > > @@ -137,8 +142,9 @@ ext2_free_blocks (block_t block, unsigned long count) > > */ > > block_t > > ext2_new_block (block_t goal, > > - block_t prealloc_goal, > > - block_t *prealloc_count, block_t *prealloc_block) > > + block_t prealloc_goal, > > + block_t *prealloc_count, > > + block_t *prealloc_block) > > { > > unsigned char *bh = NULL; > > unsigned char *p, *r; > > @@ -156,7 +162,7 @@ ext2_new_block (block_t goal, > > if (sblock->s_free_blocks_count <= sblock->s_r_blocks_count && > > (!fsuser () && (sb->u.ext2_sb.s_resuid != current->fsuid) && > > (sb->u.ext2_sb.s_resgid == 0 || > > - !in_group_p (sb->u.ext2_sb.s_resgid)))) > > + !in_group_p (sb->u.ext2_sb.s_resgid)))) > > { > > pthread_spin_unlock (&global_lock); > > return 0; > > @@ -168,7 +174,7 @@ ext2_new_block (block_t goal, > > repeat: > > assert_backtrace (bh == NULL); > > /* > > - * First, test whether the goal block is free. > > + * First, test whether the goal block is free. > > */ > > if (goal < sblock->s_first_data_block || goal >= sblock->s_blocks_count) > > goal = sblock->s_first_data_block; > > @@ -179,46 +185,48 @@ repeat: > > j = ((goal - sblock->s_first_data_block) % > > sblock->s_blocks_per_group); > > #ifdef EXT2FS_DEBUG > > if (j) > > - goal_attempts++; > > + goal_attempts++; > > #endif > > bh = disk_cache_block_ref (gdp->bg_block_bitmap); > > > > ext2_debug ("goal is at %d:%d", i, j); > > > > if (!test_bit (j, bh)) > > - { > > + { > > #ifdef EXT2FS_DEBUG > > - goal_hits++; > > - ext2_debug ("goal bit allocated!"); > > + goal_hits++; > > + ext2_debug ("goal bit allocated!"); > > #endif > > - goto got_block; > > - } > > + goto got_block; > > + } > > if (j) > > - { > > - /* > > - * The goal was occupied; search forward for a free > > - * block within the next 32 blocks > > - */ > > - if ((j & 31) == 31) > > - lmap = 0; > > - else > > - lmap = ((((unsigned long *) bh)[j >> 5]) >> > > - ((j & 31) + 1)); > > - if (j < sblock->s_blocks_per_group - 32) > > - lmap |= (((unsigned long *) bh)[(j >> 5) + 1]) << > > - (31 - (j & 31)); > > - else > > - lmap |= 0xffffffff << (31 - (j & 31)); > > - if (lmap != 0xffffffffl) > > - { > > - k = ffz (lmap) + 1; > > - if ((j + k) < sblock->s_blocks_per_group) > > - { > > - j += k; > > - goto got_block; > > - } > > - } > > - } > > + { > > + /* > > + * The goal was occupied; search forward for a free > > + * block within the next 32 blocks > > + */ > > + if ((j & 31) == 31) > > + lmap = 0; > > + else > > + lmap = ((((unsigned long *) bh)[j >> 5]) >> > > + ((j & 31) + 1)); > > + > > + if (j < sblock->s_blocks_per_group - 32) > > + lmap |= (((unsigned long *) bh)[(j >> 5) + 1]) << > > + (31 - (j & 31)); > > + else > > + lmap |= 0xffffffff << (31 - (j & 31)); > > + > > + if (lmap != 0xffffffffl) > > + { > > + k = ffz (lmap) + 1; > > + if ((j + k) < sblock->s_blocks_per_group) > > + { > > + j += k; > > + goto got_block; > > + } > > + } > > + } > > > > ext2_debug ("bit not found near goal"); > > > > @@ -235,18 +243,18 @@ repeat: > > r = memscan (p, 0, (sblock->s_blocks_per_group - j + 7) >> 3); > > k = (r - bh) << 3; > > if (k < sblock->s_blocks_per_group) > > - { > > - j = k; > > - goto search_back; > > - } > > + { > > + j = k; > > + goto search_back; > > + } > > k = find_next_zero_bit ((unsigned long *) bh, > > - sblock->s_blocks_per_group, > > - j); > > + sblock->s_blocks_per_group, > > + j); > > if (k < sblock->s_blocks_per_group) > > - { > > - j = k; > > - goto got_block; > > - } > > + { > > + j = k; > > + goto got_block; > > + } > > > > disk_cache_block_deref (bh); > > bh = NULL; > > @@ -255,17 +263,17 @@ repeat: > > ext2_debug ("bit not found in block group %d", i); > > > > /* > > - * Now search the rest of the groups. We assume that > > - * i and gdp correctly point to the last group visited. > > + * Now search the rest of the groups. We assume that > > + * i and gdp correctly point to the last group visited. > > */ > > for (k = 0; k < groups_count; k++) > > { > > i++; > > if (i >= groups_count) > > - i = 0; > > + i = 0; > > gdp = group_desc (i); > > if (gdp->bg_free_blocks_count > 0) > > - break; > > + break; > > } > > if (k >= groups_count) > > { > > @@ -280,7 +288,7 @@ repeat: > > goto search_back; > > else > > j = find_first_zero_bit ((unsigned long *) bh, > > - sblock->s_blocks_per_group); > > + sblock->s_blocks_per_group); > > if (j >= sblock->s_blocks_per_group) > > { > > disk_cache_block_deref (bh); > > @@ -340,20 +348,20 @@ got_block: > > *prealloc_count = 0; > > *prealloc_block = tmp + 1; > > for (k = 1; > > - k < prealloc_goal && (j + k) < sblock->s_blocks_per_group; k++) > > - { > > - if (set_bit (j + k, bh)) > > - break; > > - (*prealloc_count)++; > > - > > - /* (See comment before the clear_bit above) */ > > - if (modified_global_blocks) > > - { > > - pthread_spin_lock (&modified_global_blocks_lock); > > - clear_bit (tmp + k, modified_global_blocks); > > - pthread_spin_unlock (&modified_global_blocks_lock); > > - } > > - } > > + k < prealloc_goal && (j + k) < sblock->s_blocks_per_group; k++) > > + { > > + if (set_bit (j + k, bh)) > > + break; > > + (*prealloc_count)++; > > + > > + /* (See comment before the clear_bit above) */ > > + if (modified_global_blocks) > > + { > > + pthread_spin_lock (&modified_global_blocks_lock); > > + clear_bit (tmp + k, modified_global_blocks); > > + pthread_spin_unlock (&modified_global_blocks_lock); > > + } > > + } > > gdp->bg_free_blocks_count -= *prealloc_count; > > sblock->s_free_blocks_count -= *prealloc_count; > > ext2_debug ("preallocated a further %u bits", *prealloc_count); > > @@ -373,7 +381,7 @@ got_block: > > } > > > > ext2_debug ("allocating block %d; goal hits %d of %d", > > - j, goal_hits, goal_attempts); > > + j, goal_hits, goal_attempts); > > > > gdp->bg_free_blocks_count--; > > disk_cache_block_ref_ptr (gdp); > > @@ -412,11 +420,11 @@ ext2_count_free_blocks () > > x = count_free (bh, block_size); > > disk_cache_block_deref (bh); > > printf ("group %d: stored = %d, counted = %lu", > > - i, gdp->bg_free_blocks_count, x); > > + i, gdp->bg_free_blocks_count, x); > > bitmap_count += x; > > } > > printf ("ext2_count_free_blocks: stored = %u, computed = %lu, %lu", > > - sblock->s_free_blocks_count, desc_count, bitmap_count); > > + sblock->s_free_blocks_count, desc_count, bitmap_count); > > pthread_spin_unlock (&global_lock); > > return bitmap_count; > > #else > > @@ -428,7 +436,7 @@ static inline int > > block_in_use (block_t block, unsigned char *map) > > { > > return test_bit ((block - sblock->s_first_data_block) % > > - sblock->s_blocks_per_group, map); > > + sblock->s_blocks_per_group, map); > > } > > > > void > > @@ -451,62 +459,62 @@ ext2_check_blocks_bitmap () > > for (i = 0; i < groups_count; i++) > > { > > inline int test_root (int a, int b) > > - { > > - if (a == 0) > > - return 1; > > - while (1) > > - { > > - if (a == 1) > > - return 1; > > - if (a % b) > > - return 0; > > - a = a / b; > > - } > > - } > > + { > > + if (a == 0) > > + return 1; > > + while (1) > > + { > > + if (a == 1) > > + return 1; > > + if (a % b) > > + return 0; > > + a = a / b; > > + } > > + } > > inline int ext2_group_sparse (int group) > > - { > > - return (test_root (group, 3) || test_root (group, 5) > > - || test_root (group, 7)); > > - } > > + { > > + return (test_root (group, 3) || test_root (group, 5) > > + || test_root (group, 7)); > > + } > > > > gdp = group_desc (i); > > desc_count += gdp->bg_free_blocks_count; > > bh = disk_cache_block_ref (gdp->bg_block_bitmap); > > > > if (!EXT2_HAS_RO_COMPAT_FEATURE (sblock, > > - EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) > > - || ext2_group_sparse (i)) > > - { > > - if (!test_bit (0, bh)) > > - ext2_error ("superblock in group %d is marked free", i); > > - > > - for (j = 0; j < desc_blocks; j++) > > - if (!test_bit (j + 1, bh)) > > - ext2_error ("descriptor block #%d in group %d is marked free", > > - j, i); > > - } > > + EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) > > + || ext2_group_sparse (i)) > > + { > > + if (!test_bit (0, bh)) > > + ext2_error ("superblock in group %d is marked free", i); > > + > > + for (j = 0; j < desc_blocks; j++) > > + if (!test_bit (j + 1, bh)) > > + ext2_error ("descriptor block #%d in group %d is marked > > free", > > + j, i); > > + } > > > > if (!block_in_use (gdp->bg_block_bitmap, bh)) > > - ext2_error ("block bitmap for group %d is marked free", i); > > + ext2_error ("block bitmap for group %d is marked free", i); > > > > if (!block_in_use (gdp->bg_inode_bitmap, bh)) > > - ext2_error ("inode bitmap for group %d is marked free", i); > > + ext2_error ("inode bitmap for group %d is marked free", i); > > > > for (j = 0; j < itb_per_group; j++) > > - if (!block_in_use (gdp->bg_inode_table + j, bh)) > > - ext2_error ("block #%d of the inode table in group %d is marked > > free", j, i); > > + if (!block_in_use (gdp->bg_inode_table + j, bh)) > > + ext2_error ("block #%d of the inode table in group %d is marked > > free", j, i); > > > > x = count_free (bh, block_size); > > disk_cache_block_deref (bh); > > if (gdp->bg_free_blocks_count != x) > > - ext2_error ("wrong free blocks count for group %d," > > - " stored = %d, counted = %lu", > > - i, gdp->bg_free_blocks_count, x); > > + ext2_error ("wrong free blocks count for group %d," > > + " stored = %d, counted = %lu", > > + i, gdp->bg_free_blocks_count, x); > > bitmap_count += x; > > } > > if (sblock->s_free_blocks_count != bitmap_count) > > ext2_error ("wrong free blocks count in super block," > > - " stored = %lu, counted = %lu", > > - (unsigned long) sblock->s_free_blocks_count, bitmap_count); > > + " stored = %lu, counted = %lu", > > + (unsigned long) sblock->s_free_blocks_count, bitmap_count); > > pthread_spin_unlock (&global_lock); > > } > > diff --git a/ext2fs/bitmap.c b/ext2fs/bitmap.c > > index c6d882b9..7b35d206 100644 > > --- a/ext2fs/bitmap.c > > +++ b/ext2fs/bitmap.c > > @@ -34,15 +34,15 @@ static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, > > 2, 1, 2, 1, 1, 0}; > > static inline > > unsigned long count_free (unsigned char *map, unsigned int numchars) > > { > > - unsigned int i; > > - unsigned long sum = 0; > > - > > - if (!map) > > - return (0); > > - for (i = 0; i < numchars; i++) > > - sum += nibblemap[map[i] & 0xf] + > > - nibblemap[(map[i] >> 4) & 0xf]; > > - return (sum); > > + unsigned int i; > > + unsigned long sum = 0; > > + > > + if (!map) > > + return (0); > > + for (i = 0; i < numchars; i++) > > + sum += nibblemap[map[i] & 0xf] + > > + nibblemap[(map[i] >> 4) & 0xf]; > > + return (sum); > > } > > > > /* ---------------------------------------------------------------- */ > > @@ -72,16 +72,16 @@ find_next_zero_bit(void *addr, unsigned long size, > > unsigned long offset) > > tmp = *(p++); > > tmp |= ~0UL >> (32-offset); > > if (size < 32) > > - goto found_first; > > + goto found_first; > > if (~tmp) > > - goto found_middle; > > + goto found_middle; > > size -= 32; > > result += 32; > > } > > while (size & ~31UL) > > { > > if (~(tmp = *(p++))) > > - goto found_middle; > > + goto found_middle; > > result += 32; > > size -= 32; > > } > > diff --git a/ext2fs/dir.c b/ext2fs/dir.c > > index bcf90469..7ba08a2e 100644 > > --- a/ext2fs/dir.c > > +++ b/ext2fs/dir.c > > @@ -101,8 +101,8 @@ diskfs_null_dirstat (struct dirstat *ds) > > > > static error_t > > dirscanblock (vm_address_t blockoff, struct node *dp, int idx, > > - const char *name, size_t namelen, enum lookup_type type, > > - struct dirstat *ds, ino_t *inum); > > + const char *name, size_t namelen, enum lookup_type type, > > + struct dirstat *ds, ino_t *inum); > > > > > > #if 0 /* XXX unused for now */ > > @@ -135,7 +135,7 @@ static const unsigned char file_type_ext2[] = > > <hurd/diskfs.h> for the interface specification. */ > > error_t > > diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type > > type, > > - struct node **npp, struct dirstat *ds, struct protid > > *cred) > > + struct node **npp, struct dirstat *ds, struct protid > > *cred) > > { > > error_t err; > > ino_t inum; > > @@ -166,7 +166,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, > > enum lookup_type type, > > if (namelen > EXT2_NAME_LEN) > > { > > if (ds) > > - diskfs_null_dirstat (ds); > > + diskfs_null_dirstat (ds); > > return ENAMETOOLONG; > > } > > > > @@ -195,7 +195,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, > > enum lookup_type type, > > /* We allow extra space in case we have to do an EXTEND. */ > > buflen = round_page (dp->dn_stat.st_size + DIRBLKSIZ); > > err = vm_map (mach_task_self (), > > - &buf, buflen, 0, 1, memobj, 0, 0, prot, prot, 0); > > + &buf, buflen, 0, 1, memobj, 0, 0, prot, prot, 0); > > mach_port_deallocate (mach_task_self (), memobj); > > if (err) > > return err; > > @@ -218,25 +218,25 @@ diskfs_lookup_hard (struct node *dp, const char > > *name, enum lookup_type type, > > { > > err = dirscanblock (blockaddr, dp, idx, name, namelen, type, ds, > > &inum); > > if (!err) > > - { > > - diskfs_node_disknode (dp)->dir_idx = idx; > > - break; > > - } > > + { > > + diskfs_node_disknode (dp)->dir_idx = idx; > > + break; > > + } > > if (err != ENOENT) > > - { > > - munmap ((caddr_t) buf, buflen); > > - return err; > > - } > > + { > > + munmap ((caddr_t) buf, buflen); > > + return err; > > + } > > > > blockaddr += DIRBLKSIZ; > > idx++; > > if (blockaddr - buf >= dp->dn_stat.st_size && !looped) > > - { > > - /* We've gotten to the end; start back at the beginning */ > > - looped = 1; > > - blockaddr = buf; > > - idx = 0; > > - } > > + { > > + /* We've gotten to the end; start back at the beginning */ > > + looped = 1; > > + blockaddr = buf; > > + idx = 0; > > + } > > } > > > > diskfs_set_node_atime (dp); > > @@ -250,75 +250,75 @@ diskfs_lookup_hard (struct node *dp, const char > > *name, enum lookup_type type, > > if (inum && npp) > > { > > if (namelen != 2 || name[0] != '.' || name[1] != '.') > > - { > > - if (inum == dp->cache_id) > > - { > > - np = dp; > > - diskfs_nref (np); > > - } > > - else > > - { > > - err = diskfs_cached_lookup (inum, &np); > > - if (err) > > - goto out; > > - } > > - } > > + { > > + if (inum == dp->cache_id) > > + { > > + np = dp; > > + diskfs_nref (np); > > + } > > + else > > + { > > + err = diskfs_cached_lookup (inum, &np); > > + if (err) > > + goto out; > > + } > > + } > > > > /* We are looking up .. */ > > /* Check to see if this is the root of the filesystem. */ > > else if (dp->cache_id == 2) > > - { > > - err = EAGAIN; > > - goto out; > > - } > > + { > > + err = EAGAIN; > > + goto out; > > + } > > > > /* We can't just do diskfs_cached_lookup, because we would then > > deadlock. > > - So we do this. Ick. */ > > + So we do this. Ick. */ > > else if (retry_dotdot) > > - { > > - /* Check to see that we got the same answer as last time. */ > > - if (inum != retry_dotdot) > > - { > > - /* Drop what we *thought* was .. (but isn't any more) and > > - try *again*. */ > > - diskfs_nput (np); > > - pthread_mutex_unlock (&dp->lock); > > - err = diskfs_cached_lookup (inum, &np); > > - pthread_mutex_lock (&dp->lock); > > - if (err) > > - goto out; > > - retry_dotdot = inum; > > - goto try_again; > > - } > > - /* Otherwise, we got it fine and np is already set properly. */ > > - } > > + { > > + /* Check to see that we got the same answer as last time. */ > > + if (inum != retry_dotdot) > > + { > > + /* Drop what we *thought* was .. (but isn't any more) and > > + try *again*. */ > > + diskfs_nput (np); > > + pthread_mutex_unlock (&dp->lock); > > + err = diskfs_cached_lookup (inum, &np); > > + pthread_mutex_lock (&dp->lock); > > + if (err) > > + goto out; > > + retry_dotdot = inum; > > + goto try_again; > > + } > > + /* Otherwise, we got it fine and np is already set properly. */ > > + } > > else if (!spec_dotdot) > > - { > > - /* Lock them in the proper order, and then > > - repeat the directory scan to see if this is still > > - right. */ > > - pthread_mutex_unlock (&dp->lock); > > - err = diskfs_cached_lookup (inum, &np); > > - pthread_mutex_lock (&dp->lock); > > - if (err) > > - goto out; > > - retry_dotdot = inum; > > - goto try_again; > > - } > > + { > > + /* Lock them in the proper order, and then > > + repeat the directory scan to see if this is still > > + right. */ > > + pthread_mutex_unlock (&dp->lock); > > + err = diskfs_cached_lookup (inum, &np); > > + pthread_mutex_lock (&dp->lock); > > + if (err) > > + goto out; > > + retry_dotdot = inum; > > + goto try_again; > > + } > > > > /* Here below are the spec dotdot cases. */ > > else if (type == RENAME || type == REMOVE) > > - np = diskfs_cached_ifind (inum); > > + np = diskfs_cached_ifind (inum); > > > > else if (type == LOOKUP) > > - { > > - diskfs_nput (dp); > > - err = diskfs_cached_lookup (inum, &np); > > - if (err) > > - goto out; > > - } > > + { > > + diskfs_nput (dp); > > + err = diskfs_cached_lookup (inum, &np); > > + if (err) > > + goto out; > > + } > > else > > - assert_backtrace (0); > > + assert_backtrace (0); > > } > > > > if ((type == CREATE || type == RENAME) && !inum && ds && ds->stat == > > LOOKING) > > @@ -339,7 +339,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, > > enum lookup_type type, > > { > > munmap ((caddr_t) buf, buflen); > > if (ds) > > - ds->type = LOOKUP; /* set to be ignored by drop_dirstat */ > > + ds->type = LOOKUP; /* set to be ignored by drop_dirstat */ > > } > > else > > { > > @@ -351,25 +351,25 @@ diskfs_lookup_hard (struct node *dp, const char > > *name, enum lookup_type type, > > { > > assert_backtrace (npp); > > if (err) > > - { > > - if (!spec_dotdot) > > - { > > - /* Normal case */ > > - if (np == dp) > > - diskfs_nrele (np); > > - else > > - diskfs_nput (np); > > - } > > - else if (type == RENAME || type == REMOVE) > > - /* We just did diskfs_cached_ifind to get np; that allocates > > - no new references, so we don't have anything to do */ > > - ; > > - else if (type == LOOKUP) > > - /* We did diskfs_cached_lookup */ > > - diskfs_nput (np); > > - } > > + { > > + if (!spec_dotdot) > > + { > > + /* Normal case */ > > + if (np == dp) > > + diskfs_nrele (np); > > + else > > + diskfs_nput (np); > > + } > > + else if (type == RENAME || type == REMOVE) > > + /* We just did diskfs_cached_ifind to get np; that allocates > > + no new references, so we don't have anything to do */ > > + ; > > + else if (type == LOOKUP) > > + /* We did diskfs_cached_lookup */ > > + diskfs_nput (np); > > + } > > else > > - *npp = np; > > + *npp = np; > > } > > > > return err ? : inum ? 0 : ENOENT; > > @@ -381,8 +381,8 @@ diskfs_lookup_hard (struct node *dp, const char *name, > > enum lookup_type type, > > return ENOENT. */ > > static error_t > > dirscanblock (vm_address_t blockaddr, struct node *dp, int idx, > > - const char *name, size_t namelen, enum lookup_type type, > > - struct dirstat *ds, ino_t *inum) > > + const char *name, size_t namelen, enum lookup_type type, > > + struct dirstat *ds, ino_t *inum) > > { > > size_t nfree = 0; > > size_t needed = 0; > > @@ -395,7 +395,7 @@ dirscanblock (vm_address_t blockaddr, struct node *dp, > > int idx, > > int consider_compress = 0; > > > > if (ds && (ds->stat == LOOKING > > - || ds->stat == COMPRESS)) > > + || ds->stat == COMPRESS)) > > { > > looking = 1; > > countcopies = 1; > > @@ -409,68 +409,68 @@ dirscanblock (vm_address_t blockaddr, struct node > > *dp, int idx, > > entry = (struct ext2_dir_entry_2 *)currentoff; > > > > if (!entry->rec_len > > - || entry->rec_len % EXT2_DIR_PAD > > - || entry->name_len > EXT2_NAME_LEN > > - || currentoff + entry->rec_len > blockaddr + DIRBLKSIZ > > - || EXT2_DIR_REC_LEN (entry->name_len) > entry->rec_len > > - || memchr (entry->name, '\0', entry->name_len)) > > - { > > - ext2_warning ("bad directory entry: inode: %Ld offset: %lu", > > - dp->cache_id, > > - currentoff - blockaddr + idx * DIRBLKSIZ); > > - return ENOENT; > > - } > > + || entry->rec_len % EXT2_DIR_PAD > > + || entry->name_len > EXT2_NAME_LEN > > + || currentoff + entry->rec_len > blockaddr + DIRBLKSIZ > > + || EXT2_DIR_REC_LEN (entry->name_len) > entry->rec_len > > + || memchr (entry->name, '\0', entry->name_len)) > > + { > > + ext2_warning ("bad directory entry: inode: %Ld offset: %lu", > > + dp->cache_id, > > + currentoff - blockaddr + idx * DIRBLKSIZ); > > + return ENOENT; > > + } > > > > if (looking || countcopies) > > - { > > - size_t thisfree; > > - > > - /* Count how much free space this entry has in it. */ > > - if (entry->inode == 0) > > - thisfree = entry->rec_len; > > - else > > - thisfree = entry->rec_len - EXT2_DIR_REC_LEN (entry->name_len); > > - > > - /* If this isn't at the front of the block, then it will > > - have to be copied if we do a compression; count the > > - number of bytes there too. */ > > - if (countcopies && currentoff != blockaddr) > > - nbytes += EXT2_DIR_REC_LEN (entry->name_len); > > - > > - if (ds->stat == COMPRESS && nbytes > ds->nbytes) > > - /* The previously found compress is better than > > - this one, so don't bother counting any more. */ > > - countcopies = 0; > > - > > - if (thisfree >= needed) > > - { > > - ds->type = CREATE; > > - ds->stat = entry->inode == 0 ? TAKE : SHRINK; > > - ds->entry = entry; > > - ds->idx = idx; > > - looking = countcopies = 0; > > - } > > - else > > - { > > - nfree += thisfree; > > - if (nfree >= needed) > > - consider_compress = 1; > > - } > > - } > > + { > > + size_t thisfree; > > + > > + /* Count how much free space this entry has in it. */ > > + if (entry->inode == 0) > > + thisfree = entry->rec_len; > > + else > > + thisfree = entry->rec_len - EXT2_DIR_REC_LEN (entry->name_len); > > + > > + /* If this isn't at the front of the block, then it will > > + have to be copied if we do a compression; count the > > + number of bytes there too. */ > > + if (countcopies && currentoff != blockaddr) > > + nbytes += EXT2_DIR_REC_LEN (entry->name_len); > > + > > + if (ds->stat == COMPRESS && nbytes > ds->nbytes) > > + /* The previously found compress is better than > > + this one, so don't bother counting any more. */ > > + countcopies = 0; > > + > > + if (thisfree >= needed) > > + { > > + ds->type = CREATE; > > + ds->stat = entry->inode == 0 ? TAKE : SHRINK; > > + ds->entry = entry; > > + ds->idx = idx; > > + looking = countcopies = 0; > > + } > > + else > > + { > > + nfree += thisfree; > > + if (nfree >= needed) > > + consider_compress = 1; > > + } > > + } > > > > if (entry->inode) > > - nentries++; > > + nentries++; > > > > if (entry->name_len == namelen > > - && entry->name[0] == name[0] > > - && entry->inode > > - && !bcmp (entry->name, name, namelen)) > > - break; > > + && entry->name[0] == name[0] > > + && entry->inode > > + && !bcmp (entry->name, name, namelen)) > > + break; > > } > > > > if (consider_compress > > && (ds->stat == LOOKING > > - || (ds->stat == COMPRESS && ds->nbytes > nbytes))) > > + || (ds->stat == COMPRESS && ds->nbytes > nbytes))) > > { > > ds->type = CREATE; > > ds->stat = COMPRESS; > > @@ -485,17 +485,17 @@ dirscanblock (vm_address_t blockaddr, struct node > > *dp, int idx, > > /* The name is not in this block. */ > > > > /* Because we scanned the entire block, we should write > > - down how many entries there were. */ > > + down how many entries there were. */ > > if (!diskfs_node_disknode (dp)->dirents) > > - { > > - diskfs_node_disknode (dp)->dirents = > > - malloc ((dp->dn_stat.st_size / DIRBLKSIZ) * sizeof (int)); > > - for (i = 0; i < dp->dn_stat.st_size/DIRBLKSIZ; i++) > > - diskfs_node_disknode (dp)->dirents[i] = -1; > > - } > > + { > > + diskfs_node_disknode (dp)->dirents = > > + malloc ((dp->dn_stat.st_size / DIRBLKSIZ) * sizeof (int)); > > + for (i = 0; i < dp->dn_stat.st_size/DIRBLKSIZ; i++) > > + diskfs_node_disknode (dp)->dirents[i] = -1; > > + } > > /* Make sure the count is correct if there is one now. */ > > assert_backtrace (diskfs_node_disknode (dp)->dirents[idx] == -1 > > - || diskfs_node_disknode (dp)->dirents[idx] == nentries); > > + || diskfs_node_disknode (dp)->dirents[idx] == nentries); > > diskfs_node_disknode (dp)->dirents[idx] = nentries; > > > > return ENOENT; > > @@ -526,7 +526,7 @@ dirscanblock (vm_address_t blockaddr, struct node *dp, > > int idx, > > the preceding lookup call, and only if that call returned ENOENT. */ > > error_t > > diskfs_direnter_hard (struct node *dp, const char *name, struct node *np, > > - struct dirstat *ds, struct protid *cred) > > + struct dirstat *ds, struct protid *cred) > > { > > struct ext2_dir_entry_2 *new; > > size_t namelen = strlen (name); > > @@ -558,7 +558,7 @@ diskfs_direnter_hard (struct node *dp, const char > > *name, struct node *np, > > > > case SHRINK: > > /* We are supposed to take the extra space at the end > > - of this slot. */ > > + of this slot. */ > > oldneeded = EXT2_DIR_REC_LEN (ds->entry->name_len); > > assert_backtrace (ds->entry->rec_len - oldneeded >= needed); > > > > @@ -570,28 +570,28 @@ diskfs_direnter_hard (struct node *dp, const char > > *name, struct node *np, > > > > case COMPRESS: > > /* We are supposed to move all the entries to the > > - front of the block, giving each the minimum > > - necessary room. This should free up enough space > > - for the new entry. */ > > + front of the block, giving each the minimum > > + necessary room. This should free up enough space > > + for the new entry. */ > > fromoff = tooff = (vm_address_t) ds->entry; > > > > while (fromoff < (vm_address_t) ds->entry + DIRBLKSIZ) > > - { > > - struct ext2_dir_entry_2 *from = (struct ext2_dir_entry_2 *)fromoff; > > - struct ext2_dir_entry_2 *to = (struct ext2_dir_entry_2 *) tooff; > > - size_t fromreclen = from->rec_len; > > + { > > + struct ext2_dir_entry_2 *from = (struct ext2_dir_entry_2 > > *)fromoff; > > + struct ext2_dir_entry_2 *to = (struct ext2_dir_entry_2 *) tooff; > > + size_t fromreclen = from->rec_len; > > > > - if (from->inode != 0) > > - { > > - assert_backtrace (fromoff >= tooff); > > + if (from->inode != 0) > > + { > > + assert_backtrace (fromoff >= tooff); > > > > - memmove (to, from, fromreclen); > > - to->rec_len = EXT2_DIR_REC_LEN (to->name_len); > > + memmove (to, from, fromreclen); > > + to->rec_len = EXT2_DIR_REC_LEN (to->name_len); > > > > - tooff += to->rec_len; > > - } > > - fromoff += fromreclen; > > - } > > + tooff += to->rec_len; > > + } > > + fromoff += fromreclen; > > + } > > > > totfreed = (vm_address_t) ds->entry + DIRBLKSIZ - tooff; > > assert_backtrace (totfreed >= needed); > > @@ -606,27 +606,27 @@ diskfs_direnter_hard (struct node *dp, const char > > *name, struct node *np, > > > > oldsize = dp->dn_stat.st_size; > > if ((off_t)(oldsize + DIRBLKSIZ) != (dp->dn_stat.st_size + > > DIRBLKSIZ)) > > - { > > - /* We can't possibly map the whole directory in. */ > > - munmap ((caddr_t) ds->mapbuf, ds->mapextent); > > - return EOVERFLOW; > > - } > > + { > > + /* We can't possibly map the whole directory in. */ > > + munmap ((caddr_t) ds->mapbuf, ds->mapextent); > > + return EOVERFLOW; > > + } > > while (oldsize + DIRBLKSIZ > dp->allocsize) > > - { > > - err = diskfs_grow (dp, oldsize + DIRBLKSIZ, cred); > > - if (err) > > - { > > - munmap ((caddr_t) ds->mapbuf, ds->mapextent); > > - return err; > > - } > > - } > > + { > > + err = diskfs_grow (dp, oldsize + DIRBLKSIZ, cred); > > + if (err) > > + { > > + munmap ((caddr_t) ds->mapbuf, ds->mapextent); > > + return err; > > + } > > + } > > > > new = (struct ext2_dir_entry_2 *) (ds->mapbuf + oldsize); > > err = hurd_safe_memset (new, 0, DIRBLKSIZ); > > if (err) > > { > > - if (err == EKERN_MEMORY_ERROR) > > - err = ENOSPC; > > + if (err == EKERN_MEMORY_ERROR) > > + err = ENOSPC; > > munmap ((caddr_t) ds->mapbuf, ds->mapextent); > > return err; > > } > > @@ -653,9 +653,9 @@ diskfs_direnter_hard (struct node *dp, const char > > *name, struct node *np, > > the virtual node to cause all the directory entries linked to > > its underlying inode to reflect the proper type. */ > > new->file_type = (EXT2_HAS_INCOMPAT_FEATURE (sblock, > > - EXT2_FEATURE_INCOMPAT_FILETYPE) > > - ? file_type_ext2[IFTODT (np->dn_stat.st_mode & S_IFMT)] > > - : 0); > > + > > EXT2_FEATURE_INCOMPAT_FILETYPE) > > + ? file_type_ext2[IFTODT (np->dn_stat.st_mode & S_IFMT)] > > + : 0); > > #else > > new->file_type = 0; > > #endif > > @@ -671,36 +671,36 @@ diskfs_direnter_hard (struct node *dp, const char > > *name, struct node *np, > > if (ds->stat != EXTEND) > > { > > /* If we are keeping count of this block, then keep the count up > > - to date. */ > > + to date. */ > > if (diskfs_node_disknode (dp)->dirents > > - && diskfs_node_disknode (dp)->dirents[ds->idx] != -1) > > - diskfs_node_disknode (dp)->dirents[ds->idx]++; > > + && diskfs_node_disknode (dp)->dirents[ds->idx] != -1) > > + diskfs_node_disknode (dp)->dirents[ds->idx]++; > > } > > else > > { > > int i; > > /* It's cheap, so start a count here even if we aren't counting > > - anything at all. */ > > + anything at all. */ > > if (diskfs_node_disknode (dp)->dirents) > > - { > > - diskfs_node_disknode (dp)->dirents = > > - realloc (diskfs_node_disknode (dp)->dirents, > > - (dp->dn_stat.st_size / DIRBLKSIZ * sizeof (int))); > > - for (i = oldsize / DIRBLKSIZ; > > - i < dp->dn_stat.st_size / DIRBLKSIZ; > > - i++) > > - diskfs_node_disknode (dp)->dirents[i] = -1; > > - > > - diskfs_node_disknode (dp)->dirents[ds->idx] = 1; > > - } > > + { > > + diskfs_node_disknode (dp)->dirents = > > + realloc (diskfs_node_disknode (dp)->dirents, > > + (dp->dn_stat.st_size / DIRBLKSIZ * sizeof (int))); > > + for (i = oldsize / DIRBLKSIZ; > > + i < dp->dn_stat.st_size / DIRBLKSIZ; > > + i++) > > + diskfs_node_disknode (dp)->dirents[i] = -1; > > + > > + diskfs_node_disknode (dp)->dirents[ds->idx] = 1; > > + } > > else > > - { > > - diskfs_node_disknode (dp)->dirents = > > - malloc (dp->dn_stat.st_size / DIRBLKSIZ * sizeof (int)); > > - for (i = 0; i < dp->dn_stat.st_size / DIRBLKSIZ; i++) > > - diskfs_node_disknode (dp)->dirents[i] = -1; > > - diskfs_node_disknode (dp)->dirents[ds->idx] = 1; > > - } > > + { > > + diskfs_node_disknode (dp)->dirents = > > + malloc (dp->dn_stat.st_size / DIRBLKSIZ * sizeof (int)); > > + for (i = 0; i < dp->dn_stat.st_size / DIRBLKSIZ; i++) > > + diskfs_node_disknode (dp)->dirents[i] = -1; > > + diskfs_node_disknode (dp)->dirents[ds->idx] = 1; > > + } > > } > > > > diskfs_file_update (dp, diskfs_synchronous); > > @@ -726,7 +726,7 @@ diskfs_dirremove_hard (struct node *dp, struct dirstat > > *ds) > > else > > { > > assert_backtrace ((vm_address_t) ds->entry - (vm_address_t) > > ds->preventry > > - == ds->preventry->rec_len); > > + == ds->preventry->rec_len); > > ds->preventry->rec_len += ds->entry->rec_len; > > } > > > > @@ -788,7 +788,7 @@ diskfs_dirempty (struct node *dp, struct protid *cred) > > return 0; > > > > err = vm_map (mach_task_self (), &buf, dp->dn_stat.st_size, 0, > > - 1, memobj, 0, 0, VM_PROT_READ, VM_PROT_READ, 0); > > + 1, memobj, 0, 0, VM_PROT_READ, VM_PROT_READ, 0); > > mach_port_deallocate (mach_task_self (), memobj); > > assert_backtrace (!err); > > > > @@ -801,11 +801,11 @@ diskfs_dirempty (struct node *dp, struct protid *cred) > > entry = (struct ext2_dir_entry_2 *) curoff; > > > > if (entry->inode != 0 > > - && (entry->name_len > 2 > > - || entry->name[0] != '.' > > - || (entry->name[1] != '.' > > - && entry->name[1] != '\0'))) > > - hit = 1; > > + && (entry->name_len > 2 > > + || entry->name[0] != '.' > > + || (entry->name[1] != '.' > > + && entry->name[1] != '\0'))) > > + hit = 1; > > } > > > > diskfs_set_node_atime (dp); > > @@ -857,11 +857,11 @@ count_dirents (struct node *dp, block_t nb, char *buf) > > { > > entry = (struct ext2_dir_entry_2 *) offinblk; > > if (entry->inode) > > - count++; > > + count++; > > } > > > > assert_backtrace (diskfs_node_disknode (dp)->dirents[nb] == -1 > > - || diskfs_node_disknode (dp)->dirents[nb] == count); > > + || diskfs_node_disknode (dp)->dirents[nb] == count); > > diskfs_node_disknode (dp)->dirents[nb] = count; > > return 0; > > } > > @@ -874,12 +874,12 @@ count_dirents (struct node *dp, block_t nb, char *buf) > > <hurd/diskfs.h>. */ > > error_t > > diskfs_get_directs (struct node *dp, > > - int entry, > > - int nentries, > > - char **data, > > - size_t *datacnt, > > - vm_size_t bufsiz, > > - int *amt) > > + int entry, > > + int nentries, > > + char **data, > > + size_t *datacnt, > > + vm_size_t bufsiz, > > + int *amt) > > { > > block_t blkno; > > block_t nblks; > > @@ -901,7 +901,7 @@ diskfs_get_directs (struct node *dp, > > { > > diskfs_node_disknode (dp)->dirents = malloc (nblks * sizeof (int)); > > for (i = 0; i < nblks; i++) > > - diskfs_node_disknode (dp)->dirents[i] = -1; > > + diskfs_node_disknode (dp)->dirents[i] = -1; > > } > > > > /* Scan through the entries to find ENTRY. If we encounter > > @@ -912,16 +912,16 @@ diskfs_get_directs (struct node *dp, > > for (blkno = 0; blkno < nblks; blkno++) > > { > > if (diskfs_node_disknode (dp)->dirents[blkno] == -1) > > - { > > - err = count_dirents (dp, blkno, buf); > > - if (err) > > - return err; > > - bufvalid = 1; > > - } > > + { > > + err = count_dirents (dp, blkno, buf); > > + if (err) > > + return err; > > + bufvalid = 1; > > + } > > > > if (curentry + diskfs_node_disknode (dp)->dirents[blkno] > entry) > > - /* ENTRY starts in this block. */ > > - break; > > + /* ENTRY starts in this block. */ > > + break; > > > > curentry += diskfs_node_disknode (dp)->dirents[blkno]; > > > > @@ -931,8 +931,8 @@ diskfs_get_directs (struct node *dp, > > if (blkno == nblks) > > { > > /* We reached the end of the directory without seeing ENTRY. > > - This is treated as an EOF condition, meaning we return > > - success with empty results. */ > > + This is treated as an EOF condition, meaning we return > > + success with empty results. */ > > *datacnt = 0; > > *amt = 0; > > return 0; > > @@ -953,9 +953,9 @@ diskfs_get_directs (struct node *dp, > > size_t max_entries = dp->dn_stat.st_size / min_entry_size; > > /* The maximum difference in size per directory entry. */ > > size_t entry_extra = > > - DIRENT_ALIGN > > - + (min_dirent_size > min_entry_size > > - ? min_dirent_size - min_entry_size : 0); > > + DIRENT_ALIGN > > + + (min_dirent_size > min_entry_size > > + ? min_dirent_size - min_entry_size : 0); > > > > allocsize = round_page (dp->dn_stat.st_size + max_entries * > > entry_extra); > > } > > @@ -970,20 +970,20 @@ diskfs_get_directs (struct node *dp, > > if (curentry != entry) > > { > > /* Look through the block to find out where to start, > > - setting bufp appropriately. */ > > + setting bufp appropriately. */ > > if (!bufvalid) > > - { > > - err = diskfs_node_rdwr (dp, buf, blkno * DIRBLKSIZ, DIRBLKSIZ, > > - 0, 0, &checklen); > > - if (err) > > - return err; > > - assert_backtrace (checklen == DIRBLKSIZ); > > - bufvalid = 1; > > - } > > + { > > + err = diskfs_node_rdwr (dp, buf, blkno * DIRBLKSIZ, DIRBLKSIZ, > > + 0, 0, &checklen); > > + if (err) > > + return err; > > + assert_backtrace (checklen == DIRBLKSIZ); > > + bufvalid = 1; > > + } > > for (i = 0, bufp = buf; > > - i < entry - curentry && bufp - buf < DIRBLKSIZ; > > - bufp += ((struct ext2_dir_entry_2 *)bufp)->rec_len, i++) > > - ; > > + i < entry - curentry && bufp - buf < DIRBLKSIZ; > > + bufp += ((struct ext2_dir_entry_2 *)bufp)->rec_len, i++) > > + ; > > /* Make sure we didn't run off the end. */ > > assert_backtrace (bufp - buf < DIRBLKSIZ); > > } > > @@ -993,100 +993,100 @@ diskfs_get_directs (struct node *dp, > > > > /* Copy the entries, one at a time. */ > > while (((nentries == -1) || (i < nentries)) > > - && (!bufsiz || (datap - *data < bufsiz) ) > > - && blkno < nblks) > > + && (!bufsiz || (datap - *data < bufsiz) ) > > + && blkno < nblks) > > { > > if (!bufvalid) > > - { > > - err = diskfs_node_rdwr (dp, buf, blkno * DIRBLKSIZ, DIRBLKSIZ, > > - 0, 0, &checklen); > > - if (err) > > - return err; > > - assert_backtrace (checklen == DIRBLKSIZ); > > - bufvalid = 1; > > - bufp = buf; > > - } > > + { > > + err = diskfs_node_rdwr (dp, buf, blkno * DIRBLKSIZ, DIRBLKSIZ, > > + 0, 0, &checklen); > > + if (err) > > + return err; > > + assert_backtrace (checklen == DIRBLKSIZ); > > + bufvalid = 1; > > + bufp = buf; > > + } > > > > entryp = (struct ext2_dir_entry_2 *)bufp; > > > > if (entryp->inode) > > - { > > - int rec_len; > > - int name_len = entryp->name_len; > > - > > - userp = (struct dirent *) datap; > > - > > - /* Length is structure before the name + the name + '\0', all > > - padded to a four-byte alignment. */ > > - rec_len = > > - ((offsetof (struct dirent, d_name) > > - + name_len + 1 > > - + (DIRENT_ALIGN - 1)) > > - & ~(DIRENT_ALIGN - 1)); > > - > > - /* See if this record would run over the end of the return buffer. > > */ > > - if (bufsiz == 0) > > - /* It shouldn't ever, as we calculated the worst case size. */ > > - assert_backtrace (datap + rec_len <= *data + allocsize); > > - else > > - /* It's ok if it does, just leave off returning this entry. */ > > - if (datap + rec_len > *data + allocsize) > > - break; > > - > > - userp->d_fileno = entryp->inode; > > - userp->d_reclen = rec_len; > > - userp->d_namlen = name_len; > > + { > > + int rec_len; > > + int name_len = entryp->name_len; > > + > > + userp = (struct dirent *) datap; > > + > > + /* Length is structure before the name + the name + '\0', all > > + padded to a four-byte alignment. */ > > + rec_len = > > + ((offsetof (struct dirent, d_name) > > + + name_len + 1 > > + + (DIRENT_ALIGN - 1)) > > + & ~(DIRENT_ALIGN - 1)); > > + > > + /* See if this record would run over the end of the return > > buffer. */ > > + if (bufsiz == 0) > > + /* It shouldn't ever, as we calculated the worst case size. */ > > + assert_backtrace (datap + rec_len <= *data + allocsize); > > + else > > + /* It's ok if it does, just leave off returning this entry. */ > > + if (datap + rec_len > *data + allocsize) > > + break; > > + > > + userp->d_fileno = entryp->inode; > > + userp->d_reclen = rec_len; > > + userp->d_namlen = name_len; > > > > #if 0 > > - /* We don't bother to check the EXT2_FEATURE_INCOMPAT_FILETYPE > > - flag in the superblock, because in old filesystems the > > - file_type field is the high byte of the length field and is > > - always zero because names cannot be that long. */ > > - if (entryp->file_type < EXT2_FT_MAX) > > - userp->d_type = ext2_file_type[entryp->file_type]; > > - else > > - { > > - ext2_warning ("bad type %d in directory entry: " > > - "inode: %d offset: %d", > > - entryp->file_type, > > - dp->cache_id, > > - blkno * DIRBLKSIZ + bufp - buf); > > - userp->d_type = DT_UNKNOWN; > > - } > > + /* We don't bother to check the EXT2_FEATURE_INCOMPAT_FILETYPE > > + flag in the superblock, because in old filesystems the > > + file_type field is the high byte of the length field and is > > + always zero because names cannot be that long. */ > > + if (entryp->file_type < EXT2_FT_MAX) > > + userp->d_type = ext2_file_type[entryp->file_type]; > > + else > > + { > > + ext2_warning ("bad type %d in directory entry: " > > + "inode: %d offset: %d", > > + entryp->file_type, > > + dp->cache_id, > > + blkno * DIRBLKSIZ + bufp - buf); > > + userp->d_type = DT_UNKNOWN; > > + } > > #else > > - /* XXX > > - For complex reasons it might not be correct to return > > - the filesystem's d_type value to the user. */ > > - userp->d_type = DT_UNKNOWN; > > + /* XXX > > + For complex reasons it might not be correct to return > > + the filesystem's d_type value to the user. */ > > + userp->d_type = DT_UNKNOWN; > > #endif > > - memcpy (userp->d_name, entryp->name, name_len); > > - userp->d_name[name_len] = '\0'; > > + memcpy (userp->d_name, entryp->name, name_len); > > + userp->d_name[name_len] = '\0'; > > > > - datap += rec_len; > > - i++; > > - } > > + datap += rec_len; > > + i++; > > + } > > > > if (entryp->rec_len == 0) > > - { > > - ext2_warning ("zero length directory entry: inode: %Ld offset: %zd", > > - dp->cache_id, > > - blkno * DIRBLKSIZ + bufp - buf); > > - return EIO; > > - } > > + { > > + ext2_warning ("zero length directory entry: inode: %Ld offset: > > %zd", > > + dp->cache_id, > > + blkno * DIRBLKSIZ + bufp - buf); > > + return EIO; > > + } > > > > bufp += entryp->rec_len; > > if (bufp - buf == DIRBLKSIZ) > > - { > > - blkno++; > > - bufvalid = 0; > > - } > > + { > > + blkno++; > > + bufvalid = 0; > > + } > > else if (bufp - buf > DIRBLKSIZ) > > - { > > - ext2_warning ("directory entry too long: inode: %Ld offset: %zd", > > - dp->cache_id, > > - blkno * DIRBLKSIZ + bufp - buf - entryp->rec_len); > > - return EIO; > > - } > > + { > > + ext2_warning ("directory entry too long: inode: %Ld offset: %zd", > > + dp->cache_id, > > + blkno * DIRBLKSIZ + bufp - buf - entryp->rec_len); > > + return EIO; > > + } > > } > > > > /* We've copied all we can. If we allocated our own array > > @@ -1094,8 +1094,8 @@ diskfs_get_directs (struct node *dp, > > if (allocsize > *datacnt) > > { > > if (round_page (datap - *data) < allocsize) > > - munmap ((caddr_t) (*data + round_page (datap - *data)), > > - allocsize - round_page (datap - *data)); > > + munmap ((caddr_t) (*data + round_page (datap - *data)), > > + allocsize - round_page (datap - *data)); > > } > > > > /* Set variables for return */ > > diff --git a/ext2fs/ext2fs.c b/ext2fs/ext2fs.c > > index 50435c76..5a5506c6 100644 > > --- a/ext2fs/ext2fs.c > > +++ b/ext2fs/ext2fs.c > > @@ -144,10 +144,10 @@ parse_opt (int key, char *arg, struct argp_state > > *state) > > case 'S': > > values->sb_block = strtoul (arg, &arg, 0); > > if (!arg || *arg != '\0') > > - { > > - argp_error (state, "invalid number for --sblock"); > > - return EINVAL; > > - } > > + { > > + argp_error (state, "invalid number for --sblock"); > > + return EINVAL; > > + } > > break; > > #endif > > > > @@ -155,7 +155,7 @@ parse_opt (int key, char *arg, struct argp_state *state) > > state->child_inputs[0] = state->input; > > values = malloc (sizeof *values); > > if (values == 0) > > - return ENOMEM; > > + return ENOMEM; > > state->hook = values; > > memset (values, 0, sizeof *values); > > #ifdef ALTERNATE_SBLOCK > > @@ -166,14 +166,14 @@ parse_opt (int key, char *arg, struct argp_state > > *state) > > case ARGP_KEY_SUCCESS: > > /* All options parse successfully, so implement ours if possible. */ > > if (values->debug_flag) > > - { > > + { > > #ifdef EXT2FS_DEBUG > > - ext2_debug_flag = !ext2_debug_flag; > > + ext2_debug_flag = !ext2_debug_flag; > > #else > > - argp_failure (state, 2, 0, "debugging support not compiled in"); > > - return EINVAL; > > + argp_failure (state, 2, 0, "debugging support not compiled in"); > > + return EINVAL; > > #endif > > - } > > + } > > > > use_xattr_translator_records = values->use_xattr_translator_records; > > break; > > @@ -227,13 +227,13 @@ main (int argc, char **argv) > > /* Initialize the diskfs library, parse arguments, and open the store. > > This starts the first diskfs thread for us. */ > > store = diskfs_init_main (&startup_argp, argc, argv, > > - &store_parsed, &bootstrap); > > + &store_parsed, &bootstrap); > > > > if (store->size < SBLOCK_OFFS + SBLOCK_SIZE) > > ext2_panic ("device too small for superblock (%Ld bytes)", > > store->size); > > if (store->log2_blocks_per_page < 0) > > ext2_panic ("device block size (%zu) greater than page size (%zd)", > > - store->block_size, vm_page_size); > > + store->block_size, vm_page_size); > > > > /* Map the entire disk. */ > > create_disk_pager (); > > diff --git a/ext2fs/getblk.c b/ext2fs/getblk.c > > index 43daf6c9..10a34f8d 100644 > > --- a/ext2fs/getblk.c > > +++ b/ext2fs/getblk.c > > @@ -53,7 +53,7 @@ ext2_discard_prealloc (struct node *node) > > { > > int i = diskfs_node_disknode (node)->info.i_prealloc_count; > > ext2_debug ("discarding %d prealloced blocks for inode %d", > > - i, node->cache_id); > > + i, node->cache_id); > > diskfs_node_disknode (node)->info.i_prealloc_count = 0; > > ext2_free_blocks (diskfs_node_disknode > > (node)->info.i_prealloc_block, i); > > } > > @@ -79,24 +79,24 @@ ext2_alloc_block (struct node *node, block_t goal, int > > zero) > > result = diskfs_node_disknode (node)->info.i_prealloc_block++; > > diskfs_node_disknode (node)->info.i_prealloc_count--; > > ext2_debug ("preallocation hit (%lu/%lu) => %u", > > - ++alloc_hits, ++alloc_attempts, result); > > + ++alloc_hits, ++alloc_attempts, result); > > } > > else > > { > > ext2_debug ("preallocation miss (%lu/%lu)", > > - alloc_hits, ++alloc_attempts); > > + alloc_hits, ++alloc_attempts); > > ext2_discard_prealloc (node); > > - result = ext2_new_block > > - (goal, > > - S_ISREG (node->dn_stat.st_mode) > > - ? (sblock->s_prealloc_blocks ?: EXT2_DEFAULT_PREALLOC_BLOCKS) > > - : (S_ISDIR (node->dn_stat.st_mode) > > - && EXT2_HAS_COMPAT_FEATURE(sblock, > > - EXT2_FEATURE_COMPAT_DIR_PREALLOC)) > > - ? sblock->s_prealloc_dir_blocks > > - : 0, > > - &diskfs_node_disknode (node)->info.i_prealloc_count, > > - &diskfs_node_disknode (node)->info.i_prealloc_block); > > + result = ext2_new_block ( > > + goal, > > + S_ISREG (node->dn_stat.st_mode) > > + ? (sblock->s_prealloc_blocks ?: EXT2_DEFAULT_PREALLOC_BLOCKS) > > + : (S_ISDIR (node->dn_stat.st_mode) > > + && EXT2_HAS_COMPAT_FEATURE(sblock, > > + EXT2_FEATURE_COMPAT_DIR_PREALLOC)) > > + ? sblock->s_prealloc_dir_blocks > > + : 0, > > + &diskfs_node_disknode (node)->info.i_prealloc_count, > > + &diskfs_node_disknode (node)->info.i_prealloc_block); > > } > > #else > > result = ext2_new_block (goal, 0, 0); > > @@ -114,7 +114,7 @@ ext2_alloc_block (struct node *node, block_t goal, int > > zero) > > > > static error_t > > inode_getblk (struct node *node, int nr, int create, int zero, > > - block_t new_block, block_t *result) > > + block_t new_block, block_t *result) > > { > > int i; > > block_t goal = 0; > > @@ -141,24 +141,24 @@ inode_getblk (struct node *node, int nr, int create, > > int zero, > > if (!goal) > > { > > for (i = nr - 1; i >= 0; i--) > > - { > > - if (diskfs_node_disknode (node)->info.i_data[i]) > > - { > > - goal = diskfs_node_disknode (node)->info.i_data[i]; > > - break; > > - } > > - } > > + { > > + if (diskfs_node_disknode (node)->info.i_data[i]) > > + { > > + goal = diskfs_node_disknode (node)->info.i_data[i]; > > + break; > > + } > > + } > > if (!goal) > > - goal = > > - (diskfs_node_disknode (node)->info.i_block_group > > + goal = > > + (diskfs_node_disknode (node)->info.i_block_group > > * EXT2_BLOCKS_PER_GROUP (sblock)) > > - + sblock->s_first_data_block; > > + + sblock->s_first_data_block; > > } > > > > *result = ext2_alloc_block (node, goal, zero); > > > > ext2_debug ("%screate, hint = %u, goal = %u => %u", > > - create ? "" : "no", hint, goal, *result); > > + create ? "" : "no", hint, goal, *result); > > > > if (!*result) > > return ENOSPC; > > @@ -179,7 +179,7 @@ inode_getblk (struct node *node, int nr, int create, > > int zero, > > > > error_t > > block_getblk (struct node *node, block_t block, int nr, int create, int > > zero, > > - block_t new_block, block_t *result) > > + block_t new_block, block_t *result) > > { > > int i; > > block_t goal = 0; > > @@ -203,15 +203,15 @@ block_getblk (struct node *node, block_t block, int > > nr, int create, int zero, > > if (!goal) > > { > > for (i = nr - 1; i >= 0; i--) > > - { > > - if (bh[i]) > > - { > > - goal = bh[i]; > > - break; > > - } > > - } > > + { > > + if (bh[i]) > > + { > > + goal = bh[i]; > > + break; > > + } > > + } > > if (!goal) > > - goal = block; > > + goal = block; > > } > > > > *result = ext2_alloc_block (node, goal, zero); > > @@ -261,8 +261,8 @@ ext2_getblk (struct node *node, block_t block, int > > create, block_t *disk_block) > > */ > > > > ext2_debug ("block = %u, next = %u, goal = %u", block, > > - diskfs_node_disknode (node)->info.i_next_alloc_block, > > - diskfs_node_disknode (node)->info.i_next_alloc_goal); > > + diskfs_node_disknode (node)->info.i_next_alloc_block, > > + diskfs_node_disknode (node)->info.i_next_alloc_goal); > > > > if (block == diskfs_node_disknode (node)->info.i_next_alloc_block + 1) > > { > > @@ -280,7 +280,7 @@ ext2_getblk (struct node *node, block_t block, int > > create, block_t *disk_block) > > { > > err = inode_getblk (node, EXT2_IND_BLOCK, create, 1, b, &indir); > > if (!err) > > - err = block_getblk (node, indir, block, create, 0, b, disk_block); > > + err = block_getblk (node, indir, block, create, 0, b, disk_block); > > return err; > > } > > > > @@ -289,11 +289,11 @@ ext2_getblk (struct node *node, block_t block, int > > create, block_t *disk_block) > > { > > err = inode_getblk (node, EXT2_DIND_BLOCK, create, 1, b, &indir); > > if (!err) > > - err = block_getblk (node, indir, block / addr_per_block, create, 1, > > - b, &indir); > > + err = block_getblk (node, indir, block / addr_per_block, create, 1, > > + b, &indir); > > if (!err) > > - err = block_getblk (node, indir, block & (addr_per_block - 1), > > - create, 0, b, disk_block); > > + err = block_getblk (node, indir, block & (addr_per_block - 1), > > + create, 0, b, disk_block); > > return err; > > } > > > > @@ -301,15 +301,15 @@ ext2_getblk (struct node *node, block_t block, int > > create, block_t *disk_block) > > err = inode_getblk (node, EXT2_TIND_BLOCK, create, 1, b, &indir); > > if (!err) > > err = block_getblk (node, indir, block / (addr_per_block * > > addr_per_block), > > - create, 1, b, &indir); > > + create, 1, b, &indir); > > if (!err) > > err = > > block_getblk (node, indir, > > - (block / addr_per_block) & (addr_per_block - 1), > > - create, 1, b, &indir); > > + (block / addr_per_block) & (addr_per_block - 1), > > + create, 1, b, &indir); > > if (!err) > > err = block_getblk (node, indir, block & (addr_per_block - 1), create, > > 0, > > - b, disk_block); > > + b, disk_block); > > > > return err; > > } > > diff --git a/ext2fs/hyper.c b/ext2fs/hyper.c > > index e77c0266..93fb7dbb 100644 > > --- a/ext2fs/hyper.c > > +++ b/ext2fs/hyper.c > > @@ -35,7 +35,7 @@ allocate_mod_map (void) > > /* Get rid of the old one. */ > > munmap (modified_global_blocks, mod_map_size); > > > > - if (!diskfs_readonly && block_size < vm_page_size) > > + if (!diskfs_readonly && block_size < vm_page_size) > > /* If the block size is too small, we have to take extra care when > > writing out pages from the global pager, to make sure we don't stomp > > on any file pager blocks. In this case use a bitmap to record which > > @@ -44,7 +44,7 @@ allocate_mod_map (void) > > /* One bit per filesystem block. */ > > mod_map_size = sblock->s_blocks_count >> 3; > > modified_global_blocks = mmap (0, mod_map_size, PROT_READ|PROT_WRITE, > > - MAP_ANON, 0, 0); > > + MAP_ANON, 0, 0); > > assert_backtrace (modified_global_blocks != (void *) -1); > > } > > else > > @@ -65,7 +65,7 @@ get_hypermetadata (void) > > munmap (sblock, SBLOCK_SIZE); > > > > err = store_read (store, SBLOCK_OFFS >> store->log2_block_size, > > - SBLOCK_SIZE, (void **)&sblock, &read); > > + SBLOCK_SIZE, (void **)&sblock, &read); > > if (err || read != SBLOCK_SIZE) > > ext2_panic ("Cannot read hypermetadata"); > > > > @@ -75,19 +75,19 @@ get_hypermetadata (void) > > #endif > > ) > > ext2_panic ("bad magic number %#x (should be %#x)", > > - sblock->s_magic, EXT2_SUPER_MAGIC); > > + sblock->s_magic, EXT2_SUPER_MAGIC); > > > > log2_block_size = EXT2_MIN_BLOCK_LOG_SIZE + sblock->s_log_block_size; > > block_size = 1 << log2_block_size; > > > > if (block_size > EXT2_MAX_BLOCK_SIZE) > > ext2_panic ("block size %d is too big (max is %d bytes)", > > - block_size, EXT2_MAX_BLOCK_SIZE); > > + block_size, EXT2_MAX_BLOCK_SIZE); > > > > if (log2_block_size < store->log2_block_size) > > ext2_panic ("block size %d isn't a power-of-two multiple of the device" > > - " block size (%zd)!", > > - block_size, store->block_size); > > + " block size (%zd)!", > > + block_size, store->block_size); > > log2_dev_blocks_per_fs_block = log2_block_size - store->log2_block_size; > > > > log2_stat_blocks_per_fs_block = 0; > > @@ -95,18 +95,18 @@ get_hypermetadata (void) > > log2_stat_blocks_per_fs_block++; > > if ((512 << log2_stat_blocks_per_fs_block) != block_size) > > ext2_panic ("block size %d isn't a power-of-two multiple of 512!", > > - block_size); > > + block_size); > > > > if ((store->size >> log2_block_size) < sblock->s_blocks_count) > > ext2_panic ("disk size (%qd bytes) too small; superblock says we need > > %qd", > > - (long long int) store->size, > > - (long long int) sblock->s_blocks_count << log2_block_size); > > + (long long int) store->size, > > + (long long int) sblock->s_blocks_count << log2_block_size); > > if (log2_dev_blocks_per_fs_block != 0 > > && (store->size & ((1 << log2_dev_blocks_per_fs_block) - 1)) != 0) > > ext2_warning ("%Ld (%zd byte) device blocks " > > - " unused after last filesystem (%d byte) block", > > - (store->size & ((1 << log2_dev_blocks_per_fs_block) - 1)), > > - store->block_size, block_size); > > + " unused after last filesystem (%d byte) block", > > + (store->size & ((1 << log2_dev_blocks_per_fs_block) - > > 1)), > > + store->block_size, block_size); > > > > /* Set these handy variables. */ > > inodes_per_block = block_size / EXT2_INODE_SIZE (sblock); > > @@ -120,18 +120,18 @@ get_hypermetadata (void) > > if (sblock->s_rev_level > EXT2_GOOD_OLD_REV) > > { > > if (sblock->s_feature_incompat & ~EXT2_FEATURE_INCOMPAT_SUPP) > > - ext2_panic ("could not mount because of unsupported optional features" > > - " (0x%x)", > > - sblock->s_feature_incompat & ~EXT2_FEATURE_INCOMPAT_SUPP); > > + ext2_panic ("could not mount because of unsupported optional > > features" > > + " (0x%x)", > > + sblock->s_feature_incompat & > > ~EXT2_FEATURE_INCOMPAT_SUPP); > > if (sblock->s_feature_ro_compat & ~EXT2_FEATURE_RO_COMPAT_SUPP) > > - { > > - ext2_warning ("mounted readonly because of" > > - " unsupported optional features (0x%x)", > > - sblock->s_feature_ro_compat & > > ~EXT2_FEATURE_RO_COMPAT_SUPP); > > - diskfs_readonly = 1; > > - } > > + { > > + ext2_warning ("mounted readonly because of" > > + " unsupported optional features (0x%x)", > > + sblock->s_feature_ro_compat & > > ~EXT2_FEATURE_RO_COMPAT_SUPP); > > + diskfs_readonly = 1; > > + } > > if (sblock->s_inode_size != EXT2_GOOD_OLD_INODE_SIZE) > > - ext2_panic ("inode size %d isn't supported", sblock->s_inode_size); > > + ext2_panic ("inode size %d isn't supported", sblock->s_inode_size); > > } > > > > groups_count = > > @@ -149,10 +149,10 @@ get_hypermetadata (void) > > { > > ext2_warning ("FILESYSTEM NOT UNMOUNTED CLEANLY; PLEASE fsck"); > > if (! diskfs_readonly) > > - { > > - diskfs_readonly = 1; > > - ext2_warning ("MOUNTED READ-ONLY; MUST USE `fsysopts --writable'"); > > - } > > + { > > + diskfs_readonly = 1; > > + ext2_warning ("MOUNTED READ-ONLY; MUST USE `fsysopts > > --writable'"); > > + } > > } > > > > allocate_mod_map (); > > @@ -195,7 +195,7 @@ diskfs_set_hypermetadata (int wait, int clean) > > wait = 1; > > } > > > > - if (sblock_dirty) > > + if (sblock_dirty) > > { > > sblock_dirty = 0; > > memcpy (mapped_sblock, sblock, SBLOCK_SIZE); > > @@ -217,7 +217,7 @@ diskfs_readonly_changed (int readonly) > > (*(readonly ? store_set_flags : store_clear_flags)) (store, > > STORE_READONLY); > > > > mprotect (disk_cache, disk_cache_size, > > - PROT_READ | (readonly ? 0 : PROT_WRITE)); > > + PROT_READ | (readonly ? 0 : PROT_WRITE)); > > > > if (!readonly && !(sblock->s_state & EXT2_VALID_FS)) > > ext2_warning ("UNCLEANED FILESYSTEM NOW WRITABLE"); > > diff --git a/ext2fs/ialloc.c b/ext2fs/ialloc.c > > index 49122319..46821a1f 100644 > > --- a/ext2fs/ialloc.c > > +++ b/ext2fs/ialloc.c > > @@ -88,7 +88,7 @@ diskfs_free_node (struct node *np, mode_t old_mode) > > > > gdp->bg_free_inodes_count++; > > if (S_ISDIR (old_mode)) > > - gdp->bg_used_dirs_count--; > > + gdp->bg_used_dirs_count--; > > disk_cache_block_ref_ptr (gdp); > > record_global_poke (gdp); > > > > @@ -136,35 +136,35 @@ repeat: > > /* I am not yet convinced that this next bit is necessary. > > i = inode_group_num(dir_inum); > > for (j = 0; j < groups_count; j++) > > - { > > - tmp = group_desc (i); > > - if ((tmp->bg_used_dirs_count << 8) < tmp->bg_free_inodes_count) > > - { > > - gdp = tmp; > > - break; > > - } > > - else > > - i = ++i % groups_count; > > - } > > + { > > + tmp = group_desc (i); > > + if ((tmp->bg_used_dirs_count << 8) < tmp->bg_free_inodes_count) > > + { > > + gdp = tmp; > > + break; > > + } > > + else > > + i = ++i % groups_count; > > + } > > */ > > > > if (!gdp) > > - { > > - for (j = 0; j < groups_count; j++) > > - { > > - tmp = group_desc (j); > > - if (tmp->bg_free_inodes_count > > - && tmp->bg_free_inodes_count >= avefreei) > > - { > > - if (!gdp || > > - (tmp->bg_free_blocks_count > gdp->bg_free_blocks_count)) > > - { > > - i = j; > > - gdp = tmp; > > - } > > - } > > - } > > - } > > + { > > + for (j = 0; j < groups_count; j++) > > + { > > + tmp = group_desc (j); > > + if (tmp->bg_free_inodes_count > > + && tmp->bg_free_inodes_count >= avefreei) > > + { > > + if (!gdp || > > + (tmp->bg_free_blocks_count > > > gdp->bg_free_blocks_count)) > > + { > > + i = j; > > + gdp = tmp; > > + } > > + } > > + } > > + } > > } > > else > > { > > @@ -174,44 +174,44 @@ repeat: > > i = inode_group_num(dir_inum); > > tmp = group_desc (i); > > if (tmp->bg_free_inodes_count) > > - gdp = tmp; > > + gdp = tmp; > > else > > - { > > - /* > > - * Use a quadratic hash to find a group with a > > - * free inode > > - */ > > - for (j = 1; j < groups_count; j <<= 1) > > - { > > - i += j; > > - if (i >= groups_count) > > - i -= groups_count; > > - tmp = group_desc (i); > > - if (tmp->bg_free_inodes_count) > > - { > > - gdp = tmp; > > - break; > > - } > > - } > > - } > > + { > > + /* > > + * Use a quadratic hash to find a group with a > > + * free inode > > + */ > > + for (j = 1; j < groups_count; j <<= 1) > > + { > > + i += j; > > + if (i >= groups_count) > > + i -= groups_count; > > + tmp = group_desc (i); > > + if (tmp->bg_free_inodes_count) > > + { > > + gdp = tmp; > > + break; > > + } > > + } > > + } > > if (!gdp) > > - { > > - /* > > - * That failed: try linear search for a free inode > > - */ > > - i = inode_group_num(dir_inum) + 1; > > - for (j = 2; j < groups_count; j++) > > - { > > - if (++i >= groups_count) > > - i = 0; > > - tmp = group_desc (i); > > - if (tmp->bg_free_inodes_count) > > - { > > - gdp = tmp; > > - break; > > - } > > - } > > - } > > + { > > + /* > > + * That failed: try linear search for a free inode > > + */ > > + i = inode_group_num(dir_inum) + 1; > > + for (j = 2; j < groups_count; j++) > > + { > > + if (++i >= groups_count) > > + i = 0; > > + tmp = group_desc (i); > > + if (tmp->bg_free_inodes_count) > > + { > > + gdp = tmp; > > + break; > > + } > > + } > > + } > > } > > > > if (!gdp) > > @@ -226,12 +226,12 @@ repeat: > > < sblock->s_inodes_per_group) > > { > > if (set_bit (inum, bh)) > > - { > > - ext2_warning ("bit already set for inode %llu", inum); > > - disk_cache_block_deref (bh); > > - bh = NULL; > > - goto repeat; > > - } > > + { > > + ext2_warning ("bit already set for inode %llu", inum); > > + disk_cache_block_deref (bh); > > + bh = NULL; > > + goto repeat; > > + } > > record_global_poke (bh); > > bh = NULL; > > } > > @@ -240,11 +240,11 @@ repeat: > > disk_cache_block_deref (bh); > > bh = NULL; > > if (gdp->bg_free_inodes_count != 0) > > - { > > - ext2_error ("free inodes count corrupted in group %d", i); > > - inum = 0; > > - goto sync_out; > > - } > > + { > > + ext2_error ("free inodes count corrupted in group %d", i); > > + inum = 0; > > + goto sync_out; > > + } > > goto repeat; > > } > > > > @@ -252,7 +252,7 @@ repeat: > > if (inum < EXT2_FIRST_INO (sblock) || inum > sblock->s_inodes_count) > > { > > ext2_error ("reserved inode or inode > inodes count - " > > - "block_group = %d,inode=%llu", i, inum); > > + "block_group = %d,inode=%llu", i, inum); > > inum = 0; > > goto sync_out; > > } > > @@ -321,8 +321,8 @@ diskfs_alloc_node (struct node *dir, mode_t mode, > > struct node **node) > > for (block = 0; block < EXT2_N_BLOCKS; block++) > > if (diskfs_node_disknode (np)->info.i_data[block] != 0) > > { > > - diskfs_node_disknode (np)->info.i_data[block] = 0; > > - np->dn_set_ctime = 1; > > + diskfs_node_disknode (np)->info.i_data[block] = 0; > > + np->dn_set_ctime = 1; > > } > > > > if (diskfs_node_disknode (np)->info_i_translator != 0) > > @@ -342,7 +342,7 @@ diskfs_alloc_node (struct node *dir, mode_t mode, > > struct node **node) > > /* Propagate initial inode flags from the directory, as Linux does. */ > > diskfs_node_disknode (np)->info.i_flags = > > ext2_mask_flags(mode, > > - diskfs_node_disknode (dir)->info.i_flags & EXT2_FL_INHERITED); > > + diskfs_node_disknode (dir)->info.i_flags & > > EXT2_FL_INHERITED); > > > > st->st_flags = 0; > > > > @@ -386,11 +386,11 @@ ext2_count_free_inodes () > > x = count_free (bh, sblock->s_inodes_per_group / 8); > > disk_cache_block_deref (bh); > > ext2_debug ("group %d: stored = %d, counted = %lu", > > - i, gdp->bg_free_inodes_count, x); > > + i, gdp->bg_free_inodes_count, x); > > bitmap_count += x; > > } > > ext2_debug ("stored = %u, computed = %lu, %lu", > > - sblock->s_free_inodes_count, desc_count, bitmap_count); > > + sblock->s_free_inodes_count, desc_count, bitmap_count); > > pthread_spin_unlock (&global_lock); > > return desc_count; > > #else > > @@ -421,15 +421,15 @@ ext2_check_inodes_bitmap () > > x = count_free (bh, sblock->s_inodes_per_group / 8); > > disk_cache_block_deref (bh); > > if (gdp->bg_free_inodes_count != x) > > - ext2_error ("wrong free inodes count in group %d, " > > - "stored = %d, counted = %lu", > > - i, gdp->bg_free_inodes_count, x); > > + ext2_error ("wrong free inodes count in group %d, " > > + "stored = %d, counted = %lu", > > + i, gdp->bg_free_inodes_count, x); > > bitmap_count += x; > > } > > if (sblock->s_free_inodes_count != bitmap_count) > > ext2_error ("wrong free inodes count in super block, " > > - "stored = %lu, counted = %lu", > > - (unsigned long) sblock->s_free_inodes_count, bitmap_count); > > + "stored = %lu, counted = %lu", > > + (unsigned long) sblock->s_free_inodes_count, bitmap_count); > > > > pthread_spin_unlock (&global_lock); > > } > > diff --git a/ext2fs/inode.c b/ext2fs/inode.c > > index 3bfbdfdb..fe1af528 100644 > > --- a/ext2fs/inode.c > > +++ b/ext2fs/inode.c > > @@ -169,21 +169,21 @@ diskfs_user_read_node (struct node *np, struct > > lookup_context *ctx) > > st->st_mode &= ~S_ITRANS; > > > > if (di->i_translator) > > - st->st_mode |= S_IPTRANS; > > + st->st_mode |= S_IPTRANS; > > else > > - { > > - size_t datalen = 0; > > - err = ext2_get_xattr (np, "gnu.translator", NULL, &datalen); > > - if (! err && datalen > 0) > > - st->st_mode |= S_IPTRANS; > > - } > > + { > > + size_t datalen = 0; > > + err = ext2_get_xattr (np, "gnu.translator", NULL, &datalen); > > + if (! err && datalen > 0) > > + st->st_mode |= S_IPTRANS; > > + } > > > > st->st_uid = di->i_uid | (di->i_uid_high << 16); > > st->st_gid = di->i_gid | (di->i_gid_high << 16); > > > > st->st_author = di->i_author; > > if (st->st_author == -1) > > - st->st_author = st->st_uid; > > + st->st_author = st->st_uid; > > } > > else > > { > > @@ -208,18 +208,18 @@ diskfs_user_read_node (struct node *np, struct > > lookup_context *ctx) > > { > > info->i_dir_acl = 0; > > if (sizeof (off_t) >= 8) > > - /* 64bit file size */ > > - st->st_size += ((off_t) di->i_size_high) << 32; > > + /* 64bit file size */ > > + st->st_size += ((off_t) di->i_size_high) << 32; > > else > > - { > > - if (di->i_size_high) /* XXX */ > > - { > > - dino_deref (di); > > - ext2_warning ("cannot handle large file inode %Ld", > > np->cache_id); > > - diskfs_end_catch_exception (); > > - return EFBIG; > > - } > > - } > > + { > > + if (di->i_size_high) /* XXX */ > > + { > > + dino_deref (di); > > + ext2_warning ("cannot handle large file inode %Ld", > > np->cache_id); > > + diskfs_end_catch_exception (); > > + return EFBIG; > > + } > > + } > > } > > info->i_block_group = inode_group_num (np->cache_id); > > info->i_next_alloc_block = 0; > > @@ -234,7 +234,7 @@ diskfs_user_read_node (struct node *np, struct > > lookup_context *ctx) > > else > > { > > memcpy (info->i_data, di->i_block, > > - EXT2_N_BLOCKS * sizeof info->i_data[0]); > > + EXT2_N_BLOCKS * sizeof info->i_data[0]); > > st->st_rdev = 0; > > } > > dn->info_i_translator = di->i_translator; > > @@ -252,7 +252,7 @@ diskfs_user_read_node (struct node *np, struct > > lookup_context *ctx) > > /* Round up to a block multiple. */ > > offset = np->allocsize & ((1 << log2_block_size) - 1); > > if (offset > 0) > > - np->allocsize += block_size - offset; > > + np->allocsize += block_size - offset; > > } > > else > > /* Allocsize should be zero for anything except directories, files, and > > @@ -266,7 +266,7 @@ diskfs_user_read_node (struct node *np, struct > > lookup_context *ctx) > > { > > pthread_spin_lock (&generation_lock); > > if (++next_generation < diskfs_mtime->seconds) > > - next_generation = diskfs_mtime->seconds; > > + next_generation = diskfs_mtime->seconds; > > np->dn_stat.st_gen = next_generation; > > pthread_spin_unlock (&generation_lock); > > np->dn_set_ctime = 1; > > @@ -368,38 +368,38 @@ write_node (struct node *np) > > > > err = diskfs_catch_exception (); > > if (err) > > - return NULL; > > + return NULL; > > > > di = dino_ref (np->cache_id); > > > > di->i_generation = st->st_gen; > > > > /* We happen to know that the stat mode bits are the same > > - as the ext2fs mode bits. */ > > + as the ext2fs mode bits. */ > > /* XXX? */ > > > > /* Only the low 16 bits of these fields are standard across all ext2 > > - implementations. */ > > + implementations. */ > > di->i_mode = st->st_mode & 0xFFFF & ~S_ITRANS; > > di->i_uid = st->st_uid & 0xFFFF; > > di->i_gid = st->st_gid & 0xFFFF; > > > > if (sblock->s_creator_os == EXT2_OS_HURD) > > - /* If this is a hurd-compatible filesystem, write the high bits too. > > */ > > - { > > - di->i_mode_high = (st->st_mode >> 16) & 0xffff & ~S_ITRANS; > > - di->i_uid_high = st->st_uid >> 16; > > - di->i_gid_high = st->st_gid >> 16; > > - di->i_author = st->st_author; > > - } > > + /* If this is a hurd-compatible filesystem, write the high bits > > too. */ > > + { > > + di->i_mode_high = (st->st_mode >> 16) & 0xffff & ~S_ITRANS; > > + di->i_uid_high = st->st_uid >> 16; > > + di->i_gid_high = st->st_gid >> 16; > > + di->i_author = st->st_author; > > + } > > else > > - /* No hurd extensions should be turned on. */ > > - { > > - assert_backtrace ((st->st_uid & ~0xFFFF) == 0); > > - assert_backtrace ((st->st_gid & ~0xFFFF) == 0); > > - assert_backtrace ((st->st_mode & ~0xFFFF) == 0); > > - assert_backtrace (np->author_tracks_uid && st->st_author == > > st->st_uid); > > - } > > + /* No hurd extensions should be turned on. */ > > + { > > + assert_backtrace ((st->st_uid & ~0xFFFF) == 0); > > + assert_backtrace ((st->st_gid & ~0xFFFF) == 0); > > + assert_backtrace ((st->st_mode & ~0xFFFF) == 0); > > + assert_backtrace (np->author_tracks_uid && st->st_author == > > st->st_uid); > > + } > > > > di->i_links_count = st->st_nlink; > > > > @@ -419,38 +419,38 @@ write_node (struct node *np) > > > > /* Convert generic flags in ST->st_flags to ext2-specific flags in DI > > (but don't mess with ext