Skip to content

Commit

Permalink
Return -EOPNOTSUPP for ZFS_IOC_{GET|SET}FLAGS
Browse files Browse the repository at this point in the history
Until these hooks are fully implemented return the expected
-EOPNOTSUPP error to indicate they are not functional.  This
allows test suites such as xfstests to cleanly skip testing
this functionality until it's implemented.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue #229
  • Loading branch information
behlendorf committed Jun 26, 2013
1 parent 0c1171d commit 88c2839
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/linux/vfs_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,7 @@ typedef int zpl_umode_t;
#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, mtd)
#endif /* HAVE_5ARG_SGET */

#define ZFS_IOC_GETFLAGS FS_IOC_GETFLAGS
#define ZFS_IOC_SETFLAGS FS_IOC_SETFLAGS

#endif /* _ZFS_VFS_H */
29 changes: 29 additions & 0 deletions module/zfs/zpl_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,27 @@ zpl_fallocate(struct file *filp, int mode, loff_t offset, loff_t len)
}
#endif /* HAVE_FILE_FALLOCATE */

static long
zpl_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
switch (cmd) {
case ZFS_IOC_GETFLAGS:
case ZFS_IOC_SETFLAGS:
return (-EOPNOTSUPP);
default:
return (-ENOTTY);
}
}

#ifdef CONFIG_COMPAT
static long
zpl_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
return zpl_ioctl(filp, cmd, arg);
}
#endif /* CONFIG_COMPAT */


const struct address_space_operations zpl_address_space_operations = {
.readpages = zpl_readpages,
.readpage = zpl_readpage,
Expand All @@ -451,11 +472,19 @@ const struct file_operations zpl_file_operations = {
#ifdef HAVE_FILE_FALLOCATE
.fallocate = zpl_fallocate,
#endif /* HAVE_FILE_FALLOCATE */
.unlocked_ioctl = zpl_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = zpl_compat_ioctl,
#endif
};

const struct file_operations zpl_dir_file_operations = {
.llseek = generic_file_llseek,
.read = generic_read_dir,
.readdir = zpl_readdir,
.fsync = zpl_fsync,
.unlocked_ioctl = zpl_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = zpl_compat_ioctl,
#endif
};

0 comments on commit 88c2839

Please sign in to comment.