diff options
Diffstat (limited to 'libnetfs/make-node.c')
-rw-r--r-- | libnetfs/make-node.c | 29 |
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)); +} |