]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- reuse code 763/head
authorArvin Schnell <aschnell@suse.de>
Wed, 4 Jan 2023 09:36:33 +0000 (10:36 +0100)
committerArvin Schnell <aschnell@suse.de>
Wed, 4 Jan 2023 09:36:33 +0000 (10:36 +0100)
snapper/Btrfs.cc

index bcd9b765dae7350bcf6be4549a48571964d1f113..d7af15aee68ee8334386919a2f4a17583c8d517a 100644 (file)
@@ -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());