Mercurial > nomad > experimental
changeset 1239:dba21dccfd98 draft orphan
common: add RENAME
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Mon, 13 Apr 2020 15:50:08 -0400 |
unstable | orphan: obsolete parent dbaa4ed738e3 |
parents | dbaa4ed738e3 |
children | c38fd4b83c37 |
files | docs/fs-protocol.md src/common/include/nomad/rpc_fs.h src/common/rpc_fs.x |
diffstat | 3 files changed, 44 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/fs-protocol.md Mon Apr 13 17:01:13 2020 -0400 +++ b/docs/fs-protocol.md Mon Apr 13 15:50:08 2020 -0400 @@ -204,6 +204,40 @@ Fails with `EPROTO` if the client hasn't gotten a successful LOGIN. +RENAME (0x0007) +=============== + +Given source and destination directory open file handles and path +components, atomically perform what amounts to: + + 1. LINK {dest dir} {dest name} path({source dir}/{source name}) {desired oid} + 2. UNLINK (source dir} {source name} {desired oid} + +The source is renamed to the destination. + +If a non-null desired oid is specified, only the dirent matching the oid is +considered as a source. If a null oid is specificied and there is only one +dirent under that name (in other words, there is no conflict), the dirent is +use as the source. If a null oid is specified and there are multiple +dirents with the same name, the operation fails with `ENOTUNIQ`. + +Inputs +------ +* source directory open file handle +* source path component name +* destination directory open file handle +* destination path component name +* desired destination oid + +Outputs +------- +None. + +Limitations +----------- +Fails with `EPROTO` if the client hasn't gotten a successful LOGIN. + + OPEN (0x0008) ============= @@ -440,9 +474,3 @@ For each loaded volume matching the uuid criteria: * uuid - - -Other RPCs that may end up useful -================================= - -* RENAME - rename a "file"
--- a/src/common/include/nomad/rpc_fs.h Mon Apr 13 17:01:13 2020 -0400 +++ b/src/common/include/nomad/rpc_fs.h Mon Apr 13 15:50:08 2020 -0400 @@ -36,6 +36,7 @@ #define NRPC_CREATE 0x0004 #define NRPC_LINK 0x0005 #define NRPC_UNLINK 0x0006 +#define NRPC_RENAME 0x0007 #define NRPC_OPEN 0x0008 #define NRPC_CLOSE 0x0009 #define NRPC_READ 0x000A
--- a/src/common/rpc_fs.x Mon Apr 13 17:01:13 2020 -0400 +++ b/src/common/rpc_fs.x Mon Apr 13 15:50:08 2020 -0400 @@ -107,6 +107,15 @@ struct noid desired; }; +%/***** RENAME *****/ +struct rpc_rename_req { + HANDLE(src_parent); + string src_name<>; + HANDLE(dst_parent); + string dst_name<>; + struct noid desired; +}; + %/***** OPEN *****/ struct rpc_open_req { struct noid oid;