Mercurial > nomad
changeset 846:547f3f8961dc
common: add fscall_link / fscall_symlink
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Mon, 13 Apr 2020 16:10:48 -0400 |
parents | f1876d613da0 |
children | fecec851b5d6 |
files | src/common/fscall.c src/common/include/nomad/fscall.h |
diffstat | 2 files changed, 52 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/common/fscall.c Mon Apr 13 15:46:40 2020 -0400 +++ b/src/common/fscall.c Mon Apr 13 16:10:48 2020 -0400 @@ -298,6 +298,54 @@ return 0; } +int fscall_symlink(struct fscall_state *state, const uint32_t parent_handle, + const char *name, const char *target) +{ + struct rpc_link_req link_req; + int ret; + + link_req.parent = parent_handle; + link_req.name = (char *) name; + link_req.target_name = (char *) target; + link_req.target_handle = 0; + link_req.symlink = true; + + ret = __fscall(state->sock, NRPC_LINK, + (void *) xdr_rpc_link_req, + NULL, + &link_req, + NULL, + 0); + if (ret) + return ret; + + return 0; +} + +int fscall_link(struct fscall_state *state, const uint32_t parent_handle, + const char *name, const uint32_t target_handle) +{ + struct rpc_link_req link_req; + int ret; + + link_req.parent = parent_handle; + link_req.name = (char *) name; + link_req.target_name = NULL; + link_req.target_handle = target_handle; + link_req.symlink = false; + + ret = __fscall(state->sock, NRPC_LINK, + (void *) xdr_rpc_link_req, + NULL, + &link_req, + NULL, + 0); + if (ret) + return ret; + + return 0; +} + int fscall_unlink(struct fscall_state *state, const uint32_t parent_handle, const char *name, const struct noid *desired)
--- a/src/common/include/nomad/fscall.h Mon Apr 13 15:46:40 2020 -0400 +++ b/src/common/include/nomad/fscall.h Mon Apr 13 16:10:48 2020 -0400 @@ -61,6 +61,10 @@ const char *name, const uint32_t owner, const uint32_t group, uint16_t mode, uint64_t dev, struct noid *child); +extern int fscall_symlink(struct fscall_state *state, const uint32_t parent_handle, + const char *name, const char *target); +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); extern int fscall_read(struct fscall_state *state, const uint32_t handle,