[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 06/17] ext2fs: reindent files
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 06/17] ext2fs: reindent files |
Date: |
Sun, 23 Jan 2022 11:01:42 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
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 ext2 flags we don't know about). The original
> - set was copied from DI into INFO by read_node, but might have been
> - modified for ext2fs-specific reasons; so we use INFO->i_flags
> - to start with, and then apply the flags in ST->st_flags. */
> + set was copied from DI into INFO by read_node, but might have been
> + modified for ext2fs-specific reasons; so we use INFO->i_flags
> + to start with, and then apply the flags in ST->st_flags. */
> info->i_flags &= ~(EXT2_APPEND_FL | EXT2_NODUMP_FL |
> EXT2_IMMUTABLE_FL);
> if (st->st_flags & UF_APPEND)
> - info->i_flags |= EXT2_APPEND_FL;
> + info->i_flags |= EXT2_APPEND_FL;
> if (st->st_flags & UF_NODUMP)
> - info->i_flags |= EXT2_NODUMP_FL;
> + info->i_flags |= EXT2_NODUMP_FL;
> if (st->st_flags & UF_IMMUTABLE)
> - info->i_flags |= EXT2_IMMUTABLE_FL;
> + info->i_flags |= EXT2_IMMUTABLE_FL;
> di->i_flags = info->i_flags;
>
> if (st->st_mode == 0)
> - /* Set dtime non-zero to indicate a deleted file.
> - We don't clear i_size, i_blocks, and i_translator in this case,
> - to give "undeletion" utilities a chance. */
> - di->i_dtime = di->i_mtime;
> + /* Set dtime non-zero to indicate a deleted file.
> + We don't clear i_size, i_blocks, and i_translator in this case,
> + to give "undeletion" utilities a chance. */
> + di->i_dtime = di->i_mtime;
> else
> - {
> - di->i_dtime = 0;
> - di->i_size = st->st_size;
> - if (sizeof (off_t) >= 8 && !S_ISDIR (st->st_mode))
> - /* 64bit file size */
> - di->i_size_high = st->st_size >> 32;
> - di->i_blocks = st->st_blocks;
> - }
> + {
> + di->i_dtime = 0;
> + di->i_size = st->st_size;
> + if (sizeof (off_t) >= 8 && !S_ISDIR (st->st_mode))
> + /* 64bit file size */
> + di->i_size_high = st->st_size >> 32;
> + di->i_blocks = st->st_blocks;
> + }
>
> if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode))
> - di->i_block[0] = st->st_rdev;
> + di->i_block[0] = st->st_rdev;
> else
> - memcpy (di->i_block, diskfs_node_disknode (np)->info.i_data,
> - EXT2_N_BLOCKS * sizeof di->i_block[0]);
> + memcpy (di->i_block, diskfs_node_disknode (np)->info.i_data,
> + EXT2_N_BLOCKS * sizeof di->i_block[0]);
>
> diskfs_end_catch_exception ();
> np->dn_stat_dirty = 0;
> @@ -490,7 +490,7 @@ write_all_disknodes ()
> struct ext2_inode *di;
>
> /* Sync the indirect blocks here; they'll all be done before any
> - inodes. Waiting for them shouldn't be too bad. */
> + inodes. Waiting for them shouldn't be too bad. */
> pokel_sync (&diskfs_node_disknode (node)->indir_pokel, 1);
>
> diskfs_set_node_times (node);
> @@ -498,7 +498,7 @@ write_all_disknodes ()
> /* Update the inode image. */
> di = write_node (node);
> if (di)
> - record_global_poke (di);
> + record_global_poke (di);
>
> return 0;
> }
> @@ -516,9 +516,9 @@ diskfs_write_disknode (struct node *np, int wait)
> if (di)
> {
> if (wait)
> - sync_global_ptr (di, 1);
> + sync_global_ptr (di, 1);
> else
> - record_global_poke (di);
> + record_global_poke (di);
> }
> }
>
> @@ -547,7 +547,7 @@ diskfs_set_statfs (struct statfs *st)
> library; see <hurd/diskfs.h> for the interface description. */
> error_t
> diskfs_set_translator (struct node *np, const char *name, unsigned namelen,
> - struct protid *cred)
> + struct protid *cred)
> {
> error_t err;
>
> @@ -573,49 +573,49 @@ diskfs_set_translator (struct node *np, const char
> *name, unsigned namelen,
>
> /* If a legacy translator record found, clear it */
> if (blkno)
> - {
> - ext2_debug ("Old translator record found, clear it");
> -
> - /* Clear block for translator going away. */
> - di->i_translator = 0;
> - diskfs_node_disknode (np)->info_i_translator = 0;
> - record_global_poke (di);
> - ext2_free_blocks (blkno, 1);
> -
> - np->dn_stat.st_blocks -= 1 << log2_stat_blocks_per_fs_block;
> - np->dn_stat.st_mode &= ~S_IPTRANS;
> - np->dn_set_ctime = 1;
> - }
> + {
> + ext2_debug ("Old translator record found, clear it");
> +
> + /* Clear block for translator going away. */
> + di->i_translator = 0;
> + diskfs_node_disknode (np)->info_i_translator = 0;
> + record_global_poke (di);
> + ext2_free_blocks (blkno, 1);
> +
> + np->dn_stat.st_blocks -= 1 << log2_stat_blocks_per_fs_block;
> + np->dn_stat.st_mode &= ~S_IPTRANS;
> + np->dn_set_ctime = 1;
> + }
> else
> - dino_deref (di);
> + dino_deref (di);
>
> /* Use xattr to store translator record, with key "gnu.translator" */
> if (namelen)
> - {
> - err = ext2_set_xattr (np, "gnu.translator", name, namelen, 0);
> -
> - if (!err)
> - {
> - np->dn_stat.st_mode |= S_IPTRANS;
> - np->dn_set_ctime = 1;
> - }
> - }
> + {
> + err = ext2_set_xattr (np, "gnu.translator", name, namelen, 0);
> +
> + if (!err)
> + {
> + np->dn_stat.st_mode |= S_IPTRANS;
> + np->dn_set_ctime = 1;
> + }
> + }
> else
> - {
> - /* Removing the translator. */
> - err = ext2_set_xattr (np, "gnu.translator", NULL, 0, 0);
> -
> - if (err == ENODATA)
> - /* Happens if the key did not exist in the first place. */
> - err = 0;
> -
> - if (!err)
> - {
> - /* Do not use hurd extensions on non-hurd created filesystem */
> - np->dn_stat.st_mode &= ~S_IPTRANS;
> - np->dn_set_ctime = 1;
> - }
> - }
> + {
> + /* Removing the translator. */
> + err = ext2_set_xattr (np, "gnu.translator", NULL, 0, 0);
> +
> + if (err == ENODATA)
> + /* Happens if the key did not exist in the first place. */
> + err = 0;
> +
> + if (!err)
> + {
> + /* Do not use hurd extensions on non-hurd created filesystem */
> + np->dn_stat.st_mode &= ~S_IPTRANS;
> + np->dn_set_ctime = 1;
> + }
> + }
> }
> else
> {
> @@ -625,82 +625,82 @@ diskfs_set_translator (struct node *np, const char
> *name, unsigned namelen,
> char buf[block_size];
>
> if (namelen + 2 > block_size)
> - return ENAMETOOLONG;
> + return ENAMETOOLONG;
>
> di = dino_ref (np->cache_id);
> blkno = di->i_translator;
>
> if (namelen && !blkno)
> - {
> - mode_t newmode = 0;
> -
> - if (S_ISLNK (np->dn_stat.st_mode))
> - {
> - /* Avoid storing both a symlink and a translator,
> - * e2fsck does not like it. */
> - newmode = (np->dn_stat.st_mode & ~S_IFMT) | S_IFREG;
> - err = diskfs_validate_mode_change (np, newmode);
> - if (err)
> - return err;
> - }
> -
> - /* Allocate block for translator */
> - blkno =
> - ext2_new_block ((diskfs_node_disknode (np)->info.i_block_group
> - * EXT2_BLOCKS_PER_GROUP (sblock))
> - + sblock->s_first_data_block,
> - 0, 0, 0);
> - if (blkno == 0)
> - {
> - dino_deref (di);
> - diskfs_end_catch_exception ();
> - return ENOSPC;
> - }
> -
> - if (newmode)
> - {
> - /* Clear previous data */
> - diskfs_truncate (np, 0);
> - np->dn_stat.st_mode = newmode;
> - }
> -
> - di->i_translator = blkno;
> - diskfs_node_disknode (np)->info_i_translator = blkno;
> - record_global_poke (di);
> -
> - np->dn_stat.st_blocks += 1 << log2_stat_blocks_per_fs_block;
> - np->dn_set_ctime = 1;
> - }
> + {
> + mode_t newmode = 0;
> +
> + if (S_ISLNK (np->dn_stat.st_mode))
> + {
> + /* Avoid storing both a symlink and a translator,
> + * e2fsck does not like it. */
> + newmode = (np->dn_stat.st_mode & ~S_IFMT) | S_IFREG;
> + err = diskfs_validate_mode_change (np, newmode);
> + if (err)
> + return err;
> + }
> +
> + /* Allocate block for translator */
> + blkno =
> + ext2_new_block ((diskfs_node_disknode (np)->info.i_block_group
> + * EXT2_BLOCKS_PER_GROUP (sblock))
> + + sblock->s_first_data_block,
> + 0, 0, 0);
> + if (blkno == 0)
> + {
> + dino_deref (di);
> + diskfs_end_catch_exception ();
> + return ENOSPC;
> + }
> +
> + if (newmode)
> + {
> + /* Clear previous data */
> + diskfs_truncate (np, 0);
> + np->dn_stat.st_mode = newmode;
> + }
> +
> + di->i_translator = blkno;
> + diskfs_node_disknode (np)->info_i_translator = blkno;
> + record_global_poke (di);
> +
> + np->dn_stat.st_blocks += 1 << log2_stat_blocks_per_fs_block;
> + np->dn_set_ctime = 1;
> + }
> else if (!namelen && blkno)
> - {
> - /* Clear block for translator going away. */
> - di->i_translator = 0;
> - diskfs_node_disknode (np)->info_i_translator = 0;
> - record_global_poke (di);
> - ext2_free_blocks (blkno, 1);
> -
> - np->dn_stat.st_blocks -= 1 << log2_stat_blocks_per_fs_block;
> - np->dn_stat.st_mode &= ~S_IPTRANS;
> - np->dn_set_ctime = 1;
> - }
> + {
> + /* Clear block for translator going away. */
> + di->i_translator = 0;
> + diskfs_node_disknode (np)->info_i_translator = 0;
> + record_global_poke (di);
> + ext2_free_blocks (blkno, 1);
> +
> + np->dn_stat.st_blocks -= 1 << log2_stat_blocks_per_fs_block;
> + np->dn_stat.st_mode &= ~S_IPTRANS;
> + np->dn_set_ctime = 1;
> + }
> else
> - dino_deref (di);
> + dino_deref (di);
>
> if (namelen)
> - {
> - void *blkptr;
> + {
> + void *blkptr;
>
> - buf[0] = namelen & 0xFF;
> - buf[1] = (namelen >> 8) & 0xFF;
> - memcpy (buf + 2, name, namelen);
> + buf[0] = namelen & 0xFF;
> + buf[1] = (namelen >> 8) & 0xFF;
> + memcpy (buf + 2, name, namelen);
>
> - blkptr = disk_cache_block_ref (blkno);
> - memcpy (blkptr, buf, block_size);
> - record_global_poke (blkptr);
> + blkptr = disk_cache_block_ref (blkno);
> + memcpy (blkptr, buf, block_size);
> + record_global_poke (blkptr);
>
> - np->dn_stat.st_mode |= S_IPTRANS;
> - np->dn_set_ctime = 1;
> - }
> + np->dn_stat.st_mode |= S_IPTRANS;
> + np->dn_set_ctime = 1;
> + }
> }
>
> diskfs_end_catch_exception ();
> @@ -735,22 +735,22 @@ diskfs_get_translator (struct node *np, char **namep,
> unsigned *namelen)
> {
> /* If xattr is no supported by this filesystem, don't report a warning
> */
> if (EXT2_HAS_COMPAT_FEATURE (sblock, EXT2_FEATURE_COMPAT_EXT_ATTR)
> - && use_xattr_translator_records)
> - ext2_debug ("This is an old translator record, please update it");
> + && use_xattr_translator_records)
> + ext2_debug ("This is an old translator record, please update it");
>
> transloc = disk_cache_block_ref (blkno);
> datalen =
> - ((unsigned char *)transloc)[0] + (((unsigned char *)transloc)[1] << 8);
> + ((unsigned char *)transloc)[0] + (((unsigned char *)transloc)[1] <<
> 8);
> if (datalen > block_size - 2)
> - err = EFTYPE; /* ? */
> + err = EFTYPE; /* ? */
> else
> - {
> - *namep = malloc (datalen);
> - if (!*namep)
> - err = ENOMEM;
> - else
> - memcpy (*namep, transloc + 2, datalen);
> - }
> + {
> + *namep = malloc (datalen);
> + if (!*namep)
> + err = ENOMEM;
> + else
> + memcpy (*namep, transloc + 2, datalen);
> + }
>
> disk_cache_block_deref (transloc);
> diskfs_end_catch_exception ();
> diff --git a/ext2fs/msg.c b/ext2fs/msg.c
> index 83939b06..6b8a50ff 100644
> --- a/ext2fs/msg.c
> +++ b/ext2fs/msg.c
> @@ -66,7 +66,7 @@ void _ext2_panic (const char * function, const char * fmt,
> ...)
> va_end (args);
>
> fprintf(stderr, "ext2fs: %s: panic: %s: %s\n",
> - diskfs_disk_name, function, error_buf);
> + diskfs_disk_name, function, error_buf);
>
> pthread_mutex_unlock (&printf_lock);
>
> diff --git a/ext2fs/pager.c b/ext2fs/pager.c
> index a47c53ce..acb7f8b1 100644
> --- a/ext2fs/pager.c
> +++ b/ext2fs/pager.c
> @@ -100,24 +100,24 @@ get_page_buf ()
> buf = free_page_bufs;
> num_free_page_bufs --;
> if (num_free_page_bufs > 0)
> - free_page_bufs += vm_page_size;
> + free_page_bufs += vm_page_size;
> #ifndef NDEBUG
> else
> - free_page_bufs = 0;
> + free_page_bufs = 0;
> #endif /* ! NDEBUG */
> }
> else
> {
> assert_backtrace (free_page_bufs == 0);
> buf = mmap (0, vm_page_size * FREE_PAGE_BUFS,
> - PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
> + PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
> if (buf == MAP_FAILED)
> - buf = 0;
> + buf = 0;
> else
> - {
> - free_page_bufs = buf + vm_page_size;
> - num_free_page_bufs = FREE_PAGE_BUFS - 1;
> - }
> + {
> + free_page_bufs = buf + vm_page_size;
> + num_free_page_bufs = FREE_PAGE_BUFS - 1;
> + }
> }
>
> pthread_mutex_unlock (&free_page_bufs_lock);
> @@ -138,7 +138,7 @@ free_page_buf (void *buf)
> on success otherwise an error code. */
> static error_t
> find_block (struct node *node, vm_offset_t offset,
> - block_t *block, pthread_rwlock_t **lock)
> + block_t *block, pthread_rwlock_t **lock)
> {
> error_t err;
>
> @@ -167,7 +167,7 @@ find_block (struct node *node, vm_offset_t offset,
> to consolidate the i/o if possible. */
> static error_t
> file_pager_read_page (struct node *node, vm_offset_t page,
> - void **buf, int *writelock)
> + void **buf, int *writelock)
> {
> error_t err;
> int offs = 0;
> @@ -178,7 +178,7 @@ file_pager_read_page (struct node *node, vm_offset_t page,
> int num_pending_blocks = 0;
>
> ext2_debug ("reading inode %llu page %lu[%u]",
> - node->cache_id, page, vm_page_size);
> + node->cache_id, page, vm_page_size);
>
> /* Read the NUM_PENDING_BLOCKS blocks in PENDING_BLOCKS, into the buffer
> pointed to by BUF (allocating it if necessary) at offset OFFS. OFFS in
> @@ -187,44 +187,44 @@ file_pager_read_page (struct node *node, vm_offset_t
> page,
> error_t do_pending_reads ()
> {
> if (num_pending_blocks > 0)
> - {
> - store_offset_t dev_block = (store_offset_t) pending_blocks
> - << log2_dev_blocks_per_fs_block;
> - size_t amount = num_pending_blocks << log2_block_size;
> - /* The buffer we try to read into; on the first read, we pass in a
> - size of zero, so that the read is guaranteed to allocate a new
> - buffer, otherwise, we try to read directly into the tail of the
> - buffer we've already got. */
> - void *new_buf = *buf + offs;
> - size_t new_len = offs == 0 ? 0 : vm_page_size - offs;
> -
> - STAT_INC (file_pagein_reads);
> -
> - err = store_read (store, dev_block, amount, &new_buf, &new_len);
> - if (err)
> - return err;
> - else if (amount != new_len)
> - return EIO;
> -
> - if (new_buf != *buf + offs)
> - {
> - /* The read went into a different buffer than the one we
> + {
> + store_offset_t dev_block = (store_offset_t) pending_blocks
> + << log2_dev_blocks_per_fs_block;
> + size_t amount = num_pending_blocks << log2_block_size;
> + /* The buffer we try to read into; on the first read, we pass in a
> + size of zero, so that the read is guaranteed to allocate a new
> + buffer, otherwise, we try to read directly into the tail of the
> + buffer we've already got. */
> + void *new_buf = *buf + offs;
> + size_t new_len = offs == 0 ? 0 : vm_page_size - offs;
> +
> + STAT_INC (file_pagein_reads);
> +
> + err = store_read (store, dev_block, amount, &new_buf, &new_len);
> + if (err)
> + return err;
> + else if (amount != new_len)
> + return EIO;
> +
> + if (new_buf != *buf + offs)
> + {
> + /* The read went into a different buffer than the one we
> passed. */
> - if (offs == 0)
> - /* First read, make the returned page be our buffer. */
> - *buf = new_buf;
> - else
> - /* We've already got some buffer, so copy into it. */
> - {
> - memcpy (*buf + offs, new_buf, new_len);
> - free_page_buf (new_buf); /* Return NEW_BUF to our pool. */
> - STAT_INC (file_pagein_freed_bufs);
> - }
> - }
> -
> - offs += new_len;
> - num_pending_blocks = 0;
> - }
> + if (offs == 0)
> + /* First read, make the returned page be our buffer. */
> + *buf = new_buf;
> + else
> + /* We've already got some buffer, so copy into it. */
> + {
> + memcpy (*buf + offs, new_buf, new_len);
> + free_page_buf (new_buf); /* Return NEW_BUF to our pool. */
> + STAT_INC (file_pagein_freed_bufs);
> + }
> + }
> +
> + offs += new_len;
> + num_pending_blocks = 0;
> + }
>
> return 0;
> }
> @@ -250,33 +250,33 @@ file_pager_read_page (struct node *node, vm_offset_t
> page,
>
> err = find_block (node, page, &block, &lock);
> if (err)
> - break;
> + break;
>
> if (block != pending_blocks + num_pending_blocks)
> - {
> - err = do_pending_reads ();
> - if (err)
> - break;
> - pending_blocks = block;
> - }
> + {
> + err = do_pending_reads ();
> + if (err)
> + break;
> + pending_blocks = block;
> + }
>
> if (block == 0)
> - /* Reading unallocated block, just make a zero-filled one. */
> - {
> - *writelock = 1;
> - if (offs == 0)
> - /* No page allocated to read into yet. */
> - {
> - *buf = get_page_buf ();
> - if (! *buf)
> - break;
> - STAT_INC (file_pagein_alloced_bufs);
> - }
> - memset (*buf + offs, 0, block_size);
> - offs += block_size;
> - }
> + /* Reading unallocated block, just make a zero-filled one. */
> + {
> + *writelock = 1;
> + if (offs == 0)
> + /* No page allocated to read into yet. */
> + {
> + *buf = get_page_buf ();
> + if (! *buf)
> + break;
> + STAT_INC (file_pagein_alloced_bufs);
> + }
> + memset (*buf + offs, 0, block_size);
> + offs += block_size;
> + }
> else
> - num_pending_blocks++;
> + num_pending_blocks++;
>
> page += block_size;
> left -= block_size;
> @@ -314,25 +314,25 @@ pending_blocks_write (struct pending_blocks *pb)
> {
> error_t err;
> store_offset_t dev_block = (store_offset_t) pb->block
> - << log2_dev_blocks_per_fs_block;
> + << log2_dev_blocks_per_fs_block;
> size_t length = pb->num << log2_block_size, amount;
>
> ext2_debug ("writing block %u[%ld]", pb->block, pb->num);
>
> if (pb->offs > 0)
> - /* Put what we're going to write into a page-aligned buffer. */
> - {
> - void *page_buf = get_page_buf ();
> - memcpy ((void *)page_buf, pb->buf + pb->offs, length);
> - err = store_write (store, dev_block, page_buf, length, &amount);
> - free_page_buf (page_buf);
> - }
> + /* Put what we're going to write into a page-aligned buffer. */
> + {
> + void *page_buf = get_page_buf ();
> + memcpy ((void *)page_buf, pb->buf + pb->offs, length);
> + err = store_write (store, dev_block, page_buf, length, &amount);
> + free_page_buf (page_buf);
> + }
> else
> - err = store_write (store, dev_block, pb->buf, length, &amount);
> + err = store_write (store, dev_block, pb->buf, length, &amount);
> if (err)
> - return err;
> + return err;
> else if (amount != length)
> - return EIO;
> + return EIO;
>
> pb->offs += length;
> pb->num = 0;
> @@ -369,7 +369,7 @@ pending_blocks_add (struct pending_blocks *pb, block_t
> block)
> {
> error_t err = pending_blocks_write (pb);
> if (err)
> - return err;
> + return err;
> pb->block = block;
> }
> pb->num++;
> @@ -408,7 +408,7 @@ file_pager_write_page (struct node *node, vm_offset_t
> offset, void *buf)
> {
> err = find_block (node, offset, &block, &lock);
> if (err)
> - break;
> + break;
> assert_backtrace (block);
> pending_blocks_add (&pb, block);
> offset += block_size;
> @@ -449,7 +449,7 @@ disk_pager_read_page (vm_offset_t page, void **buf, int
> *writelock)
> length = dev_end - offset;
>
> err = store_read (store, offset >> store->log2_block_size, length,
> - buf, &read);
> + buf, &read);
> if (read != length)
> return EIO;
> if (!err && length != vm_page_size)
> @@ -474,9 +474,9 @@ disk_pager_write_page (vm_offset_t page, void *buf)
> + offset % block_size;
> #ifdef DEBUG_DISK_CACHE /* Not strictly needed. */
> assert_backtrace ((disk_cache_info[index].last_read ^
> DISK_CACHE_LAST_READ_XOR)
> - == disk_cache_info[index].last_read_xor);
> + == disk_cache_info[index].last_read_xor);
> assert_backtrace (disk_cache_info[index].last_read
> - == disk_cache_info[index].block);
> + == disk_cache_info[index].block);
> #endif
> pthread_mutex_unlock (&disk_cache_lock);
>
> @@ -495,38 +495,38 @@ disk_pager_write_page (vm_offset_t page, void *buf)
> pending_blocks_init (&pb, buf);
>
> while (length > 0 && !err)
> - {
> - block_t block = boffs_block (offset);
> -
> - /* We don't clear the block modified bit here because this paging
> - write request may not be the same one that actually set the bit,
> - and our copy of the page may be out of date; we have to leave
> - the bit on in case a paging write request corresponding to the
> - modification comes along later. The bit is only actually ever
> - cleared if the block is allocated to a file, so this results in
> - excess writes of blocks from modified pages. Unfortunately I
> - know of no way to get arount this given the current external
> - paging interface. XXXX */
> - if (test_bit (block, modified_global_blocks))
> - /* This block may have been modified, so write it out. */
> - err = pending_blocks_add (&pb, block);
> - else
> - /* Otherwise just skip it. */
> - err = pending_blocks_skip (&pb);
> -
> - offset += block_size;
> - length -= block_size;
> - }
> + {
> + block_t block = boffs_block (offset);
> +
> + /* We don't clear the block modified bit here because this paging
> + write request may not be the same one that actually set the bit,
> + and our copy of the page may be out of date; we have to leave
> + the bit on in case a paging write request corresponding to the
> + modification comes along later. The bit is only actually ever
> + cleared if the block is allocated to a file, so this results in
> + excess writes of blocks from modified pages. Unfortunately I
> + know of no way to get arount this given the current external
> + paging interface. XXXX */
> + if (test_bit (block, modified_global_blocks))
> + /* This block may have been modified, so write it out. */
> + err = pending_blocks_add (&pb, block);
> + else
> + /* Otherwise just skip it. */
> + err = pending_blocks_skip (&pb);
> +
> + offset += block_size;
> + length -= block_size;
> + }
>
> if (!err)
> - err = pending_blocks_write (&pb);
> + err = pending_blocks_write (&pb);
> }
> else
> {
> err = store_write (store, offset >> store->log2_block_size,
> - buf, length, &amount);
> + buf, length, &amount);
> if (!err && length != amount)
> - err = EIO;
> + err = EIO;
> }
>
> return err;
> @@ -552,7 +552,7 @@ disk_pager_notify_evict (vm_offset_t page)
> the pager should make the page writeable. */
> error_t
> pager_read_page (struct user_pager_info *pager, vm_offset_t page,
> - vm_address_t *buf, int *writelock)
> + vm_address_t *buf, int *writelock)
> {
> if (pager->type == DISK)
> return disk_pager_read_page (page, (void **)buf, writelock);
> @@ -564,7 +564,7 @@ pager_read_page (struct user_pager_info *pager,
> vm_offset_t page,
> PAGER, from the page at offset PAGE from BUF. */
> error_t
> pager_write_page (struct user_pager_info *pager, vm_offset_t page,
> - vm_address_t buf)
> + vm_address_t buf)
> {
> if (pager->type == DISK)
> return disk_pager_write_page (page, (void *)buf);
> @@ -601,38 +601,38 @@ pager_unlock_page (struct user_pager_info *pager,
> vm_offset_t page)
>
> err = diskfs_catch_exception ();
> if (!err)
> - {
> - block_t block = page >> log2_block_size;
> - int left = (partial_page ? node->allocsize - page : vm_page_size);
> -
> - while (left > 0)
> - {
> - block_t disk_block;
> - err = ext2_getblk (node, block++, 1, &disk_block);
> - if (err)
> - break;
> - left -= block_size;
> - }
> - }
> + {
> + block_t block = page >> log2_block_size;
> + int left = (partial_page ? node->allocsize - page : vm_page_size);
> +
> + while (left > 0)
> + {
> + block_t disk_block;
> + err = ext2_getblk (node, block++, 1, &disk_block);
> + if (err)
> + break;
> + left -= block_size;
> + }
> + }
> diskfs_end_catch_exception ();
>
> if (partial_page)
> - /* If an error occurred, this page still isn't writable; otherwise,
> - since it's at the end of the file, it's now partially writable. */
> - dn->last_page_partially_writable = !err;
> + /* If an error occurred, this page still isn't writable; otherwise,
> + since it's at the end of the file, it's now partially writable.
> */
> + dn->last_page_partially_writable = !err;
> else if (page + vm_page_size == node->allocsize)
> - /* This makes the last page writable, which ends exactly at the end
> - of the file. If any error occurred, the page still isn't
> - writable, and if not, then the whole thing is writable. */
> - dn->last_page_partially_writable = 0;
> + /* This makes the last page writable, which ends exactly at the end
> + of the file. If any error occurred, the page still isn't
> + writable, and if not, then the whole thing is writable. */
> + dn->last_page_partially_writable = 0;
>
> #ifdef EXT2FS_DEBUG
> if (dn->last_page_partially_writable)
> - ext2_debug ("made page %u[%lu] in inode %d partially writable",
> - page, node->allocsize - page, node->cache_id);
> + ext2_debug ("made page %u[%lu] in inode %d partially writable",
> + page, node->allocsize - page, node->cache_id);
> else
> - ext2_debug ("made page %u[%u] in inode %d writable",
> - page, vm_page_size, node->cache_id);
> + ext2_debug ("made page %u[%u] in inode %d writable",
> + page, vm_page_size, node->cache_id);
> #endif
>
> STAT_INC (file_page_unlocks);
> @@ -640,10 +640,10 @@ pager_unlock_page (struct user_pager_info *pager,
> vm_offset_t page)
> pthread_rwlock_unlock (&dn->alloc_lock);
>
> if (err == ENOSPC)
> - ext2_warning ("This filesystem is out of space.");
> + ext2_warning ("This filesystem is out of space.");
> else if (err)
> - ext2_warning ("inode=%Ld, page=0x%lx: %s",
> - node->cache_id, page, strerror (err));
> + ext2_warning ("inode=%Ld, page=0x%lx: %s",
> + node->cache_id, page, strerror (err));
>
> return err;
> }
> @@ -674,64 +674,64 @@ diskfs_grow (struct node *node, off_t size, struct
> protid *cred)
> new_size = round_block (size);
>
> /* The first unallocated blocks after the old and new ends of the
> - file, respectively. */
> + file, respectively. */
> end_block = old_size >> log2_block_size;
> new_end_block = new_size >> log2_block_size;
>
> if (new_end_block > end_block)
> - {
> - /* The first block of the first unallocate page after the old end
> - of the file. If LAST_PAGE_PARTIALLY_WRITABLE is true, any
> - blocks between this and END_BLOCK were unallocated, but are
> - considered `unlocked' -- that is pager_unlock_page has been
> - called on the page they're in. Since after this grow the pager
> - will expect them to be writable, we'd better allocate them. */
> - block_t old_page_end_block =
> - round_page (old_size) >> log2_block_size;
> -
> - ext2_debug ("growing inode %d to %lu bytes (from %lu)",
> node->cache_id,
> - new_size, old_size);
> -
> - if (dn->last_page_partially_writable
> - && old_page_end_block > end_block)
> - {
> - volatile block_t writable_end =
> - (old_page_end_block > new_end_block
> - ? new_end_block
> - : old_page_end_block);
> -
> - ext2_debug ("extending writable page %u by %d blocks"
> - "; first new block = %u",
> - trunc_page (old_size),
> - writable_end - end_block,
> - end_block);
> -
> - err = diskfs_catch_exception ();
> - while (!err && end_block < writable_end)
> - {
> - block_t disk_block;
> - err = ext2_getblk (node, end_block++, 1, &disk_block);
> - }
> - diskfs_end_catch_exception ();
> -
> - if (! err)
> - /* Reflect how much we allocated successfully. */
> - new_size = end_block << log2_block_size;
> - else
> - /* See if it's still valid to say this. */
> - dn->last_page_partially_writable =
> - (old_page_end_block > end_block);
> - }
> - }
> + {
> + /* The first block of the first unallocate page after the old end
> + of the file. If LAST_PAGE_PARTIALLY_WRITABLE is true, any
> + blocks between this and END_BLOCK were unallocated, but are
> + considered `unlocked' -- that is pager_unlock_page has been
> + called on the page they're in. Since after this grow the pager
> + will expect them to be writable, we'd better allocate them. */
> + block_t old_page_end_block =
> + round_page (old_size) >> log2_block_size;
> +
> + ext2_debug ("growing inode %d to %lu bytes (from %lu)",
> node->cache_id,
> + new_size, old_size);
> +
> + if (dn->last_page_partially_writable
> + && old_page_end_block > end_block)
> + {
> + volatile block_t writable_end =
> + (old_page_end_block > new_end_block
> + ? new_end_block
> + : old_page_end_block);
> +
> + ext2_debug ("extending writable page %u by %d blocks"
> + "; first new block = %u",
> + trunc_page (old_size),
> + writable_end - end_block,
> + end_block);
> +
> + err = diskfs_catch_exception ();
> + while (!err && end_block < writable_end)
> + {
> + block_t disk_block;
> + err = ext2_getblk (node, end_block++, 1, &disk_block);
> + }
> + diskfs_end_catch_exception ();
> +
> + if (! err)
> + /* Reflect how much we allocated successfully. */
> + new_size = end_block << log2_block_size;
> + else
> + /* See if it's still valid to say this. */
> + dn->last_page_partially_writable =
> + (old_page_end_block > end_block);
> + }
> + }
>
> STAT_INC (file_grows);
>
> ext2_debug ("new size: %ld%s.", new_size,
> - dn->last_page_partially_writable
> - ? " (last page writable)": "");
> + dn->last_page_partially_writable
> + ? " (last page writable)": "");
> if (err)
> - ext2_warning ("inode=%Ld, target=%Ld: %s",
> - node->cache_id, new_size, strerror (err));
> + ext2_warning ("inode=%Ld, target=%Ld: %s",
> + node->cache_id, new_size, strerror (err));
>
> node->allocsize = new_size;
>
> @@ -792,7 +792,7 @@ flush_node_pager (struct node *node)
> accept and the size of the object. */
> inline error_t
> pager_report_extent (struct user_pager_info *pager,
> - vm_address_t *offset, vm_size_t *size)
> + vm_address_t *offset, vm_size_t *size)
> {
> assert_backtrace (pager->type == DISK || pager->type == FILE_DATA);
>
> @@ -837,10 +837,10 @@ pager_dropweak (struct user_pager_info *upi)
> pthread_spin_lock (&node_to_page_lock);
> pager = diskfs_node_disknode (upi->node)->pager;
> if (pager && pager_get_upi (pager) == upi)
> - {
> - diskfs_node_disknode (upi->node)->pager = NULL;
> - ports_port_deref_weak (pager);
> - }
> + {
> + diskfs_node_disknode (upi->node)->pager = NULL;
> + ports_port_deref_weak (pager);
> + }
> pthread_spin_unlock (&node_to_page_lock);
> }
> }
> @@ -877,10 +877,10 @@ disk_cache_info_free_pop (void)
> pthread_mutex_lock (&disk_cache_info_free_lock);
> p = disk_cache_info_free;
> if (p)
> - {
> - disk_cache_info_free = p->next;
> - p->next = NULL;
> - }
> + {
> + disk_cache_info_free = p->next;
> + p->next = NULL;
> + }
> pthread_mutex_unlock (&disk_cache_info_free_lock);
> }
> while (p && (p->flags & DC_DONT_REUSE || p->ref_count > 0));
> @@ -906,7 +906,7 @@ disk_cache_init (void)
> {
> if (block_size != vm_page_size)
> ext2_panic ("Block size %u != vm_page_size %u",
> - block_size, vm_page_size);
> + block_size, vm_page_size);
>
> pthread_mutex_init (&disk_cache_lock, NULL);
> pthread_cond_init (&disk_cache_reassociation, NULL);
> @@ -934,7 +934,7 @@ disk_cache_init (void)
> #ifdef DEBUG_DISK_CACHE
> disk_cache_info[i].last_read = DC_NO_BLOCK;
> disk_cache_info[i].last_read_xor
> - = DC_NO_BLOCK ^ DISK_CACHE_LAST_READ_XOR;
> + = DC_NO_BLOCK ^ DISK_CACHE_LAST_READ_XOR;
> #endif
> }
>
> @@ -972,26 +972,26 @@ disk_cache_return_unused (void)
> pthread_mutex_lock (&disk_cache_lock);
> for (index = 0; index < disk_cache_blocks; index++)
> if (! (disk_cache_info[index].flags & (DC_DONT_REUSE & ~DC_INCORE))
> - && ! disk_cache_info[index].ref_count)
> + && ! disk_cache_info[index].ref_count)
> {
> - ext2_debug ("return %u -> %d",
> - disk_cache_info[index].block, index);
> - if (index != pending_end)
> - {
> - /* Return previous region, if there is such, ... */
> - if (pending_end >= 0)
> - {
> - pthread_mutex_unlock (&disk_cache_lock);
> - pager_return_some (diskfs_disk_pager,
> - pending_begin * vm_page_size,
> - (pending_end - pending_begin)
> - * vm_page_size, 1);
> - pthread_mutex_lock (&disk_cache_lock);
> - }
> - /* ... and start new region. */
> - pending_begin = index;
> - }
> - pending_end = index + 1;
> + ext2_debug ("return %u -> %d",
> + disk_cache_info[index].block, index);
> + if (index != pending_end)
> + {
> + /* Return previous region, if there is such, ... */
> + if (pending_end >= 0)
> + {
> + pthread_mutex_unlock (&disk_cache_lock);
> + pager_return_some (diskfs_disk_pager,
> + pending_begin * vm_page_size,
> + (pending_end - pending_begin)
> + * vm_page_size, 1);
> + pthread_mutex_lock (&disk_cache_lock);
> + }
> + /* ... and start new region. */
> + pending_begin = index;
> + }
> + pending_end = index + 1;
> }
>
> pthread_mutex_unlock (&disk_cache_lock);
> @@ -999,9 +999,9 @@ disk_cache_return_unused (void)
> /* Return last region, if there is such. */
> if (pending_end >= 0)
> pager_return_some (diskfs_disk_pager,
> - pending_begin * vm_page_size,
> - (pending_end - pending_begin) * vm_page_size,
> - 1);
> + pending_begin * vm_page_size,
> + (pending_end - pending_begin) * vm_page_size,
> + 1);
> else
> {
> ext2_debug ("ext2fs: disk cache is starving\n");
> @@ -1035,27 +1035,27 @@ retry_ref:
>
> /* In process of re-associating? */
> if (disk_cache_info[index].flags & DC_UNTOUCHED)
> - {
> - /* Wait re-association to finish. */
> - pthread_cond_wait (&disk_cache_reassociation, &disk_cache_lock);
> - pthread_mutex_unlock (&disk_cache_lock);
> + {
> + /* Wait re-association to finish. */
> + pthread_cond_wait (&disk_cache_reassociation, &disk_cache_lock);
> + pthread_mutex_unlock (&disk_cache_lock);
>
> #if 0
> - printf ("Re-association -- wait finished.\n");
> + printf ("Re-association -- wait finished.\n");
> #endif
>
> - goto retry_ref;
> - }
> + goto retry_ref;
> + }
>
> /* Just increment reference and return. */
> assert_backtrace (disk_cache_info[index].ref_count + 1
> - > disk_cache_info[index].ref_count);
> + > disk_cache_info[index].ref_count);
> disk_cache_info[index].ref_count++;
>
> ext2_debug ("cached %u -> %d (ref_count = %hu, flags = %#hx, ptr =
> %p)",
> - disk_cache_info[index].block, index,
> - disk_cache_info[index].ref_count,
> - disk_cache_info[index].flags, bptr);
> + disk_cache_info[index].block, index,
> + disk_cache_info[index].ref_count,
> + disk_cache_info[index].flags, bptr);
>
> pthread_mutex_unlock (&disk_cache_lock);
>
> @@ -1115,7 +1115,7 @@ retry_ref:
> int page = (bptr - disk_cache) / vm_page_size;
> assert_backtrace (page >= 0);
> int is_incore = (page < diskfs_disk_pager->pagemapsize
> - && (diskfs_disk_pager->pagemap[page] & PM_INCORE));
> + && (diskfs_disk_pager->pagemap[page] & PM_INCORE));
> pthread_mutex_unlock (&diskfs_disk_pager->interlock);
> if (is_incore)
> {
> @@ -1159,7 +1159,7 @@ retry_ref:
>
> /* Prepare next time association of this page to succeed. */
> pager_flush_some (diskfs_disk_pager, bptr - disk_cache,
> - vm_page_size, 0);
> + vm_page_size, 0);
>
> #if 0
> printf ("Re-association failed.\n");
> @@ -1186,13 +1186,13 @@ disk_cache_block_ref_ptr (void *ptr)
> index = bptr_index (ptr);
> assert_backtrace (disk_cache_info[index].ref_count >= 1);
> assert_backtrace (disk_cache_info[index].ref_count + 1
> - > disk_cache_info[index].ref_count);
> + > disk_cache_info[index].ref_count);
> disk_cache_info[index].ref_count++;
> assert_backtrace (! (disk_cache_info[index].flags & DC_UNTOUCHED));
> ext2_debug ("(%p) (ref_count = %hu, flags = %#hx)",
> - ptr,
> - disk_cache_info[index].ref_count,
> - disk_cache_info[index].flags);
> + ptr,
> + disk_cache_info[index].ref_count,
> + disk_cache_info[index].flags);
> pthread_mutex_unlock (&disk_cache_lock);
> }
>
> @@ -1206,9 +1206,9 @@ _disk_cache_block_deref (void *ptr)
> pthread_mutex_lock (&disk_cache_lock);
> index = bptr_index (ptr);
> ext2_debug ("(%p) (ref_count = %hu, flags = %#hx)",
> - ptr,
> - disk_cache_info[index].ref_count - 1,
> - disk_cache_info[index].flags);
> + ptr,
> + disk_cache_info[index].ref_count - 1,
> + disk_cache_info[index].flags);
> assert_backtrace (! (disk_cache_info[index].flags & DC_UNTOUCHED));
> assert_backtrace (disk_cache_info[index].ref_count >= 1);
> disk_cache_info[index].ref_count--;
> @@ -1252,7 +1252,7 @@ create_disk_pager (void)
> disk_cache_blocks = DISK_CACHE_BLOCKS;
> disk_cache_size = disk_cache_blocks << log2_block_size;
> diskfs_start_disk_pager (upi, disk_pager_bucket, MAY_CACHE, 1,
> - disk_cache_size, &disk_cache);
> + disk_cache_size, &disk_cache);
> disk_cache_init ();
>
> /* The file pager. */
> @@ -1299,49 +1299,49 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot)
> mach_port_t right;
>
> assert_backtrace (S_ISDIR (node->dn_stat.st_mode)
> - || S_ISREG (node->dn_stat.st_mode)
> - || (S_ISLNK (node->dn_stat.st_mode)));
> + || S_ISREG (node->dn_stat.st_mode)
> + || (S_ISLNK (node->dn_stat.st_mode)));
>
> pthread_spin_lock (&node_to_page_lock);
> do
> {
> struct pager *pager = diskfs_node_disknode (node)->pager;
> if (pager)
> - {
> - right = pager_get_port (pager);
> - assert_backtrace (MACH_PORT_VALID (right));
> - pager_get_upi (pager)->max_prot |= prot;
> - }
> + {
> + right = pager_get_port (pager);
> + assert_backtrace (MACH_PORT_VALID (right));
> + pager_get_upi (pager)->max_prot |= prot;
> + }
> else
> - {
> - struct user_pager_info *upi;
> - pager = pager_create_alloc (sizeof *upi, file_pager_bucket,
> - MAY_CACHE, MEMORY_OBJECT_COPY_DELAY, 0);
> - if (pager == NULL)
> - {
> - pthread_spin_unlock (&node_to_page_lock);
> - return MACH_PORT_NULL;
> - }
> -
> - upi = pager_get_upi (pager);
> - upi->type = FILE_DATA;
> - upi->node = node;
> - upi->max_prot = prot;
> - diskfs_nref_light (node);
> - diskfs_node_disknode (node)->pager = pager;
> -
> - /* A weak reference for being part of the node. */
> - ports_port_ref_weak (diskfs_node_disknode (node)->pager);
> -
> - right = pager_get_port (diskfs_node_disknode (node)->pager);
> - ports_port_deref (diskfs_node_disknode (node)->pager);
> - }
> + {
> + struct user_pager_info *upi;
> + pager = pager_create_alloc (sizeof *upi, file_pager_bucket,
> + MAY_CACHE, MEMORY_OBJECT_COPY_DELAY, 0);
> + if (pager == NULL)
> + {
> + pthread_spin_unlock (&node_to_page_lock);
> + return MACH_PORT_NULL;
> + }
> +
> + upi = pager_get_upi (pager);
> + upi->type = FILE_DATA;
> + upi->node = node;
> + upi->max_prot = prot;
> + diskfs_nref_light (node);
> + diskfs_node_disknode (node)->pager = pager;
> +
> + /* A weak reference for being part of the node. */
> + ports_port_ref_weak (diskfs_node_disknode (node)->pager);
> +
> + right = pager_get_port (diskfs_node_disknode (node)->pager);
> + ports_port_deref (diskfs_node_disknode (node)->pager);
> + }
> }
> while (right == MACH_PORT_NULL);
> pthread_spin_unlock (&node_to_page_lock);
>
> mach_port_insert_right (mach_task_self (), right, right,
> - MACH_MSG_TYPE_MAKE_SEND);
> + MACH_MSG_TYPE_MAKE_SEND);
>
> return right;
> }
> @@ -1467,16 +1467,16 @@ enable_caching ()
> pager_change_attributes (p, 1, MEMORY_OBJECT_COPY_DELAY, 0);
>
> /* It's possible that we didn't have caching on before, because
> - the user here is the only reference to the underlying node
> - (actually, that's quite likely inside this particular
> - routine), and if that node has no links. So dinkle the node
> - ref counting scheme here, which will cause caching to be
> - turned off, if that's really necessary. */
> + the user here is the only reference to the underlying node
> + (actually, that's quite likely inside this particular
> + routine), and if that node has no links. So dinkle the node
> + ref counting scheme here, which will cause caching to be
> + turned off, if that's really necessary. */
> if (upi->type == FILE_DATA)
> - {
> - diskfs_nref (upi->node);
> - diskfs_nrele (upi->node);
> - }
> + {
> + diskfs_nref (upi->node);
> + diskfs_nrele (upi->node);
> + }
>
> return 0;
> }
> @@ -1500,15 +1500,15 @@ diskfs_pager_users ()
> disable_caching ();
>
> /* Give it a second; the kernel doesn't actually shutdown
> - immediately. XXX */
> + immediately. XXX */
> sleep (1);
>
> npagers = ports_count_bucket (file_pager_bucket);
> if (npagers == 0)
> - return 0;
> + return 0;
>
> /* Darn, there are actual honest users. Turn caching back on,
> - and return failure. */
> + and return failure. */
> enable_caching ();
> }
>
> @@ -1528,18 +1528,18 @@ diskfs_max_user_pager_prot ()
> if (npagers > 0)
> {
> error_t add_pager_max_prot (void *v_p)
> - {
> - struct pager *p = v_p;
> - struct user_pager_info *upi = pager_get_upi (p);
> - max_prot |= upi->max_prot;
> - /* Stop iterating if MAX_PROT is as filled as it's going to get. */
> - return max_prot == (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
> - }
> + {
> + struct pager *p = v_p;
> + struct user_pager_info *upi = pager_get_upi (p);
> + max_prot |= upi->max_prot;
> + /* Stop iterating if MAX_PROT is as filled as it's going to get. */
> + return max_prot == (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
> + }
>
> disable_caching (); /* Make any silly pagers go away. */
>
> /* Give it a second; the kernel doesn't actually shutdown
> - immediately. XXX */
> + immediately. XXX */
> sleep (1);
>
> ports_bucket_iterate (file_pager_bucket, add_pager_max_prot);
> diff --git a/ext2fs/pokel.c b/ext2fs/pokel.c
> index 38209428..d4373bc5 100644
> --- a/ext2fs/pokel.c
> +++ b/ext2fs/pokel.c
> @@ -68,30 +68,30 @@ pokel_add (struct pokel *pokel, void *loc, vm_size_t
> length)
> vm_size_t p_end = p_offs + pl->length;
>
> if (p_offs <= offset && end <= p_end)
> - {
> - if (pokel->image == disk_cache)
> - for (vm_offset_t i = offset; i < end; i += block_size)
> - _disk_cache_block_deref (disk_cache + i);
> + {
> + if (pokel->image == disk_cache)
> + for (vm_offset_t i = offset; i < end; i += block_size)
> + _disk_cache_block_deref (disk_cache + i);
>
> - break;
> - }
> + break;
> + }
> else if (p_end >= offset && end >= p_offs)
> - {
> - pl->offset = offset < p_offs ? offset : p_offs;
> - pl->length = (end > p_end ? end : p_end) - pl->offset;
> -
> - if (pokel->image == disk_cache)
> - {
> - vm_offset_t i_begin = p_offs > offset ? p_offs : offset;
> - vm_offset_t i_end = p_end < end ? p_end : end;
> - for (vm_offset_t i = i_begin; i < i_end; i += block_size)
> - _disk_cache_block_deref (disk_cache + i);
> - }
> -
> - ext2_debug ("extended 0x%x[%ul] to 0x%x[%ul]",
> - p_offs, p_end - p_offs, pl->offset, pl->length);
> - break;
> - }
> + {
> + pl->offset = offset < p_offs ? offset : p_offs;
> + pl->length = (end > p_end ? end : p_end) - pl->offset;
> +
> + if (pokel->image == disk_cache)
> + {
> + vm_offset_t i_begin = p_offs > offset ? p_offs : offset;
> + vm_offset_t i_end = p_end < end ? p_end : end;
> + for (vm_offset_t i = i_begin; i < i_end; i += block_size)
> + _disk_cache_block_deref (disk_cache + i);
> + }
> +
> + ext2_debug ("extended 0x%x[%ul] to 0x%x[%ul]",
> + p_offs, p_end - p_offs, pl->offset, pl->length);
> + break;
> + }
>
> pl = pl->next;
> }
> @@ -100,12 +100,12 @@ pokel_add (struct pokel *pokel, void *loc, vm_size_t
> length)
> {
> pl = pokel->free_pokes;
> if (pl == NULL)
> - {
> - pl = malloc (sizeof (struct poke));
> - assert_backtrace (pl);
> - }
> + {
> + pl = malloc (sizeof (struct poke));
> + assert_backtrace (pl);
> + }
> else
> - pokel->free_pokes = pl->next;
> + pokel->free_pokes = pl->next;
> pl->offset = offset;
> pl->length = end - offset;
> pl->next = pokel->pokes;
> @@ -130,18 +130,18 @@ _pokel_exec (struct pokel *pokel, int sync, int wait)
> for (pl = pokes; pl; last = pl, pl = pl->next)
> {
> if (sync)
> - {
> - ext2_debug ("syncing 0x%lx[%ul]", pl->offset, pl->length);
> - pager_sync_some (pokel->pager, pl->offset, pl->length, wait);
> - }
> + {
> + ext2_debug ("syncing 0x%lx[%ul]", pl->offset, pl->length);
> + pager_sync_some (pokel->pager, pl->offset, pl->length, wait);
> + }
>
> if (pokel->image == disk_cache)
> - {
> - vm_offset_t begin = trunc_block (pl->offset);
> - vm_offset_t end = round_block (pl->offset + pl->length);
> - for (vm_offset_t i = begin; i != end; i += block_size)
> - _disk_cache_block_deref (pokel->image + i);
> - }
> + {
> + vm_offset_t begin = trunc_block (pl->offset);
> + vm_offset_t end = round_block (pl->offset + pl->length);
> + for (vm_offset_t i = begin; i != end; i += block_size)
> + _disk_cache_block_deref (pokel->image + i);
> + }
> }
>
> if (last)
> @@ -188,7 +188,7 @@ pokel_inherit (struct pokel *pokel, struct pokel *from)
> if (last)
> {
> while (last->next)
> - last = last->next;
> + last = last->next;
> last->next = pokes;
> }
> else
> diff --git a/ext2fs/storeinfo.c b/ext2fs/storeinfo.c
> index 40e0f603..59db97d6 100644
> --- a/ext2fs/storeinfo.c
> +++ b/ext2fs/storeinfo.c
> @@ -26,13 +26,13 @@
>
> error_t
> diskfs_S_file_get_storage_info (struct protid *cred,
> - mach_port_t **ports,
> - mach_msg_type_name_t *ports_type,
> - mach_msg_type_number_t *num_ports,
> - int **ints, mach_msg_type_number_t *num_ints,
> - off_t **offsets,
> - mach_msg_type_number_t *num_offsets,
> - data_t *data, mach_msg_type_number_t *data_len)
> + mach_port_t **ports,
> + mach_msg_type_name_t *ports_type,
> + mach_msg_type_number_t *num_ports,
> + int **ints, mach_msg_type_number_t *num_ints,
> + off_t **offsets,
> + mach_msg_type_number_t *num_offsets,
> + data_t *data, mach_msg_type_number_t
> *data_len)
> {
> error_t err = 0;
> unsigned num_fs_blocks;
> @@ -64,38 +64,38 @@ diskfs_S_file_get_storage_info (struct protid *cred,
>
> err = ext2_getblk (node, index++, 0, &block);
> if (err == EINVAL)
> - /* Either a hole, or past the end of the file.
> - A hole can't be mapped in runs since we don't know
> - where the blocks will be allocated, so we can't return the
> - underlying storage. */
> - err = EOPNOTSUPP;
> + /* Either a hole, or past the end of the file.
> + A hole can't be mapped in runs since we don't know
> + where the blocks will be allocated, so we can't return the
> + underlying storage. */
> + err = EOPNOTSUPP;
> if (err)
> - break;
> + break;
>
> block <<= log2_dev_blocks_per_fs_block;
> if (num_runs == 0
> - || block != run->start + run->length) /* BLOCK doesn't follow RUN */
> - /* Add a new run. */
> - {
> - if (num_runs == runs_alloced)
> - /* Make some more space in RUNS. */
> - {
> - struct store_run *new;
> - runs_alloced *= 2;
> - new = realloc (runs, runs_alloced * sizeof (struct store_run));
> - if (! new)
> - {
> - err = ENOMEM;
> - break;
> - }
> - runs = new;
> - }
> -
> - run = runs + num_runs++;
> - run->start = block;
> - /* The length will get extended just below. */
> - run->length = 0;
> - }
> + || block != run->start + run->length) /* BLOCK doesn't follow RUN
> */
> + /* Add a new run. */
> + {
> + if (num_runs == runs_alloced)
> + /* Make some more space in RUNS. */
> + {
> + struct store_run *new;
> + runs_alloced *= 2;
> + new = realloc (runs, runs_alloced * sizeof (struct store_run));
> + if (! new)
> + {
> + err = ENOMEM;
> + break;
> + }
> + runs = new;
> + }
> +
> + run = runs + num_runs++;
> + run->start = block;
> + /* The length will get extended just below. */
> + run->length = 0;
> + }
>
> /* Increase the size of the current run by one filesystem block. */
> run->length += 1 << log2_dev_blocks_per_fs_block;
> @@ -109,19 +109,19 @@ diskfs_S_file_get_storage_info (struct protid *cred,
> {
> err = store_remap (file_store, runs, num_runs, &file_store);
> if (!err
> - && !idvec_contains (cred->user->uids, 0)
> - && !store_is_securely_returnable (file_store, cred->po->openstat))
> - {
> - err = store_set_flags (file_store, STORE_INACTIVE);
> - if (err == EINVAL)
> - err = EACCES;
> - }
> + && !idvec_contains (cred->user->uids, 0)
> + && !store_is_securely_returnable (file_store, cred->po->openstat))
> + {
> + err = store_set_flags (file_store, STORE_INACTIVE);
> + if (err == EINVAL)
> + err = EACCES;
> + }
> if (! err)
> - {
> - *ports_type = MACH_MSG_TYPE_COPY_SEND;
> - err = store_return (file_store, ports, num_ports, ints, num_ints,
> - offsets, num_offsets, data, data_len);
> - }
> + {
> + *ports_type = MACH_MSG_TYPE_COPY_SEND;
> + err = store_return (file_store, ports, num_ports, ints, num_ints,
> + offsets, num_offsets, data, data_len);
> + }
> store_free (file_store);
> }
>
> diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c
> index 44aab3c7..756aad0b 100644
> --- a/ext2fs/truncate.c
> +++ b/ext2fs/truncate.c
> @@ -116,9 +116,9 @@ trunc_direct (struct node *node, block_t end, struct
> free_block_run *fbr)
> set to 0, otherwise it is left alone. */
> static void
> trunc_indirect (struct node *node, block_t end,
> - block_t *p, block_t offset,
> - void (*free_block)(block_t *p, unsigned index),
> - struct free_block_run *fbr)
> + block_t *p, block_t offset,
> + void (*free_block)(block_t *p, unsigned index),
> + struct free_block_run *fbr)
> {
> if (*p)
> {
> @@ -128,34 +128,34 @@ trunc_indirect (struct node *node, block_t end,
> unsigned first = end < offset ? 0 : end - offset;
>
> for (index = first; index < addr_per_block; index++)
> - if (ind_bh[index])
> - {
> - (*free_block)(ind_bh + index, index);
> - if (ind_bh[index])
> - all_freed = 0; /* Some descendent hasn't been freed. */
> - else
> - modified = 1;
> - }
> + if (ind_bh[index])
> + {
> + (*free_block)(ind_bh + index, index);
> + if (ind_bh[index])
> + all_freed = 0; /* Some descendent hasn't been freed. */
> + else
> + modified = 1;
> + }
>
> if (first == 0 && all_freed)
> - {
> - pager_flush_some (diskfs_disk_pager,
> - bptr_index (ind_bh) << log2_block_size,
> - block_size, 1);
> - free_block_run_free_ptr (fbr, p);
> - disk_cache_block_deref (ind_bh);
> - }
> + {
> + pager_flush_some (diskfs_disk_pager,
> + bptr_index (ind_bh) << log2_block_size,
> + block_size, 1);
> + free_block_run_free_ptr (fbr, p);
> + disk_cache_block_deref (ind_bh);
> + }
> else if (modified)
> - record_indir_poke (node, ind_bh);
> + record_indir_poke (node, ind_bh);
> else
> - disk_cache_block_deref (ind_bh);
> + disk_cache_block_deref (ind_bh);
> }
> }
>
> static void
> trunc_single_indirect (struct node *node, block_t end,
> - block_t *p, block_t offset,
> - struct free_block_run *fbr)
> + block_t *p, block_t offset,
> + struct free_block_run *fbr)
> {
> void free_block (block_t *p, unsigned index)
> {
> @@ -166,8 +166,8 @@ trunc_single_indirect (struct node *node, block_t end,
>
> static void
> trunc_double_indirect (struct node *node, block_t end,
> - block_t *p, block_t offset,
> - struct free_block_run *fbr)
> + block_t *p, block_t offset,
> + struct free_block_run *fbr)
> {
> void free_block (block_t *p, unsigned index)
> {
> @@ -179,8 +179,8 @@ trunc_double_indirect (struct node *node, block_t end,
>
> static void
> trunc_triple_indirect (struct node *node, block_t end,
> - block_t *p, block_t offset,
> - struct free_block_run *fbr)
> + block_t *p, block_t offset,
> + struct free_block_run *fbr)
> {
> void free_block (block_t *p, unsigned index)
> {
> @@ -204,17 +204,17 @@ poke_pages (memory_object_t obj, vm_offset_t start,
> vm_offset_t end)
> vm_address_t addr = 0;
>
> if (len > end - start)
> - len = end - start;
> + len = end - start;
>
> err = vm_map (mach_task_self (), &addr, len, 0, 1, obj, start, 0,
> - VM_PROT_WRITE|VM_PROT_READ, VM_PROT_READ|VM_PROT_WRITE, 0);
> + VM_PROT_WRITE|VM_PROT_READ, VM_PROT_READ|VM_PROT_WRITE,
> 0);
> if (!err)
> - {
> - vm_address_t poke;
> - for (poke = addr; poke < addr + len; poke += vm_page_size)
> - *(volatile int *)poke = *(volatile int *)poke;
> - munmap ((caddr_t) addr, len);
> - }
> + {
> + vm_address_t poke;
> + for (poke = addr; poke < addr + len; poke += vm_page_size)
> + *(volatile int *)poke = *(volatile int *)poke;
> + munmap ((caddr_t) addr, len);
> + }
>
> start += len;
> }
> @@ -242,13 +242,13 @@ force_delayed_copies (struct node *node, off_t length)
> pager_change_attributes (pager, MAY_CACHE, MEMORY_OBJECT_COPY_NONE, 1);
> obj = diskfs_get_filemap (node, VM_PROT_READ | VM_PROT_WRITE);
> if (obj != MACH_PORT_NULL)
> - {
> - /* XXX should cope with errors from diskfs_get_filemap */
> - poke_pages (obj, round_page (length), round_page (node->allocsize));
> - mach_port_deallocate (mach_task_self (), obj);
> - pager_flush_some (pager, round_page(length),
> - node->allocsize - length, 1);
> - }
> + {
> + /* XXX should cope with errors from diskfs_get_filemap */
> + poke_pages (obj, round_page (length), round_page
> (node->allocsize));
> + mach_port_deallocate (mach_task_self (), obj);
> + pager_flush_some (pager, round_page(length),
> + node->allocsize - length, 1);
> + }
>
> ports_port_deref (pager);
> }
> @@ -300,14 +300,14 @@ diskfs_truncate (struct node *node, off_t length)
> off_t frobmax = sizeof(diskfs_node_disknode (node)->info.i_data);
>
> if (froblen > frobmax)
> - {
> - ext2_warning ("inline data was %lld, more than max %lld",
> - (long long) froblen, (long long) frobmax);
> - froblen = frobmax;
> - }
> + {
> + ext2_warning ("inline data was %lld, more than max %lld",
> + (long long) froblen, (long long) frobmax);
> + froblen = frobmax;
> + }
> froblen -= length;
> memset (((char *) (diskfs_node_disknode (node)->info.i_data)) + length,
> - 0, froblen);
> + 0, froblen);
>
> node->dn_stat.st_size = length;
> node->dn_set_mtime = 1;
> @@ -326,7 +326,7 @@ diskfs_truncate (struct node *node, off_t length)
> if (offset > 0)
> {
> diskfs_node_rdwr (node, (void *)zeroblock, length, block_size - offset,
> - 1, 0, 0);
> + 1, 0, 0);
> /* Make sure that really happens to avoid leaks. */
> diskfs_file_update (node, 1);
> }
> @@ -367,9 +367,9 @@ diskfs_truncate (struct node *node, off_t length)
> node->allocsize = round_block (length);
>
> /* Set our last_page_partially_writable to a pessimistic state -- it
> - won't hurt if is wrong. */
> + won't hurt if is wrong. */
> diskfs_node_disknode (node)->last_page_partially_writable =
> - trunc_page (node->allocsize) != node->allocsize;
> + trunc_page (node->allocsize) != node->allocsize;
>
> diskfs_end_catch_exception ();
> }
> diff --git a/ext2fs/xattr.c b/ext2fs/xattr.c
> index ff84a3b9..6bb89bec 100644
> --- a/ext2fs/xattr.c
> +++ b/ext2fs/xattr.c
> @@ -57,12 +57,12 @@ xattr_name_prefix (const char *full_name, int *index,
> const char **name)
> for (i = 0; xattr_prefixes[i].prefix != NULL; i++)
> {
> if (!strncmp (xattr_prefixes[i].prefix, full_name,
> - xattr_prefixes[i].size))
> - {
> - *name = full_name + xattr_prefixes[i].size;
> - *index = xattr_prefixes[i].index;
> - break;
> - }
> + xattr_prefixes[i].size))
> + {
> + *name = full_name + xattr_prefixes[i].size;
> + *index = xattr_prefixes[i].index;
> + break;
> + }
> }
> return i;
> }
> @@ -75,7 +75,7 @@ xattr_name_prefix (const char *full_name, int *index, const
> char **name)
> */
> static void
> xattr_entry_hash (struct ext2_xattr_header *header,
> - struct ext2_xattr_entry *entry)
> + struct ext2_xattr_entry *entry)
> {
>
> __u32 hash = 0;
> @@ -86,19 +86,19 @@ xattr_entry_hash (struct ext2_xattr_header *header,
> {
> hash = (hash << NAME_HASH_SHIFT)
> ^ (hash >> (8 * sizeof (hash) - NAME_HASH_SHIFT))
> - ^ *name++;
> + ^ *name++;
> }
>
> if (entry->e_value_block == 0 && entry->e_value_size != 0)
> {
> __u32 *value = (__u32 *) ((char *) header + entry->e_value_offs);
> for (n = (entry->e_value_size + EXT2_XATTR_ROUND) >>
> - EXT2_XATTR_PAD_BITS; n; n--)
> - {
> - hash = (hash << VALUE_HASH_SHIFT)
> - ^ (hash >> (8 * sizeof (hash) - VALUE_HASH_SHIFT))
> - ^ *value++;
> - }
> + EXT2_XATTR_PAD_BITS; n; n--)
> + {
> + hash = (hash << VALUE_HASH_SHIFT)
> + ^ (hash >> (8 * sizeof (hash) - VALUE_HASH_SHIFT))
> + ^ *value++;
> + }
> }
>
> entry->e_hash = hash;
> @@ -116,7 +116,7 @@ xattr_entry_hash (struct ext2_xattr_header *header,
> */
> static void
> xattr_entry_rehash (struct ext2_xattr_header *header,
> - struct ext2_xattr_entry *entry)
> + struct ext2_xattr_entry *entry)
> {
>
> __u32 hash = 0;
> @@ -128,15 +128,15 @@ xattr_entry_rehash (struct ext2_xattr_header *header,
> while (!EXT2_XATTR_ENTRY_LAST (position))
> {
> if (position->e_hash == 0)
> - {
> - /* Block is not shared if an entry's hash value == 0 */
> - hash = 0;
> - break;
> - }
> + {
> + /* Block is not shared if an entry's hash value == 0 */
> + hash = 0;
> + break;
> + }
>
> hash = (hash << BLOCK_HASH_SHIFT)
> - ^ (hash >> (8 * sizeof (hash) - BLOCK_HASH_SHIFT))
> - ^ position->e_hash;
> + ^ (hash >> (8 * sizeof (hash) - BLOCK_HASH_SHIFT))
> + ^ position->e_hash;
>
> position = EXT2_XATTR_ENTRY_NEXT (position);
> }
> @@ -165,7 +165,7 @@ xattr_entry_list (struct ext2_xattr_entry *entry, char
> *buffer, size_t *len)
> for (i = 0; xattr_prefixes[i].prefix != NULL; i++)
> {
> if (entry->e_name_index == xattr_prefixes[i].index)
> - break;
> + break;
> }
>
> if (xattr_prefixes[i].prefix == NULL)
> @@ -176,17 +176,17 @@ xattr_entry_list (struct ext2_xattr_entry *entry, char
> *buffer, size_t *len)
> if (buffer)
> {
> if (size <= *len)
> - {
> - memcpy (buffer, xattr_prefixes[i].prefix, xattr_prefixes[i].size);
> - buffer += xattr_prefixes[i].size;
> - memcpy (buffer, entry->e_name, entry->e_name_len);
> - buffer += entry->e_name_len;
> - *buffer++ = 0;
> - }
> + {
> + memcpy (buffer, xattr_prefixes[i].prefix, xattr_prefixes[i].size);
> + buffer += xattr_prefixes[i].size;
> + memcpy (buffer, entry->e_name, entry->e_name_len);
> + buffer += entry->e_name_len;
> + *buffer++ = 0;
> + }
> else
> - {
> - return ERANGE;
> - }
> + {
> + return ERANGE;
> + }
> }
>
> *len -= size;
> @@ -209,7 +209,7 @@ xattr_entry_list (struct ext2_xattr_entry *entry, char
> *buffer, size_t *len)
> */
> static error_t
> xattr_entry_get (void *block, struct ext2_xattr_entry *entry,
> - const char *full_name, char *value, size_t *len, int *cmp)
> + const char *full_name, char *value, size_t *len, int *cmp)
> {
>
> int i;
> @@ -231,16 +231,16 @@ xattr_entry_get (void *block, struct ext2_xattr_entry
> *entry,
> if (tmp_cmp)
> {
> if (cmp)
> - *cmp = tmp_cmp;
> + *cmp = tmp_cmp;
> return ENODATA;
> }
>
> if (value)
> {
> if (*len < entry->e_value_size)
> - {
> - return ERANGE;
> - }
> + {
> + return ERANGE;
> + }
> memcpy (value, block + entry->e_value_offs, entry->e_value_size);
> }
>
> @@ -258,10 +258,10 @@ xattr_entry_get (void *block, struct ext2_xattr_entry
> *entry,
> */
> static error_t
> xattr_entry_create (struct ext2_xattr_header *header,
> - struct ext2_xattr_entry *last,
> - struct ext2_xattr_entry *position,
> - const char *full_name, const char *value,
> - size_t len, size_t rest)
> + struct ext2_xattr_entry *last,
> + struct ext2_xattr_entry *position,
> + const char *full_name, const char *value,
> + size_t len, size_t rest)
> {
>
> int i;
> @@ -302,7 +302,7 @@ xattr_entry_create (struct ext2_xattr_header *header,
>
> memcpy ((char *) header + position->e_value_offs, value, len);
> memset ((char *) header + position->e_value_offs + len, 0,
> - value_size - len);
> + value_size - len);
>
> return 0;
>
> @@ -315,8 +315,8 @@ xattr_entry_create (struct ext2_xattr_header *header,
> */
> static error_t
> xattr_entry_remove (struct ext2_xattr_header *header,
> - struct ext2_xattr_entry *last,
> - struct ext2_xattr_entry *position, size_t rest)
> + struct ext2_xattr_entry *last,
> + struct ext2_xattr_entry *position, size_t rest)
> {
>
> size_t size;
> @@ -330,7 +330,7 @@ xattr_entry_remove (struct ext2_xattr_header *header,
> end = position->e_value_offs;
>
> memmove ((char *) header + start + size, (char *) header + start,
> - end - start);
> + end - start);
> memset ((char *) header + start, 0, size);
>
> /* Adjust all value offsets */
> @@ -338,7 +338,7 @@ xattr_entry_remove (struct ext2_xattr_header *header,
> while (!EXT2_XATTR_ENTRY_LAST (entry))
> {
> if (entry->e_value_offs < end)
> - entry->e_value_offs += size;
> + entry->e_value_offs += size;
> entry = EXT2_XATTR_ENTRY_NEXT (entry);
> }
>
> @@ -348,7 +348,7 @@ xattr_entry_remove (struct ext2_xattr_header *header,
> end = EXT2_XATTR_ENTRY_OFFSET (header, last);
>
> memmove ((char *) header + start , (char *) header + start + size,
> - end - (start + size));
> + end - (start + size));
> memset ((char *) header + end - size, 0, size);
>
> return 0;
> @@ -364,9 +364,9 @@ xattr_entry_remove (struct ext2_xattr_header *header,
> */
> static error_t
> xattr_entry_replace (struct ext2_xattr_header *header,
> - struct ext2_xattr_entry *last,
> - struct ext2_xattr_entry *position,
> - const char *value, size_t len, size_t rest)
> + struct ext2_xattr_entry *last,
> + struct ext2_xattr_entry *position,
> + const char *value, size_t len, size_t rest)
> {
>
> size_t old_size;
> @@ -389,16 +389,16 @@ xattr_entry_replace (struct ext2_xattr_header *header,
>
> /* Remove the old value */
> memmove ((char *) header + start + old_size, (char *) header + start,
> - end - start);
> + end - start);
>
> /* Adjust all value offsets */
> entry = EXT2_XATTR_ENTRY_FIRST (header);
> while (!EXT2_XATTR_ENTRY_LAST (entry))
> - {
> - if (entry->e_value_offs < end)
> - entry->e_value_offs += old_size;
> - entry = EXT2_XATTR_ENTRY_NEXT (entry);
> - }
> + {
> + if (entry->e_value_offs < end)
> + entry->e_value_offs += old_size;
> + entry = EXT2_XATTR_ENTRY_NEXT (entry);
> + }
>
> position->e_value_offs = start - (new_size - old_size);
> }
> @@ -548,7 +548,7 @@ ext2_list_xattr (struct node *np, char *buffer, size_t
> *len)
> {
> err = xattr_entry_list (entry, buffer, &size);
> if (err)
> - goto cleanup;
> + goto cleanup;
> if (buffer)
> buffer += strlen (buffer) + 1;
> entry = EXT2_XATTR_ENTRY_NEXT (entry);
> @@ -623,8 +623,8 @@ ext2_get_xattr (struct node *np, const char *name, char
> *value, size_t *len)
> {
> size = *len;
> err = xattr_entry_get (block, entry, name, value, &size, NULL);
> - if (err!= ENODATA)
> - break;
> + if (err != ENODATA)
> + break;
> entry = EXT2_XATTR_ENTRY_NEXT (entry);
> }
>
> @@ -656,7 +656,7 @@ cleanup:
> */
> error_t
> ext2_set_xattr (struct node *np, const char *name, const char *value,
> - size_t len, int flags)
> + size_t len, int flags)
> {
>
> int found;
> @@ -700,14 +700,14 @@ ext2_set_xattr (struct node *np, const char *name,
> const char *value,
> assert_backtrace (!diskfs_readonly);
>
> goal = sblock->s_first_data_block + np->dn->info.i_block_group *
> - EXT2_BLOCKS_PER_GROUP (sblock);
> + EXT2_BLOCKS_PER_GROUP (sblock);
> blkno = ext2_new_block (goal, 0, 0, 0);
>
> if (blkno == 0)
> - {
> - err = ENOSPC;
> - goto cleanup;
> - }
> + {
> + err = ENOSPC;
> + goto cleanup;
> + }
>
> block = disk_cache_block_ref (blkno);
> memset (block, 0, block_size);
> @@ -722,11 +722,11 @@ ext2_set_xattr (struct node *np, const char *name,
> const char *value,
> block = disk_cache_block_ref (blkno);
> header = EXT2_XATTR_HEADER (block);
> if (header->h_magic != EXT2_XATTR_BLOCK_MAGIC || header->h_blocks != 1)
> - {
> - ext2_warning ("Invalid extended attribute block.");
> - err = EIO;
> - goto cleanup;
> - }
> + {
> + ext2_warning ("Invalid extended attribute block.");
> + err = EIO;
> + goto cleanup;
> + }
> }
>
> entry = EXT2_XATTR_ENTRY_FIRST (header);
> @@ -743,23 +743,23 @@ ext2_set_xattr (struct node *np, const char *name,
> const char *value,
>
> err = xattr_entry_get (NULL, entry, name, NULL, &size, &cmp);
> if (err == 0)
> - {
> - location = entry;
> - found = TRUE;
> - }
> + {
> + location = entry;
> + found = TRUE;
> + }
> else if (err == ENODATA)
> - {
> - /* The xattr entries are sorted by attribute name */
> - if (cmp < 0 && !found)
> - {
> - location = entry;
> - found = FALSE;
> - }
> - }
> + {
> + /* The xattr entries are sorted by attribute name */
> + if (cmp < 0 && !found)
> + {
> + location = entry;
> + found = FALSE;
> + }
> + }
> else
> - {
> - break;
> - }
> + {
> + break;
> + }
>
> rest -= EXT2_XATTR_ALIGN (entry->e_value_size);
> entry = EXT2_XATTR_ENTRY_NEXT (entry);
> @@ -786,46 +786,46 @@ ext2_set_xattr (struct node *np, const char *name,
> const char *value,
> if (value && flags & XATTR_CREATE)
> {
> if (found)
> - {
> - err = EEXIST;
> - goto cleanup;
> - }
> + {
> + err = EEXIST;
> + goto cleanup;
> + }
> else
> - err = xattr_entry_create (header, entry, location, name, value, len,
> - rest);
> + err = xattr_entry_create (header, entry, location, name, value, len,
> + rest);
> }
> else if (value && flags & XATTR_REPLACE)
> {
> if (!found)
> - {
> - err = ENODATA;
> - goto cleanup;
> - }
> + {
> + err = ENODATA;
> + goto cleanup;
> + }
> else
> - err = xattr_entry_replace (header, entry, location, value, len, rest);
> + err = xattr_entry_replace (header, entry, location, value, len,
> rest);
> }
> else if (value)
> {
> if (found)
> - err = xattr_entry_replace (header, entry, location, value, len, rest);
> + err = xattr_entry_replace (header, entry, location, value, len,
> rest);
> else
> - err = xattr_entry_create (header, entry, location, name, value, len,
> - rest);
> + err = xattr_entry_create (header, entry, location, name, value, len,
> + rest);
> }
> else
> {
> if (flags & XATTR_REPLACE || flags & XATTR_CREATE)
> - {
> - err = EINVAL;
> - goto cleanup;
> - }
> + {
> + err = EINVAL;
> + goto cleanup;
> + }
> else if (!found)
> - {
> - err = ENODATA;
> - goto cleanup;
> - }
> + {
> + err = ENODATA;
> + goto cleanup;
> + }
> else
> - err = xattr_entry_remove (header, entry, location, rest);
> + err = xattr_entry_remove (header, entry, location, rest);
> }
>
> /* Check if the xattr block is empty */
> @@ -835,31 +835,31 @@ ext2_set_xattr (struct node *np, const char *name,
> const char *value,
> if (err == 0)
> {
> if (empty)
> - {
> - disk_cache_block_deref (block);
> - dino_deref (ei);
> + {
> + disk_cache_block_deref (block);
> + dino_deref (ei);
>
> - return ext2_free_xattr_block (np);
> - }
> + return ext2_free_xattr_block (np);
> + }
> else
> - {
> - xattr_entry_rehash (header, location);
> + {
> + xattr_entry_rehash (header, location);
>
> - record_global_poke (block);
> + record_global_poke (block);
>
> - if (ei->i_file_acl == 0)
> - {
> - np->dn_stat.st_blocks += 1 << log2_stat_blocks_per_fs_block;
> - np->dn_set_ctime = 1;
> + if (ei->i_file_acl == 0)
> + {
> + np->dn_stat.st_blocks += 1 << log2_stat_blocks_per_fs_block;
> + np->dn_set_ctime = 1;
>
> - ei->i_file_acl = blkno;
> - record_global_poke (ei);
> - }
> - else
> - dino_deref (ei);
> + ei->i_file_acl = blkno;
> + record_global_poke (ei);
> + }
> + else
> + dino_deref (ei);
>
> - return 0;
> - }
> + return 0;
> + }
> }
>
> cleanup:
> --
> 2.34.1
>
>
>
--
Samuel
Be warned that typing \fBkillall \fIname\fP may not have the desired
effect on non-Linux systems, especially when done by a privileged user.
(From the killall manual page)
- [PATCH 01/17] ext2fs Merge 2 headers, Etienne Brateau, 2022/01/22
- [PATCH 08/17] ext2fs: Take cares of indiannes, Etienne Brateau, 2022/01/22
- [PATCH 10/17] ext2fs: set the writing time in the superblock, Etienne Brateau, 2022/01/22
- [PATCH 11/17] ext2fs: resolve a todo, check writability before writing, Etienne Brateau, 2022/01/22
- [PATCH 14/17] ext2fs: refactor add a method for dupplicated code, Etienne Brateau, 2022/01/22