From aa605bfe967f40f13b925558eba2f621579500ee Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Wed, 4 Jan 2023 10:36:33 +0100 Subject: [PATCH] - reuse code --- snapper/Btrfs.cc | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/snapper/Btrfs.cc b/snapper/Btrfs.cc index bcd9b765..d7af15ae 100644 --- a/snapper/Btrfs.cc +++ b/snapper/Btrfs.cc @@ -1323,25 +1323,12 @@ namespace snapper } - static bool - is_subvolume_ro(const SDir& dir) - { - u64 flags; - if (ioctl(dir.fd(), BTRFS_IOC_SUBVOL_GETFLAGS, &flags) < 0) - { - SN_THROW(IOErrorException("ioctl BTRFS_IOC_SUBVOL_GETFLAGS failed")); - } - - return flags & BTRFS_SUBVOL_RDONLY; - } - - void StreamProcessor::process(cmpdirs_cb_t cb) { y2mil("dir1:'" << dir1.fullname() << "' dir2:'" << dir2.fullname() << "'"); - if (!is_subvolume_ro(dir1) || !is_subvolume_ro(dir2)) + if (!is_subvolume_read_only(dir1.fd()) || !is_subvolume_read_only(dir2.fd())) { y2err("not read-only snapshots"); SN_THROW(BtrfsSendReceiveException()); -- 2.47.3