public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: dsterba@suse.com, josef@toxicpanda.com,
	linux-btrfs@vger.kernel.org,
	Marcos Paulo de Souza <mpdesouza@suse.com>
Subject: [PATCH 2/5] libbtrfsutil: add IOC_SNAP_DESTROY_V2 to ioctl.h
Date: Sun, 26 Jan 2020 23:49:51 -0300	[thread overview]
Message-ID: <20200127024954.16916-2-marcos.souza.org@gmail.com> (raw)
In-Reply-To: <20200127024954.16916-1-marcos.souza.org@gmail.com>

From: Marcos Paulo de Souza <mpdesouza@suse.com>

This ioctl will make possible to delete a subvolume/snapshot by using
the subvolume id.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
 libbtrfsutil/btrfs.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libbtrfsutil/btrfs.h b/libbtrfsutil/btrfs.h
index c9a61b30..fe478ab1 100644
--- a/libbtrfsutil/btrfs.h
+++ b/libbtrfsutil/btrfs.h
@@ -36,12 +36,14 @@ struct btrfs_ioctl_vol_args {
 #define BTRFS_DEVICE_PATH_NAME_MAX 1024
 
 #define BTRFS_DEVICE_SPEC_BY_ID		(1ULL << 3)
+#define BTRFS_SUBVOL_BY_ID	(1ULL << 4)
 
 #define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED		\
 			(BTRFS_SUBVOL_CREATE_ASYNC |	\
 			BTRFS_SUBVOL_RDONLY |		\
 			BTRFS_SUBVOL_QGROUP_INHERIT |	\
-			BTRFS_DEVICE_SPEC_BY_ID)
+			BTRFS_DEVICE_SPEC_BY_ID |	\
+			BTRFS_SUBVOL_BY_ID)
 
 #define BTRFS_FSID_SIZE 16
 #define BTRFS_UUID_SIZE 16
@@ -118,7 +120,10 @@ struct btrfs_ioctl_vol_args_v2 {
 		__u64 unused[4];
 	};
 	union {
-		char name[BTRFS_SUBVOL_NAME_MAX + 1];
+		union {
+			char name[BTRFS_SUBVOL_NAME_MAX + 1];
+			__u64 subvolid;
+		};
 		__u64 devid;
 	};
 };
@@ -942,5 +947,7 @@ enum btrfs_err_code {
 				struct btrfs_ioctl_get_subvol_rootref_args)
 #define BTRFS_IOC_INO_LOOKUP_USER _IOWR(BTRFS_IOCTL_MAGIC, 62, \
 				struct btrfs_ioctl_ino_lookup_user_args)
+#define BTRFS_IOC_SNAP_DESTROY_V2 _IOW(BTRFS_IOCTL_MAGIC, 63, \
+				struct btrfs_ioctl_vol_args_v2)
 
 #endif /* _LINUX_BTRFS_H */
-- 
2.24.0


  reply	other threads:[~2020-01-27  2:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-27  2:49 [PATCH 1/5] btrfs-progs: add IOC_SNAP_DESTROY_V2 to ioctl.h Marcos Paulo de Souza
2020-01-27  2:49 ` Marcos Paulo de Souza [this message]
2020-01-27  2:49 ` [PATCH 3/5] libbtrfsutil: Introduce btrfs_util_delete_subvolume_by_id_fd Marcos Paulo de Souza
2020-01-27  2:49 ` [PATCH 4/5] cmds: subvolume: Add --subvolid argument to subvol_delete Marcos Paulo de Souza
2020-01-27  2:49 ` [PATCH 5/5] VERSION: bump version Marcos Paulo de Souza
2020-01-27  2:50   ` Qu Wenruo
2020-01-27 14:24     ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200127024954.16916-2-marcos.souza.org@gmail.com \
    --to=marcos.souza.org@gmail.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=mpdesouza@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox