* 2) it exists
* 3) is a directory
*/
-int check_branch(struct nameidata *nd)
+int check_branch(const struct path *path)
{
/* XXX: remove in ODF code -- stacking unions allowed there */
- if (!strcmp(nd->path.dentry->d_sb->s_type->name, UNIONFS_NAME))
+ if (!strcmp(path->dentry->d_sb->s_type->name, UNIONFS_NAME))
return -EINVAL;
- if (!nd->path.dentry->d_inode)
+ if (!path->dentry->d_inode)
return -ENOENT;
- if (!S_ISDIR(nd->path.dentry->d_inode->i_mode))
+ if (!S_ISDIR(path->dentry->d_inode->i_mode))
return -ENOTDIR;
return 0;
}
static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info
*lower_root_info, char *options)
{
- struct nameidata nd;
+ struct path path;
char *name;
int err = 0;
int branches = 1;
goto out;
}
- err = path_lookup(name, LOOKUP_FOLLOW, &nd);
+ err = kern_path(name, LOOKUP_FOLLOW, &path);
if (err) {
printk(KERN_ERR "unionfs: error accessing "
"lower directory '%s' (error %d)\n",
goto out;
}
- err = check_branch(&nd);
+ err = check_branch(&path);
if (err) {
printk(KERN_ERR "unionfs: lower directory "
"'%s' is not a valid branch\n", name);
- path_put(&nd.path);
+ path_put(&path);
goto out;
}
- lower_root_info->lower_paths[bindex].dentry = nd.path.dentry;
- lower_root_info->lower_paths[bindex].mnt = nd.path.mnt;
+ lower_root_info->lower_paths[bindex].dentry = path.dentry;
+ lower_root_info->lower_paths[bindex].mnt = path.mnt;
set_branchperms(sb, bindex, perms);
set_branch_count(sb, bindex, 0);
return err;
}
-static int unionfs_get_sb(struct file_system_type *fs_type,
- int flags, const char *dev_name,
- void *raw_data, struct vfsmount *mnt)
+static struct dentry *unionfs_mount(struct file_system_type *fs_type,
+ int flags, const char *dev_name,
+ void *raw_data)
{
- int err;
- err = get_sb_nodev(fs_type, flags, raw_data, unionfs_read_super, mnt);
- if (!err)
- UNIONFS_SB(mnt->mnt_sb)->dev_name =
+ struct dentry *dentry;
+
+ dentry = mount_nodev(fs_type, flags, raw_data, unionfs_read_super);
+ if (!PTR_ERR(dentry))
+ UNIONFS_SB(dentry->d_sb)->dev_name =
kstrdup(dev_name, GFP_KERNEL);
- return err;
+ return dentry;
}
static struct file_system_type unionfs_fs_type = {
.owner = THIS_MODULE,
.name = UNIONFS_NAME,
- .get_sb = unionfs_get_sb,
+ .mount = unionfs_mount,
.kill_sb = generic_shutdown_super,
.fs_flags = FS_REVAL_DOT,
};
int err = -EINVAL;
int perms, idx;
char *modename = strchr(optarg, '=');
- struct nameidata nd;
+ struct path path;
/* by now, optarg contains the branch name */
if (!*optarg) {
* and cache-coherency resolved, we'll address the branch-path
* uniqueness.
*/
- err = path_lookup(optarg, LOOKUP_FOLLOW, &nd);
+ err = kern_path(optarg, LOOKUP_FOLLOW, &path);
if (err) {
printk(KERN_ERR "unionfs: error accessing "
"lower directory \"%s\" (error %d)\n",
goto out;
}
for (idx = 0; idx < cur_branches; idx++)
- if (nd.path.mnt == new_lower_paths[idx].mnt &&
- nd.path.dentry == new_lower_paths[idx].dentry)
+ if (path.mnt == new_lower_paths[idx].mnt &&
+ path.dentry == new_lower_paths[idx].dentry)
break;
- path_put(&nd.path); /* no longer needed */
+ path_put(&path); /* no longer needed */
if (idx == cur_branches) {
err = -ENOENT; /* err may have been reset above */
printk(KERN_ERR "unionfs: branch \"%s\" "
{
int err = -EINVAL;
int idx;
- struct nameidata nd;
+ struct path path;
/* optarg contains the branch name to delete */
* and cache-coherency resolved, we'll address the branch-path
* uniqueness.
*/
- err = path_lookup(optarg, LOOKUP_FOLLOW, &nd);
+ err = kern_path(optarg, LOOKUP_FOLLOW, &path);
if (err) {
printk(KERN_ERR "unionfs: error accessing "
"lower directory \"%s\" (error %d)\n",
goto out;
}
for (idx = 0; idx < cur_branches; idx++)
- if (nd.path.mnt == new_lower_paths[idx].mnt &&
- nd.path.dentry == new_lower_paths[idx].dentry)
+ if (path.mnt == new_lower_paths[idx].mnt &&
+ path.dentry == new_lower_paths[idx].dentry)
break;
- path_put(&nd.path); /* no longer needed */
+ path_put(&path); /* no longer needed */
if (idx == cur_branches) {
printk(KERN_ERR "unionfs: branch \"%s\" "
"not found\n", optarg);
int perms;
int idx = 0; /* default: insert at beginning */
char *new_branch , *modename = NULL;
- struct nameidata nd;
+ struct path path;
/*
* optarg can be of several forms:
* and cache-coherency resolved, we'll address the branch-path
* uniqueness.
*/
- err = path_lookup(optarg, LOOKUP_FOLLOW, &nd);
+ err = kern_path(optarg, LOOKUP_FOLLOW, &path);
if (err) {
printk(KERN_ERR "unionfs: error accessing "
"lower directory \"%s\" (error %d)\n",
goto out;
}
for (idx = 0; idx < cur_branches; idx++)
- if (nd.path.mnt == new_lower_paths[idx].mnt &&
- nd.path.dentry == new_lower_paths[idx].dentry)
+ if (path.mnt == new_lower_paths[idx].mnt &&
+ path.dentry == new_lower_paths[idx].dentry)
break;
- path_put(&nd.path); /* no longer needed */
+ path_put(&path); /* no longer needed */
if (idx == cur_branches) {
printk(KERN_ERR "unionfs: branch \"%s\" "
"not found\n", optarg);
"branch \"%s\"\n", modename, new_branch);
goto out;
}
- err = path_lookup(new_branch, LOOKUP_FOLLOW, &nd);
+ err = kern_path(new_branch, LOOKUP_FOLLOW, &path);
if (err) {
printk(KERN_ERR "unionfs: error accessing "
"lower directory \"%s\" (error %d)\n",
* because this code base doesn't support stacking unionfs: the ODF
* code base supports that correctly.
*/
- err = check_branch(&nd);
+ err = check_branch(&path);
if (err) {
printk(KERN_ERR "unionfs: lower directory "
"\"%s\" is not a valid branch\n", optarg);
- path_put(&nd.path);
+ path_put(&path);
goto out;
}
memmove(&new_lower_paths[idx+1], &new_lower_paths[idx],
(cur_branches - idx) * sizeof(struct path));
}
- new_lower_paths[idx].dentry = nd.path.dentry;
- new_lower_paths[idx].mnt = nd.path.mnt;
+ new_lower_paths[idx].dentry = path.dentry;
+ new_lower_paths[idx].mnt = path.mnt;
- new_data[idx].sb = nd.path.dentry->d_sb;
+ new_data[idx].sb = path.dentry->d_sb;
atomic_set(&new_data[idx].open_files, 0);
new_data[idx].branchperms = perms;
new_data[idx].branch_id = ++*high_branch_id; /* assign new branch ID */
path_get(&tmp_lower_paths[i]); /* drop refs at end of fxn */
/*******************************************************************
- * For each branch command, do path_lookup on the requested branch,
+ * For each branch command, do kern_path on the requested branch,
* and apply the change to a temp branch list. To handle errors, we
* already dup'ed the old arrays (above), and increased the refcnts
- * on various f/s objects. So now we can do all the path_lookups
+ * on various f/s objects. So now we can do all the kern_path'ss
* and branch-management commands on the new arrays. If it fail mid
* way, we free the tmp arrays and *put all objects. If we succeed,
* then we free old arrays and *put its objects, and then replace