diff mbox series

[v2,1/2] exfat: add initial ioctl function

Message ID 20210216223306.47693-2-hyeongseok@gmail.com (mailing list archive)
State New
Headers show
Series Add FITRIM ioctl support for exFAT filesystem | expand

Commit Message

Hyeongseok Kim Feb. 16, 2021, 10:33 p.m. UTC
Initialize empty ioctl function

Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
---
 fs/exfat/dir.c      |  5 +++++
 fs/exfat/exfat_fs.h |  3 +++
 fs/exfat/file.c     | 21 +++++++++++++++++++++
 3 files changed, 29 insertions(+)

Comments

Chaitanya Kulkarni Feb. 16, 2021, 11:51 p.m. UTC | #1
On 2/16/21 14:36, Hyeongseok Kim wrote:
> Initialize empty ioctl function
>
> Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
This patch doesn't do much, but this commit log could be better.

Also from my experience there is not point in introducing an empty
function.
Hyeongseok Kim Feb. 17, 2021, 12:13 a.m. UTC | #2
On 2/17/21 8:51 AM, Chaitanya Kulkarni wrote:
> On 2/16/21 14:36, Hyeongseok Kim wrote:
>> Initialize empty ioctl function
>>
>> Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
> This patch doesn't do much, but this commit log could be better.
Sorry, I don't understand exactly.
You're saying that these 2 patch should be merged to a single patch?
Would it be better?
>
> Also from my experience there is not point in introducing an empty
> function.
>
Chaitanya Kulkarni Feb. 17, 2021, 12:17 a.m. UTC | #3
On 2/16/21 16:13, Hyeongseok Kim wrote:
> Sorry, I don't understand exactly.
> You're saying that these 2 patch should be merged to a single patch?
> Would it be better?
I think so unless there is a specific reason for this to keep it isolated.
Hyeongseok Kim Feb. 17, 2021, 12:33 a.m. UTC | #4
On 2/17/21 9:17 AM, Chaitanya Kulkarni wrote:
> On 2/16/21 16:13, Hyeongseok Kim wrote:
>> Sorry, I don't understand exactly.
>> You're saying that these 2 patch should be merged to a single patch?
>> Would it be better?
> I think so unless there is a specific reason for this to keep it isolated.
>
The reason was just that I think it seems better to seperate ioctl 
initializing and adding specific ioctl functionality.
Anyway, I got it.

Namjae,
Do you have any other opinion about this?
If you agree, I'll merge these as one.
Namjae Jeon Feb. 17, 2021, 5:39 a.m. UTC | #5
2021-02-17 9:33 GMT+09:00, Hyeongseok Kim <hyeongseok@gmail.com>:
> On 2/17/21 9:17 AM, Chaitanya Kulkarni wrote:
>> On 2/16/21 16:13, Hyeongseok Kim wrote:
>>> Sorry, I don't understand exactly.
>>> You're saying that these 2 patch should be merged to a single patch?
>>> Would it be better?
>> I think so unless there is a specific reason for this to keep it
>> isolated.
>>
> The reason was just that I think it seems better to seperate ioctl
> initializing and adding specific ioctl functionality.
> Anyway, I got it.
>
> Namjae,
Hi Hyeongseok,
> Do you have any other opinion about this?
I also think this patch should be combined with the 2/2 patch.
> If you agree, I'll merge these as one.
Yep, Agreed. Please do that:)
Thanks!
>
>
Hyeongseok Kim Feb. 17, 2021, 6:05 a.m. UTC | #6
On 2/17/21 2:39 PM, Namjae Jeon wrote:
> Hi Hyeongseok,
>> Do you have any other opinion about this?
> I also think this patch should be combined with the 2/2 patch.
>> If you agree, I'll merge these as one.
> Yep, Agreed. Please do that:)
> Thanks!
Thank you for the opinion.
I sent out v3.
diff mbox series

Patch

diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c
index 916797077aad..e1d5536de948 100644
--- a/fs/exfat/dir.c
+++ b/fs/exfat/dir.c
@@ -4,6 +4,7 @@ 
  */
 
 #include <linux/slab.h>
+#include <linux/compat.h>
 #include <linux/bio.h>
 #include <linux/buffer_head.h>
 
@@ -306,6 +307,10 @@  const struct file_operations exfat_dir_operations = {
 	.llseek		= generic_file_llseek,
 	.read		= generic_read_dir,
 	.iterate	= exfat_iterate,
+	.unlocked_ioctl = exfat_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl = exfat_compat_ioctl,
+#endif
 	.fsync		= exfat_file_fsync,
 };
 
diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h
index 764bc645241e..a183021ae31d 100644
--- a/fs/exfat/exfat_fs.h
+++ b/fs/exfat/exfat_fs.h
@@ -420,6 +420,9 @@  int exfat_setattr(struct dentry *dentry, struct iattr *attr);
 int exfat_getattr(const struct path *path, struct kstat *stat,
 		unsigned int request_mask, unsigned int query_flags);
 int exfat_file_fsync(struct file *file, loff_t start, loff_t end, int datasync);
+long exfat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
+long exfat_compat_ioctl(struct file *filp, unsigned int cmd,
+				unsigned long arg);
 
 /* namei.c */
 extern const struct dentry_operations exfat_dentry_ops;
diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index a92478eabfa4..679828e7be07 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -4,6 +4,7 @@ 
  */
 
 #include <linux/slab.h>
+#include <linux/compat.h>
 #include <linux/cred.h>
 #include <linux/buffer_head.h>
 #include <linux/blkdev.h>
@@ -348,6 +349,22 @@  int exfat_setattr(struct dentry *dentry, struct iattr *attr)
 	return error;
 }
 
+long exfat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+{
+	switch (cmd) {
+	default:
+		return -ENOTTY;
+	}
+}
+
+#ifdef CONFIG_COMPAT
+long exfat_compat_ioctl(struct file *filp, unsigned int cmd,
+				unsigned long arg)
+{
+	return exfat_ioctl(filp, cmd, (unsigned long)compat_ptr(arg));
+}
+#endif
+
 int exfat_file_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
 {
 	struct inode *inode = filp->f_mapping->host;
@@ -368,6 +385,10 @@  const struct file_operations exfat_file_operations = {
 	.llseek		= generic_file_llseek,
 	.read_iter	= generic_file_read_iter,
 	.write_iter	= generic_file_write_iter,
+	.unlocked_ioctl = exfat_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl = exfat_compat_ioctl,
+#endif
 	.mmap		= generic_file_mmap,
 	.fsync		= exfat_file_fsync,
 	.splice_read	= generic_file_splice_read,