From 3cea44dc5425410ad2ca0b5d5b471445def94a6c Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 2 Feb 2014 11:41:22 -0800 Subject: [PATCH] Rename the nfs_open() argument from mode to flags --- include/nfsc/libnfs.h | 9 +++++++-- lib/libnfs-sync.c | 4 ++-- lib/libnfs.c | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/nfsc/libnfs.h b/include/nfsc/libnfs.h index e075064..b9138c9 100644 --- a/include/nfsc/libnfs.h +++ b/include/nfsc/libnfs.h @@ -272,6 +272,11 @@ EXTERN int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh, struct stat * * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked. * <0 : An error occured when trying to set up the operation. The callback will not be invoked. * + * Supported flags are + * O_RDONLY + * O_WRONLY + * O_RDWR + * * When the callback is invoked, status indicates the result: * 0 : Success. * data is a struct *nfsfh; @@ -279,14 +284,14 @@ EXTERN int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh, struct stat * * -errno : An error occured. * data is the error string. */ -EXTERN int nfs_open_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data); +EXTERN int nfs_open_async(struct nfs_context *nfs, const char *path, int flags, nfs_cb cb, void *private_data); /* * Sync open() * Function returns * 0 : The operation was successfull. *nfsfh is filled in. * -errno : The command failed. */ -EXTERN int nfs_open(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh); +EXTERN int nfs_open(struct nfs_context *nfs, const char *path, int flags, struct nfsfh **nfsfh); diff --git a/lib/libnfs-sync.c b/lib/libnfs-sync.c index 8ab05d7..580f76d 100644 --- a/lib/libnfs-sync.c +++ b/lib/libnfs-sync.c @@ -258,14 +258,14 @@ static void open_cb(int status, struct nfs_context *nfs, void *data, void *priva *nfsfh = fh; } -int nfs_open(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh) +int nfs_open(struct nfs_context *nfs, const char *path, int flags, struct nfsfh **nfsfh) { struct sync_cb_data cb_data; cb_data.is_finished = 0; cb_data.return_data = nfsfh; - if (nfs_open_async(nfs, path, mode, open_cb, &cb_data) != 0) { + if (nfs_open_async(nfs, path, flags, open_cb, &cb_data) != 0) { nfs_set_error(nfs, "nfs_open_async failed"); return -1; } diff --git a/lib/libnfs.c b/lib/libnfs.c index 303615a..bfb1b7c 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -1346,9 +1346,9 @@ static int nfs_open_continue_internal(struct nfs_context *nfs, struct nfs_cb_dat return 0; } -int nfs_open_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data) +int nfs_open_async(struct nfs_context *nfs, const char *path, int flags, nfs_cb cb, void *private_data) { - if (nfs_lookuppath_async(nfs, path, cb, private_data, nfs_open_continue_internal, NULL, NULL, mode) != 0) { + if (nfs_lookuppath_async(nfs, path, cb, private_data, nfs_open_continue_internal, NULL, NULL, flags) != 0) { rpc_set_error(nfs->rpc, "Out of memory: failed to start parsing the path components"); return -1; } -- 2.34.1