Message ID | 1386323897-2354-11-git-send-email-wenqing.lz@taobao.com |
---|---|
State | Superseded, archived |
Headers | show |
On Fri, Dec 06, 2013 at 05:57:57PM +0800, Zheng Liu wrote: > From: Zheng Liu <wenqing.lz@taobao.com> > > Later we will use ext2fs_dirent_swab_in/out to handle big-endian problem > for inline data. Now interfaces assume that it handles a block, but it > is not true after adding inline data. So this commit defines a new > interface for inline data. > > Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Thanks, applied. - Ted -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
errcode_t ext2fs_dirent_swab_in(ext2_filsys fs, char *buf, int flags) { + return ext2fs_dirent_swab_in(fs, buf, fs->blocksize, flags); +} I guess it misses "2" for function name. Should be: errcode_t ext2fs_dirent_swab_in(ext2_filsys fs, char *buf, int flags) { + return ext2fs_dirent_swab_in2(fs, buf, fs->blocksize, flags); +} Thanks, Jon > On Mon, Mar 3, 2014 at 10:49 AM, Theodore Ts'o <tytso@mit.edu> wrote: >> On Fri, Dec 06, 2013 at 05:57:57PM +0800, Zheng Liu wrote: >> From: Zheng Liu <wenqing.lz@taobao.com> >> >> Later we will use ext2fs_dirent_swab_in/out to handle big-endian problem >> for inline data. Now interfaces assume that it handles a block, but it >> is not true after adding inline data. So this commit defines a new >> interface for inline data. >> >> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> > > Thanks, applied. > > - Ted > -- > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h index e251435..1d5b80c 100644 --- a/lib/ext2fs/ext2fs.h +++ b/lib/ext2fs/ext2fs.h @@ -1524,7 +1524,11 @@ extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, extern errcode_t ext2fs_create_resize_inode(ext2_filsys fs); /* swapfs.c */ +extern errcode_t ext2fs_dirent_swab_in2(ext2_filsys fs, char *buf, size_t size, + int flags); extern errcode_t ext2fs_dirent_swab_in(ext2_filsys fs, char *buf, int flags); +extern errcode_t ext2fs_dirent_swab_out2(ext2_filsys fs, char *buf, size_t size, + int flags); extern errcode_t ext2fs_dirent_swab_out(ext2_filsys fs, char *buf, int flags); extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, int has_header); diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c index 1295e81..8dfdcc9 100644 --- a/lib/ext2fs/swapfs.c +++ b/lib/ext2fs/swapfs.c @@ -354,13 +354,19 @@ void ext2fs_swap_mmp(struct mmp_struct *mmp) errcode_t ext2fs_dirent_swab_in(ext2_filsys fs, char *buf, int flags) { + return ext2fs_dirent_swab_in(fs, buf, fs->blocksize, flags); +} + +errcode_t ext2fs_dirent_swab_in2(ext2_filsys fs, char *buf, + size_t size, int flags) +{ errcode_t retval; char *p, *end; struct ext2_dir_entry *dirent; unsigned int name_len, rec_len; p = (char *) buf; - end = (char *) buf + fs->blocksize; + end = (char *) buf + size; while (p < end-8) { dirent = (struct ext2_dir_entry *) p; dirent->inode = ext2fs_swab32(dirent->inode); @@ -385,13 +391,19 @@ errcode_t ext2fs_dirent_swab_in(ext2_filsys fs, char *buf, int flags) errcode_t ext2fs_dirent_swab_out(ext2_filsys fs, char *buf, int flags) { + return ext2fs_dirent_swab_out2(fs, buf, fs->blocksize, flags); +} + +errcode_t ext2fs_dirent_swab_out2(ext2_filsys fs, char *buf, + size_t size, int flags) +{ errcode_t retval; char *p, *end; unsigned int rec_len; struct ext2_dir_entry *dirent; p = buf; - end = buf + fs->blocksize; + end = buf + size; while (p < end) { dirent = (struct ext2_dir_entry *) p; retval = ext2fs_get_rec_len(fs, dirent, &rec_len);