Mercurial > nomad > experimental
changeset 1262:79102a88827c
objstore: remove an unnecessary obj_create wrapper
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sat, 17 Dec 2022 16:08:01 -0500 |
parents | 6d515779ac45 |
children | 8d3171c87786 |
files | src/objstore/obj_dir_create.c |
diffstat | 1 files changed, 13 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/objstore/obj_dir_create.c Sat Dec 17 14:55:52 2022 -0500 +++ b/src/objstore/obj_dir_create.c Sat Dec 17 16:08:01 2022 -0500 @@ -24,27 +24,6 @@ #include <jeffpc/time.h> -/* create a new object - the child */ -static struct objver *__dir_create(struct txn *txn, uint32_t owner, - uint32_t group, uint16_t mode, - const struct noid *parent) -{ - const uint64_t now = gettime(); - struct nattr attrs = { - .mode = mode, - .nlink = 1, /* even new dirs start with link count of 1 */ - .size = NATTR_ISDIR(mode) ? DIR_BLOCK_SIZE : 0, - .atime = now, - .btime = now, - .ctime = now, - .mtime = now, - .owner = owner, - .group = group, - }; - - return obj_create(txn, &attrs, parent); -} - static int __dir_create_add_dirent(struct txn *txn, struct objver *dirver, const char *name, uint16_t mode, const struct noid *child) @@ -196,6 +175,18 @@ uint32_t owner, uint32_t group, uint16_t mode, struct noid *_child) { + const uint64_t now = gettime(); + struct nattr attrs = { + .mode = mode, + .nlink = 1, /* even new dirs start with link count of 1 */ + .size = NATTR_ISDIR(mode) ? DIR_BLOCK_SIZE : 0, + .atime = now, + .btime = now, + .ctime = now, + .mtime = now, + .owner = owner, + .group = group, + }; uint8_t raw[DIR_BLOCK_SIZE]; struct objver *child; struct ndirent_mem ent; @@ -222,7 +213,7 @@ } /* create the child */ - child = __dir_create(txn, owner, group, mode, &dirver->obj->oid); + child = obj_create(txn, &attrs, &dirver->obj->oid); if (IS_ERR(child)) return PTR_ERR(child);