Skip to content

Commit 90c07c8

Browse files
htejungregkh
authored andcommitted
kernfs: rename kernfs_dir_ops to kernfs_syscall_ops
We're gonna need non-dir syscall callbacks, which will make dir_ops a misnomer. Let's rename kernfs_dir_ops to kernfs_syscall_ops. This is pure rename. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 07c7530 commit 90c07c8

2 files changed

Lines changed: 22 additions & 21 deletions

File tree

‎fs/kernfs/dir.c‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -527,13 +527,14 @@ EXPORT_SYMBOL_GPL(kernfs_find_and_get_ns);
527527

528528
/**
529529
* kernfs_create_root - create a new kernfs hierarchy
530-
* @kdops: optional directory syscall operations for the hierarchy
530+
* @scops: optional syscall operations for the hierarchy
531531
* @priv: opaque data associated with the new directory
532532
*
533533
* Returns the root of the new hierarchy on success, ERR_PTR() value on
534534
* failure.
535535
*/
536-
struct kernfs_root *kernfs_create_root(struct kernfs_dir_ops *kdops, void *priv)
536+
struct kernfs_root *kernfs_create_root(struct kernfs_syscall_ops *scops,
537+
void *priv)
537538
{
538539
struct kernfs_root *root;
539540
struct kernfs_node *kn;
@@ -556,7 +557,7 @@ struct kernfs_root *kernfs_create_root(struct kernfs_dir_ops *kdops, void *priv)
556557
kn->priv = priv;
557558
kn->dir.root = root;
558559

559-
root->dir_ops = kdops;
560+
root->syscall_ops = scops;
560561
root->kn = kn;
561562
init_waitqueue_head(&root->deactivate_waitq);
562563

@@ -653,16 +654,16 @@ static int kernfs_iop_mkdir(struct inode *dir, struct dentry *dentry,
653654
umode_t mode)
654655
{
655656
struct kernfs_node *parent = dir->i_private;
656-
struct kernfs_dir_ops *kdops = kernfs_root(parent)->dir_ops;
657+
struct kernfs_syscall_ops *scops = kernfs_root(parent)->syscall_ops;
657658
int ret;
658659

659-
if (!kdops || !kdops->mkdir)
660+
if (!scops || !scops->mkdir)
660661
return -EPERM;
661662

662663
if (!kernfs_get_active(parent))
663664
return -ENODEV;
664665

665-
ret = kdops->mkdir(parent, dentry->d_name.name, mode);
666+
ret = scops->mkdir(parent, dentry->d_name.name, mode);
666667

667668
kernfs_put_active(parent);
668669
return ret;
@@ -671,16 +672,16 @@ static int kernfs_iop_mkdir(struct inode *dir, struct dentry *dentry,
671672
static int kernfs_iop_rmdir(struct inode *dir, struct dentry *dentry)
672673
{
673674
struct kernfs_node *kn = dentry->d_fsdata;
674-
struct kernfs_dir_ops *kdops = kernfs_root(kn)->dir_ops;
675+
struct kernfs_syscall_ops *scops = kernfs_root(kn)->syscall_ops;
675676
int ret;
676677

677-
if (!kdops || !kdops->rmdir)
678+
if (!scops || !scops->rmdir)
678679
return -EPERM;
679680

680681
if (!kernfs_get_active(kn))
681682
return -ENODEV;
682683

683-
ret = kdops->rmdir(kn);
684+
ret = scops->rmdir(kn);
684685

685686
kernfs_put_active(kn);
686687
return ret;
@@ -691,10 +692,10 @@ static int kernfs_iop_rename(struct inode *old_dir, struct dentry *old_dentry,
691692
{
692693
struct kernfs_node *kn = old_dentry->d_fsdata;
693694
struct kernfs_node *new_parent = new_dir->i_private;
694-
struct kernfs_dir_ops *kdops = kernfs_root(kn)->dir_ops;
695+
struct kernfs_syscall_ops *scops = kernfs_root(kn)->syscall_ops;
695696
int ret;
696697

697-
if (!kdops || !kdops->rename)
698+
if (!scops || !scops->rename)
698699
return -EPERM;
699700

700701
if (!kernfs_get_active(kn))
@@ -705,7 +706,7 @@ static int kernfs_iop_rename(struct inode *old_dir, struct dentry *old_dentry,
705706
return -ENODEV;
706707
}
707708

708-
ret = kdops->rename(kn, new_parent, new_dentry->d_name.name);
709+
ret = scops->rename(kn, new_parent, new_dentry->d_name.name);
709710

710711
kernfs_put_active(new_parent);
711712
kernfs_put_active(kn);

‎include/linux/kernfs.h‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ struct kernfs_node {
108108
};
109109

110110
/*
111-
* kernfs_dir_ops may be specified on kernfs_create_root() to support
112-
* directory manipulation syscalls. These optional callbacks are invoked
113-
* on the matching syscalls and can perform any kernfs operations which
114-
* don't necessarily have to be the exact operation requested. An active
115-
* reference is held for each kernfs_node parameter.
111+
* kernfs_syscall_ops may be specified on kernfs_create_root() to support
112+
* syscalls. These optional callbacks are invoked on the matching syscalls
113+
* and can perform any kernfs operations which don't necessarily have to be
114+
* the exact operation requested. An active reference is held for each
115+
* kernfs_node parameter.
116116
*/
117-
struct kernfs_dir_ops {
117+
struct kernfs_syscall_ops {
118118
int (*mkdir)(struct kernfs_node *parent, const char *name,
119119
umode_t mode);
120120
int (*rmdir)(struct kernfs_node *kn);
@@ -128,7 +128,7 @@ struct kernfs_root {
128128

129129
/* private fields, do not use outside kernfs proper */
130130
struct ida ino_ida;
131-
struct kernfs_dir_ops *dir_ops;
131+
struct kernfs_syscall_ops *syscall_ops;
132132
wait_queue_head_t deactivate_waitq;
133133
};
134134

@@ -219,7 +219,7 @@ struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent,
219219
void kernfs_get(struct kernfs_node *kn);
220220
void kernfs_put(struct kernfs_node *kn);
221221

222-
struct kernfs_root *kernfs_create_root(struct kernfs_dir_ops *kdops,
222+
struct kernfs_root *kernfs_create_root(struct kernfs_syscall_ops *scops,
223223
void *priv);
224224
void kernfs_destroy_root(struct kernfs_root *root);
225225

@@ -273,7 +273,7 @@ static inline void kernfs_get(struct kernfs_node *kn) { }
273273
static inline void kernfs_put(struct kernfs_node *kn) { }
274274

275275
static inline struct kernfs_root *
276-
kernfs_create_root(struct kernfs_dir_ops *kdops, void *priv)
276+
kernfs_create_root(struct kernfs_syscall_ops *scops, void *priv)
277277
{ return ERR_PTR(-ENOSYS); }
278278

279279
static inline void kernfs_destroy_root(struct kernfs_root *root) { }

0 commit comments

Comments
 (0)