lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 23 Oct 2019 23:36:35 -0300
From:   Marcos Paulo de Souza <marcos.souza.org@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     clm@...com, josef@...icpanda.com, dsterba@...e.com,
        linux-btrfs@...r.kernel.org, mpdesouza@...e.com
Subject: [PATCH 4/5] btrfs: ctree.h: Add btrfs_is_snapshot function

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

This new function takes a btrfs_root as argument, and returns true is
root_key.offset is bigger than 0, meaning that this tree is a snapshot.

This new function will be used by the next patch.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@...e.com>
---
 fs/btrfs/ctree.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 19d669d12ca1..8502e9082914 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3411,6 +3411,20 @@ static inline int btrfs_defrag_cancelled(struct btrfs_fs_info *fs_info)
 	return signal_pending(current);
 }
 
+/*
+ * btrfs_is_snapshot() - Verify is a tree is a snapshot
+ * @root: btrfs_root
+ *
+ * When the key.offset field of btrfs_root is bigger than 0 it means the referred
+ * tree is a snapshot.
+ *
+ * Returns true if @root refers to a snapshot.
+ */
+static inline bool btrfs_is_snapshot(struct btrfs_root *root)
+{
+	return root->root_key.offset > 0;
+}
+
 #define in_range(b, first, len) ((b) >= (first) && (b) < (first) + (len))
 
 /* Sanity test specific functions */
-- 
2.23.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ