From: Arvin Schnell Date: Wed, 4 Jan 2023 09:36:33 +0000 (+0100) Subject: - reuse code X-Git-Tag: v0.10.5~72^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F763%2Fhead;p=thirdparty%2Fsnapper.git - reuse code --- 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());