X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lib%2Flibnfs.c;h=40b6a8dc18a1c2bd5bec7dc7c0c2ca6f6c5e23e6;hb=440a7dfced274c078b61fdb87301d26a4177fc70;hp=da47e858b78fbd4f23e370a3e6c847f12e9a4c0b;hpb=5f9d02f8396f090b406090427bb74a0997525ac1;p=deb_libnfs.git diff --git a/lib/libnfs.c b/lib/libnfs.c index da47e85..40b6a8d 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -19,6 +19,7 @@ */ #include +#include #include #include #include @@ -33,6 +34,12 @@ #include "libnfs-raw.h" #include "libnfs-raw-mount.h" #include "libnfs-raw-nfs.h" +#include "libnfs-private.h" + +struct nfsdir { + struct nfsdirent *entries; + struct nfsdirent *current; +}; struct nfsfh { struct nfs_fh3 fh; @@ -40,9 +47,13 @@ struct nfsfh { off_t offset; }; -struct nfsdir { - struct nfsdirent *entries; - struct nfsdirent *current; +struct nfs_context { + struct rpc_context *rpc; + char *server; + char *export; + struct nfs_fh3 rootfh; + size_t readmax; + size_t writemax; }; void nfs_free_nfsdir(struct nfsdir *nfsdir) @@ -58,15 +69,6 @@ void nfs_free_nfsdir(struct nfsdir *nfsdir) free(nfsdir); } -struct nfs_context { - struct rpc_context *rpc; - char *server; - char *export; - struct nfs_fh3 rootfh; - size_t readmax; - size_t writemax; -}; - struct nfs_cb_data; typedef int (*continue_func)(struct nfs_context *nfs, struct nfs_cb_data *data); @@ -2855,3 +2857,17 @@ size_t nfs_get_writemax(struct nfs_context *nfs) { return nfs->writemax; } + +void nfs_set_error(struct nfs_context *nfs, char *error_string, ...) +{ + va_list ap; + char *str; + + if (nfs->rpc->error_string != NULL) { + free(nfs->rpc->error_string); + } + va_start(ap, error_string); + vasprintf(&str, error_string, ap); + nfs->rpc->error_string = str; + va_end(ap); +}