aboutsummaryrefslogtreecommitdiff
path: root/libnetfs/make-node.c
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 /libnetfs/make-node.c
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 'libnetfs/make-node.c')
-rw-r--r--libnetfs/make-node.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/libnetfs/make-node.c b/libnetfs/make-node.c
index f20ada18..6bd8109c 100644
--- a/libnetfs/make-node.c
+++ b/libnetfs/make-node.c
@@ -21,13 +21,9 @@
#include "netfs.h"
#include <hurd/fshelp.h>
-struct node *
-netfs_make_node (struct netnode *nn)
+static struct node *
+init_node (struct node *np, struct netnode *nn)
{
- struct node *np = malloc (sizeof (struct node));
- if (! np)
- return NULL;
-
np->nn = nn;
pthread_mutex_init (&np->lock, NULL);
@@ -40,3 +36,24 @@ netfs_make_node (struct netnode *nn)
return np;
}
+
+struct node *
+netfs_make_node (struct netnode *nn)
+{
+ struct node *np = malloc (sizeof (struct node));
+ if (! np)
+ return NULL;
+
+ return init_node (np, nn);
+}
+
+struct node *
+netfs_make_node_alloc (size_t size)
+{
+ struct node *np = malloc (sizeof (struct node) + size);
+
+ if (np == NULL)
+ return NULL;
+
+ return init_node (np, netfs_node_netnode (np));
+}