changeset 1272:a3989958f5fc

objstore: pass unlink's rmdir arg all the way to where we need it We don't use it yet. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sat, 17 Dec 2022 20:11:50 -0500
parents 90d2af779270
children 75e654e85cab
files src/client/cmd_dir.c src/objstore/include/nomad/objstore.h src/objstore/obj_dir_unlink.c src/objstore/obj_ops.c src/objstore/objstore_impl.h
diffstat 5 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/client/cmd_dir.c	Sat Dec 17 20:10:04 2022 -0500
+++ b/src/client/cmd_dir.c	Sat Dec 17 20:11:50 2022 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2020 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2015-2020,2022 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  * Copyright (c) 2015 Holly Sipek
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -79,7 +79,8 @@
 	if (!oh)
 		return -EINVAL;
 
-	return objstore_unlink(oh->cookie, req->name, &req->desired);
+	return objstore_unlink(oh->cookie, req->name, &req->desired,
+			       req->rmdir);
 }
 
 int cmd_getdent(struct fsconn *conn, union cmd *cmd)
--- a/src/objstore/include/nomad/objstore.h	Sat Dec 17 20:10:04 2022 -0500
+++ b/src/objstore/include/nomad/objstore.h	Sat Dec 17 20:11:50 2022 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2020 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * 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
@@ -165,7 +165,8 @@
 			   const char *name, uint32_t owner, uint32_t group,
 			   uint16_t mode, uint64_t dev, struct noid *child);
 extern int objstore_unlink(struct objstore_open_obj_info *dircookie,
-			   const char *name, const struct noid *desired);
+			   const char *name, const struct noid *desired,
+			   bool rmdir);
 extern int objstore_getdent(struct objstore_open_obj_info *dircookie,
 			    const uint64_t offset, struct ndirent *child);
 
--- a/src/objstore/obj_dir_unlink.c	Sat Dec 17 20:10:04 2022 -0500
+++ b/src/objstore/obj_dir_unlink.c	Sat Dec 17 20:11:50 2022 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2020 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * 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
@@ -23,7 +23,7 @@
 #include "dir.h"
 
 static int __dir_unlink_update(struct dirblock *block, const char *name,
-			       const struct noid *desired)
+			       const struct noid *desired, bool rmdir)
 {
 	const size_t namelen = strlen(name);
 	size_t non_deleted_targets;
@@ -88,7 +88,7 @@
 }
 
 int dir_unlink(struct txn *txn, struct objver *dirver, const char *name,
-	       const struct noid *desired)
+	       const struct noid *desired, bool rmdir)
 {
 	uint8_t raw[DIR_BLOCK_SIZE];
 	struct ndirent_mem ent;
@@ -115,7 +115,7 @@
 		return ret;
 
 	/* update the dirent target */
-	ret = __dir_unlink_update(&block, name, desired);
+	ret = __dir_unlink_update(&block, name, desired, rmdir);
 	if (ret)
 		return ret;
 
--- a/src/objstore/obj_ops.c	Sat Dec 17 20:10:04 2022 -0500
+++ b/src/objstore/obj_ops.c	Sat Dec 17 20:11:50 2022 -0500
@@ -423,7 +423,7 @@
 }
 
 int objstore_unlink(struct objstore_open_obj_info *diropen, const char *name,
-		    const struct noid *desired)
+		    const struct noid *desired, bool rmdir)
 {
 	struct objver *newver;
 	struct obj *dir;
@@ -455,7 +455,7 @@
 		goto err_txn;
 	}
 
-	ret = dir_unlink(&txn, newver, name, desired);
+	ret = dir_unlink(&txn, newver, name, desired, rmdir);
 
 err_txn:
 	ret = txn_commitabort(&txn, ret);
--- a/src/objstore/objstore_impl.h	Sat Dec 17 20:10:04 2022 -0500
+++ b/src/objstore/objstore_impl.h	Sat Dec 17 20:11:50 2022 -0500
@@ -106,7 +106,7 @@
 		      uint32_t owner, uint32_t group, uint16_t mode,
 		      struct noid *child);
 extern int dir_unlink(struct txn *txn, struct objver *dirver, const char *name,
-		      const struct noid *desired);
+		      const struct noid *desired, bool rmdir);
 
 /*
  * Each transaction starts with a begin call and ends with a commit or abort