squashfs: thread initialization through the backend framework
Subsystems (2)
PATCH 1/1 squashfs: thread initialization through the backend framework
This necessitated introducing the killsb callback. The read path is still untouched.
--- fs/squashfs/backend.c | 22 +++++++++++++++----- fs/squashfs/backend.h | 11 ++++----- fs/squashfs/bdev.c | 3 +- fs/squashfs/squashfs.h | 6 ++-- fs/squashfs/super.c | 49 +++++++++++++++++++++-------------------------- 5 files changed, 48 insertions(+), 43 deletions(-)
fs/squashfs/backend.c +16 -6
@@ -11,14 +11,24 @@ const struct squashfs_backend *backends[] = { NULL }; -const struct squashfs_backend * -squashfs_find_backend (struct file_system_type *fs_type,int flags, +int squashfs_find_backend (struct file_system_type *fs_type,int flags,const char *dev_name,void *data,struct vfsmount *mnt) {const struct squashfs_backend **b; +int err; -for (b = backends; *b; b++) -if (!(*b)->probe (fs_type, flags, dev_name, data, mnt)) -break ; -return *b; +for (b = backends; *b; b++) { + err = (*b)->probe (fs_type, flags, dev_name, data, mnt); +if (!err) +return 0 ; + } +ERROR ("No suitable backend found\n" ); +return -ENODEV ; +} + +void squashfs_kill_super (struct super_block *sb) +{ +struct squashfs_sb_info *msblk = sb->s_fs_info; + + msblk->backend->killsb (sb); }
fs/squashfs/backend.h +5 -6
@@ -9,14 +9,13 @@ struct squashfs_backend {ssize_t (*read)(struct squashfs_sb_info *,void **,size_t );int (*probe)(struct file_system_type *,int ,const char *,void *,struct vfsmount *); +void (*killsb)(struct super_block *);void (*kill)(struct squashfs_sb_info *);loff_t (*size)(const struct super_block *);const char *(*devname)(const struct super_block *,char *); }; -/* Dummy, until the original is nuked */ -static inline int squashfs_fill_super2 (struct super_block *sb,void *data, -int silent,int (*add_bend)(struct super_block *)) -{ -return -1 ; -} +int squashfs_find_backend (struct file_system_type *,int , +const char *,void *,struct vfsmount *); + +void squashfs_kill_super (struct super_block *);
fs/squashfs/bdev.c +2 -1
@@ -69,7 +69,7 @@ static int add_bdev_backend(struct super_block *sb)static int fill_bdev_super (struct super_block *sb,void *data,int silent) { -return squashfs_fill_super2 (sb, data, silent, add_bdev_backend); +return squashfs_fill_super (sb, data, silent, add_bdev_backend); } static int bdev_probe(struct file_system_type *fs_type, int flags,
@@ -104,6 +104,7 @@ const struct squashfs_backend squashfs_bdev_ops = { .free = bdev_free, .read = bdev_read, .probe = bdev_probe, + .killsb = kill_block_super, .kill = bdev_kill, .size = bdev_size, .devname= bdev_devname
fs/squashfs/squashfs.h +3 -3
@@ -73,10 +73,10 @@ extern struct inode *squashfs_iget(struct super_block *, long long, unsigned int);extern int squashfs_read_inode (struct inode *,long long ); -/* super.c +/* super.c */ int squashfs_fill_super (struct super_block *,void *,int , -struct squashfs_backend *); -*/ +int (*)(struct super_block *)); +/* * Inodes, files, backend and decompressor operations */
fs/squashfs/super.c +22 -27
119 lines not on this page · raw message
Signature · 1 line
1.5.6.5