Change ioctl() cmd argument to be unsigned int
On Linux, the ioctl() function is defined in <sys/ioctl.h> with a request
argument defined as an unsigned long. However the libfuse library defines
it as a signed int. This is inconsistent.
The values defined for the ioctl() command are meant to be unsigned. For
instance FITRIM is defined as 0xc0185879 in <linux/fs.h>, which does not
fit into a signed int.
As a consequence the clang compiler complains:
external/ntfs-3g/libntfs-3g/ioctl.c:398:7: error: overflow converting case value to switch condition type (
3222820985 to
18446744072637405305) [-Werror,-Wswitch]
case FITRIM:
^
bionic/libc/kernel/uapi/linux/fs.h:169:16: note: expanded from macro 'FITRIM'
#define FITRIM _IOWR('X', 121, struct fstrim_range)
^
bionic/libc/kernel/uapi/asm-generic/ioctl.h:51:29: note: expanded from macro '_IOWR'
#define _IOWR(type,nr,size) _IOC(_IOC_READ | _IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size)))
^
bionic/libc/kernel/uapi/asm-generic/ioctl.h:46:32: note: expanded from macro '_IOC'
#define _IOC(dir,type,nr,size) (((dir) << _IOC_DIRSHIFT) | ((type) << _IOC_TYPESHIFT) | ((nr) << _IOC_NRSHIFT) | ((size) << _IOC_SIZESHIFT))
^
1 error generated.
Th problem has been reported to https://github.com/libfuse/libfuse/issues/367
According to the discussion, we should change unsigned int. If change it to
unsigned long, an int would be sign extended to a wrong value.