diff options
author | Tejun Heo <tj@kernel.org> | 2013-12-11 16:02:55 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-17 11:59:15 -0500 |
commit | bb8b9d095c5c56cce99576cfef0cf9b989f7120d (patch) | |
tree | 9cc1ae8c8954de2d0dbb0b0f4c29a411d4716809 /fs/kernfs | |
parent | c637b8acbe079edb477d887041755b489036f146 (diff) |
kernfs: add @mode to kernfs_create_dir[_ns]()
sysfs assumed 0755 for all newly created directories and kernfs
inherited it. This assumption is unnecessarily restrictive and
inconsistent with kernfs_create_file[_ns](). This patch adds @mode
parameter to kernfs_create_dir[_ns]() and update uses in sysfs
accordingly. Among others, this will be useful for implementations of
the planned ->mkdir() method.
This patch doesn't introduce any behavior differences.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs')
-rw-r--r-- | fs/kernfs/dir.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 6520066c49ea..e55bb02f15a4 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c | |||
@@ -639,22 +639,23 @@ void kernfs_destroy_root(struct kernfs_root *root) | |||
639 | * kernfs_create_dir_ns - create a directory | 639 | * kernfs_create_dir_ns - create a directory |
640 | * @parent: parent in which to create a new directory | 640 | * @parent: parent in which to create a new directory |
641 | * @name: name of the new directory | 641 | * @name: name of the new directory |
642 | * @mode: mode of the new directory | ||
642 | * @priv: opaque data associated with the new directory | 643 | * @priv: opaque data associated with the new directory |
643 | * @ns: optional namespace tag of the directory | 644 | * @ns: optional namespace tag of the directory |
644 | * | 645 | * |
645 | * Returns the created node on success, ERR_PTR() value on failure. | 646 | * Returns the created node on success, ERR_PTR() value on failure. |
646 | */ | 647 | */ |
647 | struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, | 648 | struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, |
648 | const char *name, void *priv, | 649 | const char *name, umode_t mode, |
649 | const void *ns) | 650 | void *priv, const void *ns) |
650 | { | 651 | { |
651 | umode_t mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; | ||
652 | struct kernfs_addrm_cxt acxt; | 652 | struct kernfs_addrm_cxt acxt; |
653 | struct kernfs_node *kn; | 653 | struct kernfs_node *kn; |
654 | int rc; | 654 | int rc; |
655 | 655 | ||
656 | /* allocate */ | 656 | /* allocate */ |
657 | kn = kernfs_new_node(kernfs_root(parent), name, mode, KERNFS_DIR); | 657 | kn = kernfs_new_node(kernfs_root(parent), name, mode | S_IFDIR, |
658 | KERNFS_DIR); | ||
658 | if (!kn) | 659 | if (!kn) |
659 | return ERR_PTR(-ENOMEM); | 660 | return ERR_PTR(-ENOMEM); |
660 | 661 | ||