]> git.openpandora.org Git - pandora-kernel.git/commitdiff
kernfs: remove KERNFS_STATIC_NAME
authorTejun Heo <tj@kernel.org>
Fri, 13 Feb 2015 22:36:31 +0000 (14:36 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 14 Feb 2015 05:21:36 +0000 (21:21 -0800)
When a new kernfs node is created, KERNFS_STATIC_NAME is used to avoid
making a separate copy of its name.  It's currently only used for sysfs
attributes whose filenames are required to stay accessible and unchanged.
There are rare exceptions where these names are allocated and formatted
dynamically but for the vast majority of cases they're consts in the
rodata section.

Now that kernfs is converted to use kstrdup_const() and kfree_const(),
there's little point in keeping KERNFS_STATIC_NAME around.  Remove it.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/kernfs/dir.c
fs/kernfs/file.c
fs/sysfs/file.c
include/linux/kernfs.h
kernel/cgroup.c

index 35e40879860aebc4491082ca3dbc0bad6ef70727..6acc9648f9869727dc9fb030d281d37bffdf3277 100644 (file)
@@ -411,8 +411,9 @@ void kernfs_put(struct kernfs_node *kn)
 
        if (kernfs_type(kn) == KERNFS_LINK)
                kernfs_put(kn->symlink.target_kn);
-       if (!(kn->flags & KERNFS_STATIC_NAME))
-               kfree_const(kn->name);
+
+       kfree_const(kn->name);
+
        if (kn->iattr) {
                if (kn->iattr->ia_secdata)
                        security_release_secctx(kn->iattr->ia_secdata,
@@ -506,15 +507,12 @@ static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root,
                                             const char *name, umode_t mode,
                                             unsigned flags)
 {
-       const char *dup_name = NULL;
        struct kernfs_node *kn;
        int ret;
 
-       if (!(flags & KERNFS_STATIC_NAME)) {
-               name = dup_name = kstrdup_const(name, GFP_KERNEL);
-               if (!name)
-                       return NULL;
-       }
+       name = kstrdup_const(name, GFP_KERNEL);
+       if (!name)
+               return NULL;
 
        kn = kmem_cache_zalloc(kernfs_node_cache, GFP_KERNEL);
        if (!kn)
@@ -538,7 +536,7 @@ static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root,
  err_out2:
        kmem_cache_free(kernfs_node_cache, kn);
  err_out1:
-       kfree_const(dup_name);
+       kfree_const(name);
        return NULL;
 }
 
@@ -1285,9 +1283,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
 
        kn->ns = new_ns;
        if (new_name) {
-               if (!(kn->flags & KERNFS_STATIC_NAME))
-                       old_name = kn->name;
-               kn->flags &= ~KERNFS_STATIC_NAME;
+               old_name = kn->name;
                kn->name = new_name;
        }
 
index ddc9f9612f168f026ea71aa4f4aac41bf6860369..b684e8a132e6255b7f294321ccd3a2f0e5097a09 100644 (file)
@@ -901,7 +901,6 @@ const struct file_operations kernfs_file_fops = {
  * @ops: kernfs operations for the file
  * @priv: private data for the file
  * @ns: optional namespace tag of the file
- * @name_is_static: don't copy file name
  * @key: lockdep key for the file's active_ref, %NULL to disable lockdep
  *
  * Returns the created node on success, ERR_PTR() value on error.
@@ -911,7 +910,6 @@ struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent,
                                         umode_t mode, loff_t size,
                                         const struct kernfs_ops *ops,
                                         void *priv, const void *ns,
-                                        bool name_is_static,
                                         struct lock_class_key *key)
 {
        struct kernfs_node *kn;
@@ -919,8 +917,6 @@ struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent,
        int rc;
 
        flags = KERNFS_FILE;
-       if (name_is_static)
-               flags |= KERNFS_STATIC_NAME;
 
        kn = kernfs_new_node(parent, name, (mode & S_IALLUGO) | S_IFREG, flags);
        if (!kn)
diff --cc fs/sysfs/file.c
Simple merge
Simple merge
diff --cc kernel/cgroup.c
Simple merge