From f7e5a85daf99fd446603339cf9d67588ad54db53 Mon Sep 17 00:00:00 2001 From: liuzerun Date: Tue, 30 Jul 2024 03:53:06 +0000 Subject: [PATCH] get_dst_path march local Signed-off-by: liuzerun --- fs/hmdfs/file_local.c | 12 ++++++++++++ fs/hmdfs/file_merge.c | 4 +--- fs/hmdfs/hmdfs.h | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/fs/hmdfs/file_local.c b/fs/hmdfs/file_local.c index 41f65cfa4184..0d068709d691 100644 --- a/fs/hmdfs/file_local.c +++ b/fs/hmdfs/file_local.c @@ -215,6 +215,14 @@ int hmdfs_file_mmap_local(struct file *file, struct vm_area_struct *vma) return ret; } +static long hmdfs_ioctl_local(struct file *filp, unsigned int cmd, unsigned long arg) +{ + if (cmd == HMDFS_IOC_GET_DST_PATH) + return hmdfs_ioc_get_dst_path(filp, arg); + else + return -ENOTTY; +} + const struct file_operations hmdfs_file_fops_local = { .owner = THIS_MODULE, .llseek = hmdfs_file_llseek_local, @@ -224,6 +232,8 @@ const struct file_operations hmdfs_file_fops_local = { .open = hmdfs_file_open_local, .release = hmdfs_file_release_local, .fsync = hmdfs_fsync_local, + .unlocked_ioctl = hmdfs_ioctl_local, + .compat_ioctl = hmdfs_ioctl_local, .splice_read = generic_file_splice_read, .splice_write = iter_file_splice_write, }; @@ -299,6 +309,8 @@ const struct file_operations hmdfs_dir_ops_local = { .open = hmdfs_dir_open_local, .release = hmdfs_dir_release_local, .fsync = hmdfs_fsync_local, + .unlocked_ioctl = hmdfs_ioctl_local, + .compat_ioctl = hmdfs_ioctl_local, }; static int __hmdfs_ioc_set_share_path(struct file *file, diff --git a/fs/hmdfs/file_merge.c b/fs/hmdfs/file_merge.c index 8952674a23d4..78e07235de0b 100644 --- a/fs/hmdfs/file_merge.c +++ b/fs/hmdfs/file_merge.c @@ -464,8 +464,6 @@ int hmdfs_dir_release_merge(struct inode *inode, struct file *file) return 0; } -static long hmdfs_ioc_get_dst_path(struct file *filp, unsigned long arg); - long hmdfs_dir_unlocked_ioctl_merge(struct file *file, unsigned int cmd, unsigned long arg) { @@ -760,7 +758,7 @@ static int create_dir_recursive(const char *path_value, mode_t mode) return err; } -static long hmdfs_ioc_get_dst_path(struct file *filp, unsigned long arg) +long hmdfs_ioc_get_dst_path(struct file *filp, unsigned long arg) { int ret = 0; const struct cred *old_cred; diff --git a/fs/hmdfs/hmdfs.h b/fs/hmdfs/hmdfs.h index c9940693f3e7..c27c9dd90f2b 100644 --- a/fs/hmdfs/hmdfs.h +++ b/fs/hmdfs/hmdfs.h @@ -306,6 +306,8 @@ int hmdfs_permission(struct inode *inode, int mask); int hmdfs_parse_options(struct hmdfs_sb_info *sbi, const char *data); +long hmdfs_ioc_get_dst_path(struct file *filp, unsigned long arg); + /* Refer to comments in hmdfs_request_work_fn() */ #define HMDFS_SERVER_CTX_FLAGS (PF_KTHREAD | PF_WQ_WORKER | PF_NPROC_EXCEEDED) -- Gitee