changeset 1269:eca18abb5295

common: extend fscall_unlink to cover rmdir behavior as well Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sat, 17 Dec 2022 20:08:29 -0500
parents 4105b14950bc
children 0694e4cf0753
files src/common/fscall.c src/common/include/nomad/fscall.h src/fs/nomadfs.c
diffstat 3 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/common/fscall.c	Sat Dec 17 20:06:51 2022 -0500
+++ b/src/common/fscall.c	Sat Dec 17 20:08:29 2022 -0500
@@ -347,7 +347,7 @@
 }
 
 int fscall_unlink(struct fscall_state *state, const uint32_t parent_handle,
-		  const char *name, const struct noid *desired)
+		  const char *name, const struct noid *desired, bool rmdir)
 
 {
 	struct rpc_unlink_req unlink_req;
@@ -355,7 +355,7 @@
 
 	unlink_req.parent = parent_handle;
 	unlink_req.name = (char *) name;
-	unlink_req.rmdir = false;
+	unlink_req.rmdir = rmdir;
 
 	if (desired)
 		unlink_req.desired = *desired;
--- a/src/common/include/nomad/fscall.h	Sat Dec 17 20:06:51 2022 -0500
+++ b/src/common/include/nomad/fscall.h	Sat Dec 17 20:08:29 2022 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2020 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2016-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
@@ -66,7 +66,8 @@
 extern int fscall_link(struct fscall_state *state, const uint32_t parent_handle,
 		       const char *name, const uint32_t target_handle);
 extern int fscall_unlink(struct fscall_state *state, const uint32_t parent_handle,
-			 const char *name, const struct noid *desired);
+			 const char *name, const struct noid *desired,
+			 bool rmdir);
 extern int fscall_read(struct fscall_state *state, const uint32_t handle,
 		       void *buf, size_t len, uint64_t off);
 extern int fscall_write(struct fscall_state *state, const uint32_t handle,
--- a/src/fs/nomadfs.c	Sat Dec 17 20:06:51 2022 -0500
+++ b/src/fs/nomadfs.c	Sat Dec 17 20:08:29 2022 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2020 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2016-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
@@ -307,7 +307,7 @@
 	if (ret)
 		goto err;
 
-	ret = fscall_unlink(&state, dir_ohandle, name, NULL);
+	ret = fscall_unlink(&state, dir_ohandle, name, NULL, false);
 	if (ret)
 		goto err_close;