[PATCH v3 1/2] fs: reserve a new ioctl magic for exfat and ntfs

David Timber <[email protected]>
Newsgroups dev.linux.lists.ntfs3,org.kernel.vger.linux-doc,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
ntfs and ntfs3 had no ioctl magic assigned to them. A decision to share
the new ioctl magic(0xEF) between ntfs and exfat has been made

  1. due to the similarities in API design
  2. because they're maintained by the same group devs
  3. to delay the eventual exhaustion of ioctl number namespace

Also, the uapi header file is named ntfs.h, not ntfs3.h to cater the
on-going work of reviving ntfs classic and potentially consolidating
it with ntfs3.

Link: https://lore.kernel.org/linux-fsdevel/[email protected]/
Signed-off-by: David Timber <[email protected]>
---
 .../userspace-api/ioctl/ioctl-number.rst         |  1 +
 MAINTAINERS                                      |  2 ++
 fs/ntfs3/file.c                                  |  6 ------
 fs/ntfs3/ntfs_fs.h                               |  1 +
 include/uapi/linux/exfat.h                       |  3 ++-
 include/uapi/linux/ntfs.h                        | 16 ++++++++++++++++
 6 files changed, 22 insertions(+), 7 deletions(-)
 create mode 100644 include/uapi/linux/ntfs.h

diff --git a/Documentation/userspace-api/ioctl/ioctl-number.rst b/Documentation/userspace-api/ioctl/ioctl-number.rst
index 331223761fff..1c81f1f030ca 100644
--- a/Documentation/userspace-api/ioctl/ioctl-number.rst
+++ b/Documentation/userspace-api/ioctl/ioctl-number.rst
@@ -410,6 +410,7 @@ Code  Seq#    Include File                                             Comments
                                                                        <mailto:[email protected]>
 0xF9  00-0F  uapi/misc/amd-apml.h                                      AMD side band system management interface driver
                                                                        <mailto:[email protected]>
+0xEF  00-0F  uapi/linux/exfat.h and uapi/linux/ntfs3.h
 0xFD  all    linux/dm-ioctl.h
 0xFE  all    linux/isst_if.h
 ====  =====  ========================================================= ================================================================
diff --git a/MAINTAINERS b/MAINTAINERS
index 55af015174a5..59a722414e09 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9597,6 +9597,7 @@ L:	[email protected]
 S:	Maintained
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat.git
 F:	fs/exfat/
+F:	include/uapi/linux/exfat.h
 
 EXPRESSWIRE PROTOCOL LIBRARY
 M:	Duje Mihanović <[email protected]>
@@ -18876,6 +18877,7 @@ W:	http://www.paragon-software.com/
 T:	git https://github.com/Paragon-Software-Group/linux-ntfs3.git
 F:	Documentation/filesystems/ntfs3.rst
 F:	fs/ntfs3/
+F:	include/uapi/linux/ntfs.h
 
 NTSYNC SYNCHRONIZATION PRIMITIVE DRIVER
 M:	Elizabeth Figura <[email protected]>
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 7eecf1e01f74..2dd15af0255c 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -21,12 +21,6 @@
 #include "ntfs.h"
 #include "ntfs_fs.h"
 
-/*
- * cifx, btrfs, exfat, ext4, f2fs use this constant.
- * Hope this value will become common to all fs.
- */
-#define NTFS3_IOC_SHUTDOWN _IOR('X', 125, __u32)
-
 /*
  * Helper for ntfs_should_use_dio.
  */
diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index daf5a1f47275..633d8472fa1f 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -26,6 +26,7 @@
 #include <linux/time64.h>
 #include <linux/types.h>
 #include <linux/uidgid.h>
+#include <uapi/linux/ntfs.h>
 #include <asm/div64.h>
 #include <asm/page.h>
 
diff --git a/include/uapi/linux/exfat.h b/include/uapi/linux/exfat.h
index 46d95b16fc4b..050dcea0aa12 100644
--- a/include/uapi/linux/exfat.h
+++ b/include/uapi/linux/exfat.h
@@ -12,7 +12,8 @@
  * exfat-specific ioctl commands
  */
 
-#define EXFAT_IOC_SHUTDOWN _IOR('X', 125, __u32)
+#define EXFAT_IOCTL_MAGIC	0xEF			/* shared with ntfs3 */
+#define EXFAT_IOC_SHUTDOWN	_IOR('X', 125, __u32)
 
 /*
  * Flags used by EXFAT_IOC_SHUTDOWN
diff --git a/include/uapi/linux/ntfs.h b/include/uapi/linux/ntfs.h
new file mode 100644
index 000000000000..f00428af6901
--- /dev/null
+++ b/include/uapi/linux/ntfs.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+
+#ifndef _UAPI_LINUX_NTFS_H
+#define _UAPI_LINUX_NTFS_H
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#define NTFS_IOCTL_MAGIC	0xEF			/* shared with exfat */
+
+/*
+ * cifx, btrfs, exfat, ext4, f2fs use this constant.
+ * Hope this value will become common to all fs.
+ */
+#define NTFS3_IOC_SHUTDOWN	_IOR('X', 125, __u32)
+
+#endif /* _UAPI_LINUX_NTFS_H */
-- 
2.53.0.1.ga224b40d3f.dirty
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.