diff options
Diffstat (limited to 'e2fsprogs/ext2fs/fileio.c')
-rw-r--r-- | e2fsprogs/ext2fs/fileio.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/e2fsprogs/ext2fs/fileio.c b/e2fsprogs/ext2fs/fileio.c index 3e42cbc..669e80c 100644 --- a/e2fsprogs/ext2fs/fileio.c +++ b/e2fsprogs/ext2fs/fileio.c @@ -1,6 +1,6 @@ /* * fileio.c --- Simple file I/O routines - * + * * Copyright (C) 1997 Theodore Ts'o. * * %Begin-Header% @@ -20,14 +20,14 @@ struct ext2_file { errcode_t magic; - ext2_filsys fs; + ext2_filsys fs; ext2_ino_t ino; struct ext2_inode inode; - int flags; + int flags; __u64 pos; blk_t blockno; blk_t physblock; - char *buf; + char *buf; }; #define BMAP_BUFFER (file->buf + fs->blocksize) @@ -36,7 +36,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, int flags, ext2_file_t *ret) { - ext2_file_t file; + ext2_file_t file; errcode_t retval; /* @@ -50,7 +50,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, retval = ext2fs_get_mem(sizeof(struct ext2_file), &file); if (retval) return retval; - + memset(file, 0, sizeof(struct ext2_file)); file->magic = EXT2_ET_MAGIC_EXT2_FILE; file->fs = fs; @@ -64,14 +64,14 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, if (retval) goto fail; } - + retval = ext2fs_get_mem(fs->blocksize * 3, &file->buf); if (retval) goto fail; *ret = file; return 0; - + fail: if (file->buf) ext2fs_free_mem(&file->buf); @@ -103,7 +103,7 @@ errcode_t ext2fs_file_flush(ext2_file_t file) { errcode_t retval; ext2_filsys fs; - + EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); fs = file->fs; @@ -176,7 +176,7 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill) if (!dontfill) { if (file->physblock) { retval = io_channel_read_blk(fs->io, - file->physblock, + file->physblock, 1, file->buf); if (retval) return retval; @@ -187,16 +187,16 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill) } return 0; } - + errcode_t ext2fs_file_close(ext2_file_t file) { errcode_t retval; - + EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); retval = ext2fs_file_flush(file); - + if (file->buf) ext2fs_free_mem(&file->buf); ext2fs_free_mem(&file); @@ -232,14 +232,14 @@ errcode_t ext2fs_file_read(ext2_file_t file, void *buf, left = EXT2_I_SIZE(&file->inode) - file->pos ; if (c > left) c = left; - + memcpy(ptr, file->buf+start, c); file->pos += c; ptr += c; count += c; wanted -= c; } - + fail: if (got) *got = count; @@ -265,7 +265,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, retval = sync_buffer_position(file); if (retval) goto fail; - + start = file->pos % fs->blocksize; c = fs->blocksize - start; if (c > nbytes) @@ -286,7 +286,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, count += c; nbytes -= c; } - + fail: if (written) *written = count; @@ -318,7 +318,7 @@ errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset, { __u64 loffset, ret_loffset; errcode_t retval; - + loffset = offset; retval = ext2fs_file_llseek(file, loffset, whence, &ret_loffset); if (ret_pos) @@ -354,14 +354,14 @@ ext2_off_t ext2fs_file_get_size(ext2_file_t file) /* * This function sets the size of the file, truncating it if necessary - * + * * XXX still need to call truncate */ errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size) { errcode_t retval; EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); - + file->inode.i_size = size; file->inode.i_size_high = 0; if (file->ino) { @@ -370,7 +370,7 @@ errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size) return retval; } - /* + /* * XXX truncate inode if necessary */ |