Hi list,
I am trying to create a dummy module for learning purpose. For “hello
world” example, everything goes fine. But when I tried to add
register_filesystem and unregister_filesystem call the behavior is
unexpected. I am not able to unload my module.
My module has single file named rkfs_mod.c:
[a...@tom kernel]$ cat rkfs_mod.c
#include <linux/module.h>
#include <linux/fs.h>
static struct super_block *rkfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *raw_data)
{
printk("get_sb call\n");
return NULL;
}
static void rkfs_kill_sb(struct super_block *s)
{
printk("kill sb \n");
return;
}
static struct file_system_type rkfs = {
name: "rkfs_mod",
get_sb: rkfs_get_sb,
kill_sb: rkfs_kill_sb,
owner: THIS_MODULE
};
int init_module(void) {
int err;
printk("Registering the filesystem\n");
err = register_filesystem( &rkfs );
return err;
}
void exit_module(void){
printk("Unregisterign the filesystem\n");
unregister_filesystem(&rkfs);
}
[a...@tom kernel]$
My Makefile contents:
[a...@tom kernel]$ cat Makefile
obj-m += rkfs_mod.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean :
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
[a...@tom kernel]$
[a...@tom kernel]$ uname -a
Linux tom.HCLTECH 2.6.30 #1 SMP Thu Dec 17 16:45:24 IST 2009 i686 i686
i386 GNU/Linux
[a...@tom kernel]$
Module loading is successful but unloading fails.
[r...@tom linux-2.6.30]# /sbin/lsmod | grep rkfs
rkfs_mod 1452 0 [permanent]
[r...@tom linux-2.6.30]# /sbin/rmmod rkfs_mod
ERROR: Removing 'rkfs_mod': Device or resource busy
[r...@tom linux-2.6.30]#
[r...@tom linux-2.6.30]# /sbin/rmmod -f rkfs_mod
ERROR: Removing 'rkfs_mod': Device or resource busy
[r...@tom linux-2.6.30]#
I checked config and found “CONFIG_MODULE_UNLOAD=y”
What are the possible causes for this error?
Any help?
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ