diff options
author | Fabian Frederick <fabf@skynet.be> | 2017-05-05 14:51:42 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-05-05 15:24:52 -0400 |
commit | c6184028a75cf63036267089741ec7ef975ebc27 (patch) | |
tree | ff5f7ff224da467a6bd497ba058eac5020e03981 /fs/affs/namei.c | |
parent | deccf497d804a4c5fca2dbfad2f104675a6f9102 (diff) |
fs/affs: add rename2 to prepare multiple methods
Currently AFFS only supports RENAME_NOREPLACE.
This patch isolates that method to a static function to
prepare RENAME_EXCHANGE addition.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/affs/namei.c')
-rw-r--r-- | fs/affs/namei.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index d9a40b5ca4d3..49a8dc12d604 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c | |||
@@ -394,21 +394,14 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | |||
394 | return affs_add_entry(dir, inode, dentry, ST_LINKFILE); | 394 | return affs_add_entry(dir, inode, dentry, ST_LINKFILE); |
395 | } | 395 | } |
396 | 396 | ||
397 | int | 397 | static int |
398 | affs_rename(struct inode *old_dir, struct dentry *old_dentry, | 398 | affs_rename(struct inode *old_dir, struct dentry *old_dentry, |
399 | struct inode *new_dir, struct dentry *new_dentry, | 399 | struct inode *new_dir, struct dentry *new_dentry) |
400 | unsigned int flags) | ||
401 | { | 400 | { |
402 | struct super_block *sb = old_dir->i_sb; | 401 | struct super_block *sb = old_dir->i_sb; |
403 | struct buffer_head *bh = NULL; | 402 | struct buffer_head *bh = NULL; |
404 | int retval; | 403 | int retval; |
405 | 404 | ||
406 | if (flags & ~RENAME_NOREPLACE) | ||
407 | return -EINVAL; | ||
408 | |||
409 | pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__, | ||
410 | old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry); | ||
411 | |||
412 | retval = affs_check_name(new_dentry->d_name.name, | 405 | retval = affs_check_name(new_dentry->d_name.name, |
413 | new_dentry->d_name.len, | 406 | new_dentry->d_name.len, |
414 | affs_nofilenametruncate(old_dentry)); | 407 | affs_nofilenametruncate(old_dentry)); |
@@ -448,6 +441,20 @@ done: | |||
448 | return retval; | 441 | return retval; |
449 | } | 442 | } |
450 | 443 | ||
444 | int affs_rename2(struct inode *old_dir, struct dentry *old_dentry, | ||
445 | struct inode *new_dir, struct dentry *new_dentry, | ||
446 | unsigned int flags) | ||
447 | { | ||
448 | |||
449 | if (flags & ~RENAME_NOREPLACE) | ||
450 | return -EINVAL; | ||
451 | |||
452 | pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__, | ||
453 | old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry); | ||
454 | |||
455 | return affs_rename(old_dir, old_dentry, new_dir, new_dentry); | ||
456 | } | ||
457 | |||
451 | static struct dentry *affs_get_parent(struct dentry *child) | 458 | static struct dentry *affs_get_parent(struct dentry *child) |
452 | { | 459 | { |
453 | struct inode *parent; | 460 | struct inode *parent; |