summaryrefslogtreecommitdiffstats
path: root/fs/kernfs/dir.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-12-11 14:11:58 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-11 17:39:20 -0800
commitc637b8acbe079edb477d887041755b489036f146 (patch)
tree7d6e856930752574bb1d56b56bea5a2bf816de72 /fs/kernfs/dir.c
parenta797bfc30532388e8a11ca726df60cdd77aa8675 (diff)
downloadblackbird-op-linux-c637b8acbe079edb477d887041755b489036f146.tar.gz
blackbird-op-linux-c637b8acbe079edb477d887041755b489036f146.zip
kernfs: s/sysfs/kernfs/ in internal functions and whatever is left
kernfs has just been separated out from sysfs and we're already in full conflict mode. Nothing can make the situation any worse. Let's take the chance to name things properly. This patch performs the following renames. * s/sysfs_*()/kernfs_*()/ in all internal functions * s/sysfs/kernfs/ in internal strings, comments and whatever is remaining * Uniformly rename various vfs operations so that they're consistently named and distinguishable. This patch is strictly rename only and doesn't introduce any functional difference. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs/dir.c')
-rw-r--r--fs/kernfs/dir.c212
1 files changed, 107 insertions, 105 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index d3c66237474f..6520066c49ea 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -22,13 +22,13 @@ DEFINE_MUTEX(kernfs_mutex);
#define rb_to_kn(X) rb_entry((X), struct kernfs_node, rb)
/**
- * sysfs_name_hash
+ * kernfs_name_hash
* @name: Null terminated string to hash
* @ns: Namespace tag to hash
*
* Returns 31 bit hash of ns + name (so it fits in an off_t )
*/
-static unsigned int sysfs_name_hash(const char *name, const void *ns)
+static unsigned int kernfs_name_hash(const char *name, const void *ns)
{
unsigned long hash = init_name_hash();
unsigned int len = strlen(name);
@@ -44,8 +44,8 @@ static unsigned int sysfs_name_hash(const char *name, const void *ns)
return hash;
}
-static int sysfs_name_compare(unsigned int hash, const char *name,
- const void *ns, const struct kernfs_node *kn)
+static int kernfs_name_compare(unsigned int hash, const char *name,
+ const void *ns, const struct kernfs_node *kn)
{
if (hash != kn->hash)
return hash - kn->hash;
@@ -54,14 +54,14 @@ static int sysfs_name_compare(unsigned int hash, const char *name,
return strcmp(name, kn->name);
}
-static int sysfs_sd_compare(const struct kernfs_node *left,
- const struct kernfs_node *right)
+static int kernfs_sd_compare(const struct kernfs_node *left,
+ const struct kernfs_node *right)
{
- return sysfs_name_compare(left->hash, left->name, left->ns, right);
+ return kernfs_name_compare(left->hash, left->name, left->ns, right);
}
/**
- * sysfs_link_sibling - link kernfs_node into sibling rbtree
+ * kernfs_link_sibling - link kernfs_node into sibling rbtree
* @kn: kernfs_node of interest
*
* Link @kn into its sibling rbtree which starts from
@@ -73,7 +73,7 @@ static int sysfs_sd_compare(const struct kernfs_node *left,
* RETURNS:
* 0 on susccess -EEXIST on failure.
*/
-static int sysfs_link_sibling(struct kernfs_node *kn)
+static int kernfs_link_sibling(struct kernfs_node *kn)
{
struct rb_node **node = &kn->parent->dir.children.rb_node;
struct rb_node *parent = NULL;
@@ -87,7 +87,7 @@ static int sysfs_link_sibling(struct kernfs_node *kn)
pos = rb_to_kn(*node);
parent = *node;
- result = sysfs_sd_compare(kn, pos);
+ result = kernfs_sd_compare(kn, pos);
if (result < 0)
node = &pos->rb.rb_left;
else if (result > 0)
@@ -102,7 +102,7 @@ static int sysfs_link_sibling(struct kernfs_node *kn)
}
/**
- * sysfs_unlink_sibling - unlink kernfs_node from sibling rbtree
+ * kernfs_unlink_sibling - unlink kernfs_node from sibling rbtree
* @kn: kernfs_node of interest
*
* Unlink @kn from its sibling rbtree which starts from
@@ -111,7 +111,7 @@ static int sysfs_link_sibling(struct kernfs_node *kn)
* Locking:
* mutex_lock(kernfs_mutex)
*/
-static void sysfs_unlink_sibling(struct kernfs_node *kn)
+static void kernfs_unlink_sibling(struct kernfs_node *kn)
{
if (kernfs_type(kn) == KERNFS_DIR)
kn->parent->dir.subdirs--;
@@ -120,7 +120,7 @@ static void sysfs_unlink_sibling(struct kernfs_node *kn)
}
/**
- * sysfs_get_active - get an active reference to kernfs_node
+ * kernfs_get_active - get an active reference to kernfs_node
* @kn: kernfs_node to get an active reference to
*
* Get an active reference of @kn. This function is noop if @kn
@@ -129,7 +129,7 @@ static void sysfs_unlink_sibling(struct kernfs_node *kn)
* RETURNS:
* Pointer to @kn on success, NULL on failure.
*/
-struct kernfs_node *sysfs_get_active(struct kernfs_node *kn)
+struct kernfs_node *kernfs_get_active(struct kernfs_node *kn)
{
if (unlikely(!kn))
return NULL;
@@ -143,13 +143,13 @@ struct kernfs_node *sysfs_get_active(struct kernfs_node *kn)
}
/**
- * sysfs_put_active - put an active reference to kernfs_node
+ * kernfs_put_active - put an active reference to kernfs_node
* @kn: kernfs_node to put an active reference to
*
* Put an active reference to @kn. This function is noop if @kn
* is NULL.
*/
-void sysfs_put_active(struct kernfs_node *kn)
+void kernfs_put_active(struct kernfs_node *kn)
{
int v;
@@ -170,12 +170,12 @@ void sysfs_put_active(struct kernfs_node *kn)
}
/**
- * sysfs_deactivate - deactivate kernfs_node
+ * kernfs_deactivate - deactivate kernfs_node
* @kn: kernfs_node to deactivate
*
* Deny new active references and drain existing ones.
*/
-static void sysfs_deactivate(struct kernfs_node *kn)
+static void kernfs_deactivate(struct kernfs_node *kn)
{
DECLARE_COMPLETION_ONSTACK(wait);
int v;
@@ -235,9 +235,8 @@ void kernfs_put(struct kernfs_node *kn)
*/
parent = kn->parent;
- WARN(!(kn->flags & KERNFS_REMOVED),
- "sysfs: free using entry: %s/%s\n",
- parent ? parent->name : "", kn->name);
+ WARN(!(kn->flags & KERNFS_REMOVED), "kernfs: free using entry: %s/%s\n",
+ parent ? parent->name : "", kn->name);
if (kernfs_type(kn) == KERNFS_LINK)
kernfs_put(kn->symlink.target_kn);
@@ -265,13 +264,13 @@ void kernfs_put(struct kernfs_node *kn)
}
EXPORT_SYMBOL_GPL(kernfs_put);
-static int sysfs_dentry_delete(const struct dentry *dentry)
+static int kernfs_dop_delete(const struct dentry *dentry)
{
struct kernfs_node *kn = dentry->d_fsdata;
return !(kn && !(kn->flags & KERNFS_REMOVED));
}
-static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
+static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
{
struct kernfs_node *kn;
@@ -281,19 +280,19 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
kn = dentry->d_fsdata;
mutex_lock(&kernfs_mutex);
- /* The sysfs dirent has been deleted */
+ /* The kernfs node has been deleted */
if (kn->flags & KERNFS_REMOVED)
goto out_bad;
- /* The sysfs dirent has been moved? */
+ /* The kernfs node has been moved? */
if (dentry->d_parent->d_fsdata != kn->parent)
goto out_bad;
- /* The sysfs dirent has been renamed */
+ /* The kernfs node has been renamed */
if (strcmp(dentry->d_name.name, kn->name) != 0)
goto out_bad;
- /* The sysfs dirent has been moved to a different namespace */
+ /* The kernfs node has been moved to a different namespace */
if (kn->parent && kernfs_ns_enabled(kn->parent) &&
kernfs_info(dentry->d_sb)->ns != kn->ns)
goto out_bad;
@@ -302,9 +301,10 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
out_valid:
return 1;
out_bad:
- /* Remove the dentry from the dcache hashes.
+ /*
+ * Remove the dentry from the dcache hashes.
* If this is a deleted dentry we use d_drop instead of d_delete
- * so sysfs doesn't need to cope with negative dentries.
+ * so kernfs doesn't need to cope with negative dentries.
*
* If this is a dentry that has simply been renamed we
* use d_drop to remove it from the dcache lookup on its
@@ -324,19 +324,19 @@ out_bad:
return 0;
}
-static void sysfs_dentry_release(struct dentry *dentry)
+static void kernfs_dop_release(struct dentry *dentry)
{
kernfs_put(dentry->d_fsdata);
}
const struct dentry_operations kernfs_dops = {
- .d_revalidate = sysfs_dentry_revalidate,
- .d_delete = sysfs_dentry_delete,
- .d_release = sysfs_dentry_release,
+ .d_revalidate = kernfs_dop_revalidate,
+ .d_delete = kernfs_dop_delete,
+ .d_release = kernfs_dop_release,
};
-struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
- const char *name, umode_t mode, int type)
+struct kernfs_node *kernfs_new_node(struct kernfs_root *root, const char *name,
+ umode_t mode, int type)
{
char *dup_name = NULL;
struct kernfs_node *kn;
@@ -374,7 +374,7 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
}
/**
- * sysfs_addrm_start - prepare for kernfs_node add/remove
+ * kernfs_addrm_start - prepare for kernfs_node add/remove
* @acxt: pointer to kernfs_addrm_cxt to be used
*
* This function is called when the caller is about to add or remove
@@ -385,7 +385,7 @@ struct kernfs_node *sysfs_new_dirent(struct kernfs_root *root,
* Kernel thread context (may sleep). kernfs_mutex is locked on
* return.
*/
-void sysfs_addrm_start(struct kernfs_addrm_cxt *acxt)
+void kernfs_addrm_start(struct kernfs_addrm_cxt *acxt)
__acquires(kernfs_mutex)
{
memset(acxt, 0, sizeof(*acxt));
@@ -394,7 +394,7 @@ void sysfs_addrm_start(struct kernfs_addrm_cxt *acxt)
}
/**
- * sysfs_add_one - add kernfs_node to parent without warning
+ * kernfs_add_one - add kernfs_node to parent without warning
* @acxt: addrm context to use
* @kn: kernfs_node to be added
* @parent: the parent kernfs_node to add @kn to
@@ -404,17 +404,17 @@ void sysfs_addrm_start(struct kernfs_addrm_cxt *acxt)
* of the parent.
*
* This function should be called between calls to
- * sysfs_addrm_start() and sysfs_addrm_finish() and should be
- * passed the same @acxt as passed to sysfs_addrm_start().
+ * kernfs_addrm_start() and kernfs_addrm_finish() and should be passed
+ * the same @acxt as passed to kernfs_addrm_start().
*
* LOCKING:
- * Determined by sysfs_addrm_start().
+ * Determined by kernfs_addrm_start().
*
* RETURNS:
* 0 on success, -EEXIST if entry with the given name already
* exists.
*/
-int sysfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn,
+int kernfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn,
struct kernfs_node *parent)
{
bool has_ns = kernfs_ns_enabled(parent);
@@ -422,7 +422,7 @@ int sysfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn,
int ret;
if (has_ns != (bool)kn->ns) {
- WARN(1, KERN_WARNING "sysfs: ns %s in '%s' for '%s'\n",
+ WARN(1, KERN_WARNING "kernfs: ns %s in '%s' for '%s'\n",
has_ns ? "required" : "invalid", parent->name, kn->name);
return -EINVAL;
}
@@ -430,11 +430,11 @@ int sysfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn,
if (kernfs_type(parent) != KERNFS_DIR)
return -EINVAL;
- kn->hash = sysfs_name_hash(kn->name, kn->ns);
+ kn->hash = kernfs_name_hash(kn->name, kn->ns);
kn->parent = parent;
kernfs_get(parent);
- ret = sysfs_link_sibling(kn);
+ ret = kernfs_link_sibling(kn);
if (ret)
return ret;
@@ -452,7 +452,7 @@ int sysfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn,
}
/**
- * sysfs_remove_one - remove kernfs_node from parent
+ * kernfs_remove_one - remove kernfs_node from parent
* @acxt: addrm context to use
* @kn: kernfs_node to be removed
*
@@ -460,14 +460,14 @@ int sysfs_add_one(struct kernfs_addrm_cxt *acxt, struct kernfs_node *kn,
* directory. @kn is unlinked from the children list.
*
* This function should be called between calls to
- * sysfs_addrm_start() and sysfs_addrm_finish() and should be
- * passed the same @acxt as passed to sysfs_addrm_start().
+ * kernfs_addrm_start() and kernfs_addrm_finish() and should be
+ * passed the same @acxt as passed to kernfs_addrm_start().
*
* LOCKING:
- * Determined by sysfs_addrm_start().
+ * Determined by kernfs_addrm_start().
*/
-static void sysfs_remove_one(struct kernfs_addrm_cxt *acxt,
- struct kernfs_node *kn)
+static void kernfs_remove_one(struct kernfs_addrm_cxt *acxt,
+ struct kernfs_node *kn)
{
struct kernfs_iattrs *ps_iattr;
@@ -479,7 +479,7 @@ static void sysfs_remove_one(struct kernfs_addrm_cxt *acxt,
return;
if (kn->parent) {
- sysfs_unlink_sibling(kn);
+ kernfs_unlink_sibling(kn);
/* Update timestamps on the parent */
ps_iattr = kn->parent->iattr;
@@ -495,20 +495,20 @@ static void sysfs_remove_one(struct kernfs_addrm_cxt *acxt,
}
/**
- * sysfs_addrm_finish - finish up kernfs_node add/remove
+ * kernfs_addrm_finish - finish up kernfs_node add/remove
* @acxt: addrm context to finish up
*
* Finish up kernfs_node add/remove. Resources acquired by
- * sysfs_addrm_start() are released and removed kernfs_nodes are
+ * kernfs_addrm_start() are released and removed kernfs_nodes are
* cleaned up.
*
* LOCKING:
* kernfs_mutex is released.
*/
-void sysfs_addrm_finish(struct kernfs_addrm_cxt *acxt)
+void kernfs_addrm_finish(struct kernfs_addrm_cxt *acxt)
__releases(kernfs_mutex)
{
- /* release resources acquired by sysfs_addrm_start() */
+ /* release resources acquired by kernfs_addrm_start() */
mutex_unlock(&kernfs_mutex);
/* kill removed kernfs_nodes */
@@ -517,8 +517,8 @@ void sysfs_addrm_finish(struct kernfs_addrm_cxt *acxt)
acxt->removed = kn->u.removed_list;
- sysfs_deactivate(kn);
- sysfs_unmap_bin_file(kn);
+ kernfs_deactivate(kn);
+ kernfs_unmap_bin_file(kn);
kernfs_put(kn);
}
}
@@ -543,18 +543,18 @@ static struct kernfs_node *kernfs_find_ns(struct kernfs_node *parent,
lockdep_assert_held(&kernfs_mutex);
if (has_ns != (bool)ns) {
- WARN(1, KERN_WARNING "sysfs: ns %s in '%s' for '%s'\n",
+ WARN(1, KERN_WARNING "kernfs: ns %s in '%s' for '%s'\n",
has_ns ? "required" : "invalid", parent->name, name);
return NULL;
}
- hash = sysfs_name_hash(name, ns);
+ hash = kernfs_name_hash(name, ns);
while (node) {
struct kernfs_node *kn;
int result;
kn = rb_to_kn(node);
- result = sysfs_name_compare(hash, name, ns, kn);
+ result = kernfs_name_compare(hash, name, ns, kn);
if (result < 0)
node = node->rb_left;
else if (result > 0)
@@ -607,7 +607,7 @@ struct kernfs_root *kernfs_create_root(void *priv)
ida_init(&root->ino_ida);
- kn = sysfs_new_dirent(root, "", S_IFDIR | S_IRUGO | S_IXUGO, KERNFS_DIR);
+ kn = kernfs_new_node(root, "", S_IFDIR | S_IRUGO | S_IXUGO, KERNFS_DIR);
if (!kn) {
ida_destroy(&root->ino_ida);
kfree(root);
@@ -654,7 +654,7 @@ struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent,
int rc;
/* allocate */
- kn = sysfs_new_dirent(kernfs_root(parent), name, mode, KERNFS_DIR);
+ kn = kernfs_new_node(kernfs_root(parent), name, mode, KERNFS_DIR);
if (!kn)
return ERR_PTR(-ENOMEM);
@@ -663,9 +663,9 @@ struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent,
kn->priv = priv;
/* link in */
- sysfs_addrm_start(&acxt);
- rc = sysfs_add_one(&acxt, kn, parent);
- sysfs_addrm_finish(&acxt);
+ kernfs_addrm_start(&acxt);
+ rc = kernfs_add_one(&acxt, kn, parent);
+ kernfs_addrm_finish(&acxt);
if (!rc)
return kn;
@@ -674,8 +674,9 @@ struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent,
return ERR_PTR(rc);
}
-static struct dentry *sysfs_lookup(struct inode *dir, struct dentry *dentry,
- unsigned int flags)
+static struct dentry *kernfs_iop_lookup(struct inode *dir,
+ struct dentry *dentry,
+ unsigned int flags)
{
struct dentry *ret = NULL;
struct kernfs_node *parent = dentry->d_parent->d_fsdata;
@@ -699,7 +700,7 @@ static struct dentry *sysfs_lookup(struct inode *dir, struct dentry *dentry,
dentry->d_fsdata = kn;
/* attach dentry and inode */
- inode = sysfs_get_inode(dir->i_sb, kn);
+ inode = kernfs_get_inode(dir->i_sb, kn);
if (!inode) {
ret = ERR_PTR(-ENOMEM);
goto out_unlock;
@@ -713,17 +714,17 @@ static struct dentry *sysfs_lookup(struct inode *dir, struct dentry *dentry,
}
const struct inode_operations kernfs_dir_iops = {
- .lookup = sysfs_lookup,
- .permission = sysfs_permission,
- .setattr = sysfs_setattr,
- .getattr = sysfs_getattr,
- .setxattr = sysfs_setxattr,
- .removexattr = sysfs_removexattr,
- .getxattr = sysfs_getxattr,
- .listxattr = sysfs_listxattr,
+ .lookup = kernfs_iop_lookup,
+ .permission = kernfs_iop_permission,
+ .setattr = kernfs_iop_setattr,
+ .getattr = kernfs_iop_getattr,
+ .setxattr = kernfs_iop_setxattr,
+ .removexattr = kernfs_iop_removexattr,
+ .getxattr = kernfs_iop_getxattr,
+ .listxattr = kernfs_iop_listxattr,
};
-static struct kernfs_node *sysfs_leftmost_descendant(struct kernfs_node *pos)
+static struct kernfs_node *kernfs_leftmost_descendant(struct kernfs_node *pos)
{
struct kernfs_node *last;
@@ -746,7 +747,7 @@ static struct kernfs_node *sysfs_leftmost_descendant(struct kernfs_node *pos)
}
/**
- * sysfs_next_descendant_post - find the next descendant for post-order walk
+ * kernfs_next_descendant_post - find the next descendant for post-order walk
* @pos: the current position (%NULL to initiate traversal)
* @root: kernfs_node whose descendants to walk
*
@@ -754,8 +755,8 @@ static struct kernfs_node *sysfs_leftmost_descendant(struct kernfs_node *pos)
* descendants. @root is included in the iteration and the last node to be
* visited.
*/
-static struct kernfs_node *sysfs_next_descendant_post(struct kernfs_node *pos,
- struct kernfs_node *root)
+static struct kernfs_node *kernfs_next_descendant_post(struct kernfs_node *pos,
+ struct kernfs_node *root)
{
struct rb_node *rbn;
@@ -763,7 +764,7 @@ static struct kernfs_node *sysfs_next_descendant_post(struct kernfs_node *pos,
/* if first iteration, visit leftmost descendant which may be root */
if (!pos)
- return sysfs_leftmost_descendant(root);
+ return kernfs_leftmost_descendant(root);
/* if we visited @root, we're done */
if (pos == root)
@@ -772,7 +773,7 @@ static struct kernfs_node *sysfs_next_descendant_post(struct kernfs_node *pos,
/* if there's an unvisited sibling, visit its leftmost descendant */
rbn = rb_next(&pos->rb);
if (rbn)
- return sysfs_leftmost_descendant(rb_to_kn(rbn));
+ return kernfs_leftmost_descendant(rb_to_kn(rbn));
/* no sibling left, visit parent */
return pos->parent;
@@ -786,14 +787,14 @@ static void __kernfs_remove(struct kernfs_addrm_cxt *acxt,
if (!kn)
return;
- pr_debug("sysfs %s: removing\n", kn->name);
+ pr_debug("kernfs %s: removing\n", kn->name);
next = NULL;
do {
pos = next;
- next = sysfs_next_descendant_post(pos, kn);
+ next = kernfs_next_descendant_post(pos, kn);
if (pos)
- sysfs_remove_one(acxt, pos);
+ kernfs_remove_one(acxt, pos);
} while (next);
}
@@ -807,9 +808,9 @@ void kernfs_remove(struct kernfs_node *kn)
{
struct kernfs_addrm_cxt acxt;
- sysfs_addrm_start(&acxt);
+ kernfs_addrm_start(&acxt);
__kernfs_remove(&acxt, kn);
- sysfs_addrm_finish(&acxt);
+ kernfs_addrm_finish(&acxt);
}
/**
@@ -828,18 +829,18 @@ int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
struct kernfs_node *kn;
if (!parent) {
- WARN(1, KERN_WARNING "sysfs: can not remove '%s', no directory\n",
+ WARN(1, KERN_WARNING "kernfs: can not remove '%s', no directory\n",
name);
return -ENOENT;
}
- sysfs_addrm_start(&acxt);
+ kernfs_addrm_start(&acxt);
kn = kernfs_find_ns(parent, name, ns);
if (kn)
__kernfs_remove(&acxt, kn);
- sysfs_addrm_finish(&acxt);
+ kernfs_addrm_finish(&acxt);
if (kn)
return 0;
@@ -884,13 +885,13 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
/*
* Move to the appropriate place in the appropriate directories rbtree.
*/
- sysfs_unlink_sibling(kn);
+ kernfs_unlink_sibling(kn);
kernfs_get(new_parent);
kernfs_put(kn->parent);
kn->ns = new_ns;
- kn->hash = sysfs_name_hash(kn->name, kn->ns);
+ kn->hash = kernfs_name_hash(kn->name, kn->ns);
kn->parent = new_parent;
- sysfs_link_sibling(kn);
+ kernfs_link_sibling(kn);
error = 0;
out:
@@ -904,13 +905,13 @@ static inline unsigned char dt_type(struct kernfs_node *kn)
return (kn->mode >> 12) & 15;
}
-static int sysfs_dir_release(struct inode *inode, struct file *filp)
+static int kernfs_dir_fop_release(struct inode *inode, struct file *filp)
{
kernfs_put(filp->private_data);
return 0;
}
-static struct kernfs_node *sysfs_dir_pos(const void *ns,
+static struct kernfs_node *kernfs_dir_pos(const void *ns,
struct kernfs_node *parent, loff_t hash, struct kernfs_node *pos)
{
if (pos) {
@@ -944,10 +945,10 @@ static struct kernfs_node *sysfs_dir_pos(const void *ns,
return pos;
}
-static struct kernfs_node *sysfs_dir_next_pos(const void *ns,
+static struct kernfs_node *kernfs_dir_next_pos(const void *ns,
struct kernfs_node *parent, ino_t ino, struct kernfs_node *pos)
{
- pos = sysfs_dir_pos(ns, parent, ino, pos);
+ pos = kernfs_dir_pos(ns, parent, ino, pos);
if (pos)
do {
struct rb_node *node = rb_next(&pos->rb);
@@ -959,7 +960,7 @@ static struct kernfs_node *sysfs_dir_next_pos(const void *ns,
return pos;
}
-static int sysfs_readdir(struct file *file, struct dir_context *ctx)
+static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx)
{
struct dentry *dentry = file->f_path.dentry;
struct kernfs_node *parent = dentry->d_fsdata;
@@ -973,9 +974,9 @@ static int sysfs_readdir(struct file *file, struct dir_context *ctx)
if (kernfs_ns_enabled(parent))
ns = kernfs_info(dentry->d_sb)->ns;
- for (pos = sysfs_dir_pos(ns, parent, ctx->pos, pos);
+ for (pos = kernfs_dir_pos(ns, parent, ctx->pos, pos);
pos;
- pos = sysfs_dir_next_pos(ns, parent, ctx->pos, pos)) {
+ pos = kernfs_dir_next_pos(ns, parent, ctx->pos, pos)) {
const char *name = pos->name;
unsigned int type = dt_type(pos);
int len = strlen(name);
@@ -996,7 +997,8 @@ static int sysfs_readdir(struct file *file, struct dir_context *ctx)
return 0;
}
-static loff_t sysfs_dir_llseek(struct file *file, loff_t offset, int whence)
+static loff_t kernfs_dir_fop_llseek(struct file *file, loff_t offset,
+ int whence)
{
struct inode *inode = file_inode(file);
loff_t ret;
@@ -1010,7 +1012,7 @@ static loff_t sysfs_dir_llseek(struct file *file, loff_t offset, int whence)
const struct file_operations kernfs_dir_fops = {
.read = generic_read_dir,
- .iterate = sysfs_readdir,
- .release = sysfs_dir_release,
- .llseek = sysfs_dir_llseek,
+ .iterate = kernfs_fop_readdir,
+ .release = kernfs_dir_fop_release,
+ .llseek = kernfs_dir_fop_llseek,
};
OpenPOWER on IntegriCloud