| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916 |
- #ifndef CCAN_NFS_H
- #define CCAN_NFS_H
- /*
- Copyright (C) by Ronnie Sahlberg <ronniesahlberg@gmail.com> 2010
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
- /*
- * This is the highlevel interface to access NFS resources using a posix-like interface
- */
- #include <sys/types.h>
- #include <stdint.h>
- typedef uint64_t nfs_off_t;
- struct nfs_context;
- /*
- * Used for interfacing the async version of the api into an external eventsystem
- */
- int nfs_get_fd(struct nfs_context *nfs);
- int nfs_which_events(struct nfs_context *nfs);
- int nfs_service(struct nfs_context *nfs, int revents);
- /*
- * Used if you need different credentials than the default for the current user.
- */
- struct AUTH;
- void nfs_set_auth(struct nfs_context *nfs, struct AUTH *auth);
- /*
- * When an operation failed, this function can extract a detailed error string.
- */
- char *nfs_get_error(struct nfs_context *nfs);
- /*
- * Callback for all async nfs functions
- */
- typedef void (*nfs_cb)(int err, struct nfs_context *nfs, void *data, void *private_data);
- /*
- * NFS CONTEXT.
- */
- /*
- * Create an NFS context.
- * Function returns
- * NULL : Failed to create a context.
- * struct nfs_context * : A pointer to an nfs context.
- */
- struct nfs_context *nfs_init_context(void);
- /*
- * Destroy an nfs context.
- */
- void nfs_destroy_context(struct nfs_context *nfs);
- /*
- * A libnfs filehandle
- */
- struct nfsfh;
- /*
- * MOUNT THE EXPORT
- */
- /*
- * Async nfs mount.
- * This function will try to connect to the server and mount the export.
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_mount_async(struct nfs_context *nfs, const char *server, const char *export, nfs_cb cb, void *private_data);
- /*
- * Sync nfs mount.
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_mount_sync(struct nfs_context *nfs, const char *server, const char *export);
- /*
- * STAT()
- */
- /*
- * Async stat(<filename>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is struct stat *
- * -errno : An error occurred.
- * data is the error string.
- */
- struct stat;
- int nfs_stat_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
- /*
- * Sync stat(<filename>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_stat_sync(struct nfs_context *nfs, const char *path, struct stat *st);
- /*
- * FSTAT()
- */
- /*
- * Async fstat(nfsfh *)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is struct stat *
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_fstat_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
- /*
- * Sync fstat(nfsfh *)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_fstat_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, struct stat *st);
- /*
- * OPEN()
- */
- /*
- * Async open(<filename>)
- *
- * mode is a combination of the flags : O_RDOLNY, O_WRONLY, O_RDWR , O_SYNC
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is a struct *nfsfh;
- * The nfsfh is close using nfs_close().
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_open_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
- /*
- * Sync open(<filename>)
- * Function returns
- * 0 : The operation was successful. *nfsfh is filled in.
- * -errno : The command failed.
- */
- int nfs_open_sync(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh);
- /*
- * CLOSE
- */
- /*
- * Async close(nfsfh)
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL.
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_close_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
- /*
- * Sync close(nfsfh)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_close_sync(struct nfs_context *nfs, struct nfsfh *nfsfh);
- /*
- * PREAD()
- */
- /*
- * Async pread()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * >=0 : Success.
- * status is numer of bytes read.
- * data is a pointer to the returned data.
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_pread_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_off_t offset, size_t count, nfs_cb cb, void *private_data);
- /*
- * Sync pread()
- * Function returns
- * >=0 : numer of bytes read.
- * -errno : An error occurred.
- */
- int nfs_pread_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_off_t offset, size_t count, char *buf);
- /*
- * READ()
- */
- /*
- * Async read()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * >=0 : Success.
- * status is numer of bytes read.
- * data is a pointer to the returned data.
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_read_async(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, nfs_cb cb, void *private_data);
- /*
- * Sync read()
- * Function returns
- * >=0 : numer of bytes read.
- * -errno : An error occurred.
- */
- int nfs_read_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf);
- /*
- * PWRITE()
- */
- /*
- * Async pwrite()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * >=0 : Success.
- * status is numer of bytes written.
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_pwrite_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_off_t offset, size_t count, char *buf, nfs_cb cb, void *private_data);
- /*
- * Sync pwrite()
- * Function returns
- * >=0 : numer of bytes written.
- * -errno : An error occurred.
- */
- int nfs_pwrite_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_off_t offset, size_t count, char *buf);
- /*
- * WRITE()
- */
- /*
- * Async write()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * >=0 : Success.
- * status is numer of bytes written.
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_write_async(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf, nfs_cb cb, void *private_data);
- /*
- * Sync write()
- * Function returns
- * >=0 : numer of bytes written.
- * -errno : An error occurred.
- */
- int nfs_write_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf);
- /*
- * LSEEK()
- */
- /*
- * Async lseek()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * >=0 : Success.
- * data is nfs_off_t * for the current position.
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_lseek_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_off_t offset, int whence, nfs_cb cb, void *private_data);
- /*
- * Sync lseek()
- * Function returns
- * >=0 : numer of bytes read.
- * -errno : An error occurred.
- */
- int nfs_lseek_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_off_t offset, int whence, nfs_off_t *current_offset);
- /*
- * FSYNC()
- */
- /*
- * Async fsync()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_fsync_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_cb cb, void *private_data);
- /*
- * Sync fsync()
- * Function returns
- * 0 : Success
- * -errno : An error occurred.
- */
- int nfs_fsync_sync(struct nfs_context *nfs, struct nfsfh *nfsfh);
- /*
- * TRUNCATE()
- */
- /*
- * Async truncate()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_truncate_async(struct nfs_context *nfs, const char *path, nfs_off_t length, nfs_cb cb, void *private_data);
- /*
- * Sync truncate()
- * Function returns
- * 0 : Success
- * -errno : An error occurred.
- */
- int nfs_truncate_sync(struct nfs_context *nfs, const char *path, nfs_off_t length);
- /*
- * FTRUNCATE()
- */
- /*
- * Async ftruncate()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_ftruncate_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_off_t length, nfs_cb cb, void *private_data);
- /*
- * Sync ftruncate()
- * Function returns
- * 0 : Success
- * -errno : An error occurred.
- */
- int nfs_ftruncate_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_off_t length);
- /*
- * MKDIR()
- */
- /*
- * Async mkdir()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_mkdir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
- /*
- * Sync mkdir()
- * Function returns
- * 0 : Success
- * -errno : An error occurred.
- */
- int nfs_mkdir_sync(struct nfs_context *nfs, const char *path);
- /*
- * RMDIR()
- */
- /*
- * Async rmdir()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_rmdir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
- /*
- * Sync rmdir()
- * Function returns
- * 0 : Success
- * -errno : An error occurred.
- */
- int nfs_rmdir_sync(struct nfs_context *nfs, const char *path);
- /*
- * CREAT()
- */
- /*
- * Async creat()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is a struct *nfsfh;
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_creat_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
- /*
- * Sync creat()
- * Function returns
- * 0 : Success
- * -errno : An error occurred.
- */
- int nfs_creat_sync(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh);
- /*
- * UNLINK()
- */
- /*
- * Async unlink()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_unlink_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
- /*
- * Sync unlink()
- * Function returns
- * 0 : Success
- * -errno : An error occurred.
- */
- int nfs_unlink_sync(struct nfs_context *nfs, const char *path);
- /*
- * OPENDIR()
- */
- struct nfsdir;
- /*
- * Async opendir()
- *
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When struct nfsdir * is returned, this resource is closed/freed by calling nfs_closedir()
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is struct nfsdir *
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_opendir_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
- /*
- * Sync opendir()
- * Function returns
- * 0 : Success
- * -errno : An error occurred.
- */
- int nfs_opendir_sync(struct nfs_context *nfs, const char *path, struct nfsdir **nfsdir);
- /*
- * READDIR()
- */
- struct nfsdirent {
- struct nfsdirent *next;
- char *name;
- uint64_t inode;
- };
- /*
- * nfs_readdir() never blocks, so no special sync/async versions are available
- */
- struct nfsdirent *nfs_readdir(struct nfs_context *nfs, struct nfsdir *nfsdir);
- /*
- * READDIR()
- */
- /*
- * nfs_closedir() never blocks, so no special sync/async versions are available
- */
- void nfs_closedir(struct nfs_context *nfs, struct nfsdir *nfsdir);
- /*
- * STATVFS()
- */
- /*
- * Async statvfs(<dirname>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is struct statvfs *
- * -errno : An error occurred.
- * data is the error string.
- */
- struct statvfs;
- int nfs_statvfs_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
- /*
- * Sync statvfs(<dirname>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_statvfs_sync(struct nfs_context *nfs, const char *path, struct statvfs *svfs);
- /*
- * READLINK()
- */
- /*
- * Async readlink(<name>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is a char *
- * data is only valid during the callback and is automatically freed when the callback returns.
- * -errno : An error occurred.
- * data is the error string.
- */
- struct statvfs;
- int nfs_readlink_async(struct nfs_context *nfs, const char *path, nfs_cb cb, void *private_data);
- /*
- * Sync readlink(<name>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_readlink_sync(struct nfs_context *nfs, const char *path, char *buf, int bufsize);
- /*
- * CHMOD()
- */
- /*
- * Async chmod(<name>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_chmod_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
- /*
- * Sync chmod(<name>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_chmod_sync(struct nfs_context *nfs, const char *path, int mode);
- /*
- * FCHMOD()
- */
- /*
- * Async fchmod(<handle>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_fchmod_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode, nfs_cb cb, void *private_data);
- /*
- * Sync fchmod(<handle>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_fchmod_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode);
- /*
- * CHOWN()
- */
- /*
- * Async chown(<name>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_chown_async(struct nfs_context *nfs, const char *path, int uid, int gid, nfs_cb cb, void *private_data);
- /*
- * Sync chown(<name>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_chown_sync(struct nfs_context *nfs, const char *path, int uid, int gid);
- /*
- * FCHOWN()
- */
- /*
- * Async fchown(<handle>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid, nfs_cb cb, void *private_data);
- /*
- * Sync fchown(<handle>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_fchown_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid);
- /*
- * UTIMES()
- */
- /*
- * Async utimes(<path>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_utimes_async(struct nfs_context *nfs, const char *path, struct timeval *times, nfs_cb cb, void *private_data);
- /*
- * Sync utimes(<path>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_utimes_sync(struct nfs_context *nfs, const char *path, struct timeval *times);
- /*
- * UTIME()
- */
- /*
- * Async utime(<path>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL
- * -errno : An error occurred.
- * data is the error string.
- */
- struct utimbuf;
- int nfs_utime_async(struct nfs_context *nfs, const char *path, struct utimbuf *times, nfs_cb cb, void *private_data);
- /*
- * Sync utime(<path>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_utime_sync(struct nfs_context *nfs, const char *path, struct utimbuf *times);
- /*
- * ACCESS()
- */
- /*
- * Async access(<path>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_access_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb cb, void *private_data);
- /*
- * Sync access(<path>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_access_sync(struct nfs_context *nfs, const char *path, int mode);
- /*
- * SYMLINK()
- */
- /*
- * Async symlink(<path>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_symlink_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
- /*
- * Sync symlink(<path>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_symlink_sync(struct nfs_context *nfs, const char *oldpath, const char *newpath);
- /*
- * RENAME()
- */
- /*
- * Async rename(<oldpath>, <newpath>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_rename_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
- /*
- * Sync rename(<oldpath>, <newpath>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_rename_sync(struct nfs_context *nfs, const char *oldpath, const char *newpath);
- /*
- * LINK()
- */
- /*
- * Async link(<oldpath>, <newpath>)
- * Function returns
- * 0 : The operation was initiated. Once the operation finishes, the callback will be invoked.
- * <0 : An error occurred when trying to set up the operation. The callback will not be invoked.
- *
- * When the callback is invoked, status indicates the result:
- * 0 : Success.
- * data is NULL
- * -errno : An error occurred.
- * data is the error string.
- */
- int nfs_link_async(struct nfs_context *nfs, const char *oldpath, const char *newpath, nfs_cb cb, void *private_data);
- /*
- * Sync link(<oldpath>, <newpath>)
- * Function returns
- * 0 : The operation was successful.
- * -errno : The command failed.
- */
- int nfs_link_sync(struct nfs_context *nfs, const char *oldpath, const char *newpath);
- //qqq replace later with lseek(cur, 0)
- nfs_off_t nfs_get_current_offset(struct nfsfh *nfsfh);
- #endif /* CCAN_NFS_H */
|