Skip to contentSkip to conversation

Btrfs: move fs/btrfs/ioctl.h to include/uapi/linux/btrfs.h

PATCH New Filipe Brandenburger 1 participant 2 messages Jan 29, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: move fs/btrfs/ioctl.h to include/uapi/linux/btrfs.h

Hello,

This is a cleanup patch to move ioctl.h to create an include/linux/btrfs.h

The suggestion was listed in this cleanup page:
https://btrfs.wiki.kernel.org/index.php/Cleanup_ideas#Remove_ioctl.h_in_btrfs_and_btrfs-progs_world.2C_create_include.2Flinux.2Fbtrfs.h_with_those_definitions

It will serve as base to add Btrfs-specific ioctl support to strace (which I just claimed):
https://btrfs.wiki.kernel.org/index.php/Project_ideas#strace

It's using the new UAPI model for header files, include/uapi/linux/btrfs.h should contain everything that should be exported to userspace (this file will be post-processed to remove __user, etc. and installed to /usr/include/linux) and include/linux/btrfs.h should have everything that's private to the kernel (right now the latter only contains an #include of the former.)

This is the first patch to export these constants and structs, later on we might need to move other things around, but this is a good starting point.

The patch is trivial, but I tested a kernel build, booting with the kernel, loading the module and mounting a filesystem. Also tested "make headers_install" to make sure the btrfs.h header will be installed at the right place.

Thanks,
Filipe

Filipe Brandenburger (1):
Btrfs: move fs/btrfs/ioctl.h to include/uapi/linux/btrfs.h

 fs/btrfs/backref.h                             | 2 +-
 fs/btrfs/ctree.h                               | 2 +-
 fs/btrfs/file.c                                | 2 +-
 fs/btrfs/inode.c                               | 2 +-
 fs/btrfs/ioctl.c                               | 2 +-
 fs/btrfs/qgroup.c                              | 2 +-
 fs/btrfs/super.c                               | 2 +-
 fs/btrfs/volumes.h                             | 2 +-
 include/linux/btrfs.h                          | 6 ++++++
 include/uapi/linux/Kbuild                      | 1 +
 fs/btrfs/ioctl.h => include/uapi/linux/btrfs.h | 7 ++++---
 11 files changed, 19 insertions(+), 11 deletions(-)
 create mode 100644 include/linux/btrfs.h
 rename fs/btrfs/ioctl.h => include/uapi/linux/btrfs.h (99%)
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 1/1 Btrfs: move fs/btrfs/ioctl.h to include/uapi/linux/btrfs.h

The header file will then be installed under /usr/include/linux so that userspace applications can refer to Btrfs ioctls by name and use the same structs used internally in the kernel.

---
 fs/btrfs/backref.h                             | 2 +-
 fs/btrfs/ctree.h                               | 2 +-
 fs/btrfs/file.c                                | 2 +-
 fs/btrfs/inode.c                               | 2 +-
 fs/btrfs/ioctl.c                               | 2 +-
 fs/btrfs/qgroup.c                              | 2 +-
 fs/btrfs/super.c                               | 2 +-
 fs/btrfs/volumes.h                             | 2 +-
 include/linux/btrfs.h                          | 6 ++++++
 include/uapi/linux/Kbuild                      | 1 +
 fs/btrfs/ioctl.h => include/uapi/linux/btrfs.h | 7 ++++---
 11 files changed, 19 insertions(+), 11 deletions(-)
 create mode 100644 include/linux/btrfs.h
 rename fs/btrfs/ioctl.h => include/uapi/linux/btrfs.h (99%)
fs/btrfs/backref.h +1 -1
index d61feca7..310a7f6 100644
@@ -19,7 +19,7 @@
 #ifndef __BTRFS_BACKREF__
 #define __BTRFS_BACKREF__
 
-#include "ioctl.h"
+#include <linux/btrfs.h>
 #include "ulist.h"
 #include "extent_io.h"
 
fs/btrfs/ctree.h +1 -1
index 547b7b0..53ffd31 100644
@@ -31,10 +31,10 @@
 #include <trace/events/btrfs.h>
 #include <asm/kmap_types.h>
 #include <linux/pagemap.h>
+#include <linux/btrfs.h>
 #include "extent_io.h"
 #include "extent_map.h"
 #include "async-thread.h"
-#include "ioctl.h"
 
 struct btrfs_trans_handle;
 struct btrfs_transaction;
fs/btrfs/file.c +1 -1
index 841cfe3..2cdf85c 100644
@@ -30,11 +30,11 @@
 #include <linux/statfs.h>
 #include <linux/compat.h>
 #include <linux/slab.h>
+#include <linux/btrfs.h>
 #include "ctree.h"
 #include "disk-io.h"
 #include "transaction.h"
 #include "btrfs_inode.h"
-#include "ioctl.h"
 #include "print-tree.h"
 #include "tree-log.h"
 #include "locking.h"
fs/btrfs/inode.c +1 -1
index ca7ace7..fa98870 100644
@@ -39,12 +39,12 @@
 #include <linux/slab.h>
 #include <linux/ratelimit.h>
 #include <linux/mount.h>
+#include <linux/btrfs.h>
 #include "compat.h"
 #include "ctree.h"
 #include "disk-io.h"
 #include "transaction.h"
 #include "btrfs_inode.h"
-#include "ioctl.h"
 #include "print-tree.h"
 #include "ordered-data.h"
 #include "xattr.h"
fs/btrfs/ioctl.c +1 -1
index afbf3ac..3f7a080 100644
@@ -42,12 +42,12 @@
 #include <linux/slab.h>
 #include <linux/blkdev.h>
 #include <linux/uuid.h>
+#include <linux/btrfs.h>
 #include "compat.h"
 #include "ctree.h"
 #include "disk-io.h"
 #include "transaction.h"
 #include "btrfs_inode.h"
-#include "ioctl.h"
 #include "print-tree.h"
 #include "volumes.h"
 #include "locking.h"
fs/btrfs/qgroup.c +1 -1
index a5c8562..a0d6368 100644
@@ -23,13 +23,13 @@
 #include <linux/rbtree.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
+#include <linux/btrfs.h>
 
 #include "ctree.h"
 #include "transaction.h"
 #include "disk-io.h"
 #include "locking.h"
 #include "ulist.h"
-#include "ioctl.h"
 #include "backref.h"
 
 /* TODO XXX FIXME
fs/btrfs/super.c +1 -1
index d8982e9..231177b 100644
@@ -41,13 +41,13 @@
 #include <linux/slab.h>
 #include <linux/cleancache.h>
 #include <linux/ratelimit.h>
+#include <linux/btrfs.h>
 #include "compat.h"
 #include "delayed-inode.h"
 #include "ctree.h"
 #include "disk-io.h"
 #include "transaction.h"
 #include "btrfs_inode.h"
-#include "ioctl.h"
 #include "print-tree.h"
 #include "xattr.h"
 #include "volumes.h"
fs/btrfs/volumes.h +1 -1
index d3c3939..12bb841 100644
@@ -21,8 +21,8 @@
 
 #include <linux/bio.h>
 #include <linux/sort.h>
+#include <linux/btrfs.h>
 #include "async-thread.h"
-#include "ioctl.h"
 
 #define BTRFS_STRIPE_LEN	(64 * 1024)
 
include/linux/btrfs.h new file +6 -0
new file mode 100644
index 0000000..22d7991
@@ -0,0 +1,6 @@
+#ifndef _LINUX_BTRFS_H
+#define _LINUX_BTRFS_H
+
+#include <uapi/linux/btrfs.h>
+
+#endif /* _LINUX_BTRFS_H */
include/uapi/linux/Kbuild +1 -0
index 19e765f..896ee12 100644
@@ -68,6 +68,7 @@ header-y += blkpg.h
 header-y += blktrace_api.h
 header-y += bpqether.h
 header-y += bsg.h
+header-y += btrfs.h
 header-y += can.h
 header-y += capability.h
 header-y += capi.h
include/uapi/linux/btrfs.h renamed from fs/btrfs/ioctl.h +4 -3
similarity index 99%
rename from fs/btrfs/ioctl.h
rename to include/uapi/linux/btrfs.h
index dabca9c..cffbb58 100644
@@ -16,8 +16,9 @@
  * Boston, MA 021110-1307, USA.
  */
 
-#ifndef __IOCTL_
-#define __IOCTL_
+#ifndef _UAPI_LINUX_BTRFS_H
+#define _UAPI_LINUX_BTRFS_H
+#include <linux/types.h>
 #include <linux/ioctl.h>
 
 #define BTRFS_IOCTL_MAGIC 0x94
@@ -499,4 +500,4 @@ struct btrfs_ioctl_send_args {
 #define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \
 				    struct btrfs_ioctl_dev_replace_args)
 
-#endif
+#endif /* _UAPI_LINUX_BTRFS_H */
Signature · 1 line
1.7.11.7