changeset 898:cbeaf88784a3

objstore: move objstore_obj_info to obj_info.c Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Mon, 19 Dec 2022 19:54:24 -0500
parents 9f9224e301a2
children b14fd508b72a
files src/objstore/CMakeLists.txt src/objstore/obj_info.c src/objstore/obj_ops.c
diffstat 3 files changed, 49 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- 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
--- /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 <jeffpc@josefsipek.net>
+ *
+ * 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;
+}
--- 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)