]> git.baikalelectronics.ru Git - kernel.git/commit
libfs: support RENAME_NOREPLACE in simple_rename()
authorMiklos Szeredi <mszeredi@redhat.com>
Tue, 27 Sep 2016 09:03:57 +0000 (11:03 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Tue, 27 Sep 2016 09:03:57 +0000 (11:03 +0200)
commit6438e8ca1eb4039be888a356a9746cd797f8d18f
tree42033a89a20c26dc0f19e9119803885b1f7a06c6
parent0475923abfb7c5e299deac34c4492ff4151dbdc4
libfs: support RENAME_NOREPLACE in simple_rename()

This is trivial to do:

 - add flags argument to simple_rename()
 - check if flags doesn't have any other than RENAME_NOREPLACE
 - assign simple_rename() to .rename2 instead of .rename

Filesystems converted:

hugetlbfs, ramfs, bpf.

Debugfs uses simple_rename() to implement debugfs_rename(), which is for
debugfs instances to rename files internally, not for userspace filesystem
access.  For this case pass zero flags to simple_rename().

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alexei Starovoitov <ast@kernel.org>
fs/debugfs/inode.c
fs/hugetlbfs/inode.c
fs/libfs.c
fs/ramfs/inode.c
include/linux/fs.h
kernel/bpf/inode.c