UFS modularisation (PATCH)

Wingerde van GR (gertjan@cs.vu.nl)
Fri, 26 Apr 1996 09:48:13 +0200 (MET DST)


Hi,

Sorry for my previous mail, I was a bit too fast for my computer ;-)

The following patch modularizes the ufs file system:

NOTE: This is untested but the patch can't do any harm to the stability
of the file system. The only thing that can happen is that the
module can't be unloaded.

Gertjan

-- 

Gertjan van Wingerde home address: Student Computer Science Vrije Universiteit J.H. Dunantstraat 44 Amsterdam 1561 BD Krommenie The Netherlands

e-mail: gertjan@cs.vu.nl URL: http://www.cs.vu.nl/~gertjan/

--- Begin patch

diff -u --recursive --new-file linux-1.3.95/fs/Makefile linux/fs/Makefile --- linux-1.3.95/fs/Makefile Thu Apr 25 19:45:44 1996 +++ linux/fs/Makefile Thu Apr 25 19:45:14 1996 @@ -143,6 +143,10 @@ ifeq ($(CONFIG_UFS_FS),y) SUB_DIRS += ufs +else + ifeq ($(CONFIG_UFS_FS),m) + MOD_SUB_DIRS += ufs + endif endif ifeq ($(CONFIG_AFFS_FS),y) diff -u --recursive --new-file linux-1.3.95/fs/ufs/ufs_super.c linux/fs/ufs/ufs_super.c --- linux-1.3.95/fs/ufs/ufs_super.c Thu Apr 25 19:56:52 1996 +++ linux/fs/ufs/ufs_super.c Thu Apr 25 19:51:13 1996 @@ -6,6 +6,9 @@ * Laboratory for Computer Science Research Computing Facility * Rutgers, The State University of New Jersey * + * 04/96 Modularised by + * Gertjan van Wingerde (gertjan@cs.vu.nl) + * * $Id: ufs_super.c,v 1.1 1996/04/21 14:41:19 davem Exp $ * */ @@ -46,6 +49,22 @@ return(register_filesystem(&ufs_fs_type)); } +#ifdef MODULE +int init_module(void) +{ + int status; + + if ((status = init_ufs_fs()) == 0) + register_symtab(0); + return status; +} + +void cleanup_module(void) +{ + unregister_filesystem(&ufs_fs_type); +} +#endif + static void ufs_print_super_stuff(struct super_block * sb, struct ufs_superblock * usb) { @@ -79,6 +98,7 @@ * and s_type when we return. */ + MOD_INC_USE_COUNT; lock_super (sb); /* XXX - make everything read only for testing */ @@ -94,7 +114,8 @@ } printk ("ufs_read_super: unable to read superblock\n"); - return 0; + MOD_DEC_USE_COUNT; + return(NULL); } /* XXX - redo this so we can free it later... */ usb = (struct ufs_superblock *)__get_free_page(GFP_KERNEL); @@ -122,6 +143,7 @@ printk ("ufs_read_super: bad magic number 0x%8.8x on dev %d/%d\n", usb->fs_magic, MAJOR(sb->s_dev), MINOR(sb->s_dev)); + MOD_DEC_USE_COUNT; return(NULL); } @@ -213,7 +235,8 @@ ufs_read_super_lose: /* XXX - clean up */ - return(0); + MOD_DEC_USE_COUNT; + return(NULL); } void ufs_put_super (struct super_block * sb)