linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfsprogs: move custom interface definitions out of xfs_fs.h
@ 2020-08-06 19:36 Eric Sandeen
  2020-08-06 19:52 ` Darrick J. Wong
  2020-08-17  6:56 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2020-08-06 19:36 UTC (permalink / raw)
  To: linux-xfs

There are several definitions and structures present in the userspace
copy of libxfs/xfs_fs.h which support older, custom xfs interfaces
which are now common definitions in the vfs.

Move them into their own compat header to minimize the shared file
differences.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/include/Makefile b/include/Makefile
index a80867e4..3031fb5c 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -35,6 +35,7 @@ HFILES = handle.h \
 	linux.h \
 	xfs.h \
 	xqm.h \
+	xfs_fs_compat.h \
 	xfs_arch.h
 
 LSRCFILES = platform_defs.h.in builddefs.in buildmacros buildrules install-sh
diff --git a/include/xfs.h b/include/xfs.h
index f673d92e..af0d36ce 100644
--- a/include/xfs.h
+++ b/include/xfs.h
@@ -39,6 +39,8 @@ extern int xfs_assert_largefile[sizeof(off_t)-8];
 #endif
 
 #include <xfs/xfs_types.h>
+/* Include deprecated/compat pre-vfs xfs-specific symbols */
+#include <xfs/xfs_fs_compat.h>
 #include <xfs/xfs_fs.h>
 
 #endif	/* __XFS_H__ */
diff --git a/include/xfs_fs_compat.h b/include/xfs_fs_compat.h
new file mode 100644
index 00000000..154a802d
--- /dev/null
+++ b/include/xfs_fs_compat.h
@@ -0,0 +1,88 @@
+/* SPDX-License-Identifier: LGPL-2.1 */
+/*
+ * Copyright (c) 1995-2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
+ */
+#ifndef __XFS_FS_COMPAT_H__
+#define __XFS_FS_COMPAT_H__
+
+/*
+ * Backwards-compatible definitions and structures for public kernel interfaces
+ */
+
+/*
+ * Flags for the bs_xflags/fsx_xflags field in XFS_IOC_FS[GS]ETXATTR[A]
+ * These are for backwards compatibility only. New code should
+ * use the kernel [4.5 onwards] defined FS_XFLAG_* definitions directly.
+ */
+#define	XFS_XFLAG_REALTIME	FS_XFLAG_REALTIME
+#define	XFS_XFLAG_PREALLOC	FS_XFLAG_PREALLOC
+#define	XFS_XFLAG_IMMUTABLE	FS_XFLAG_IMMUTABLE
+#define	XFS_XFLAG_APPEND	FS_XFLAG_APPEND
+#define	XFS_XFLAG_SYNC		FS_XFLAG_SYNC
+#define	XFS_XFLAG_NOATIME	FS_XFLAG_NOATIME
+#define	XFS_XFLAG_NODUMP	FS_XFLAG_NODUMP
+#define	XFS_XFLAG_RTINHERIT	FS_XFLAG_RTINHERIT
+#define	XFS_XFLAG_PROJINHERIT	FS_XFLAG_PROJINHERIT
+#define	XFS_XFLAG_NOSYMLINKS	FS_XFLAG_NOSYMLINKS
+#define	XFS_XFLAG_EXTSIZE	FS_XFLAG_EXTSIZE
+#define	XFS_XFLAG_EXTSZINHERIT	FS_XFLAG_EXTSZINHERIT
+#define	XFS_XFLAG_NODEFRAG	FS_XFLAG_NODEFRAG
+#define	XFS_XFLAG_FILESTREAM	FS_XFLAG_FILESTREAM
+#define	XFS_XFLAG_HASATTR	FS_XFLAG_HASATTR
+
+/*
+ * Don't use this.
+ * Use struct file_clone_range
+ */
+struct xfs_clone_args {
+	__s64 src_fd;
+	__u64 src_offset;
+	__u64 src_length;
+	__u64 dest_offset;
+};
+
+/*
+ * Don't use these.
+ * Use FILE_DEDUPE_RANGE_SAME / FILE_DEDUPE_RANGE_DIFFERS
+ */
+#define XFS_EXTENT_DATA_SAME	0
+#define XFS_EXTENT_DATA_DIFFERS	1
+
+/* Don't use this. Use file_dedupe_range_info */
+struct xfs_extent_data_info {
+	__s64 fd;		/* in - destination file */
+	__u64 logical_offset;	/* in - start of extent in destination */
+	__u64 bytes_deduped;	/* out - total # of bytes we were able
+				 * to dedupe from this file */
+	/* status of this dedupe operation:
+	 * < 0 for error
+	 * == XFS_EXTENT_DATA_SAME if dedupe succeeds
+	 * == XFS_EXTENT_DATA_DIFFERS if data differs
+	 */
+	__s32 status;		/* out - see above description */
+	__u32 reserved;
+};
+
+/*
+ * Don't use this.
+ * Use struct file_dedupe_range
+ */
+struct xfs_extent_data {
+	__u64 logical_offset;	/* in - start of extent in source */
+	__u64 length;		/* in - length of extent */
+	__u16 dest_count;	/* in - total elements in info array */
+	__u16 reserved1;
+	__u32 reserved2;
+	struct xfs_extent_data_info info[0];
+};
+
+/*
+ * Don't use these.
+ * Use FICLONE/FICLONERANGE/FIDEDUPERANGE
+ */
+#define XFS_IOC_CLONE		 _IOW (0x94, 9, int)
+#define XFS_IOC_CLONE_RANGE	 _IOW (0x94, 13, struct xfs_clone_args)
+#define XFS_IOC_FILE_EXTENT_SAME _IOWR(0x94, 54, struct xfs_extent_data)
+
+#endif	/* __XFS_FS_COMPAT_H__ */
diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h
index 36fae384..84bcffa8 100644
--- a/libxfs/xfs_fs.h
+++ b/libxfs/xfs_fs.h
@@ -23,27 +23,6 @@ struct dioattr {
 };
 #endif
 
-/*
- * Flags for the bs_xflags/fsx_xflags field in XFS_IOC_FS[GS]ETXATTR[A]
- * These are for backwards compatibility only. New code should
- * use the kernel [4.5 onwards] defined FS_XFLAG_* definitions directly.
- */
-#define	XFS_XFLAG_REALTIME	FS_XFLAG_REALTIME
-#define	XFS_XFLAG_PREALLOC	FS_XFLAG_PREALLOC
-#define	XFS_XFLAG_IMMUTABLE	FS_XFLAG_IMMUTABLE
-#define	XFS_XFLAG_APPEND	FS_XFLAG_APPEND
-#define	XFS_XFLAG_SYNC		FS_XFLAG_SYNC
-#define	XFS_XFLAG_NOATIME	FS_XFLAG_NOATIME
-#define	XFS_XFLAG_NODUMP	FS_XFLAG_NODUMP
-#define	XFS_XFLAG_RTINHERIT	FS_XFLAG_RTINHERIT
-#define	XFS_XFLAG_PROJINHERIT	FS_XFLAG_PROJINHERIT
-#define	XFS_XFLAG_NOSYMLINKS	FS_XFLAG_NOSYMLINKS
-#define	XFS_XFLAG_EXTSIZE	FS_XFLAG_EXTSIZE
-#define	XFS_XFLAG_EXTSZINHERIT	FS_XFLAG_EXTSZINHERIT
-#define	XFS_XFLAG_NODEFRAG	FS_XFLAG_NODEFRAG
-#define	XFS_XFLAG_FILESTREAM	FS_XFLAG_FILESTREAM
-#define	XFS_XFLAG_HASATTR	FS_XFLAG_HASATTR
-
 /*
  * Structure for XFS_IOC_GETBMAP.
  * On input, fill in bmv_offset and bmv_length of the first structure
@@ -858,47 +837,6 @@ struct xfs_scrub_metadata {
 #define XFS_IOC_INUMBERS	     _IOR ('X', 128, struct xfs_inumbers_req)
 /*	XFS_IOC_GETFSUUID ---------- deprecated 140	 */
 
-/* reflink ioctls; these MUST match the btrfs ioctl definitions */
-/* from struct btrfs_ioctl_clone_range_args */
-struct xfs_clone_args {
-	__s64 src_fd;
-	__u64 src_offset;
-	__u64 src_length;
-	__u64 dest_offset;
-};
-
-/* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */
-#define XFS_EXTENT_DATA_SAME	0
-#define XFS_EXTENT_DATA_DIFFERS	1
-
-/* from struct btrfs_ioctl_file_extent_same_info */
-struct xfs_extent_data_info {
-	__s64 fd;		/* in - destination file */
-	__u64 logical_offset;	/* in - start of extent in destination */
-	__u64 bytes_deduped;	/* out - total # of bytes we were able
-				 * to dedupe from this file */
-	/* status of this dedupe operation:
-	 * < 0 for error
-	 * == XFS_EXTENT_DATA_SAME if dedupe succeeds
-	 * == XFS_EXTENT_DATA_DIFFERS if data differs
-	 */
-	__s32 status;		/* out - see above description */
-	__u32 reserved;
-};
-
-/* from struct btrfs_ioctl_file_extent_same_args */
-struct xfs_extent_data {
-	__u64 logical_offset;	/* in - start of extent in source */
-	__u64 length;		/* in - length of extent */
-	__u16 dest_count;	/* in - total elements in info array */
-	__u16 reserved1;
-	__u32 reserved2;
-	struct xfs_extent_data_info info[0];
-};
-
-#define XFS_IOC_CLONE		 _IOW (0x94, 9, int)
-#define XFS_IOC_CLONE_RANGE	 _IOW (0x94, 13, struct xfs_clone_args)
-#define XFS_IOC_FILE_EXTENT_SAME _IOWR(0x94, 54, struct xfs_extent_data)
 
 #ifndef HAVE_BBMACROS
 /*


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfsprogs: move custom interface definitions out of xfs_fs.h
  2020-08-06 19:36 [PATCH] xfsprogs: move custom interface definitions out of xfs_fs.h Eric Sandeen
@ 2020-08-06 19:52 ` Darrick J. Wong
  2020-08-17  6:56 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2020-08-06 19:52 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs

On Thu, Aug 06, 2020 at 12:36:48PM -0700, Eric Sandeen wrote:
> There are several definitions and structures present in the userspace
> copy of libxfs/xfs_fs.h which support older, custom xfs interfaces
> which are now common definitions in the vfs.
> 
> Move them into their own compat header to minimize the shared file
> differences.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Hooray for shoving all the cobwebs behind the stereo! :)
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
> 
> diff --git a/include/Makefile b/include/Makefile
> index a80867e4..3031fb5c 100644
> --- a/include/Makefile
> +++ b/include/Makefile
> @@ -35,6 +35,7 @@ HFILES = handle.h \
>  	linux.h \
>  	xfs.h \
>  	xqm.h \
> +	xfs_fs_compat.h \
>  	xfs_arch.h
>  
>  LSRCFILES = platform_defs.h.in builddefs.in buildmacros buildrules install-sh
> diff --git a/include/xfs.h b/include/xfs.h
> index f673d92e..af0d36ce 100644
> --- a/include/xfs.h
> +++ b/include/xfs.h
> @@ -39,6 +39,8 @@ extern int xfs_assert_largefile[sizeof(off_t)-8];
>  #endif
>  
>  #include <xfs/xfs_types.h>
> +/* Include deprecated/compat pre-vfs xfs-specific symbols */
> +#include <xfs/xfs_fs_compat.h>
>  #include <xfs/xfs_fs.h>
>  
>  #endif	/* __XFS_H__ */
> diff --git a/include/xfs_fs_compat.h b/include/xfs_fs_compat.h
> new file mode 100644
> index 00000000..154a802d
> --- /dev/null
> +++ b/include/xfs_fs_compat.h
> @@ -0,0 +1,88 @@
> +/* SPDX-License-Identifier: LGPL-2.1 */
> +/*
> + * Copyright (c) 1995-2005 Silicon Graphics, Inc.
> + * All Rights Reserved.
> + */
> +#ifndef __XFS_FS_COMPAT_H__
> +#define __XFS_FS_COMPAT_H__
> +
> +/*
> + * Backwards-compatible definitions and structures for public kernel interfaces
> + */
> +
> +/*
> + * Flags for the bs_xflags/fsx_xflags field in XFS_IOC_FS[GS]ETXATTR[A]
> + * These are for backwards compatibility only. New code should
> + * use the kernel [4.5 onwards] defined FS_XFLAG_* definitions directly.
> + */
> +#define	XFS_XFLAG_REALTIME	FS_XFLAG_REALTIME
> +#define	XFS_XFLAG_PREALLOC	FS_XFLAG_PREALLOC
> +#define	XFS_XFLAG_IMMUTABLE	FS_XFLAG_IMMUTABLE
> +#define	XFS_XFLAG_APPEND	FS_XFLAG_APPEND
> +#define	XFS_XFLAG_SYNC		FS_XFLAG_SYNC
> +#define	XFS_XFLAG_NOATIME	FS_XFLAG_NOATIME
> +#define	XFS_XFLAG_NODUMP	FS_XFLAG_NODUMP
> +#define	XFS_XFLAG_RTINHERIT	FS_XFLAG_RTINHERIT
> +#define	XFS_XFLAG_PROJINHERIT	FS_XFLAG_PROJINHERIT
> +#define	XFS_XFLAG_NOSYMLINKS	FS_XFLAG_NOSYMLINKS
> +#define	XFS_XFLAG_EXTSIZE	FS_XFLAG_EXTSIZE
> +#define	XFS_XFLAG_EXTSZINHERIT	FS_XFLAG_EXTSZINHERIT
> +#define	XFS_XFLAG_NODEFRAG	FS_XFLAG_NODEFRAG
> +#define	XFS_XFLAG_FILESTREAM	FS_XFLAG_FILESTREAM
> +#define	XFS_XFLAG_HASATTR	FS_XFLAG_HASATTR
> +
> +/*
> + * Don't use this.
> + * Use struct file_clone_range
> + */
> +struct xfs_clone_args {
> +	__s64 src_fd;
> +	__u64 src_offset;
> +	__u64 src_length;
> +	__u64 dest_offset;
> +};
> +
> +/*
> + * Don't use these.
> + * Use FILE_DEDUPE_RANGE_SAME / FILE_DEDUPE_RANGE_DIFFERS
> + */
> +#define XFS_EXTENT_DATA_SAME	0
> +#define XFS_EXTENT_DATA_DIFFERS	1
> +
> +/* Don't use this. Use file_dedupe_range_info */
> +struct xfs_extent_data_info {
> +	__s64 fd;		/* in - destination file */
> +	__u64 logical_offset;	/* in - start of extent in destination */
> +	__u64 bytes_deduped;	/* out - total # of bytes we were able
> +				 * to dedupe from this file */
> +	/* status of this dedupe operation:
> +	 * < 0 for error
> +	 * == XFS_EXTENT_DATA_SAME if dedupe succeeds
> +	 * == XFS_EXTENT_DATA_DIFFERS if data differs
> +	 */
> +	__s32 status;		/* out - see above description */
> +	__u32 reserved;
> +};
> +
> +/*
> + * Don't use this.
> + * Use struct file_dedupe_range
> + */
> +struct xfs_extent_data {
> +	__u64 logical_offset;	/* in - start of extent in source */
> +	__u64 length;		/* in - length of extent */
> +	__u16 dest_count;	/* in - total elements in info array */
> +	__u16 reserved1;
> +	__u32 reserved2;
> +	struct xfs_extent_data_info info[0];
> +};
> +
> +/*
> + * Don't use these.
> + * Use FICLONE/FICLONERANGE/FIDEDUPERANGE
> + */
> +#define XFS_IOC_CLONE		 _IOW (0x94, 9, int)
> +#define XFS_IOC_CLONE_RANGE	 _IOW (0x94, 13, struct xfs_clone_args)
> +#define XFS_IOC_FILE_EXTENT_SAME _IOWR(0x94, 54, struct xfs_extent_data)
> +
> +#endif	/* __XFS_FS_COMPAT_H__ */
> diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h
> index 36fae384..84bcffa8 100644
> --- a/libxfs/xfs_fs.h
> +++ b/libxfs/xfs_fs.h
> @@ -23,27 +23,6 @@ struct dioattr {
>  };
>  #endif
>  
> -/*
> - * Flags for the bs_xflags/fsx_xflags field in XFS_IOC_FS[GS]ETXATTR[A]
> - * These are for backwards compatibility only. New code should
> - * use the kernel [4.5 onwards] defined FS_XFLAG_* definitions directly.
> - */
> -#define	XFS_XFLAG_REALTIME	FS_XFLAG_REALTIME
> -#define	XFS_XFLAG_PREALLOC	FS_XFLAG_PREALLOC
> -#define	XFS_XFLAG_IMMUTABLE	FS_XFLAG_IMMUTABLE
> -#define	XFS_XFLAG_APPEND	FS_XFLAG_APPEND
> -#define	XFS_XFLAG_SYNC		FS_XFLAG_SYNC
> -#define	XFS_XFLAG_NOATIME	FS_XFLAG_NOATIME
> -#define	XFS_XFLAG_NODUMP	FS_XFLAG_NODUMP
> -#define	XFS_XFLAG_RTINHERIT	FS_XFLAG_RTINHERIT
> -#define	XFS_XFLAG_PROJINHERIT	FS_XFLAG_PROJINHERIT
> -#define	XFS_XFLAG_NOSYMLINKS	FS_XFLAG_NOSYMLINKS
> -#define	XFS_XFLAG_EXTSIZE	FS_XFLAG_EXTSIZE
> -#define	XFS_XFLAG_EXTSZINHERIT	FS_XFLAG_EXTSZINHERIT
> -#define	XFS_XFLAG_NODEFRAG	FS_XFLAG_NODEFRAG
> -#define	XFS_XFLAG_FILESTREAM	FS_XFLAG_FILESTREAM
> -#define	XFS_XFLAG_HASATTR	FS_XFLAG_HASATTR
> -
>  /*
>   * Structure for XFS_IOC_GETBMAP.
>   * On input, fill in bmv_offset and bmv_length of the first structure
> @@ -858,47 +837,6 @@ struct xfs_scrub_metadata {
>  #define XFS_IOC_INUMBERS	     _IOR ('X', 128, struct xfs_inumbers_req)
>  /*	XFS_IOC_GETFSUUID ---------- deprecated 140	 */
>  
> -/* reflink ioctls; these MUST match the btrfs ioctl definitions */
> -/* from struct btrfs_ioctl_clone_range_args */
> -struct xfs_clone_args {
> -	__s64 src_fd;
> -	__u64 src_offset;
> -	__u64 src_length;
> -	__u64 dest_offset;
> -};
> -
> -/* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */
> -#define XFS_EXTENT_DATA_SAME	0
> -#define XFS_EXTENT_DATA_DIFFERS	1
> -
> -/* from struct btrfs_ioctl_file_extent_same_info */
> -struct xfs_extent_data_info {
> -	__s64 fd;		/* in - destination file */
> -	__u64 logical_offset;	/* in - start of extent in destination */
> -	__u64 bytes_deduped;	/* out - total # of bytes we were able
> -				 * to dedupe from this file */
> -	/* status of this dedupe operation:
> -	 * < 0 for error
> -	 * == XFS_EXTENT_DATA_SAME if dedupe succeeds
> -	 * == XFS_EXTENT_DATA_DIFFERS if data differs
> -	 */
> -	__s32 status;		/* out - see above description */
> -	__u32 reserved;
> -};
> -
> -/* from struct btrfs_ioctl_file_extent_same_args */
> -struct xfs_extent_data {
> -	__u64 logical_offset;	/* in - start of extent in source */
> -	__u64 length;		/* in - length of extent */
> -	__u16 dest_count;	/* in - total elements in info array */
> -	__u16 reserved1;
> -	__u32 reserved2;
> -	struct xfs_extent_data_info info[0];
> -};
> -
> -#define XFS_IOC_CLONE		 _IOW (0x94, 9, int)
> -#define XFS_IOC_CLONE_RANGE	 _IOW (0x94, 13, struct xfs_clone_args)
> -#define XFS_IOC_FILE_EXTENT_SAME _IOWR(0x94, 54, struct xfs_extent_data)
>  
>  #ifndef HAVE_BBMACROS
>  /*
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfsprogs: move custom interface definitions out of xfs_fs.h
  2020-08-06 19:36 [PATCH] xfsprogs: move custom interface definitions out of xfs_fs.h Eric Sandeen
  2020-08-06 19:52 ` Darrick J. Wong
@ 2020-08-17  6:56 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-08-17  6:56 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-17  6:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-06 19:36 [PATCH] xfsprogs: move custom interface definitions out of xfs_fs.h Eric Sandeen
2020-08-06 19:52 ` Darrick J. Wong
2020-08-17  6:56 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).