Mercurial > nomad > experimental
changeset 1248:f1876d613da0
common: add LINK
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Mon, 13 Apr 2020 15:46:40 -0400 |
parents | 77fd01b82fd7 |
children | 547f3f8961dc |
files | docs/fs-protocol.md src/common/include/nomad/rpc_fs.h src/common/rpc_fs.x |
diffstat | 3 files changed, 41 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/fs-protocol.md Fri Dec 16 19:48:03 2022 -0500 +++ b/docs/fs-protocol.md Mon Apr 13 15:46:40 2020 -0400 @@ -145,6 +145,37 @@ Fails with `EPROTO` if the client hasn't gotten a successful LOGIN. +LINK (0x0005) +============= + +Given a directory open file handle, a path component (string), a target path +(string), and a symlink bool add a link to the directory making the path +component refer to the file at the target path as either a hardlink or a +symlink. Hard-linking to a non-existent path fails with `ENOENT`. + +If a non-null desired oid is specified, only the dirent matching the oid is +considered as a target. 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 target. If a null oid is specified and there are multiple +dirents with the same name, the operation fails with `ENOTUNIQ`. + +Inputs +------ +* directory open file handle +* path component name +* target path +* desired target oid +* symlink + +Outputs +------- +None. + +Limitations +----------- +Fails with `EPROTO` if the client hasn't gotten a successful LOGIN. + + UNLINK (0x0006) =============== @@ -415,4 +446,3 @@ ================================= * RENAME - rename a "file" -* LINK - create a symlink or a hardlink
--- a/src/common/include/nomad/rpc_fs.h Fri Dec 16 19:48:03 2022 -0500 +++ b/src/common/include/nomad/rpc_fs.h Mon Apr 13 15:46:40 2020 -0400 @@ -34,6 +34,7 @@ #define NRPC_GETATTR 0x0002 #define NRPC_LOOKUP 0x0003 #define NRPC_CREATE 0x0004 +#define NRPC_LINK 0x0005 #define NRPC_UNLINK 0x0006 #define NRPC_OPEN 0x0008 #define NRPC_CLOSE 0x0009
--- a/src/common/rpc_fs.x Fri Dec 16 19:48:03 2022 -0500 +++ b/src/common/rpc_fs.x Mon Apr 13 15:46:40 2020 -0400 @@ -91,6 +91,15 @@ struct noid oid; }; +%/***** LINK *****/ +struct rpc_link_req { + HANDLE(parent); + string name<>; + string target_name<>; /* symlink only */ + HANDLE(target_handle); /* hardlink only */ + bool symlink; +}; + %/***** UNLINK *****/ struct rpc_unlink_req { HANDLE(parent);