2021-02-16 22:35:46

by Hyeongseok Kim

[permalink] [raw]
Subject: [PATCH v2 1/2] exfat: add initial ioctl function

Initialize empty ioctl function

Signed-off-by: Hyeongseok Kim <[email protected]>
---
fs/exfat/dir.c | 5 +++++
fs/exfat/exfat_fs.h | 3 +++
fs/exfat/file.c | 21 +++++++++++++++++++++
3 files changed, 29 insertions(+)

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,
--
2.27.0.83.g0313f36


2021-02-17 00:18:42

by Hyeongseok Kim

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] exfat: add initial ioctl function

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 <[email protected]>
> 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.
>

2021-02-17 00:22:08

by Chaitanya Kulkarni

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] exfat: add initial ioctl function

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.

2021-02-17 01:10:52

by Chaitanya Kulkarni

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] exfat: add initial ioctl function

On 2/16/21 14:36, Hyeongseok Kim wrote:
> Initialize empty ioctl function
>
> Signed-off-by: Hyeongseok Kim <[email protected]>
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.

2021-02-17 01:14:48

by Hyeongseok Kim

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] exfat: add initial ioctl function

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.

2021-02-17 05:41:28

by Namjae Jeon

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] exfat: add initial ioctl function

2021-02-17 9:33 GMT+09:00, Hyeongseok Kim <[email protected]>:
> 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!
>
>

2021-02-17 06:09:48

by Hyeongseok Kim

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] exfat: add initial ioctl function

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.