Line
Link Here
|
0 |
-- a/grub/asmstub.c |
0 |
++ b/grub/asmstub.c |
Lines 1037-1043
hex_dump (void *buf, size_t size)
Link Here
|
1037 |
|
1037 |
|
1038 |
int |
1038 |
int |
1039 |
biosdisk (int subfunc, int drive, struct geometry *geometry, |
1039 |
biosdisk (int subfunc, int drive, struct geometry *geometry, |
1040 |
int sector, int nsec, int segment) |
1040 |
unsigned sector, unsigned nsec, int segment) |
1041 |
{ |
1041 |
{ |
1042 |
char *buf; |
1042 |
char *buf; |
1043 |
int fd = geometry->flags; |
1043 |
int fd = geometry->flags; |
1044 |
-- a/stage2/bios.c |
1044 |
++ b/stage2/bios.c |
Lines 47-53
extern int get_diskinfo_floppy (int drive,
Link Here
|
47 |
return the error number. Otherwise, return 0. */ |
47 |
return the error number. Otherwise, return 0. */ |
48 |
int |
48 |
int |
49 |
biosdisk (int read, int drive, struct geometry *geometry, |
49 |
biosdisk (int read, int drive, struct geometry *geometry, |
50 |
int sector, int nsec, int segment) |
50 |
unsigned sector, unsigned nsec, int segment) |
51 |
{ |
51 |
{ |
52 |
int err; |
52 |
int err; |
53 |
|
53 |
|
54 |
-- a/stage2/builtins.c |
54 |
++ b/stage2/builtins.c |
Lines 125-131
check_password (char *entered, char* expected, password_t type)
Link Here
|
125 |
|
125 |
|
126 |
/* Print which sector is read when loading a file. */ |
126 |
/* Print which sector is read when loading a file. */ |
127 |
static void |
127 |
static void |
128 |
disk_read_print_func (int sector, int offset, int length) |
128 |
disk_read_print_func (unsigned sector, unsigned offset, int length) |
129 |
{ |
129 |
{ |
130 |
grub_printf ("[%d,%d,%d]", sector, offset, length); |
130 |
grub_printf ("[%d,%d,%d]", sector, offset, length); |
131 |
} |
131 |
} |
Lines 3431-3438
savedefault_func (char *arg, int flags)
Link Here
|
3431 |
int saved_lengths[2]; |
3431 |
int saved_lengths[2]; |
3432 |
|
3432 |
|
3433 |
/* Save sector information about at most two sectors. */ |
3433 |
/* Save sector information about at most two sectors. */ |
3434 |
auto void disk_read_savesect_func (int sector, int offset, int length); |
3434 |
auto void disk_read_savesect_func (unsigned sector, unsigned offset, int length); |
3435 |
void disk_read_savesect_func (int sector, int offset, int length) |
3435 |
void disk_read_savesect_func (unsigned sector, unsigned offset, int length) |
3436 |
{ |
3436 |
{ |
3437 |
if (sector_count < 2) |
3437 |
if (sector_count < 2) |
3438 |
{ |
3438 |
{ |
3439 |
-- a/stage2/disk_io.c |
3439 |
++ b/stage2/disk_io.c |
Lines 125-132
int buf_track;
Link Here
|
125 |
struct geometry buf_geom; |
125 |
struct geometry buf_geom; |
126 |
|
126 |
|
127 |
/* filesystem common variables */ |
127 |
/* filesystem common variables */ |
128 |
int filepos; |
128 |
unsigned filepos; |
129 |
int filemax; |
129 |
unsigned filemax; |
130 |
|
130 |
|
131 |
static inline unsigned long |
131 |
static inline unsigned long |
132 |
log2 (unsigned long word) |
132 |
log2 (unsigned long word) |
Lines 138-144
log2 (unsigned long word)
Link Here
|
138 |
} |
138 |
} |
139 |
|
139 |
|
140 |
int |
140 |
int |
141 |
rawread (int drive, int sector, int byte_offset, int byte_len, char *buf) |
141 |
rawread (int drive, unsigned sector, unsigned byte_offset, unsigned byte_len, char *buf) |
142 |
{ |
142 |
{ |
143 |
int slen, sectors_per_vtrack; |
143 |
int slen, sectors_per_vtrack; |
144 |
int sector_size_bits = log2 (buf_geom.sector_size); |
144 |
int sector_size_bits = log2 (buf_geom.sector_size); |
Lines 148-154
rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
Link Here
|
148 |
|
148 |
|
149 |
while (byte_len > 0 && !errnum) |
149 |
while (byte_len > 0 && !errnum) |
150 |
{ |
150 |
{ |
151 |
int soff, num_sect, track, size = byte_len; |
151 |
unsigned soff, num_sect, track, size = byte_len; |
152 |
char *bufaddr; |
152 |
char *bufaddr; |
153 |
|
153 |
|
154 |
/* |
154 |
/* |
Lines 168-174
rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
Link Here
|
168 |
} |
168 |
} |
169 |
|
169 |
|
170 |
/* Make sure that SECTOR is valid. */ |
170 |
/* Make sure that SECTOR is valid. */ |
171 |
if (sector < 0 || sector >= buf_geom.total_sectors) |
171 |
if (sector >= buf_geom.total_sectors) |
172 |
{ |
172 |
{ |
173 |
errnum = ERR_GEOM; |
173 |
errnum = ERR_GEOM; |
174 |
return 0; |
174 |
return 0; |
Lines 192-198
rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
Link Here
|
192 |
|
192 |
|
193 |
if (track != buf_track) |
193 |
if (track != buf_track) |
194 |
{ |
194 |
{ |
195 |
int bios_err, read_start = track, read_len = sectors_per_vtrack; |
195 |
int bios_err; |
|
|
196 |
unsigned read_start = track, read_len = sectors_per_vtrack; |
196 |
|
197 |
|
197 |
/* |
198 |
/* |
198 |
* If there's more than one read in this entire loop, then |
199 |
* If there's more than one read in this entire loop, then |
Lines 292-304
rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
Link Here
|
292 |
|
293 |
|
293 |
|
294 |
|
294 |
int |
295 |
int |
295 |
devread (int sector, int byte_offset, int byte_len, char *buf) |
296 |
devread (unsigned sector, unsigned byte_offset, unsigned byte_len, char *buf) |
296 |
{ |
297 |
{ |
297 |
/* |
298 |
/* |
298 |
* Check partition boundaries |
299 |
* Check partition boundaries |
299 |
*/ |
300 |
*/ |
300 |
if (sector < 0 |
301 |
if ( ((sector + ((byte_offset + byte_len - 1) >> SECTOR_BITS)) |
301 |
|| ((sector + ((byte_offset + byte_len - 1) >> SECTOR_BITS)) |
|
|
302 |
>= part_length)) |
302 |
>= part_length)) |
303 |
{ |
303 |
{ |
304 |
errnum = ERR_OUTSIDE_PART; |
304 |
errnum = ERR_OUTSIDE_PART; |
Lines 1744-1757
grub_open (char *filename)
Link Here
|
1744 |
|
1744 |
|
1745 |
|
1745 |
|
1746 |
int |
1746 |
int |
1747 |
grub_read (char *buf, int len) |
1747 |
grub_read (char *buf, unsigned len) |
1748 |
{ |
1748 |
{ |
1749 |
/* Make sure "filepos" is a sane value */ |
1749 |
/* Make sure "filepos" is a sane value */ |
1750 |
if ((filepos < 0) || (filepos > filemax)) |
1750 |
if (filepos > filemax) |
1751 |
filepos = filemax; |
1751 |
filepos = filemax; |
1752 |
|
1752 |
|
1753 |
/* Make sure "len" is a sane value */ |
1753 |
/* Make sure "len" is a sane value */ |
1754 |
if ((len < 0) || (len > (filemax - filepos))) |
1754 |
if ((len > (filemax - filepos))) |
1755 |
len = filemax - filepos; |
1755 |
len = filemax - filepos; |
1756 |
|
1756 |
|
1757 |
/* if target file position is past the end of |
1757 |
/* if target file position is past the end of |
Lines 1841-1849
grub_read (char *buf, int len)
Link Here
|
1841 |
#ifndef STAGE1_5 |
1841 |
#ifndef STAGE1_5 |
1842 |
/* Reposition a file offset. */ |
1842 |
/* Reposition a file offset. */ |
1843 |
int |
1843 |
int |
1844 |
grub_seek (int offset) |
1844 |
grub_seek (unsigned offset) |
1845 |
{ |
1845 |
{ |
1846 |
if (offset > filemax || offset < 0) |
1846 |
if (offset > filemax) |
1847 |
return -1; |
1847 |
return -1; |
1848 |
|
1848 |
|
1849 |
filepos = offset; |
1849 |
filepos = offset; |
1850 |
-- a/stage2/filesys.h |
1850 |
++ b/stage2/filesys.h |
Lines 52-58
int fat_dir (char *dirname);
Link Here
|
52 |
#ifdef FSYS_EXT2FS |
52 |
#ifdef FSYS_EXT2FS |
53 |
#define FSYS_EXT2FS_NUM 1 |
53 |
#define FSYS_EXT2FS_NUM 1 |
54 |
int ext2fs_mount (void); |
54 |
int ext2fs_mount (void); |
55 |
int ext2fs_read (char *buf, int len); |
55 |
int ext2fs_read (char *buf, unsigned len); |
56 |
int ext2fs_dir (char *dirname); |
56 |
int ext2fs_dir (char *dirname); |
57 |
#else |
57 |
#else |
58 |
#define FSYS_EXT2FS_NUM 0 |
58 |
#define FSYS_EXT2FS_NUM 0 |
Lines 70-76
int minix_dir (char *dirname);
Link Here
|
70 |
#ifdef FSYS_REISERFS |
70 |
#ifdef FSYS_REISERFS |
71 |
#define FSYS_REISERFS_NUM 1 |
71 |
#define FSYS_REISERFS_NUM 1 |
72 |
int reiserfs_mount (void); |
72 |
int reiserfs_mount (void); |
73 |
int reiserfs_read (char *buf, int len); |
73 |
int reiserfs_read (char *buf, unsigned len); |
74 |
int reiserfs_dir (char *dirname); |
74 |
int reiserfs_dir (char *dirname); |
75 |
int reiserfs_embed (int *start_sector, int needed_sectors); |
75 |
int reiserfs_embed (int *start_sector, int needed_sectors); |
76 |
#else |
76 |
#else |
77 |
-- a/stage2/fsys_ext2fs.c |
77 |
++ b/stage2/fsys_ext2fs.c |
Lines 22-28
Link Here
|
22 |
#include "shared.h" |
22 |
#include "shared.h" |
23 |
#include "filesys.h" |
23 |
#include "filesys.h" |
24 |
|
24 |
|
25 |
static int mapblock1, mapblock2; |
25 |
static unsigned mapblock1, mapblock2; |
26 |
|
26 |
|
27 |
/* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */ |
27 |
/* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */ |
28 |
#define DEV_BSIZE 512 |
28 |
#define DEV_BSIZE 512 |
Lines 337-345
struct ext4_extent_header
Link Here
|
337 |
#define INODE \ |
337 |
#define INODE \ |
338 |
((struct ext2_inode *)((int)GROUP_DESC + EXT2_BLOCK_SIZE(SUPERBLOCK))) |
338 |
((struct ext2_inode *)((int)GROUP_DESC + EXT2_BLOCK_SIZE(SUPERBLOCK))) |
339 |
#define DATABLOCK1 \ |
339 |
#define DATABLOCK1 \ |
340 |
((int)((int)INODE + sizeof(struct ext2_inode))) |
340 |
((unsigned int)((int)INODE + sizeof(struct ext2_inode))) |
341 |
#define DATABLOCK2 \ |
341 |
#define DATABLOCK2 \ |
342 |
((int)((int)DATABLOCK1 + EXT2_BLOCK_SIZE(SUPERBLOCK))) |
342 |
((unsigned int)(DATABLOCK1 + EXT2_BLOCK_SIZE(SUPERBLOCK))) |
343 |
|
343 |
|
344 |
/* linux/ext2_fs.h */ |
344 |
/* linux/ext2_fs.h */ |
345 |
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) |
345 |
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) |
Lines 356-362
struct ext4_extent_header
Link Here
|
356 |
/* linux/ext2_fs.h */ |
356 |
/* linux/ext2_fs.h */ |
357 |
#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) |
357 |
#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) |
358 |
/* kind of from ext2/super.c */ |
358 |
/* kind of from ext2/super.c */ |
359 |
#define EXT2_BLOCK_SIZE(s) (1 << EXT2_BLOCK_SIZE_BITS(s)) |
359 |
#define EXT2_BLOCK_SIZE(s) (1UL << EXT2_BLOCK_SIZE_BITS(s)) |
360 |
/* linux/ext2fs.h */ |
360 |
/* linux/ext2fs.h */ |
361 |
/* sizeof(struct ext2_group_desc) is changed in ext4 |
361 |
/* sizeof(struct ext2_group_desc) is changed in ext4 |
362 |
* in kernel code, ext2/3 uses sizeof(struct ext2_group_desc) to calculate |
362 |
* in kernel code, ext2/3 uses sizeof(struct ext2_group_desc) to calculate |
Lines 414-420
ext2fs_mount (void)
Link Here
|
414 |
|
414 |
|
415 |
/* Takes a file system block number and reads it into BUFFER. */ |
415 |
/* Takes a file system block number and reads it into BUFFER. */ |
416 |
static int |
416 |
static int |
417 |
ext2_rdfsb (int fsblock, int buffer) |
417 |
ext2_rdfsb (unsigned fsblock, int buffer) |
418 |
{ |
418 |
{ |
419 |
#ifdef E2DEBUG |
419 |
#ifdef E2DEBUG |
420 |
printf ("fsblock %d buffer %d\n", fsblock, buffer); |
420 |
printf ("fsblock %d buffer %d\n", fsblock, buffer); |
Lines 428-435
ext2_rdfsb (int fsblock, int buffer)
Link Here
|
428 |
*/ |
428 |
*/ |
429 |
/* Maps LOGICAL_BLOCK (the file offset divided by the blocksize) into |
429 |
/* Maps LOGICAL_BLOCK (the file offset divided by the blocksize) into |
430 |
a physical block (the location in the file system) via an inode. */ |
430 |
a physical block (the location in the file system) via an inode. */ |
431 |
static int |
431 |
static unsigned |
432 |
ext2fs_block_map (int logical_block) |
432 |
ext2fs_block_map (unsigned logical_block) |
433 |
{ |
433 |
{ |
434 |
|
434 |
|
435 |
#ifdef E2DEBUG |
435 |
#ifdef E2DEBUG |
Lines 470-476
ext2fs_block_map (int logical_block)
Link Here
|
470 |
&& !ext2_rdfsb (INODE->i_block[EXT2_IND_BLOCK], DATABLOCK1)) |
470 |
&& !ext2_rdfsb (INODE->i_block[EXT2_IND_BLOCK], DATABLOCK1)) |
471 |
{ |
471 |
{ |
472 |
errnum = ERR_FSYS_CORRUPT; |
472 |
errnum = ERR_FSYS_CORRUPT; |
473 |
return -1; |
473 |
return (unsigned)-1; |
474 |
} |
474 |
} |
475 |
mapblock1 = 1; |
475 |
mapblock1 = 1; |
476 |
return ((__u32 *) DATABLOCK1)[logical_block]; |
476 |
return ((__u32 *) DATABLOCK1)[logical_block]; |
Lines 478-491
ext2fs_block_map (int logical_block)
Link Here
|
478 |
/* else */ |
478 |
/* else */ |
479 |
logical_block -= EXT2_ADDR_PER_BLOCK (SUPERBLOCK); |
479 |
logical_block -= EXT2_ADDR_PER_BLOCK (SUPERBLOCK); |
480 |
/* now try the double indirect block */ |
480 |
/* now try the double indirect block */ |
481 |
if (logical_block < (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2))) |
481 |
if (logical_block < (1UL << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2))) |
482 |
{ |
482 |
{ |
483 |
int bnum; |
483 |
unsigned bnum; |
484 |
if (mapblock1 != 2 |
484 |
if (mapblock1 != 2 |
485 |
&& !ext2_rdfsb (INODE->i_block[EXT2_DIND_BLOCK], DATABLOCK1)) |
485 |
&& !ext2_rdfsb (INODE->i_block[EXT2_DIND_BLOCK], DATABLOCK1)) |
486 |
{ |
486 |
{ |
487 |
errnum = ERR_FSYS_CORRUPT; |
487 |
errnum = ERR_FSYS_CORRUPT; |
488 |
return -1; |
488 |
return (unsigned)-1; |
489 |
} |
489 |
} |
490 |
mapblock1 = 2; |
490 |
mapblock1 = 2; |
491 |
if ((bnum = (((__u32 *) DATABLOCK1) |
491 |
if ((bnum = (((__u32 *) DATABLOCK1) |
Lines 494-513
ext2fs_block_map (int logical_block)
Link Here
|
494 |
&& !ext2_rdfsb (bnum, DATABLOCK2)) |
494 |
&& !ext2_rdfsb (bnum, DATABLOCK2)) |
495 |
{ |
495 |
{ |
496 |
errnum = ERR_FSYS_CORRUPT; |
496 |
errnum = ERR_FSYS_CORRUPT; |
497 |
return -1; |
497 |
return (unsigned)-1; |
498 |
} |
498 |
} |
499 |
mapblock2 = bnum; |
499 |
mapblock2 = bnum; |
500 |
return ((__u32 *) DATABLOCK2) |
500 |
return ((__u32 *) DATABLOCK2) |
501 |
[logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)]; |
501 |
[logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)]; |
502 |
} |
502 |
} |
503 |
/* else */ |
503 |
/* else */ |
504 |
mapblock2 = -1; |
504 |
mapblock2 = (unsigned)-1; |
505 |
logical_block -= (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2)); |
505 |
logical_block -= (1UL << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2)); |
506 |
if (mapblock1 != 3 |
506 |
if (mapblock1 != 3 |
507 |
&& !ext2_rdfsb (INODE->i_block[EXT2_TIND_BLOCK], DATABLOCK1)) |
507 |
&& !ext2_rdfsb (INODE->i_block[EXT2_TIND_BLOCK], DATABLOCK1)) |
508 |
{ |
508 |
{ |
509 |
errnum = ERR_FSYS_CORRUPT; |
509 |
errnum = ERR_FSYS_CORRUPT; |
510 |
return -1; |
510 |
return (unsigned)-1; |
511 |
} |
511 |
} |
512 |
mapblock1 = 3; |
512 |
mapblock1 = 3; |
513 |
if (!ext2_rdfsb (((__u32 *) DATABLOCK1) |
513 |
if (!ext2_rdfsb (((__u32 *) DATABLOCK1) |
Lines 516-522
ext2fs_block_map (int logical_block)
Link Here
|
516 |
DATABLOCK2)) |
516 |
DATABLOCK2)) |
517 |
{ |
517 |
{ |
518 |
errnum = ERR_FSYS_CORRUPT; |
518 |
errnum = ERR_FSYS_CORRUPT; |
519 |
return -1; |
519 |
return (unsigned)-1; |
520 |
} |
520 |
} |
521 |
if (!ext2_rdfsb (((__u32 *) DATABLOCK2) |
521 |
if (!ext2_rdfsb (((__u32 *) DATABLOCK2) |
522 |
[(logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)) |
522 |
[(logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)) |
Lines 524-530
ext2fs_block_map (int logical_block)
Link Here
|
524 |
DATABLOCK2)) |
524 |
DATABLOCK2)) |
525 |
{ |
525 |
{ |
526 |
errnum = ERR_FSYS_CORRUPT; |
526 |
errnum = ERR_FSYS_CORRUPT; |
527 |
return -1; |
527 |
return (unsigned)-1; |
528 |
} |
528 |
} |
529 |
return ((__u32 *) DATABLOCK2) |
529 |
return ((__u32 *) DATABLOCK2) |
530 |
[logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)]; |
530 |
[logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)]; |
Lines 648-660
ext4fs_block_map (int logical_block)
Link Here
|
648 |
|
648 |
|
649 |
/* preconditions: all preconds of ext2fs_block_map */ |
649 |
/* preconditions: all preconds of ext2fs_block_map */ |
650 |
int |
650 |
int |
651 |
ext2fs_read (char *buf, int len) |
651 |
ext2fs_read (char *buf, unsigned len) |
652 |
{ |
652 |
{ |
653 |
int logical_block; |
653 |
unsigned logical_block; |
654 |
int offset; |
654 |
unsigned offset; |
655 |
int map; |
655 |
unsigned map; |
656 |
int ret = 0; |
656 |
int ret = 0; |
657 |
int size = 0; |
657 |
unsigned size = 0; |
658 |
|
658 |
|
659 |
#ifdef E2DEBUG |
659 |
#ifdef E2DEBUG |
660 |
static char hexdigit[] = "0123456789abcdef"; |
660 |
static char hexdigit[] = "0123456789abcdef"; |
Lines 689-695
ext2fs_read (char *buf, int len)
Link Here
|
689 |
#ifdef E2DEBUG |
689 |
#ifdef E2DEBUG |
690 |
printf ("map=%d\n", map); |
690 |
printf ("map=%d\n", map); |
691 |
#endif /* E2DEBUG */ |
691 |
#endif /* E2DEBUG */ |
692 |
if (map < 0) |
692 |
if (map == (unsigned)-1) |
693 |
break; |
693 |
break; |
694 |
|
694 |
|
695 |
size = EXT2_BLOCK_SIZE (SUPERBLOCK); |
695 |
size = EXT2_BLOCK_SIZE (SUPERBLOCK); |
Lines 747-753
ext2fs_read (char *buf, int len)
Link Here
|
747 |
static inline |
747 |
static inline |
748 |
int ext2_is_fast_symlink (void) |
748 |
int ext2_is_fast_symlink (void) |
749 |
{ |
749 |
{ |
750 |
int ea_blocks; |
750 |
unsigned long ea_blocks; |
751 |
ea_blocks = INODE->i_file_acl ? EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE : 0; |
751 |
ea_blocks = INODE->i_file_acl ? EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE : 0; |
752 |
return INODE->i_blocks == ea_blocks; |
752 |
return INODE->i_blocks == ea_blocks; |
753 |
} |
753 |
} |
Lines 762-773
int ext2_is_fast_symlink (void)
Link Here
|
762 |
int |
762 |
int |
763 |
ext2fs_dir (char *dirname) |
763 |
ext2fs_dir (char *dirname) |
764 |
{ |
764 |
{ |
765 |
int current_ino = EXT2_ROOT_INO; /* start at the root */ |
765 |
unsigned current_ino = EXT2_ROOT_INO; /* start at the root */ |
766 |
int updir_ino = current_ino; /* the parent of the current directory */ |
766 |
unsigned updir_ino = current_ino; /* the parent of the current directory */ |
767 |
int group_id; /* which group the inode is in */ |
767 |
unsigned group_id; /* which group the inode is in */ |
768 |
int group_desc; /* fs pointer to that group */ |
768 |
unsigned group_desc; /* fs pointer to that group */ |
769 |
int desc; /* index within that group */ |
769 |
unsigned desc; /* index within that group */ |
770 |
int ino_blk; /* fs pointer of the inode's information */ |
770 |
unsigned ino_blk; /* fs pointer of the inode's information */ |
771 |
int str_chk = 0; /* used to hold the results of a string compare */ |
771 |
int str_chk = 0; /* used to hold the results of a string compare */ |
772 |
struct ext4_group_desc *ext4_gdp; |
772 |
struct ext4_group_desc *ext4_gdp; |
773 |
struct ext2_inode *raw_inode; /* inode info corresponding to current_ino */ |
773 |
struct ext2_inode *raw_inode; /* inode info corresponding to current_ino */ |
Lines 778-787
ext2fs_dir (char *dirname)
Link Here
|
778 |
char *rest; |
778 |
char *rest; |
779 |
char ch; /* temp char holder */ |
779 |
char ch; /* temp char holder */ |
780 |
|
780 |
|
781 |
int off; /* offset within block of directory entry (off mod blocksize) */ |
781 |
unsigned off; /* offset within block of directory entry (off mod blocksize) */ |
782 |
int loc; /* location within a directory */ |
782 |
unsigned loc; /* location within a directory */ |
783 |
int blk; /* which data blk within dir entry (off div blocksize) */ |
783 |
unsigned blk; /* which data blk within dir entry (off div blocksize) */ |
784 |
long map; /* fs pointer of a particular block from dir entry */ |
784 |
unsigned map; /* fs pointer of a particular block from dir entry */ |
785 |
struct ext2_dir_entry *dp; /* pointer to directory entry */ |
785 |
struct ext2_dir_entry *dp; /* pointer to directory entry */ |
786 |
#ifdef E2DEBUG |
786 |
#ifdef E2DEBUG |
787 |
unsigned char *i; |
787 |
unsigned char *i; |
Lines 835-841
ext2fs_dir (char *dirname)
Link Here
|
835 |
} |
835 |
} |
836 |
|
836 |
|
837 |
/* reset indirect blocks! */ |
837 |
/* reset indirect blocks! */ |
838 |
mapblock2 = mapblock1 = -1; |
838 |
mapblock2 = mapblock1 = (unsigned)-1; |
839 |
|
839 |
|
840 |
raw_inode = (struct ext2_inode *)((char *)INODE + |
840 |
raw_inode = (struct ext2_inode *)((char *)INODE + |
841 |
((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) * |
841 |
((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) * |
Lines 872-878
ext2fs_dir (char *dirname)
Link Here
|
872 |
/* If we've got a symbolic link, then chase it. */ |
872 |
/* If we've got a symbolic link, then chase it. */ |
873 |
if (S_ISLNK (INODE->i_mode)) |
873 |
if (S_ISLNK (INODE->i_mode)) |
874 |
{ |
874 |
{ |
875 |
int len; |
875 |
unsigned len; |
876 |
if (++link_count > MAX_LINK_COUNT) |
876 |
if (++link_count > MAX_LINK_COUNT) |
877 |
{ |
877 |
{ |
878 |
errnum = ERR_SYMLINK_LOOP; |
878 |
errnum = ERR_SYMLINK_LOOP; |
Lines 1026-1033
ext2fs_dir (char *dirname)
Link Here
|
1026 |
#ifdef E2DEBUG |
1026 |
#ifdef E2DEBUG |
1027 |
printf ("fs block=%d\n", map); |
1027 |
printf ("fs block=%d\n", map); |
1028 |
#endif /* E2DEBUG */ |
1028 |
#endif /* E2DEBUG */ |
1029 |
mapblock2 = -1; |
1029 |
mapblock2 = (unsigned)-1; |
1030 |
if (map < 0) |
1030 |
if (map == (unsigned)-1) |
1031 |
{ |
1031 |
{ |
1032 |
*rest = ch; |
1032 |
*rest = ch; |
1033 |
return 0; |
1033 |
return 0; |
1034 |
-- a/stage2/fsys_reiserfs.c |
1034 |
++ b/stage2/fsys_reiserfs.c |
Lines 382-388
is_power_of_two (unsigned long word)
Link Here
|
382 |
} |
382 |
} |
383 |
|
383 |
|
384 |
static int |
384 |
static int |
385 |
journal_read (int block, int len, char *buffer) |
385 |
journal_read (__u32 block, unsigned len, char *buffer) |
386 |
{ |
386 |
{ |
387 |
return devread ((INFO->journal_block + block) << INFO->blocksize_shift, |
387 |
return devread ((INFO->journal_block + block) << INFO->blocksize_shift, |
388 |
0, len, buffer); |
388 |
0, len, buffer); |
Lines 393-409
journal_read (int block, int len, char *buffer)
Link Here
|
393 |
* journal taken. |
393 |
* journal taken. |
394 |
*/ |
394 |
*/ |
395 |
static int |
395 |
static int |
396 |
block_read (int blockNr, int start, int len, char *buffer) |
396 |
block_read (unsigned blockNr, unsigned start, unsigned len, char *buffer) |
397 |
{ |
397 |
{ |
398 |
int transactions = INFO->journal_transactions; |
398 |
int transactions = INFO->journal_transactions; |
399 |
int desc_block = INFO->journal_first_desc; |
399 |
unsigned desc_block = INFO->journal_first_desc; |
400 |
int journal_mask = INFO->journal_block_count - 1; |
400 |
unsigned journal_mask = INFO->journal_block_count - 1; |
401 |
int translatedNr = blockNr; |
401 |
unsigned translatedNr = blockNr; |
402 |
__u32 *journal_table = JOURNAL_START; |
402 |
__u32 *journal_table = JOURNAL_START; |
403 |
while (transactions-- > 0) |
403 |
while (transactions-- > 0) |
404 |
{ |
404 |
{ |
405 |
int i = 0; |
405 |
unsigned i = 0; |
406 |
int j_len; |
406 |
unsigned j_len; |
407 |
if (*journal_table != 0xffffffff) |
407 |
if (*journal_table != 0xffffffff) |
408 |
{ |
408 |
{ |
409 |
/* Search for the blockNr in cached journal */ |
409 |
/* Search for the blockNr in cached journal */ |
Lines 435-441
block_read (int blockNr, int start, int len, char *buffer)
Link Here
|
435 |
|
435 |
|
436 |
if (j_len >= JOURNAL_TRANS_HALF) |
436 |
if (j_len >= JOURNAL_TRANS_HALF) |
437 |
{ |
437 |
{ |
438 |
int commit_block = (desc_block + 1 + j_len) & journal_mask; |
438 |
unsigned commit_block = (desc_block + 1 + j_len) & journal_mask; |
439 |
if (! journal_read (commit_block, |
439 |
if (! journal_read (commit_block, |
440 |
sizeof (commit), (char *) &commit)) |
440 |
sizeof (commit), (char *) &commit)) |
441 |
return 0; |
441 |
return 0; |
Lines 527-533
journal_init (void)
Link Here
|
527 |
} |
527 |
} |
528 |
else |
528 |
else |
529 |
{ |
529 |
{ |
530 |
int i; |
530 |
unsigned i; |
531 |
/* Cache the length and the realblock numbers in the table. |
531 |
/* Cache the length and the realblock numbers in the table. |
532 |
* The block number of descriptor can easily be computed. |
532 |
* The block number of descriptor can easily be computed. |
533 |
* and need not to be stored here. |
533 |
* and need not to be stored here. |
Lines 569-575
int
Link Here
|
569 |
reiserfs_mount (void) |
569 |
reiserfs_mount (void) |
570 |
{ |
570 |
{ |
571 |
struct reiserfs_super_block super; |
571 |
struct reiserfs_super_block super; |
572 |
int superblock = REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS; |
572 |
unsigned superblock = REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS; |
573 |
|
573 |
|
574 |
if (part_length < superblock + (sizeof (super) >> SECTOR_BITS) |
574 |
if (part_length < superblock + (sizeof (super) >> SECTOR_BITS) |
575 |
|| ! devread (superblock, 0, sizeof (struct reiserfs_super_block), |
575 |
|| ! devread (superblock, 0, sizeof (struct reiserfs_super_block), |
Lines 775-782
next_key (void)
Link Here
|
775 |
|
775 |
|
776 |
do |
776 |
do |
777 |
{ |
777 |
{ |
778 |
int nr_item = BLOCKHEAD (cache)->blk_nr_item; |
778 |
unsigned nr_item = BLOCKHEAD (cache)->blk_nr_item; |
779 |
int key_nr = INFO->next_key_nr[depth]++; |
779 |
unsigned key_nr = INFO->next_key_nr[depth]++; |
780 |
#ifdef REISERDEBUG |
780 |
#ifdef REISERDEBUG |
781 |
printf (" depth=%d, i=%d/%d\n", depth, key_nr, nr_item); |
781 |
printf (" depth=%d, i=%d/%d\n", depth, key_nr, nr_item); |
782 |
#endif /* REISERDEBUG */ |
782 |
#endif /* REISERDEBUG */ |
Lines 821-828
search_stat (__u32 dir_id, __u32 objectid)
Link Here
|
821 |
{ |
821 |
{ |
822 |
char *cache; |
822 |
char *cache; |
823 |
int depth; |
823 |
int depth; |
824 |
int nr_item; |
824 |
unsigned nr_item; |
825 |
int i; |
825 |
unsigned i; |
826 |
struct item_head *ih; |
826 |
struct item_head *ih; |
827 |
#ifdef REISERDEBUG |
827 |
#ifdef REISERDEBUG |
828 |
printf ("search_stat:\n key %d:%d:0:0\n", dir_id, objectid); |
828 |
printf ("search_stat:\n key %d:%d:0:0\n", dir_id, objectid); |
Lines 883-889
search_stat (__u32 dir_id, __u32 objectid)
Link Here
|
883 |
} |
883 |
} |
884 |
|
884 |
|
885 |
int |
885 |
int |
886 |
reiserfs_read (char *buf, int len) |
886 |
reiserfs_read (char *buf, unsigned len) |
887 |
{ |
887 |
{ |
888 |
unsigned int blocksize; |
888 |
unsigned int blocksize; |
889 |
unsigned int offset; |
889 |
unsigned int offset; |
Lines 931-937
reiserfs_read (char *buf, int len)
Link Here
|
931 |
disk_read_func = disk_read_hook; |
931 |
disk_read_func = disk_read_hook; |
932 |
|
932 |
|
933 |
block_read (INFO->blocks[DISK_LEAF_NODE_LEVEL], |
933 |
block_read (INFO->blocks[DISK_LEAF_NODE_LEVEL], |
934 |
(INFO->current_item - LEAF + offset), to_read, buf); |
934 |
(unsigned)(INFO->current_item - LEAF + offset), to_read, buf); |
935 |
|
935 |
|
936 |
disk_read_func = NULL; |
936 |
disk_read_func = NULL; |
937 |
} |
937 |
} |
Lines 951-957
reiserfs_read (char *buf, int len)
Link Here
|
951 |
{ |
951 |
{ |
952 |
__u32 blocknr = ((__u32 *) INFO->current_item) |
952 |
__u32 blocknr = ((__u32 *) INFO->current_item) |
953 |
[offset >> INFO->fullblocksize_shift]; |
953 |
[offset >> INFO->fullblocksize_shift]; |
954 |
int blk_offset = offset & (INFO->blocksize-1); |
954 |
unsigned blk_offset = offset & (INFO->blocksize-1); |
955 |
|
955 |
|
956 |
to_read = INFO->blocksize - blk_offset; |
956 |
to_read = INFO->blocksize - blk_offset; |
957 |
if (to_read > len) |
957 |
if (to_read > len) |
Lines 1027-1033
reiserfs_dir (char *dirname)
Link Here
|
1027 |
/* If we've got a symbolic link, then chase it. */ |
1027 |
/* If we've got a symbolic link, then chase it. */ |
1028 |
if (S_ISLNK (mode)) |
1028 |
if (S_ISLNK (mode)) |
1029 |
{ |
1029 |
{ |
1030 |
int len; |
1030 |
unsigned len; |
1031 |
if (++link_count > MAX_LINK_COUNT) |
1031 |
if (++link_count > MAX_LINK_COUNT) |
1032 |
{ |
1032 |
{ |
1033 |
errnum = ERR_SYMLINK_LOOP; |
1033 |
errnum = ERR_SYMLINK_LOOP; |
1034 |
-- a/stage2/fsys_vstafs.c |
1034 |
++ b/stage2/fsys_vstafs.c |
Lines 39-45
static struct dir_entry *vstafs_nextdir (void);
Link Here
|
39 |
* In f_sector we store the sector number in which the information about |
39 |
* In f_sector we store the sector number in which the information about |
40 |
* the found file is. |
40 |
* the found file is. |
41 |
*/ |
41 |
*/ |
42 |
extern int filepos; |
42 |
extern unsigned filepos; |
43 |
static int f_sector; |
43 |
static int f_sector; |
44 |
|
44 |
|
45 |
int |
45 |
int |
46 |
-- a/stage2/shared.h |
46 |
++ b/stage2/shared.h |
Lines 669-676
extern int buf_track;
Link Here
|
669 |
extern struct geometry buf_geom; |
669 |
extern struct geometry buf_geom; |
670 |
|
670 |
|
671 |
/* these are the current file position and maximum file position */ |
671 |
/* these are the current file position and maximum file position */ |
672 |
extern int filepos; |
672 |
extern unsigned filepos; |
673 |
extern int filemax; |
673 |
extern unsigned filemax; |
674 |
|
674 |
|
675 |
/* |
675 |
/* |
676 |
* Common BIOS/boot data. |
676 |
* Common BIOS/boot data. |
Lines 813-819
int checkkey (void);
Link Here
|
813 |
/* Low-level disk I/O */ |
813 |
/* Low-level disk I/O */ |
814 |
int get_diskinfo (int drive, struct geometry *geometry); |
814 |
int get_diskinfo (int drive, struct geometry *geometry); |
815 |
int biosdisk (int subfunc, int drive, struct geometry *geometry, |
815 |
int biosdisk (int subfunc, int drive, struct geometry *geometry, |
816 |
int sector, int nsec, int segment); |
816 |
unsigned sector, unsigned nsec, int segment); |
817 |
void stop_floppy (void); |
817 |
void stop_floppy (void); |
818 |
|
818 |
|
819 |
/* Command-line interface functions. */ |
819 |
/* Command-line interface functions. */ |
Lines 927-934
int gunzip_test_header (void);
Link Here
|
927 |
int gunzip_read (char *buf, int len); |
927 |
int gunzip_read (char *buf, int len); |
928 |
#endif /* NO_DECOMPRESSION */ |
928 |
#endif /* NO_DECOMPRESSION */ |
929 |
|
929 |
|
930 |
int rawread (int drive, int sector, int byte_offset, int byte_len, char *buf); |
930 |
int rawread (int drive, unsigned sector, unsigned byte_offset, unsigned byte_len, char *buf); |
931 |
int devread (int sector, int byte_offset, int byte_len, char *buf); |
931 |
int devread (unsigned sector, unsigned byte_offset, unsigned byte_len, char *buf); |
932 |
int rawwrite (int drive, int sector, char *buf); |
932 |
int rawwrite (int drive, int sector, char *buf); |
933 |
int devwrite (int sector, int sector_len, char *buf); |
933 |
int devwrite (int sector, int sector_len, char *buf); |
934 |
|
934 |
|
Lines 957-966
int grub_open (char *filename);
Link Here
|
957 |
|
957 |
|
958 |
/* Read LEN bytes into BUF from the file that was opened with |
958 |
/* Read LEN bytes into BUF from the file that was opened with |
959 |
GRUB_OPEN. If LEN is -1, read all the remaining data in the file. */ |
959 |
GRUB_OPEN. If LEN is -1, read all the remaining data in the file. */ |
960 |
int grub_read (char *buf, int len); |
960 |
int grub_read (char *buf, unsigned len); |
961 |
|
961 |
|
962 |
/* Reposition a file offset. */ |
962 |
/* Reposition a file offset. */ |
963 |
int grub_seek (int offset); |
963 |
int grub_seek (unsigned offset); |
964 |
|
964 |
|
965 |
/* Close a file. */ |
965 |
/* Close a file. */ |
966 |
void grub_close (void); |
966 |
void grub_close (void); |