aboutsummaryrefslogtreecommitdiff
path: root/libdiskfs/diskfs.h
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2014-05-29 23:09:50 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-05-29 23:09:50 +0200
commit321912626ca7df438e3402d20b529d45f3473d62 (patch)
tree4196f0206771c3aa245ea9a679c385a873802af7 /libdiskfs/diskfs.h
parentdc7e6a136e9baf98a2323758765aeab7ebae336c (diff)
parent2c7ecdc6ec8f9d9a27aa7e4e82fa2d84fa55fe9b (diff)
downloadhurd-321912626ca7df438e3402d20b529d45f3473d62.tar.gz
hurd-321912626ca7df438e3402d20b529d45f3473d62.tar.bz2
hurd-321912626ca7df438e3402d20b529d45f3473d62.zip
Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd
Diffstat (limited to 'libdiskfs/diskfs.h')
-rw-r--r--libdiskfs/diskfs.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h
index ae1a1502..2c68aa34 100644
--- a/libdiskfs/diskfs.h
+++ b/libdiskfs/diskfs.h
@@ -686,6 +686,33 @@ diskfs_notice_filechange (struct node *np, enum file_changed_type type,
The new node will have one hard reference and no light references. */
struct node *diskfs_make_node (struct disknode *dn);
+/* Create a new node structure. Also allocate SIZE bytes for the
+ disknode. The address of the disknode can be obtained using
+ diskfs_node_disknode. The new node will have one hard reference
+ and no light references. */
+struct node *diskfs_make_node_alloc (size_t size);
+
+/* To avoid breaking the ABI whenever sizeof (struct node) changes, we
+ explicitly provide the size. The following two functions will use
+ this value for offset calculations. */
+extern const size_t _diskfs_sizeof_struct_node;
+
+/* Return the address of the disknode for NODE. NODE must have been
+ allocated using diskfs_make_node_alloc. */
+static inline struct disknode *
+diskfs_node_disknode (struct node *node)
+{
+ return (struct disknode *) ((char *) node + _diskfs_sizeof_struct_node);
+}
+
+/* Return the address of the node for DISKNODE. DISKNODE must have
+ been allocated using diskfs_make_node_alloc. */
+static inline struct node *
+diskfs_disknode_node (struct disknode *disknode)
+{
+ return (struct node *) ((char *) disknode - _diskfs_sizeof_struct_node);
+}
+
/* The library also exports the following functions; they are not generally
useful unless you are redefining other functions the library provides. */