mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
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 <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Cc: Alexei Starovoitov <[email protected]>
This commit is contained in:
parent
f03b8ad8d3
commit
e0e0be8a83
6 changed files with 11 additions and 6 deletions
|
|
@ -349,11 +349,15 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry)
|
|||
EXPORT_SYMBOL(simple_rmdir);
|
||||
|
||||
int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry)
|
||||
struct inode *new_dir, struct dentry *new_dentry,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct inode *inode = d_inode(old_dentry);
|
||||
int they_are_dirs = d_is_dir(old_dentry);
|
||||
|
||||
if (flags & ~RENAME_NOREPLACE)
|
||||
return -EINVAL;
|
||||
|
||||
if (!simple_empty(new_dentry))
|
||||
return -ENOTEMPTY;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue