Thanks for review. On Mon, Apr 20, 2015 at 10:47 PM, Eric Sandeen <sand...@redhat.com> wrote: > On 4/20/15 12:33 AM, xuw2...@gmail.com wrote: >> From: George Wang <xuw2...@gmail.com> <snip> >> This means the value "_IOW*" will be negative when we store it in the int >> variables. Such as the "BTRFS_IOC_QGROUP_CREATE", it will be "0x4010942e" on >> X86_64, but "0x8010942e" on PPC64. >> Notice that the IOC values are the "unsigned long" type, so we use the >> "unsigned long" to store it, and this can insure the comparison between the >> variable and BTRFS_IOC_* valid. > > Looks good - very strange that the manpage states that the interface takes > an int. :(
I think maybe the manpage of ioctl is stale. But int can also work except for comparison. And fortunately the kernel interface is unsigned int, such as btrfs: 5217 long btrfs_ioctl(struct file *file, unsigned int 5218 cmd, unsigned long arg) > > But - an "unsigned int" would be enough, right? I don't think it needs > to be an unsigned long. *shrug* unsigned int will be OK. But the btrfs-progs is user space, so the ioctl I think it should be consistent with the glibc: /usr/include/sys/ioctl.h:extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; unsigned long int is same with unsigned long. So maybe the unsigned long will be better? Thanks, George -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html