btrfs-progs: dump-tree: print c/o/s/r time of ROOT_ITEM
[platform/upstream/btrfs-progs.git] / ctree.h
diff --git a/ctree.h b/ctree.h
index b5f6ea6..ef422ea 100644 (file)
--- a/ctree.h
+++ b/ctree.h
@@ -19,6 +19,8 @@
 #ifndef __BTRFS_CTREE_H__
 #define __BTRFS_CTREE_H__
 
+#include <stdbool.h>
+
 #if BTRFS_FLAT_INCLUDES
 #include "list.h"
 #include "kerncompat.h"
@@ -2070,6 +2072,38 @@ BTRFS_SETGET_STACK_FUNCS(root_stransid, struct btrfs_root_item,
 BTRFS_SETGET_STACK_FUNCS(root_rtransid, struct btrfs_root_item,
                         rtransid, 64);
 
+static inline struct btrfs_timespec* btrfs_root_ctime(
+               struct btrfs_root_item *root_item)
+{
+       unsigned long ptr = (unsigned long)root_item;
+       ptr += offsetof(struct btrfs_root_item, ctime);
+       return (struct btrfs_timespec *)ptr;
+}
+
+static inline struct btrfs_timespec* btrfs_root_otime(
+               struct btrfs_root_item *root_item)
+{
+       unsigned long ptr = (unsigned long)root_item;
+       ptr += offsetof(struct btrfs_root_item, otime);
+       return (struct btrfs_timespec *)ptr;
+}
+
+static inline struct btrfs_timespec* btrfs_root_stime(
+               struct btrfs_root_item *root_item)
+{
+       unsigned long ptr = (unsigned long)root_item;
+       ptr += offsetof(struct btrfs_root_item, stime);
+       return (struct btrfs_timespec *)ptr;
+}
+
+static inline struct btrfs_timespec* btrfs_root_rtime(
+               struct btrfs_root_item *root_item)
+{
+       unsigned long ptr = (unsigned long)root_item;
+       ptr += offsetof(struct btrfs_root_item, rtime);
+       return (struct btrfs_timespec *)ptr;
+}
+
 /* struct btrfs_root_backup */
 BTRFS_SETGET_STACK_FUNCS(backup_tree_root, struct btrfs_root_backup,
                   tree_root, 64);
@@ -2736,7 +2770,7 @@ int btrfs_change_inode_flags(struct btrfs_trans_handle *trans,
                             struct btrfs_root *root, u64 ino, u64 flags);
 int btrfs_add_link(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                   u64 ino, u64 parent_ino, char *name, int namelen,
-                  u8 type, u64 *index, int add_backref);
+                  u8 type, u64 *index, int add_backref, int ignore_existed);
 int btrfs_unlink(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                 u64 ino, u64 parent_ino, u64 index, const char *name,
                 int namelen, int add_orphan);
@@ -2745,6 +2779,8 @@ int btrfs_add_orphan_item(struct btrfs_trans_handle *trans,
                          u64 ino);
 int btrfs_mkdir(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                char *name, int namelen, u64 parent_ino, u64 *ino, int mode);
+struct btrfs_root *btrfs_mksubvol(struct btrfs_root *root, const char *base,
+                                 u64 root_objectid, bool convert);
 
 /* file.c */
 int btrfs_get_extent(struct btrfs_trans_handle *trans,