aboutsummaryrefslogtreecommitdiff
path: root/e2fsprogs/ext2fs/inode.c
diff options
context:
space:
mode:
authortimr <timr@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-01-25 00:08:53 +0000
committertimr <timr@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-01-25 00:08:53 +0000
commitfd8222f9b9db2a783b17ec9c59cf3fc22a4e4586 (patch)
tree5f329b7d0c7f20ecced0dc7581a9ba6dc720d965 /e2fsprogs/ext2fs/inode.c
parent45d75f9ecc8f2b582407059da7d414f990ced68a (diff)
downloadbusybox-w32-fd8222f9b9db2a783b17ec9c59cf3fc22a4e4586.tar.gz
busybox-w32-fd8222f9b9db2a783b17ec9c59cf3fc22a4e4586.tar.bz2
busybox-w32-fd8222f9b9db2a783b17ec9c59cf3fc22a4e4586.zip
just whitespace
git-svn-id: svn://busybox.net/trunk/busybox@13584 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'e2fsprogs/ext2fs/inode.c')
-rw-r--r--e2fsprogs/ext2fs/inode.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/e2fsprogs/ext2fs/inode.c b/e2fsprogs/ext2fs/inode.c
index 30580bf6d..e50bece40 100644
--- a/e2fsprogs/ext2fs/inode.c
+++ b/e2fsprogs/ext2fs/inode.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * inode.c --- utility routines to read and write inodes 2 * inode.c --- utility routines to read and write inodes
3 * 3 *
4 * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. 4 * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o.
5 * 5 *
6 * %Begin-Header% 6 * %Begin-Header%
@@ -59,7 +59,7 @@ struct ext2_struct_inode_scan {
59errcode_t ext2fs_flush_icache(ext2_filsys fs) 59errcode_t ext2fs_flush_icache(ext2_filsys fs)
60{ 60{
61 int i; 61 int i;
62 62
63 if (!fs->icache) 63 if (!fs->icache)
64 return 0; 64 return 0;
65 65
@@ -73,7 +73,7 @@ errcode_t ext2fs_flush_icache(ext2_filsys fs)
73static errcode_t create_icache(ext2_filsys fs) 73static errcode_t create_icache(ext2_filsys fs)
74{ 74{
75 errcode_t retval; 75 errcode_t retval;
76 76
77 if (fs->icache) 77 if (fs->icache)
78 return 0; 78 return 0;
79 retval = ext2fs_get_mem(sizeof(struct ext2_inode_cache), &fs->icache); 79 retval = ext2fs_get_mem(sizeof(struct ext2_inode_cache), &fs->icache);
@@ -146,7 +146,7 @@ errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
146 group_desc[scan->current_group].bg_inode_table; 146 group_desc[scan->current_group].bg_inode_table;
147 scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super); 147 scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super);
148 scan->blocks_left = scan->fs->inode_blocks_per_group; 148 scan->blocks_left = scan->fs->inode_blocks_per_group;
149 retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks * 149 retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks *
150 fs->blocksize), 150 fs->blocksize),
151 &scan->inode_buffer); 151 &scan->inode_buffer);
152 scan->done_group = 0; 152 scan->done_group = 0;
@@ -172,7 +172,7 @@ void ext2fs_close_inode_scan(ext2_inode_scan scan)
172{ 172{
173 if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) 173 if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN))
174 return; 174 return;
175 175
176 ext2fs_free_mem(&scan->inode_buffer); 176 ext2fs_free_mem(&scan->inode_buffer);
177 scan->inode_buffer = NULL; 177 scan->inode_buffer = NULL;
178 ext2fs_free_mem(&scan->temp_buffer); 178 ext2fs_free_mem(&scan->temp_buffer);
@@ -190,7 +190,7 @@ void ext2fs_set_inode_callback(ext2_inode_scan scan,
190{ 190{
191 if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) 191 if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN))
192 return; 192 return;
193 193
194 scan->done_group = done_group; 194 scan->done_group = done_group;
195 scan->done_group_data = done_group_data; 195 scan->done_group_data = done_group_data;
196} 196}
@@ -217,7 +217,7 @@ static errcode_t get_next_blockgroup(ext2_inode_scan scan)
217{ 217{
218 scan->current_group++; 218 scan->current_group++;
219 scan->groups_left--; 219 scan->groups_left--;
220 220
221 scan->current_block = scan->fs-> 221 scan->current_block = scan->fs->
222 group_desc[scan->current_group].bg_inode_table; 222 group_desc[scan->current_group].bg_inode_table;
223 223
@@ -335,7 +335,7 @@ static errcode_t get_next_blocks(ext2_inode_scan scan)
335 if (retval) 335 if (retval)
336 return retval; 336 return retval;
337 } 337 }
338 338
339 if ((scan->scan_flags & EXT2_SF_BAD_INODE_BLK) || 339 if ((scan->scan_flags & EXT2_SF_BAD_INODE_BLK) ||
340 (scan->current_block == 0)) { 340 (scan->current_block == 0)) {
341 memset(scan->inode_buffer, 0, 341 memset(scan->inode_buffer, 0,
@@ -367,7 +367,7 @@ static errcode_t get_next_blocks(ext2_inode_scan scan)
367static inline int is_empty_scan(ext2_inode_scan scan) 367static inline int is_empty_scan(ext2_inode_scan scan)
368{ 368{
369 int i; 369 int i;
370 370
371 if (scan->bytes_left == 0) 371 if (scan->bytes_left == 0)
372 return 0; 372 return 0;
373 373
@@ -383,7 +383,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino,
383{ 383{
384 errcode_t retval; 384 errcode_t retval;
385 int extra_bytes = 0; 385 int extra_bytes = 0;
386 386
387 EXT2_CHECK_MAGIC(scan, EXT2_ET_MAGIC_INODE_SCAN); 387 EXT2_CHECK_MAGIC(scan, EXT2_ET_MAGIC_INODE_SCAN);
388 388
389 /* 389 /*
@@ -416,7 +416,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino,
416 } else 416 } else
417 return EXT2_ET_MISSING_INODE_TABLE; 417 return EXT2_ET_MISSING_INODE_TABLE;
418 } 418 }
419 419
420 420
421 /* 421 /*
422 * Have we run out of space in the inode buffer? If so, we 422 * Have we run out of space in the inode buffer? If so, we
@@ -449,9 +449,9 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino,
449#ifdef EXT2FS_ENABLE_SWAPFS 449#ifdef EXT2FS_ENABLE_SWAPFS
450 if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || 450 if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
451 (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) 451 (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
452 ext2fs_swap_inode_full(scan->fs, 452 ext2fs_swap_inode_full(scan->fs,
453 (struct ext2_inode_large *) inode, 453 (struct ext2_inode_large *) inode,
454 (struct ext2_inode_large *) scan->temp_buffer, 454 (struct ext2_inode_large *) scan->temp_buffer,
455 0, bufsize); 455 0, bufsize);
456 else 456 else
457#endif 457#endif
@@ -463,7 +463,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino,
463#ifdef EXT2FS_ENABLE_SWAPFS 463#ifdef EXT2FS_ENABLE_SWAPFS
464 if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || 464 if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
465 (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) 465 (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
466 ext2fs_swap_inode_full(scan->fs, 466 ext2fs_swap_inode_full(scan->fs,
467 (struct ext2_inode_large *) inode, 467 (struct ext2_inode_large *) inode,
468 (struct ext2_inode_large *) scan->ptr, 468 (struct ext2_inode_large *) scan->ptr,
469 0, bufsize); 469 0, bufsize);
@@ -495,10 +495,10 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino,
495errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, 495errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
496 struct ext2_inode * inode, int bufsize) 496 struct ext2_inode * inode, int bufsize)
497{ 497{
498 unsigned long group, block, block_nr, offset; 498 unsigned long group, block, block_nr, offset;
499 char *ptr; 499 char *ptr;
500 errcode_t retval; 500 errcode_t retval;
501 int clen, i, inodes_per_block, length; 501 int clen, i, inodes_per_block, length;
502 io_channel io; 502 io_channel io;
503 503
504 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); 504 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
@@ -541,7 +541,7 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
541 block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super); 541 block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super);
542 if (!fs->group_desc[(unsigned)group].bg_inode_table) 542 if (!fs->group_desc[(unsigned)group].bg_inode_table)
543 return EXT2_ET_MISSING_INODE_TABLE; 543 return EXT2_ET_MISSING_INODE_TABLE;
544 block_nr = fs->group_desc[(unsigned)group].bg_inode_table + 544 block_nr = fs->group_desc[(unsigned)group].bg_inode_table +
545 block; 545 block;
546 io = fs->io; 546 io = fs->io;
547 } 547 }
@@ -577,8 +577,8 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
577#ifdef EXT2FS_ENABLE_SWAPFS 577#ifdef EXT2FS_ENABLE_SWAPFS
578 if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || 578 if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
579 (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) 579 (fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
580 ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode, 580 ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode,
581 (struct ext2_inode_large *) inode, 581 (struct ext2_inode_large *) inode,
582 0, length); 582 0, length);
583#endif 583#endif
584 584
@@ -587,7 +587,7 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
587 fs->icache->cache_size; 587 fs->icache->cache_size;
588 fs->icache->cache[fs->icache->cache_last].ino = ino; 588 fs->icache->cache[fs->icache->cache_last].ino = ino;
589 fs->icache->cache[fs->icache->cache_last].inode = *inode; 589 fs->icache->cache[fs->icache->cache_last].inode = *inode;
590 590
591 return 0; 591 return 0;
592} 592}
593 593
@@ -629,7 +629,7 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
629 if (retval) 629 if (retval)
630 return retval; 630 return retval;
631 } 631 }
632 632
633 if (!(fs->flags & EXT2_FLAG_RW)) 633 if (!(fs->flags & EXT2_FLAG_RW))
634 return EXT2_ET_RO_FILSYS; 634 return EXT2_ET_RO_FILSYS;
635 635
@@ -649,13 +649,13 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
649#ifdef EXT2FS_ENABLE_SWAPFS 649#ifdef EXT2FS_ENABLE_SWAPFS
650 if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || 650 if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
651 (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) 651 (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))
652 ext2fs_swap_inode_full(fs, w_inode, 652 ext2fs_swap_inode_full(fs, w_inode,
653 (struct ext2_inode_large *) inode, 653 (struct ext2_inode_large *) inode,
654 1, bufsize); 654 1, bufsize);
655 else 655 else
656#endif 656#endif
657 memcpy(w_inode, inode, bufsize); 657 memcpy(w_inode, inode, bufsize);
658 658
659 group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super); 659 group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super);
660 offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) * 660 offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) *
661 EXT2_INODE_SIZE(fs->super); 661 EXT2_INODE_SIZE(fs->super);
@@ -685,11 +685,11 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
685 fs->icache->buffer_blk = block_nr; 685 fs->icache->buffer_blk = block_nr;
686 } 686 }
687 687
688 688
689 memcpy((char *) fs->icache->buffer + (unsigned) offset, 689 memcpy((char *) fs->icache->buffer + (unsigned) offset,
690 ptr, clen); 690 ptr, clen);
691 691
692 retval = io_channel_write_blk(fs->io, block_nr, 1, 692 retval = io_channel_write_blk(fs->io, block_nr, 1,
693 fs->icache->buffer); 693 fs->icache->buffer);
694 if (retval) 694 if (retval)
695 goto errout; 695 goto errout;
@@ -699,7 +699,7 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
699 length -= clen; 699 length -= clen;
700 block_nr++; 700 block_nr++;
701 } 701 }
702 702
703 fs->flags |= EXT2_FLAG_CHANGED; 703 fs->flags |= EXT2_FLAG_CHANGED;
704errout: 704errout:
705 if (w_inode && w_inode != &temp_inode) 705 if (w_inode && w_inode != &temp_inode)
@@ -714,7 +714,7 @@ errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino,
714 sizeof(struct ext2_inode)); 714 sizeof(struct ext2_inode));
715} 715}
716 716
717/* 717/*
718 * This function should be called when writing a new inode. It makes 718 * This function should be called when writing a new inode. It makes
719 * sure that extra part of large inodes is initialized properly. 719 * sure that extra part of large inodes is initialized properly.
720 */ 720 */
@@ -722,7 +722,7 @@ errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino,
722 struct ext2_inode *inode) 722 struct ext2_inode *inode)
723{ 723{
724 struct ext2_inode *buf; 724 struct ext2_inode *buf;
725 int size = EXT2_INODE_SIZE(fs->super); 725 int size = EXT2_INODE_SIZE(fs->super);
726 struct ext2_inode_large *large_inode; 726 struct ext2_inode_large *large_inode;
727 727
728 if (size == sizeof(struct ext2_inode)) 728 if (size == sizeof(struct ext2_inode))
@@ -735,19 +735,19 @@ errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino,
735 *buf = *inode; 735 *buf = *inode;
736 736
737 large_inode = (struct ext2_inode_large *) buf; 737 large_inode = (struct ext2_inode_large *) buf;
738 large_inode->i_extra_isize = sizeof(struct ext2_inode_large) - 738 large_inode->i_extra_isize = sizeof(struct ext2_inode_large) -
739 EXT2_GOOD_OLD_INODE_SIZE; 739 EXT2_GOOD_OLD_INODE_SIZE;
740 740
741 return ext2fs_write_inode_full(fs, ino, buf, size); 741 return ext2fs_write_inode_full(fs, ino, buf, size);
742} 742}
743 743
744 744
745errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks) 745errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks)
746{ 746{
747 struct ext2_inode inode; 747 struct ext2_inode inode;
748 int i; 748 int i;
749 errcode_t retval; 749 errcode_t retval;
750 750
751 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); 751 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
752 752
753 if (ino > fs->super->s_inodes_count) 753 if (ino > fs->super->s_inodes_count)
@@ -769,7 +769,7 @@ errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino)
769{ 769{
770 struct ext2_inode inode; 770 struct ext2_inode inode;
771 errcode_t retval; 771 errcode_t retval;
772 772
773 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); 773 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
774 774
775 if (ino > fs->super->s_inodes_count) 775 if (ino > fs->super->s_inodes_count)