sdcardfs: Port to 3.4
Analog port to 3.10 by Daniel Campello <campello@google.com>.
Change-Id: I0b05890cdd4332c5cfc2ffdf66a3f3a7890cce35
diff --git a/fs/sdcardfs/file.c b/fs/sdcardfs/file.c
index bcacb94..4eb82fa 100644
--- a/fs/sdcardfs/file.c
+++ b/fs/sdcardfs/file.c
@@ -296,19 +296,24 @@
return 0;
}
-static int
-sdcardfs_fsync(struct file *file, int datasync)
+static int sdcardfs_fsync(struct file *file, loff_t start, loff_t end,
+ int datasync)
{
int err;
struct file *lower_file;
struct path lower_path;
struct dentry *dentry = file->f_path.dentry;
+ err = generic_file_fsync(file, start, end, datasync);
+ if (err)
+ goto out;
+
lower_file = sdcardfs_lower_file(file);
sdcardfs_get_lower_path(dentry, &lower_path);
- err = vfs_fsync(lower_file, datasync);
+ err = vfs_fsync_range(lower_file, start, end, datasync);
sdcardfs_put_lower_path(dentry, &lower_path);
+out:
return err;
}
diff --git a/fs/sdcardfs/hashtable.h b/fs/sdcardfs/hashtable.h
deleted file mode 100644
index 1e770f3..0000000
--- a/fs/sdcardfs/hashtable.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Statically sized hash table implementation
- * (C) 2012 Sasha Levin <levinsasha928@gmail.com>
- */
-
-#ifndef _LINUX_HASHTABLE_H
-#define _LINUX_HASHTABLE_H
-
-#include <linux/list.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/hash.h>
-#include <linux/rculist.h>
-
-#define DEFINE_HASHTABLE(name, bits) \
- struct hlist_head name[1 << (bits)] = \
- { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
-
-#define DECLARE_HASHTABLE(name, bits) \
- struct hlist_head name[1 << (bits)]
-
-#define HASH_SIZE(name) (ARRAY_SIZE(name))
-#define HASH_BITS(name) ilog2(HASH_SIZE(name))
-
-/* Use hash_32 when possible to allow for fast 32bit hashing in 64bit kernels. */
-#define hash_min(val, bits) \
- (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits))
-
-static inline void __hash_init(struct hlist_head *ht, unsigned int sz)
-{
- unsigned int i;
-
- for (i = 0; i < sz; i++)
- INIT_HLIST_HEAD(&ht[i]);
-}
-
-/**
- * hash_init - initialize a hash table
- * @hashtable: hashtable to be initialized
- *
- * Calculates the size of the hashtable from the given parameter, otherwise
- * same as hash_init_size.
- *
- * This has to be a macro since HASH_BITS() will not work on pointers since
- * it calculates the size during preprocessing.
- */
-#define hash_init(hashtable) __hash_init(hashtable, HASH_SIZE(hashtable))
-
-/**
- * hash_add - add an object to a hashtable
- * @hashtable: hashtable to add to
- * @node: the &struct hlist_node of the object to be added
- * @key: the key of the object to be added
- */
-#define hash_add(hashtable, node, key) \
- hlist_add_head(node, &hashtable[hash_min(key, HASH_BITS(hashtable))])
-
-/**
- * hash_add_rcu - add an object to a rcu enabled hashtable
- * @hashtable: hashtable to add to
- * @node: the &struct hlist_node of the object to be added
- * @key: the key of the object to be added
- */
-#define hash_add_rcu(hashtable, node, key) \
- hlist_add_head_rcu(node, &hashtable[hash_min(key, HASH_BITS(hashtable))])
-
-/**
- * hash_hashed - check whether an object is in any hashtable
- * @node: the &struct hlist_node of the object to be checked
- */
-static inline bool hash_hashed(struct hlist_node *node)
-{
- return !hlist_unhashed(node);
-}
-
-static inline bool __hash_empty(struct hlist_head *ht, unsigned int sz)
-{
- unsigned int i;
-
- for (i = 0; i < sz; i++)
- if (!hlist_empty(&ht[i]))
- return false;
-
- return true;
-}
-
-/**
- * hash_empty - check whether a hashtable is empty
- * @hashtable: hashtable to check
- *
- * This has to be a macro since HASH_BITS() will not work on pointers since
- * it calculates the size during preprocessing.
- */
-#define hash_empty(hashtable) __hash_empty(hashtable, HASH_SIZE(hashtable))
-
-/**
- * hash_del - remove an object from a hashtable
- * @node: &struct hlist_node of the object to remove
- */
-static inline void hash_del(struct hlist_node *node)
-{
- hlist_del_init(node);
-}
-
-/**
- * hash_del_rcu - remove an object from a rcu enabled hashtable
- * @node: &struct hlist_node of the object to remove
- */
-static inline void hash_del_rcu(struct hlist_node *node)
-{
- hlist_del_init_rcu(node);
-}
-
-/**
- * hash_for_each - iterate over a hashtable
- * @name: hashtable to iterate
- * @bkt: integer to use as bucket loop cursor
- * @obj: the type * to use as a loop cursor for each entry
- * @member: the name of the hlist_node within the struct
- */
-#define hash_for_each(name, bkt, obj, member, pos) \
- for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
- (bkt)++)\
- hlist_for_each_entry(obj, pos, &name[bkt], member)
-
-/**
- * hash_for_each_rcu - iterate over a rcu enabled hashtable
- * @name: hashtable to iterate
- * @bkt: integer to use as bucket loop cursor
- * @obj: the type * to use as a loop cursor for each entry
- * @member: the name of the hlist_node within the struct
- */
-#define hash_for_each_rcu(name, bkt, obj, member) \
- for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
- (bkt)++)\
- hlist_for_each_entry_rcu(obj, &name[bkt], member)
-
-/**
- * hash_for_each_safe - iterate over a hashtable safe against removal of
- * hash entry
- * @name: hashtable to iterate
- * @bkt: integer to use as bucket loop cursor
- * @tmp: a &struct used for temporary storage
- * @obj: the type * to use as a loop cursor for each entry
- * @member: the name of the hlist_node within the struct
- */
-#define hash_for_each_safe(name, bkt, tmp, obj, member, pos) \
- for ((bkt) = 0, obj = NULL; (bkt) < HASH_SIZE(name);\
- (bkt)++)\
- hlist_for_each_entry_safe(obj, pos, tmp, &name[bkt], member)
-
-/**
- * hash_for_each_possible - iterate over all possible objects hashing to the
- * same bucket
- * @name: hashtable to iterate
- * @obj: the type * to use as a loop cursor for each entry
- * @member: the name of the hlist_node within the struct
- * @key: the key of the objects to iterate over
- */
-#define hash_for_each_possible(name, obj, member, key, pos) \
- hlist_for_each_entry(obj, pos, &name[hash_min(key, HASH_BITS(name))], member)
-
-/**
- * hash_for_each_possible_rcu - iterate over all possible objects hashing to the
- * same bucket in an rcu enabled hashtable
- * in a rcu enabled hashtable
- * @name: hashtable to iterate
- * @obj: the type * to use as a loop cursor for each entry
- * @member: the name of the hlist_node within the struct
- * @key: the key of the objects to iterate over
- */
-#define hash_for_each_possible_rcu(name, obj, member, key) \
- hlist_for_each_entry_rcu(obj, &name[hash_min(key, HASH_BITS(name))],\
- member)
-
-/**
- * hash_for_each_possible_safe - iterate over all possible objects hashing to the
- * same bucket safe against removals
- * @name: hashtable to iterate
- * @obj: the type * to use as a loop cursor for each entry
- * @tmp: a &struct used for temporary storage
- * @member: the name of the hlist_node within the struct
- * @key: the key of the objects to iterate over
- */
-#define hash_for_each_possible_safe(name, obj, tmp, member, key) \
- hlist_for_each_entry_safe(obj, tmp,\
- &name[hash_min(key, HASH_BITS(name))], member)
-
-
-#endif
diff --git a/fs/sdcardfs/inode.c b/fs/sdcardfs/inode.c
index e8ed042..c7098f5 100644
--- a/fs/sdcardfs/inode.c
+++ b/fs/sdcardfs/inode.c
@@ -49,12 +49,12 @@
}
static int sdcardfs_create(struct inode *dir, struct dentry *dentry,
- int mode, struct nameidata *nd)
+ umode_t mode, struct nameidata *nd)
{
int err = 0;
struct dentry *lower_dentry;
struct dentry *lower_parent_dentry = NULL;
- struct path lower_path, saved_path;
+ struct path lower_path;
struct sdcardfs_sb_info *sbi = SDCARDFS_SB(dentry->d_sb);
const struct cred *saved_cred = NULL;
@@ -78,14 +78,9 @@
if (err)
goto out_unlock;
- pathcpy(&saved_path, &nd->path);
- pathcpy(&nd->path, &lower_path);
-
/* set last 16bytes of mode field to 0664 */
mode = (mode & S_IFMT) | 00664;
err = vfs_create(lower_parent_dentry->d_inode, lower_dentry, mode, nd);
-
- pathcpy(&nd->path, &saved_path);
if (err)
goto out;
@@ -198,8 +193,8 @@
goto out;
fsstack_copy_attr_times(dir, lower_dir_inode);
fsstack_copy_inode_size(dir, lower_dir_inode);
- dentry->d_inode->i_nlink =
- sdcardfs_lower_inode(dentry->d_inode)->i_nlink;
+ set_nlink(dentry->d_inode,
+ sdcardfs_lower_inode(dentry->d_inode)->i_nlink);
dentry->d_inode->i_ctime = dir->i_ctime;
d_drop(dentry); /* this is needed, else LTP fails (VFS won't do it) */
out:
@@ -266,7 +261,7 @@
return 0;
}
-static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
+static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
{
int err = 0;
int make_nomedia_in_obb = 0;
@@ -343,7 +338,7 @@
fsstack_copy_attr_times(dir, sdcardfs_lower_inode(dir));
fsstack_copy_inode_size(dir, lower_parent_dentry->d_inode);
/* update number of links on parent directory */
- dir->i_nlink = sdcardfs_lower_inode(dir)->i_nlink;
+ set_nlink(dir, sdcardfs_lower_inode(dir)->i_nlink);
if ((sbi->options.derive == DERIVE_UNIFIED) && (!strcasecmp(dentry->d_name.name, "obb"))
&& (pi->perm == PERM_ANDROID) && (pi->userid == 0))
@@ -439,7 +434,7 @@
clear_nlink(dentry->d_inode);
fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode);
- dir->i_nlink = lower_dir_dentry->d_inode->i_nlink;
+ set_nlink(dir, lower_dir_dentry->d_inode->i_nlink);
out:
mnt_drop_write(lower_path.mnt);
@@ -659,18 +654,15 @@
}
#endif
-static int sdcardfs_permission(struct inode *inode, int mask, unsigned int flags)
+static int sdcardfs_permission(struct inode *inode, int mask)
{
int err;
- if (flags & IPERM_FLAG_RCU)
- return -ECHILD;
-
/*
* Permission check on sdcardfs inode.
* Calling process should have AID_SDCARD_RW permission
*/
- err = generic_permission(inode, mask, 0, inode->i_op->check_acl);
+ err = generic_permission(inode, mask);
/* XXX
* Original sdcardfs code calls inode_permission(lower_inode,.. )
@@ -863,7 +855,9 @@
const struct inode_operations sdcardfs_dir_iops = {
.create = sdcardfs_create,
.lookup = sdcardfs_lookup,
+#if 0
.permission = sdcardfs_permission,
+#endif
.unlink = sdcardfs_unlink,
.mkdir = sdcardfs_mkdir,
.rmdir = sdcardfs_rmdir,
diff --git a/fs/sdcardfs/lookup.c b/fs/sdcardfs/lookup.c
index c0b1237..9f5464f 100644
--- a/fs/sdcardfs/lookup.c
+++ b/fs/sdcardfs/lookup.c
@@ -79,7 +79,7 @@
return 0;
}
-static struct inode *sdcardfs_iget(struct super_block *sb,
+struct inode *sdcardfs_iget(struct super_block *sb,
struct inode *lower_inode)
{
struct sdcardfs_inode_info *info;
@@ -214,7 +214,6 @@
struct dentry *lower_dentry;
const char *name;
struct nameidata lower_nd;
- struct path lower_path;
struct qstr this;
struct sdcardfs_sb_info *sbi;
@@ -234,10 +233,10 @@
/* Use vfs_path_lookup to check if the dentry exists or not */
if (sbi->options.lower_fs == LOWER_FS_EXT4) {
err = vfs_path_lookup(lower_dir_dentry, lower_dir_mnt, name,
- LOOKUP_CASE_INSENSITIVE, &lower_nd);
+ LOOKUP_CASE_INSENSITIVE, &lower_nd.path);
} else if (sbi->options.lower_fs == LOWER_FS_FAT) {
err = vfs_path_lookup(lower_dir_dentry, lower_dir_mnt, name, 0,
- &lower_nd);
+ &lower_nd.path);
}
/* no error: handle positive dentries */
@@ -297,9 +296,9 @@
d_add(lower_dentry, NULL); /* instantiate and hash */
setup_lower:
- lower_path.dentry = lower_dentry;
- lower_path.mnt = mntget(lower_dir_mnt);
- sdcardfs_set_lower_path(dentry, &lower_path);
+ lower_nd.path.dentry = lower_dentry;
+ lower_nd.path.mnt = mntget(lower_dir_mnt);
+ sdcardfs_set_lower_path(dentry, &lower_nd.path);
/*
* If the intent is to create a file, then don't return an error, so
diff --git a/fs/sdcardfs/main.c b/fs/sdcardfs/main.c
index 1fdceff..fdd2cbd 100644
--- a/fs/sdcardfs/main.c
+++ b/fs/sdcardfs/main.c
@@ -156,6 +156,7 @@
return 0;
}
+#if 0
/*
* our custom d_alloc_root work-alike
*
@@ -181,6 +182,7 @@
}
return ret;
}
+#endif
/*
* There is no need to lock the sdcardfs_super_info's rwsem as there is no
@@ -195,6 +197,7 @@
struct path lower_path;
struct sdcardfs_sb_info *sb_info;
void *pkgl_id;
+ struct inode *inode;
printk(KERN_INFO "sdcardfs version 2.0\n");
@@ -259,12 +262,18 @@
sb->s_magic = SDCARDFS_SUPER_MAGIC;
sb->s_op = &sdcardfs_sops;
- /* see comment next to the definition of sdcardfs_d_alloc_root */
- sb->s_root = sdcardfs_d_alloc_root(sb);
- if (!sb->s_root) {
- err = -ENOMEM;
+ /* get a new inode and allocate our root dentry */
+ inode = sdcardfs_iget(sb, lower_path.dentry->d_inode);
+ if (IS_ERR(inode)) {
+ err = PTR_ERR(inode);
goto out_sput;
}
+ sb->s_root = d_make_root(inode);
+ if (!sb->s_root) {
+ err = -ENOMEM;
+ goto out_iput;
+ }
+ d_set_d_op(sb->s_root, &sdcardfs_ci_dops);
/* link the upper and lower dentries */
sb->s_root->d_fsdata = NULL;
@@ -275,56 +284,60 @@
/* set the lower dentries for s_root */
sdcardfs_set_lower_path(sb->s_root, &lower_path);
- /* call interpose to create the upper level inode */
- err = sdcardfs_interpose(sb->s_root, sb, &lower_path);
- if (!err) {
- /* setup permission policy */
- switch(sb_info->options.derive) {
- case DERIVE_NONE:
- setup_derived_state(sb->s_root->d_inode,
+ /*
+ * No need to call interpose because we already have a positive
+ * dentry, which was instantiated by d_make_root. Just need to
+ * d_rehash it.
+ */
+ d_rehash(sb->s_root);
+
+ /* setup permission policy */
+ switch(sb_info->options.derive) {
+ case DERIVE_NONE:
+ setup_derived_state(sb->s_root->d_inode,
PERM_ROOT, 0, AID_ROOT, AID_SDCARD_RW, 00775);
- sb_info->obbpath_s = NULL;
- break;
- case DERIVE_LEGACY:
- /* Legacy behavior used to support internal multiuser layout which
- * places user_id at the top directory level, with the actual roots
- * just below that. Shared OBB path is also at top level. */
- setup_derived_state(sb->s_root->d_inode,
- PERM_LEGACY_PRE_ROOT, 0, AID_ROOT, AID_SDCARD_R, 00771);
- /* initialize the obbpath string and lookup the path
- * sb_info->obb_path will be deactivated by path_put
- * on sdcardfs_put_super */
- sb_info->obbpath_s = kzalloc(PATH_MAX, GFP_KERNEL);
- snprintf(sb_info->obbpath_s, PATH_MAX, "%s/obb", dev_name);
- err = prepare_dir(sb_info->obbpath_s,
- sb_info->options.fs_low_uid,
- sb_info->options.fs_low_gid, 00755);
- if(err)
- printk(KERN_ERR "sdcardfs: %s: %d, error on creating %s\n",
- __func__,__LINE__, sb_info->obbpath_s);
- break;
- case DERIVE_UNIFIED:
- /* Unified multiuser layout which places secondary user_id under
- * /Android/user and shared OBB path under /Android/obb. */
- setup_derived_state(sb->s_root->d_inode,
- PERM_ROOT, 0, AID_ROOT, AID_SDCARD_R, 00771);
+ sb_info->obbpath_s = NULL;
+ break;
+ case DERIVE_LEGACY:
+ /* Legacy behavior used to support internal multiuser layout which
+ * places user_id at the top directory level, with the actual roots
+ * just below that. Shared OBB path is also at top level. */
+ setup_derived_state(sb->s_root->d_inode,
+ PERM_LEGACY_PRE_ROOT, 0, AID_ROOT, AID_SDCARD_R, 00771);
+ /* initialize the obbpath string and lookup the path
+ * sb_info->obb_path will be deactivated by path_put
+ * on sdcardfs_put_super */
+ sb_info->obbpath_s = kzalloc(PATH_MAX, GFP_KERNEL);
+ snprintf(sb_info->obbpath_s, PATH_MAX, "%s/obb", dev_name);
+ err = prepare_dir(sb_info->obbpath_s,
+ sb_info->options.fs_low_uid,
+ sb_info->options.fs_low_gid, 00755);
+ if(err)
+ printk(KERN_ERR "sdcardfs: %s: %d, error on creating %s\n",
+ __func__,__LINE__, sb_info->obbpath_s);
+ break;
+ case DERIVE_UNIFIED:
+ /* Unified multiuser layout which places secondary user_id under
+ * /Android/user and shared OBB path under /Android/obb. */
+ setup_derived_state(sb->s_root->d_inode,
+ PERM_ROOT, 0, AID_ROOT, AID_SDCARD_R, 00771);
- sb_info->obbpath_s = kzalloc(PATH_MAX, GFP_KERNEL);
- snprintf(sb_info->obbpath_s, PATH_MAX, "%s/Android/obb", dev_name);
- break;
- }
- fix_derived_permission(sb->s_root->d_inode);
-
- if (!silent)
- printk(KERN_INFO "sdcardfs: mounted on top of %s type %s\n",
- dev_name, lower_sb->s_type->name);
- goto out;
+ sb_info->obbpath_s = kzalloc(PATH_MAX, GFP_KERNEL);
+ snprintf(sb_info->obbpath_s, PATH_MAX, "%s/Android/obb", dev_name);
+ break;
}
- /* else error: fall through */
+ fix_derived_permission(sb->s_root->d_inode);
- free_dentry_private_data(sb->s_root);
+ if (!silent)
+ printk(KERN_INFO "sdcardfs: mounted on top of %s type %s\n",
+ dev_name, lower_sb->s_type->name);
+ goto out; /* all is well */
+
+ /* no longer needed: free_dentry_private_data(sb->s_root); */
out_freeroot:
dput(sb->s_root);
+out_iput:
+ iput(inode);
out_sput:
/* drop refs we took earlier */
atomic_dec(&lower_sb->s_active);
@@ -378,7 +391,7 @@
.name = SDCARDFS_NAME,
.mount = sdcardfs_mount,
.kill_sb = generic_shutdown_super,
- .fs_flags = FS_REVAL_DOT,
+ .fs_flags = 0,
};
static int __init init_sdcardfs_fs(void)
diff --git a/fs/sdcardfs/packagelist.c b/fs/sdcardfs/packagelist.c
index c786d8f..59dab9e 100644
--- a/fs/sdcardfs/packagelist.c
+++ b/fs/sdcardfs/packagelist.c
@@ -20,7 +20,7 @@
#include "sdcardfs.h"
#include "strtok.h"
-#include "hashtable.h"
+#include "linux/hashtable.h"
#include <linux/syscalls.h>
#include <linux/kthread.h>
#include <linux/inotify.h>
@@ -70,7 +70,7 @@
struct hashtable_entry *hash_cur;
struct hlist_node *h_n;
- hash_for_each_possible(pkgl_dat->appid_with_rw, hash_cur, hlist, (unsigned int)appid, h_n)
+ hash_for_each_possible(pkgl_dat->appid_with_rw, hash_cur, h_n, hlist, (unsigned int)appid)
if (appid == hash_cur->key)
return 1;
return 0;
@@ -104,7 +104,7 @@
//printk(KERN_INFO "sdcardfs: %s: %s, %u\n", __func__, (char *)app_name, hash);
mutex_lock(&pkgl_dat->hashtable_lock);
- hash_for_each_possible(pkgl_dat->package_to_appid, hash_cur, hlist, hash, h_n) {
+ hash_for_each_possible(pkgl_dat->package_to_appid, hash_cur, h_n, hlist, hash) {
//printk(KERN_INFO "sdcardfs: %s: %s\n", __func__, (char *)hash_cur->key);
if (!strcasecmp(app_name, hash_cur->key)) {
ret_id = (appid_t)hash_cur->value;
@@ -178,7 +178,7 @@
unsigned int hash = str_hash(key);
//printk(KERN_INFO "sdcardfs: %s: %s: %d, %u\n", __func__, (char *)key, value, hash);
- hash_for_each_possible(pkgl_dat->package_to_appid, hash_cur, hlist, hash, h_n) {
+ hash_for_each_possible(pkgl_dat->package_to_appid, hash_cur, h_n, hlist, hash) {
if (!strcasecmp(key, hash_cur->key)) {
hash_cur->value = value;
return 0;
@@ -205,8 +205,8 @@
struct hlist_node *h_n;
//printk(KERN_INFO "sdcardfs: %s: %d: %d\n", __func__, (int)key, value);
- hash_for_each_possible(pkgl_dat->appid_with_rw, hash_cur, hlist,
- (unsigned int)key, h_n) {
+ hash_for_each_possible(pkgl_dat->appid_with_rw, hash_cur, h_n, hlist,
+ (unsigned int)key) {
if (key == hash_cur->key) {
hash_cur->value = value;
return 0;
@@ -234,9 +234,9 @@
struct hlist_node *h_t;
int i;
- hash_for_each_safe(pkgl_dat->package_to_appid, i, h_t, hash_cur, hlist, h_n)
+ hash_for_each_safe(pkgl_dat->package_to_appid, i, h_t, h_n, hash_cur, hlist)
remove_str_to_int(hash_cur);
- hash_for_each_safe(pkgl_dat->appid_with_rw, i, h_t, hash_cur, hlist, h_n)
+ hash_for_each_safe(pkgl_dat->appid_with_rw, i, h_t, h_n, hash_cur, hlist)
remove_int_to_null(hash_cur);
hash_init(pkgl_dat->package_to_appid);
diff --git a/fs/sdcardfs/sdcardfs.h b/fs/sdcardfs/sdcardfs.h
index 90f8b24..f666eff 100644
--- a/fs/sdcardfs/sdcardfs.h
+++ b/fs/sdcardfs/sdcardfs.h
@@ -160,6 +160,8 @@
extern void free_dentry_private_data(struct dentry *dentry);
extern struct dentry *sdcardfs_lookup(struct inode *dir, struct dentry *dentry,
struct nameidata *nd);
+extern struct inode *sdcardfs_iget(struct super_block *sb,
+ struct inode *lower_inode);
extern int sdcardfs_interpose(struct dentry *dentry, struct super_block *sb,
struct path *lower_path);
@@ -402,16 +404,9 @@
int err;
struct dentry *dent;
struct iattr attrs;
- struct nameidata nd;
+ struct path parent;
- err = kern_path_parent(path_s, &nd);
- if (err) {
- if (err == -EEXIST)
- err = 0;
- goto out;
- }
-
- dent = lookup_create(&nd, 1);
+ dent = kern_path_locked(path_s, &parent);
if (IS_ERR(dent)) {
err = PTR_ERR(dent);
if (err == -EEXIST)
@@ -419,7 +414,7 @@
goto out_unlock;
}
- err = vfs_mkdir(nd.path.dentry->d_inode, dent, mode);
+ err = vfs_mkdir(parent.dentry->d_inode, dent, mode);
if (err) {
if (err == -EEXIST)
err = 0;
@@ -438,10 +433,9 @@
out_unlock:
/* parent dentry locked by lookup_create */
- mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
- path_put(&nd.path);
+ mutex_unlock(&parent.dentry->d_inode->i_mutex);
+ path_put(&parent);
-out:
return err;
}
diff --git a/fs/sdcardfs/super.c b/fs/sdcardfs/super.c
index 1d206c8..7431ee3 100644
--- a/fs/sdcardfs/super.c
+++ b/fs/sdcardfs/super.c
@@ -193,9 +193,9 @@
lower_sb->s_op->umount_begin(lower_sb);
}
-static int sdcardfs_show_options(struct seq_file *m, struct vfsmount *mnt)
+static int sdcardfs_show_options(struct seq_file *m, struct dentry *root)
{
- struct sdcardfs_sb_info *sbi = SDCARDFS_SB(mnt->mnt_sb);
+ struct sdcardfs_sb_info *sbi = SDCARDFS_SB(root->d_sb);
struct sdcardfs_mount_options *opts = &sbi->options;
if (opts->fs_low_uid != 0)