# HG changeset patch # User Josef 'Jeff' Sipek # Date 1671497664 18000 # Node ID cbeaf88784a3af2ffc51c3a47cf04d26a9bd78d0 # Parent 9f9224e301a2d94abc9bf6749dd31b084d1810e9 objstore: move objstore_obj_info to obj_info.c Signed-off-by: Josef 'Jeff' Sipek diff -r 9f9224e301a2 -r cbeaf88784a3 src/objstore/CMakeLists.txt --- a/src/objstore/CMakeLists.txt Mon Dec 19 19:53:17 2022 -0500 +++ b/src/objstore/CMakeLists.txt Mon Dec 19 19:54:24 2022 -0500 @@ -30,6 +30,7 @@ obj_attr.c obj_create.c obj_dir.c + obj_info.c obj_link.c obj_ops.c obj_rw.c diff -r 9f9224e301a2 -r cbeaf88784a3 src/objstore/obj_info.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/objstore/obj_info.c Mon Dec 19 19:54:24 2022 -0500 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2015-2020,2022 Josef 'Jeff' Sipek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "objstore_impl.h" + +int objstore_obj_info(struct objstore *vol, const struct noid *oid, + struct obj_info **infos, size_t *ninfos) +{ + struct obj *obj; + int ret; + + if (!vol || !oid || !infos || !ninfos) + return -EINVAL; + + obj = obj_by_oid(vol->clone, oid, false); + if (IS_ERR(obj)) + return PTR_ERR(obj); + + if (obj->ops->info) + ret = obj->ops->info(obj, infos, ninfos); + else + ret = -ENOTSUP; + + MXUNLOCK(&obj->lock); + + obj_putref(obj); + + return ret; +} diff -r 9f9224e301a2 -r cbeaf88784a3 src/objstore/obj_ops.c --- a/src/objstore/obj_ops.c Mon Dec 19 19:53:17 2022 -0500 +++ b/src/objstore/obj_ops.c Mon Dec 19 19:54:24 2022 -0500 @@ -22,31 +22,6 @@ #include "objstore_impl.h" -int objstore_obj_info(struct objstore *vol, const struct noid *oid, - struct obj_info **infos, size_t *ninfos) -{ - struct obj *obj; - int ret; - - if (!vol || !oid || !infos || !ninfos) - return -EINVAL; - - obj = obj_by_oid(vol->clone, oid, false); - if (IS_ERR(obj)) - return PTR_ERR(obj); - - if (obj->ops->info) - ret = obj->ops->info(obj, infos, ninfos); - else - ret = -ENOTSUP; - - MXUNLOCK(&obj->lock); - - obj_putref(obj); - - return ret; -} - struct objstore_open_obj_info *objstore_open(struct objstore *vol, const struct noid *oid, const struct nvclock *clock)