[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/14] linux-user: Add support for a group of btrfs ioctls used fo
From: |
Laurent Vivier |
Subject: |
[PULL 07/14] linux-user: Add support for a group of btrfs ioctls used for snapshots |
Date: |
Thu, 13 Aug 2020 08:49:16 +0200 |
From: Filip Bozuta <Filip.Bozuta@syrmia.com>
This patch implements functionality for following ioctls:
BTRFS_IOC_SNAP_CREATE - Creating a subvolume snapshot
Create a snapshot of a btrfs subvolume. The snapshot is created using the
ioctl's third argument that is a pointer to a 'struct btrfs_ioctl_vol_args'
(which was mentioned in the previous patch). Before calling this ioctl,
the fields of the structure should be filled with aproppriate values for
the file descriptor and path of the subvolume for which the snapshot is to
be created.
BTRFS_IOC_SNAP_DESTROY - Removing a subvolume snapshot
Delete a snapshot of a btrfs subvolume. The snapshot is deleted using the
ioctl's third argument that is a pointer to a 'struct btrfs_ioctl_vol_args'
(which was mentioned in the previous patch). Before calling this ioctl,
the fields of the structure should be filled with aproppriate values for
the file descriptor and path of the subvolume for which the snapshot is to
be deleted.
Implementation notes:
Since the thunk type 'struct btrfs_ioctl_vol_args' is defined in the
previous patch, the implementation for these ioctls was straightforward.
Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200803094629.21898-3-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/ioctls.h | 8 ++++++++
linux-user/syscall_defs.h | 2 ++
2 files changed, 10 insertions(+)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 12d14442249f..f33a99f8b642 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -174,10 +174,18 @@
IOCTL(FS_IOC32_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
IOCTL(FS_IOC32_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
+#ifdef BTRFS_IOC_SNAP_CREATE
+ IOCTL(BTRFS_IOC_SNAP_CREATE, IOC_W,
+ MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
+#endif
#ifdef BTRFS_IOC_SUBVOL_CREATE
IOCTL(BTRFS_IOC_SUBVOL_CREATE, IOC_W,
MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
#endif
+#ifdef BTRFS_IOC_SNAP_DESTROY
+ IOCTL(BTRFS_IOC_SNAP_DESTROY, IOC_W,
+ MK_PTR(MK_STRUCT(STRUCT_btrfs_ioctl_vol_args)))
+#endif
#ifdef BTRFS_IOC_SUBVOL_GETFLAGS
IOCTL(BTRFS_IOC_SUBVOL_GETFLAGS, IOC_R, MK_PTR(TYPE_ULONGLONG))
#endif
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 5435baea38d9..e514cb6916ed 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -973,7 +973,9 @@ struct target_rtc_pll_info {
#define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int)
/* btrfs ioctls */
+#define TARGET_BTRFS_IOC_SNAP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC,
1)
#define TARGET_BTRFS_IOC_SUBVOL_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC,
14)
+#define TARGET_BTRFS_IOC_SNAP_DESTROY TARGET_IOWU(BTRFS_IOCTL_MAGIC,
15)
#define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAGIC,
25,\
abi_ullong)
#define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAGIC,
26,\
--
2.26.2
- [PULL 00/14] Linux user for 5.2 patches, Laurent Vivier, 2020/08/13
- [PULL 01/14] linux-user: Fix "print_fdset()" in "strace.c" to not print ", " after last value, Laurent Vivier, 2020/08/13
- [PULL 02/14] linux-user: Validate mmap/mprotect prot value, Laurent Vivier, 2020/08/13
- [PULL 03/14] linux-user: Adjust guest page protection for the host, Laurent Vivier, 2020/08/13
- [PULL 07/14] linux-user: Add support for a group of btrfs ioctls used for snapshots,
Laurent Vivier <=
- [PULL 06/14] linux-user: Add support for a group of btrfs ioctls used for subvolumes, Laurent Vivier, 2020/08/13
- [PULL 05/14] linux-user: Add support for a group of 2038 safe syscalls, Laurent Vivier, 2020/08/13
- [PULL 08/14] linux-user: Add support for btrfs ioctls used to manipulate with devices, Laurent Vivier, 2020/08/13
- [PULL 04/14] linux-user: Modify 'target_to_host/host_to_target_itimerspec()', Laurent Vivier, 2020/08/13
- [PULL 09/14] linux-user: Add support for btrfs ioctls used to get/set features, Laurent Vivier, 2020/08/13
- [PULL 13/14] linux-user: Add support for btrfs ioctls used to scrub a filesystem, Laurent Vivier, 2020/08/13
- [PULL 10/14] linux-user: Add support for a group of btrfs inode ioctls, Laurent Vivier, 2020/08/13
- [PULL 14/14] linux-user: Fix 'utimensat()' implementation, Laurent Vivier, 2020/08/13
- [PULL 11/14] linux-user: Add support for two btrfs ioctls used for subvolume, Laurent Vivier, 2020/08/13
- [PULL 12/14] linux-user: Add support for btrfs ioctls used to manage quota, Laurent Vivier, 2020/08/13