From: Mike Gorse <mgorse@suse.com>
Date: Wed Sep  1 04:43:01 PM CDT 2021
Subject: [patch] Remove API-related changes

This patch reverts the so version to that used in the original release for
SLE 12 and also reverts commit 32c27a.

diff -urp ntfs-3g_ntfsprogs-2022.5.17.orig/configure.ac ntfs-3g_ntfsprogs-2022.5.17/configure.ac
--- ntfs-3g_ntfsprogs-2022.5.17.orig/configure.ac	2022-05-17 01:38:29.000000000 -0500
+++ ntfs-3g_ntfsprogs-2022.5.17/configure.ac	2022-07-29 14:14:49.701857477 -0500
@@ -25,7 +25,7 @@
 # Autoconf
 AC_PREREQ(2.59)
 AC_INIT([ntfs-3g],[2022.5.17],[ntfs-3g-devel@lists.sf.net])
-LIBNTFS_3G_VERSION="89"
+LIBNTFS_3G_VERSION="84"
 AC_CONFIG_SRCDIR([src/ntfs-3g.c])
 
 # Environment
diff -urp ntfs-3g_ntfsprogs-2022.5.17.orig/include/fuse-lite/fuse.h ntfs-3g_ntfsprogs-2022.5.17/include/fuse-lite/fuse.h
--- ntfs-3g_ntfsprogs-2022.5.17.orig/include/fuse-lite/fuse.h	2022-05-17 01:38:29.000000000 -0500
+++ ntfs-3g_ntfsprogs-2022.5.17/include/fuse-lite/fuse.h	2022-07-29 14:14:30.049753725 -0500
@@ -432,9 +432,6 @@ struct fuse_operations {
 	 * non-NULL cases, the area is of _IOC_SIZE(cmd) bytes.
 	 *
 	 * Introduced in version 2.8
-	 *
-	 * Note : the unsigned long request submitted by the application        
-	 * is truncated to 32 bits, and forwarded as a signed int.
 	 */
 	int (*ioctl) (const char *, int cmd, void *arg,
 		      struct fuse_file_info *, unsigned int flags, void *data); 
diff -urp ntfs-3g_ntfsprogs-2022.5.17.orig/include/fuse-lite/fuse_lowlevel.h ntfs-3g_ntfsprogs-2022.5.17/include/fuse-lite/fuse_lowlevel.h
--- ntfs-3g_ntfsprogs-2022.5.17.orig/include/fuse-lite/fuse_lowlevel.h	2022-05-17 01:38:29.000000000 -0500
+++ ntfs-3g_ntfsprogs-2022.5.17/include/fuse-lite/fuse_lowlevel.h	2022-07-29 14:14:30.049753725 -0500
@@ -814,9 +814,6 @@ struct fuse_lowlevel_ops {
 	 *
 	 * Introduced in version 2.8
 	 *
-	 * Note : the unsigned long request submitted by the application        
-	 * is truncated to 32 bits, and forwarded as a signed int.
-	 *
 	 * Valid replies:
 	 *   fuse_reply_ioctl_retry
 	 *   fuse_reply_ioctl
diff -urp ntfs-3g_ntfsprogs-2022.5.17.orig/include/ntfs-3g/device.h ntfs-3g_ntfsprogs-2022.5.17/include/ntfs-3g/device.h
--- ntfs-3g_ntfsprogs-2022.5.17.orig/include/ntfs-3g/device.h	2022-05-17 01:38:29.000000000 -0500
+++ ntfs-3g_ntfsprogs-2022.5.17/include/ntfs-3g/device.h	2022-07-29 14:14:30.049753725 -0500
@@ -111,8 +111,7 @@ struct ntfs_device_operations {
 			s64 offset);
 	int (*sync)(struct ntfs_device *dev);
 	int (*stat)(struct ntfs_device *dev, struct stat *buf);
-	int (*ioctl)(struct ntfs_device *dev, unsigned long request,
-			void *argp);
+	int (*ioctl)(struct ntfs_device *dev, int request, void *argp);
 };
 
 extern struct ntfs_device *ntfs_device_alloc(const char *name, const long state,
diff -urp ntfs-3g_ntfsprogs-2022.5.17.orig/include/ntfs-3g/ioctl.h ntfs-3g_ntfsprogs-2022.5.17/include/ntfs-3g/ioctl.h
--- ntfs-3g_ntfsprogs-2022.5.17.orig/include/ntfs-3g/ioctl.h	2022-05-17 01:38:29.000000000 -0500
+++ ntfs-3g_ntfsprogs-2022.5.17/include/ntfs-3g/ioctl.h	2022-07-29 14:14:30.053753746 -0500
@@ -24,12 +24,7 @@
 #ifndef IOCTL_H
 #define IOCTL_H
 
-/*
- * Using an "unsigned long cmd" internally, like in <sys/ioctl.h> for Linux
- * Note however that fuse truncates the arg to 32 bits, and that
- * some commands (e.g. FITRIM) do not fit in a signed 32 bit field.
- */
-int ntfs_ioctl(ntfs_inode *ni, unsigned long cmd, void *arg,
+int ntfs_ioctl(ntfs_inode *ni, int cmd, void *arg,
                         unsigned int flags, void *data);
 
 #endif /* IOCTL_H */
diff -urp ntfs-3g_ntfsprogs-2022.5.17.orig/include/ntfs-3g/xattrs.h ntfs-3g_ntfsprogs-2022.5.17/include/ntfs-3g/xattrs.h
--- ntfs-3g_ntfsprogs-2022.5.17.orig/include/ntfs-3g/xattrs.h	2022-05-17 01:38:29.000000000 -0500
+++ ntfs-3g_ntfsprogs-2022.5.17/include/ntfs-3g/xattrs.h	2022-07-29 14:14:30.053753746 -0500
@@ -58,9 +58,9 @@ enum SYSTEMXATTRS {
 	XATTR_NTFS_TIMES_BE,
 	XATTR_NTFS_CRTIME,
 	XATTR_NTFS_CRTIME_BE,
-	XATTR_NTFS_EA,
 	XATTR_POSIX_ACC, 
-	XATTR_POSIX_DEF
+	XATTR_POSIX_DEF,
+	XATTR_NTFS_EA
 } ;
 
 struct XATTRMAPPING {
diff -urp ntfs-3g_ntfsprogs-2022.5.17.orig/libntfs-3g/ioctl.c ntfs-3g_ntfsprogs-2022.5.17/libntfs-3g/ioctl.c
--- ntfs-3g_ntfsprogs-2022.5.17.orig/libntfs-3g/ioctl.c	2022-05-17 01:38:29.000000000 -0500
+++ ntfs-3g_ntfsprogs-2022.5.17/libntfs-3g/ioctl.c	2022-07-29 14:14:30.053753746 -0500
@@ -389,8 +389,7 @@ free_out:
 
 #endif /* FITRIM && BLKDISCARD */
 
-int ntfs_ioctl(ntfs_inode *ni, unsigned long cmd,
-			void *arg __attribute__((unused)),
+int ntfs_ioctl(ntfs_inode *ni, int cmd, void *arg __attribute__((unused)),
 			unsigned int flags __attribute__((unused)), void *data)
 {
 	int ret = 0;
diff -urp ntfs-3g_ntfsprogs-2022.5.17.orig/libntfs-3g/unix_io.c ntfs-3g_ntfsprogs-2022.5.17/libntfs-3g/unix_io.c
--- ntfs-3g_ntfsprogs-2022.5.17.orig/libntfs-3g/unix_io.c	2022-05-17 01:38:29.000000000 -0500
+++ ntfs-3g_ntfsprogs-2022.5.17/libntfs-3g/unix_io.c	2022-07-29 14:14:30.053753746 -0500
@@ -369,8 +369,8 @@ static int ntfs_device_unix_io_stat(stru
  *
  * Returns:
  */
-static int ntfs_device_unix_io_ioctl(struct ntfs_device *dev,
-		unsigned long request, void *argp)
+static int ntfs_device_unix_io_ioctl(struct ntfs_device *dev, int request,
+		void *argp)
 {
 	return ioctl(DEV_FD(dev), request, argp);
 }
diff -urp ntfs-3g_ntfsprogs-2022.5.17.orig/libntfs-3g/win32_io.c ntfs-3g_ntfsprogs-2022.5.17/libntfs-3g/win32_io.c
--- ntfs-3g_ntfsprogs-2022.5.17.orig/libntfs-3g/win32_io.c	2022-05-17 01:38:29.000000000 -0500
+++ ntfs-3g_ntfsprogs-2022.5.17/libntfs-3g/win32_io.c	2022-07-29 14:14:30.053753746 -0500
@@ -1847,14 +1847,14 @@ static __inline__ int ntfs_win32_blksszg
 	return -1;
 }
 
-static int ntfs_device_win32_ioctl(struct ntfs_device *dev,
-		unsigned long request, void *argp)
+static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request,
+		void *argp)
 {
 #if defined(BLKGETSIZE) | defined(BLKGETSIZE64)
 	win32_fd *fd = (win32_fd *)dev->d_private;
 #endif
 
-	ntfs_log_trace("win32_ioctl(0x%lx) called.\n", request);
+	ntfs_log_trace("win32_ioctl(%d) called.\n", request);
 	switch (request) {
 #if defined(BLKGETSIZE)
 	case BLKGETSIZE:
@@ -1897,7 +1897,7 @@ static int ntfs_device_win32_ioctl(struc
 		return 0;
 #endif
 	default:
-		ntfs_log_debug("unimplemented ioctl 0x%lx.\n", request);
+		ntfs_log_debug("unimplemented ioctl %d.\n", request);
 		errno = EOPNOTSUPP;
 		return -1;
 	}
diff -urp ntfs-3g_ntfsprogs-2022.5.17.orig/src/lowntfs-3g.c ntfs-3g_ntfsprogs-2022.5.17/src/lowntfs-3g.c
--- ntfs-3g_ntfsprogs-2022.5.17.orig/src/lowntfs-3g.c	2022-05-17 01:38:29.000000000 -0500
+++ ntfs-3g_ntfsprogs-2022.5.17/src/lowntfs-3g.c	2022-07-29 14:14:30.053753746 -0500
@@ -3217,14 +3217,7 @@ static void ntfs_fuse_ioctl(fuse_req_t r
 			}
 			memcpy(buf, data, in_bufsz);
 		}
-		/*
-		 * Linux defines the request argument of ioctl() to be an
-		 * unsigned long, which fuse 2.x forwards as a signed int
-		 * into which the request sometimes does not fit.
-		 * So we must expand the value and make sure it is not
-		 * sign-extended.
-		 */
-		ret = ntfs_ioctl(ni, (unsigned int)cmd, arg, flags, buf);
+		ret = ntfs_ioctl(ni, cmd, arg, flags, buf);
 		if (ntfs_inode_close (ni))
 			set_fuse_error(&ret);
 	}
diff -urp ntfs-3g_ntfsprogs-2022.5.17.orig/src/ntfs-3g.c ntfs-3g_ntfsprogs-2022.5.17/src/ntfs-3g.c
--- ntfs-3g_ntfsprogs-2022.5.17.orig/src/ntfs-3g.c	2022-05-17 01:38:29.000000000 -0500
+++ ntfs-3g_ntfsprogs-2022.5.17/src/ntfs-3g.c	2022-07-29 14:14:30.053753746 -0500
@@ -2931,13 +2931,7 @@ static int ntfs_fuse_ioctl(const char *p
 	if (!ni)
 		return -errno;
 
-	/*
-	 * Linux defines the request argument of ioctl() to be an
-	 * unsigned long, which fuse 2.x forwards as a signed int into
-	 * which the request sometimes does not fit.
-	 * So we must expand the value and make sure it is not sign-extended.
-	 */
-	ret = ntfs_ioctl(ni, (unsigned int)cmd, arg, flags, data);
+	ret = ntfs_ioctl(ni, cmd, arg, flags, data);
 
 	if (ntfs_inode_close (ni))
 		set_fuse_error(&ret);
