diff --git a/driver/device-mapper/dmfs-lv.c b/driver/device-mapper/dmfs-lv.c index 23b97053b..a5541b316 100644 --- a/driver/device-mapper/dmfs-lv.c +++ b/driver/device-mapper/dmfs-lv.c @@ -28,7 +28,7 @@ #include "dm.h" extern struct address_space_operations dmfs_address_space_operations; -extern struct inode *dmfs_create_tdir(struct inode *dir, int mode); +extern struct inode *dmfs_create_tdir(struct super_block *sb, int mode); struct dentry *dmfs_verify_name(struct inode *dir, const char *name) { @@ -161,6 +161,7 @@ static int dmfs_lv_mkdir(struct inode *dir, struct dentry *dentry, int mode) { struct inode *inode; + printk("lv mkdir\n"); if (dentry->d_name.len >= DM_NAME_LEN) return -EINVAL; @@ -173,8 +174,8 @@ static int dmfs_lv_mkdir(struct inode *dir, struct dentry *dentry, int mode) if (dentry->d_name.name[0] == '.') return -EINVAL; - - inode = dmfs_create_tdir(dir, mode); + printk("try create new tdir\n"); + inode = dmfs_create_tdir(dir->i_sb, mode); if (!IS_ERR(inode)) { d_instantiate(dentry, inode); dget(dentry); @@ -221,6 +222,7 @@ static int dmfs_lv_rmdir(struct inode *dir, struct dentry *dentry) struct inode *inode = dentry->d_inode; inode->i_nlink--; dput(dentry); + ret = 0; } return ret; @@ -256,16 +258,20 @@ struct inode *dmfs_create_lv(struct super_block *sb, int mode, struct dentry *de struct inode *inode = dmfs_new_inode(sb, mode | S_IFDIR); struct mapped_device *md; const char *name = dentry->d_name.name; + char tmp_name[DM_NAME_LEN + 1]; if (inode) { inode->i_fop = &dmfs_lv_file_operations; inode->i_op = &dmfs_lv_inode_operations; - md = dm_create(name, -1); + memcpy(tmp_name, name, dentry->d_name.len); + tmp_name[dentry->d_name.len] = 0; + md = dm_create(tmp_name, -1); if (md == NULL) { iput(inode); return NULL; } DMFS_I(inode)->md = md; + printk("created new lv\n"); } return inode; diff --git a/driver/device-mapper/dmfs-root.c b/driver/device-mapper/dmfs-root.c index a266b3a6d..b724893f6 100644 --- a/driver/device-mapper/dmfs-root.c +++ b/driver/device-mapper/dmfs-root.c @@ -27,7 +27,7 @@ #include "dm.h" -extern struct inode *dmfs_create_lv(struct inode *dir, int mode, struct dentry *dentry); +extern struct inode *dmfs_create_lv(struct super_block *sb, int mode, struct dentry *dentry); static int is_identifier(const char *str, int len) { @@ -52,7 +52,7 @@ static int dmfs_root_mkdir(struct inode *dir, struct dentry *dentry, int mode) if (dentry->d_name.name[0] == '.') return -EINVAL; - inode = dmfs_create_lv(dir, mode, dentry); + inode = dmfs_create_lv(dir->i_sb, mode, dentry); if (!IS_ERR(inode)) { d_instantiate(dentry, inode); dget(dentry); @@ -98,6 +98,7 @@ static int dmfs_root_rmdir(struct inode *dir, struct dentry *dentry) if (empty(dentry)) { struct inode *inode = dentry->d_inode; ret = dm_deactivate(DMFS_I(inode)->md); + printk("ret=%d\n", ret); if (ret == 0) { inode->i_nlink--; dput(dentry); diff --git a/driver/device-mapper/dmfs-super.c b/driver/device-mapper/dmfs-super.c index b8b7919cf..840760526 100644 --- a/driver/device-mapper/dmfs-super.c +++ b/driver/device-mapper/dmfs-super.c @@ -39,7 +39,6 @@ static int dmfs_statfs(struct super_block *sb, struct statfs *buf) static void dmfs_delete_inode(struct inode *inode) { - struct super_block *sb = inode->i_sb; struct dmfs_i *dmi = DMFS_I(inode); if (dmi) { @@ -105,7 +104,7 @@ struct inode *dmfs_new_inode(struct super_block *sb, int mode) iput(inode); return NULL; } - memset(dmi, sizeof(struct dmfs_i), 0); + memset(dmi, 0, sizeof(struct dmfs_i)); init_MUTEX(&dmi->sem); inode->u.generic_ip = dmi; } diff --git a/driver/device-mapper/dmfs-tdir.c b/driver/device-mapper/dmfs-tdir.c index 6911e53eb..47f423c08 100644 --- a/driver/device-mapper/dmfs-tdir.c +++ b/driver/device-mapper/dmfs-tdir.c @@ -46,6 +46,8 @@ static struct dentry *dmfs_tdir_lookup(struct inode *dir, struct dentry *dentry) struct inode *inode = NULL; const char *name = dentry->d_name.name; + printk("tdir lookup\n"); + switch(dentry->d_name.len) { case 5: if (memcmp("table", name, 5) == 0) { @@ -70,6 +72,8 @@ static int dmfs_tdir_readdir(struct file *filp, void *dirent, filldir_t filldir) int i; struct dentry *dentry = filp->f_dentry; + printk("tdir readdir\n"); + i = filp->f_pos; switch(i) { case 0: @@ -122,9 +126,9 @@ static struct inode_operations dmfs_tdir_inode_operations = { unlink: dmfs_tdir_unlink, }; -struct inode *dmfs_create_tdir(struct inode *dir, struct dentry *dentry, int mode) +struct inode *dmfs_create_tdir(struct super_block *sb, int mode) { - struct inode *inode = dmfs_new_inode(dir->i_sb, mode | S_IFDIR); + struct inode *inode = dmfs_new_inode(sb, mode | S_IFDIR); if (inode) { inode->i_fop = &dmfs_tdir_file_operations;