Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support 32 bit FS_IOC32_{GET|SET}FLAGS compat ioctls #4477

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion module/zfs/zpl_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
*/


#ifdef CONFIG_COMPAT
#include <linux/compat.h>
#endif
#include <sys/dmu_objset.h>
#include <sys/zfs_vfsops.h>
#include <sys/zfs_vnops.h>
Expand Down Expand Up @@ -798,7 +801,17 @@ zpl_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
static long
zpl_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
return (zpl_ioctl(filp, cmd, arg));
switch (cmd) {
case FS_IOC32_GETFLAGS:
cmd = FS_IOC_GETFLAGS;
break;
case FS_IOC32_SETFLAGS:
cmd = FS_IOC_SETFLAGS;
break;
default:
return (-ENOTTY);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the other Linux filesystems return -ENOIOCTLCMD in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autofs4, btrfs, ceph, cifs, hfsplus, jffs2, jffs, xfs return -ENOTTY, ncpfs returns -EINVAL, and ubifs returns -ENOTTY and also -ENOIOCTLCMD. The rest return -ENOIOCTLCMD. So, I'm not sure what the correct error return is. According to ioctl(2) manual, -ENOTTY seems like the documented return for a command that is not recognised for the specific object being operated on. So shall we leave it as -ENOTTY for now and not change that functionality in this particular commit?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I was just basing my comment off what ext2/3/4 does. I'm glad you took a bigger sample. Yes, I'm OK leaving this as -ENOTTY. It can always be changed if needed in a latter commit if needed.

}
return (zpl_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)));
}
#endif /* CONFIG_COMPAT */

Expand Down