Mercurial > nomad
changeset 893:7d90b5dc4fe3
objstore: move objstore_getdent to obj_dir.c
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Mon, 19 Dec 2022 19:50:34 -0500 |
parents | 9b1ce98807c0 |
children | f089372dfed0 |
files | src/objstore/obj_dir.c src/objstore/obj_ops.c |
diffstat | 2 files changed, 27 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/src/objstore/obj_dir.c Mon Dec 19 19:49:35 2022 -0500 +++ b/src/objstore/obj_dir.c Mon Dec 19 19:50:34 2022 -0500 @@ -363,3 +363,30 @@ return ret; } + +int objstore_getdent(struct objstore_open_obj_info *diropen, + const uint64_t offset, struct ndirent *child) +{ + struct obj *dir; + int ret; + + if (!diropen) + return -EINVAL; + + dir = diropen->obj; + + /* clear whatever garbage the user may have supplied */ + child->ino = 0; + + MXLOCK(&dir->lock); + if (!NATTR_ISDIR(diropen->ver->attrs.mode)) + ret = -ENOTDIR; + else + ret = dir_getdent(diropen->ver, offset, child); + MXUNLOCK(&dir->lock); + + /* sanity check that the backend didn't try to give us an inode number */ + ASSERT0(child->ino); + + return ret; +}
--- a/src/objstore/obj_ops.c Mon Dec 19 19:49:35 2022 -0500 +++ b/src/objstore/obj_ops.c Mon Dec 19 19:50:34 2022 -0500 @@ -378,30 +378,3 @@ return ret; } - -int objstore_getdent(struct objstore_open_obj_info *diropen, - const uint64_t offset, struct ndirent *child) -{ - struct obj *dir; - int ret; - - if (!diropen) - return -EINVAL; - - dir = diropen->obj; - - /* clear whatever garbage the user may have supplied */ - child->ino = 0; - - MXLOCK(&dir->lock); - if (!NATTR_ISDIR(diropen->ver->attrs.mode)) - ret = -ENOTDIR; - else - ret = dir_getdent(diropen->ver, offset, child); - MXUNLOCK(&dir->lock); - - /* sanity check that the backend didn't try to give us an inode number */ - ASSERT0(child->ino); - - return ret; -}