diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-05-29 23:09:50 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-05-29 23:09:50 +0200 |
commit | 321912626ca7df438e3402d20b529d45f3473d62 (patch) | |
tree | 4196f0206771c3aa245ea9a679c385a873802af7 /libnetfs/netfs.h | |
parent | dc7e6a136e9baf98a2323758765aeab7ebae336c (diff) | |
parent | 2c7ecdc6ec8f9d9a27aa7e4e82fa2d84fa55fe9b (diff) | |
download | hurd-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 'libnetfs/netfs.h')
-rw-r--r-- | libnetfs/netfs.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libnetfs/netfs.h b/libnetfs/netfs.h index aef4a3dd..fbe2c60d 100644 --- a/libnetfs/netfs.h +++ b/libnetfs/netfs.h @@ -372,6 +372,33 @@ extern int netfs_maxsymlinks; If an error occurs, NULL is returned. */ struct node *netfs_make_node (struct netnode *); +/* Create a new node structure. Also allocate SIZE bytes for the + netnode. The address of the netnode can be obtained using + netfs_node_netnode. The new node will have one hard reference and + no light references. If an error occurs, NULL is returned. */ +struct node *netfs_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 _netfs_sizeof_struct_node; + +/* Return the address of the netnode for NODE. NODE must have been + allocated using netfs_make_node_alloc. */ +static inline struct netnode * +netfs_node_netnode (struct node *node) +{ + return (struct netnode *) ((char *) node + _netfs_sizeof_struct_node); +} + +/* Return the address of the node for NETNODE. NETNODE must have been + allocated using netfs_make_node_alloc. */ +static inline struct node * +netfs_netnode_node (struct netnode *netnode) +{ + return (struct node *) ((char *) netnode - _netfs_sizeof_struct_node); +} + /* Whenever node->references is to be touched, this lock must be held. Cf. netfs_nrele, netfs_nput, netfs_nref and netfs_drop_node. */ extern pthread_spinlock_t netfs_node_refcnt_lock; |