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 /libdiskfs/node-make.c | |
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 'libdiskfs/node-make.c')
-rw-r--r-- | libdiskfs/node-make.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/libdiskfs/node-make.c b/libdiskfs/node-make.c index 2b6ef2af..ff0cc0d4 100644 --- a/libdiskfs/node-make.c +++ b/libdiskfs/node-make.c @@ -19,16 +19,9 @@ #include <fcntl.h> -/* Create a and return new node structure with DN as its physical disknode. - The node will have one hard reference and no light references. */ -struct node * -diskfs_make_node (struct disknode *dn) +static struct node * +init_node (struct node *np, struct disknode *dn) { - struct node *np = malloc (sizeof (struct node)); - - if (np == 0) - return 0; - np->dn = dn; np->dn_set_ctime = 0; np->dn_set_atime = 0; @@ -52,3 +45,31 @@ diskfs_make_node (struct disknode *dn) return np; } + +/* Create a and return new node structure with DN as its physical disknode. + The node will have one hard reference and no light references. */ +struct node * +diskfs_make_node (struct disknode *dn) +{ + struct node *np = malloc (sizeof (struct node)); + + if (np == 0) + return 0; + + return init_node (np, 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) +{ + struct node *np = malloc (sizeof (struct node) + size); + + if (np == NULL) + return NULL; + + return init_node (np, diskfs_node_disknode (np)); +} |