X-Git-Url: http://git.ozlabs.org/?p=yaboot.git;a=blobdiff_plain;f=second%2Ffs_ext2.c;h=a85958f0323f54e4d73c00ce158d8bc70208f8d1;hp=d24450d5c92b5b0105a7597907b54ef2ee2f2fc5;hb=37d30b56405bf9858e0c1c1baad93105737e7a1b;hpb=9a83909ef3d17b0ea205d32b6aa07ac6bea7260c diff --git a/second/fs_ext2.c b/second/fs_ext2.c index d24450d..a85958f 100644 --- a/second/fs_ext2.c +++ b/second/fs_ext2.c @@ -54,6 +54,7 @@ static int ext2_read( struct boot_file_t* file, static int ext2_seek( struct boot_file_t* file, unsigned int newpos); static int ext2_close( struct boot_file_t* file); +static unsigned int ext2_ino_size(struct boot_file_t *file); struct fs_t ext2_filesystem = { @@ -61,7 +62,8 @@ struct fs_t ext2_filesystem = ext2_open, ext2_read, ext2_seek, - ext2_close + ext2_close, + ext2_ino_size, }; /* IO manager structure for the ext2 library */ @@ -107,7 +109,7 @@ static unsigned long read_total; static unsigned long read_max; static struct boot_file_t* read_cur_file; static errcode_t read_result; -static char* read_buffer; +static unsigned char* read_buffer; static int read_dump_range(void); static int read_iterator(ext2_filsys fs, blk_t *blocknr, int lg_block, void *private); @@ -139,7 +141,8 @@ ext2_open( struct boot_file_t* file, DEBUG_LEAVE(FILE_ERR_FSBUSY); return FILE_ERR_FSBUSY; } - if (file->device_kind != FILE_DEVICE_BLOCK) { + if (file->device_kind != FILE_DEVICE_BLOCK + && file->device_kind != FILE_DEVICE_ISCSI) { DEBUG_LEAVE(FILE_ERR_BADDEV); return FILE_ERR_BADDEV; } @@ -564,6 +567,16 @@ ext2_close( struct boot_file_t* file) return 0; } +static unsigned int ext2_ino_size(struct boot_file_t *file) +{ + struct ext2_inode ei; + + if (ext2fs_read_inode(fs, file->inode, &ei)) + return 0; + + return ei.i_size; +} + static errcode_t linux_open (const char *name, int flags, io_channel * channel) { io_channel io;