mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Linux: Implement FS_IOC_GETVERSION
Provide access to file generation number on Linux. Add test coverage. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes #12856
This commit is contained in:
@@ -817,6 +817,14 @@ zpl_fallocate(struct file *filp, int mode, loff_t offset, loff_t len)
|
||||
mode, offset, len);
|
||||
}
|
||||
|
||||
static int
|
||||
zpl_ioctl_getversion(struct file *filp, void __user *arg)
|
||||
{
|
||||
uint32_t generation = file_inode(filp)->i_generation;
|
||||
|
||||
return (copy_to_user(arg, &generation, sizeof (generation)));
|
||||
}
|
||||
|
||||
#define ZFS_FL_USER_VISIBLE (FS_FL_USER_VISIBLE | ZFS_PROJINHERIT_FL)
|
||||
#define ZFS_FL_USER_MODIFIABLE (FS_FL_USER_MODIFIABLE | ZFS_PROJINHERIT_FL)
|
||||
|
||||
@@ -989,6 +997,8 @@ static long
|
||||
zpl_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
switch (cmd) {
|
||||
case FS_IOC_GETVERSION:
|
||||
return (zpl_ioctl_getversion(filp, (void *)arg));
|
||||
case FS_IOC_GETFLAGS:
|
||||
return (zpl_ioctl_getflags(filp, (void *)arg));
|
||||
case FS_IOC_SETFLAGS:
|
||||
@@ -1007,6 +1017,9 @@ static long
|
||||
zpl_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
switch (cmd) {
|
||||
case FS_IOC32_GETVERSION:
|
||||
cmd = FS_IOC_GETVERSION;
|
||||
break;
|
||||
case FS_IOC32_GETFLAGS:
|
||||
cmd = FS_IOC_GETFLAGS;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user