summaryrefslogtreecommitdiffstats
path: root/api/src/glfs.h
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2013-12-02 07:59:08 -0500
committerAnand Avati <avati@redhat.com>2013-12-03 10:01:59 -0800
commit17312534879f506c71ee72c549ba6fda6f9b063d (patch)
tree036bd2749325adea6b4052920e73d04105834223 /api/src/glfs.h
parented31918c2cf80d6c875e0b31eff4ab634d9375f2 (diff)
gfapi: add __THROW [(__attribute) ((__nothrow__))] to fn decls for C++ users.
Off hand I don't know of anything written in C++ that is or could be a user of gfapi. Never the less, it's possible that one could exist, or be written, and marking the library entry points is a) friendly, b) possibly allows the C++ compiler to generate better code, and c) is a good practice when writing APIs that might be consumed by C++ applications. Considering we already take the first step and use __BEGIN_DECLS/__END_DECLS to be C++ friendly, we should take the extra step Change-Id: Ib319ecaa452a46f258a9c6e8c7221454d2fefd0f Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/6393 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'api/src/glfs.h')
-rw-r--r--api/src/glfs.h191
1 files changed, 100 insertions, 91 deletions
diff --git a/api/src/glfs.h b/api/src/glfs.h
index bf298ce47a6..20fb18c9ecf 100644
--- a/api/src/glfs.h
+++ b/api/src/glfs.h
@@ -79,7 +79,7 @@ typedef struct glfs glfs_t;
*/
-glfs_t *glfs_new (const char *volname);
+glfs_t *glfs_new (const char *volname) __THROW;
/*
@@ -158,7 +158,7 @@ int glfs_set_volfile (glfs_t *fs, const char *volfile);
*/
int glfs_set_volfile_server (glfs_t *fs, const char *transport,
- const char *host, int port);
+ const char *host, int port) __THROW;
/*
@@ -190,7 +190,7 @@ int glfs_set_volfile_server (glfs_t *fs, const char *transport,
*/
-int glfs_set_logging (glfs_t *fs, const char *logfile, int loglevel);
+int glfs_set_logging (glfs_t *fs, const char *logfile, int loglevel) __THROW;
/*
@@ -217,7 +217,7 @@ int glfs_set_logging (glfs_t *fs, const char *logfile, int loglevel);
*/
-int glfs_init (glfs_t *fs);
+int glfs_init (glfs_t *fs) __THROW;
/*
@@ -250,7 +250,7 @@ int glfs_init (glfs_t *fs);
0 : Success.
*/
-int glfs_fini (glfs_t *fs);
+int glfs_fini (glfs_t *fs) __THROW;
/*
* FILE OPERATION
@@ -294,9 +294,9 @@ typedef struct glfs_fd glfs_fd_t;
* reverted to global process defaults as required.
*
*/
-int glfs_setfsuid (uid_t fsuid);
-int glfs_setfsgid (gid_t fsgid);
-int glfs_setfsgroups (size_t size, const gid_t *list);
+int glfs_setfsuid (uid_t fsuid) __THROW;
+int glfs_setfsgid (gid_t fsgid) __THROW;
+int glfs_setfsgroups (size_t size, const gid_t *list) __THROW;
/*
SYNOPSIS
@@ -323,7 +323,7 @@ int glfs_setfsgroups (size_t size, const gid_t *list);
*/
-glfs_fd_t *glfs_open (glfs_t *fs, const char *path, int flags);
+glfs_fd_t *glfs_open (glfs_t *fs, const char *path, int flags) __THROW;
/*
@@ -353,14 +353,14 @@ glfs_fd_t *glfs_open (glfs_t *fs, const char *path, int flags);
*/
glfs_fd_t *glfs_creat (glfs_t *fs, const char *path, int flags,
- mode_t mode);
+ mode_t mode) __THROW;
-int glfs_close (glfs_fd_t *fd);
+int glfs_close (glfs_fd_t *fd) __THROW;
-glfs_t *glfs_from_glfd (glfs_fd_t *fd);
+glfs_t *glfs_from_glfd (glfs_fd_t *fd) __THROW;
int glfs_set_xlator_option (glfs_t *fs, const char *xlator, const char *key,
- const char *value);
+ const char *value) __THROW;
/*
@@ -389,84 +389,89 @@ typedef void (*glfs_io_cbk) (glfs_fd_t *fd, ssize_t ret, void *data);
// glfs_{read,write}[_async]
-ssize_t glfs_read (glfs_fd_t *fd, void *buf, size_t count, int flags);
-ssize_t glfs_write (glfs_fd_t *fd, const void *buf, size_t count, int flags);
+ssize_t glfs_read (glfs_fd_t *fd, void *buf,
+ size_t count, int flags) __THROW;
+ssize_t glfs_write (glfs_fd_t *fd, const void *buf,
+ size_t count, int flags) __THROW;
int glfs_read_async (glfs_fd_t *fd, void *buf, size_t count, int flags,
- glfs_io_cbk fn, void *data);
+ glfs_io_cbk fn, void *data) __THROW;
int glfs_write_async (glfs_fd_t *fd, const void *buf, size_t count, int flags,
- glfs_io_cbk fn, void *data);
+ glfs_io_cbk fn, void *data) __THROW;
// glfs_{read,write}v[_async]
ssize_t glfs_readv (glfs_fd_t *fd, const struct iovec *iov, int iovcnt,
- int flags);
+ int flags) __THROW;
ssize_t glfs_writev (glfs_fd_t *fd, const struct iovec *iov, int iovcnt,
- int flags);
+ int flags) __THROW;
int glfs_readv_async (glfs_fd_t *fd, const struct iovec *iov, int count,
- int flags, glfs_io_cbk fn, void *data);
+ int flags, glfs_io_cbk fn, void *data) __THROW;
int glfs_writev_async (glfs_fd_t *fd, const struct iovec *iov, int count,
- int flags, glfs_io_cbk fn, void *data);
+ int flags, glfs_io_cbk fn, void *data) __THROW;
// glfs_p{read,write}[_async]
ssize_t glfs_pread (glfs_fd_t *fd, void *buf, size_t count, off_t offset,
- int flags);
+ int flags) __THROW;
ssize_t glfs_pwrite (glfs_fd_t *fd, const void *buf, size_t count,
- off_t offset, int flags);
+ off_t offset, int flags) __THROW;
int glfs_pread_async (glfs_fd_t *fd, void *buf, size_t count, off_t offset,
- int flags, glfs_io_cbk fn, void *data);
+ int flags, glfs_io_cbk fn, void *data) __THROW;
int glfs_pwrite_async (glfs_fd_t *fd, const void *buf, int count, off_t offset,
- int flags, glfs_io_cbk fn, void *data);
+ int flags, glfs_io_cbk fn, void *data) __THROW;
// glfs_p{read,write}v[_async]
ssize_t glfs_preadv (glfs_fd_t *fd, const struct iovec *iov, int iovcnt,
- off_t offset, int flags);
+ off_t offset, int flags) __THROW;
ssize_t glfs_pwritev (glfs_fd_t *fd, const struct iovec *iov, int iovcnt,
- off_t offset, int flags);
-int glfs_preadv_async (glfs_fd_t *fd, const struct iovec *iov, int count,
- off_t offset, int flags, glfs_io_cbk fn, void *data);
-int glfs_pwritev_async (glfs_fd_t *fd, const struct iovec *iov, int count,
- off_t offset, int flags, glfs_io_cbk fn, void *data);
+ off_t offset, int flags) __THROW;
+int glfs_preadv_async (glfs_fd_t *fd, const struct iovec *iov,
+ int count, off_t offset, int flags,
+ glfs_io_cbk fn, void *data) __THROW;
+int glfs_pwritev_async (glfs_fd_t *fd, const struct iovec *iov,
+ int count, off_t offset, int flags,
+ glfs_io_cbk fn, void *data) __THROW;
-off_t glfs_lseek (glfs_fd_t *fd, off_t offset, int whence);
+off_t glfs_lseek (glfs_fd_t *fd, off_t offset, int whence) __THROW;
-int glfs_truncate (glfs_t *fs, const char *path, off_t length);
+int glfs_truncate (glfs_t *fs, const char *path, off_t length) __THROW;
-int glfs_ftruncate (glfs_fd_t *fd, off_t length);
+int glfs_ftruncate (glfs_fd_t *fd, off_t length) __THROW;
int glfs_ftruncate_async (glfs_fd_t *fd, off_t length, glfs_io_cbk fn,
- void *data);
+ void *data) __THROW;
-int glfs_lstat (glfs_t *fs, const char *path, struct stat *buf);
-int glfs_stat (glfs_t *fs, const char *path, struct stat *buf);
-int glfs_fstat (glfs_fd_t *fd, struct stat *buf);
+int glfs_lstat (glfs_t *fs, const char *path, struct stat *buf) __THROW;
+int glfs_stat (glfs_t *fs, const char *path, struct stat *buf) __THROW;
+int glfs_fstat (glfs_fd_t *fd, struct stat *buf) __THROW;
-int glfs_fsync (glfs_fd_t *fd);
-int glfs_fsync_async (glfs_fd_t *fd, glfs_io_cbk fn, void *data);
+int glfs_fsync (glfs_fd_t *fd) __THROW;
+int glfs_fsync_async (glfs_fd_t *fd, glfs_io_cbk fn, void *data) __THROW;
-int glfs_fdatasync (glfs_fd_t *fd);
-int glfs_fdatasync_async (glfs_fd_t *fd, glfs_io_cbk fn, void *data);
+int glfs_fdatasync (glfs_fd_t *fd) __THROW;
+int glfs_fdatasync_async (glfs_fd_t *fd, glfs_io_cbk fn, void *data) __THROW;
-int glfs_access (glfs_t *fs, const char *path, int mode);
+int glfs_access (glfs_t *fs, const char *path, int mode) __THROW;
-int glfs_symlink (glfs_t *fs, const char *oldpath, const char *newpath);
+int glfs_symlink (glfs_t *fs, const char *oldpath, const char *newpath) __THROW;
-int glfs_readlink (glfs_t *fs, const char *path, char *buf, size_t bufsiz);
+int glfs_readlink (glfs_t *fs, const char *path,
+ char *buf, size_t bufsiz) __THROW;
-int glfs_mknod (glfs_t *fs, const char *path, mode_t mode, dev_t dev);
+int glfs_mknod (glfs_t *fs, const char *path, mode_t mode, dev_t dev) __THROW;
-int glfs_mkdir (glfs_t *fs, const char *path, mode_t mode);
+int glfs_mkdir (glfs_t *fs, const char *path, mode_t mode) __THROW;
-int glfs_unlink (glfs_t *fs, const char *path);
+int glfs_unlink (glfs_t *fs, const char *path) __THROW;
-int glfs_rmdir (glfs_t *fs, const char *path);
+int glfs_rmdir (glfs_t *fs, const char *path) __THROW;
-int glfs_rename (glfs_t *fs, const char *oldpath, const char *newpath);
+int glfs_rename (glfs_t *fs, const char *oldpath, const char *newpath) __THROW;
-int glfs_link (glfs_t *fs, const char *oldpath, const char *newpath);
+int glfs_link (glfs_t *fs, const char *oldpath, const char *newpath) __THROW;
-glfs_fd_t *glfs_opendir (glfs_t *fs, const char *path);
+glfs_fd_t *glfs_opendir (glfs_t *fs, const char *path) __THROW;
/*
* @glfs_readdir_r and @glfs_readdirplus_r ARE thread safe AND re-entrant,
@@ -477,10 +482,10 @@ glfs_fd_t *glfs_opendir (glfs_t *fs, const char *path);
*/
int glfs_readdir_r (glfs_fd_t *fd, struct dirent *dirent,
- struct dirent **result);
+ struct dirent **result) __THROW;
int glfs_readdirplus_r (glfs_fd_t *fd, struct stat *stat, struct dirent *dirent,
- struct dirent **result);
+ struct dirent **result) __THROW;
/*
* @glfs_readdir and @glfs_readdirplus are NEITHER thread safe NOR re-entrant
@@ -489,92 +494,96 @@ int glfs_readdirplus_r (glfs_fd_t *fd, struct stat *stat, struct dirent *dirent,
* referring to the same directory too.)
*/
-struct dirent *glfs_readdir (glfs_fd_t *fd);
+struct dirent *glfs_readdir (glfs_fd_t *fd) __THROW;
-struct dirent *glfs_readdirplus (glfs_fd_t *fd, struct stat *stat);
+struct dirent *glfs_readdirplus (glfs_fd_t *fd, struct stat *stat) __THROW;
-long glfs_telldir (glfs_fd_t *fd);
+long glfs_telldir (glfs_fd_t *fd) __THROW;
-void glfs_seekdir (glfs_fd_t *fd, long offset);
+void glfs_seekdir (glfs_fd_t *fd, long offset) __THROW;
-int glfs_closedir (glfs_fd_t *fd);
+int glfs_closedir (glfs_fd_t *fd) __THROW;
-int glfs_statvfs (glfs_t *fs, const char *path, struct statvfs *buf);
+int glfs_statvfs (glfs_t *fs, const char *path, struct statvfs *buf) __THROW;
-int glfs_chmod (glfs_t *fs, const char *path, mode_t mode);
+int glfs_chmod (glfs_t *fs, const char *path, mode_t mode) __THROW;
-int glfs_fchmod (glfs_fd_t *fd, mode_t mode);
+int glfs_fchmod (glfs_fd_t *fd, mode_t mode) __THROW;
-int glfs_chown (glfs_t *fs, const char *path, uid_t uid, gid_t gid);
+int glfs_chown (glfs_t *fs, const char *path, uid_t uid, gid_t gid) __THROW;
-int glfs_lchown (glfs_t *fs, const char *path, uid_t uid, gid_t gid);
+int glfs_lchown (glfs_t *fs, const char *path, uid_t uid, gid_t gid) __THROW;
-int glfs_fchown (glfs_fd_t *fd, uid_t uid, gid_t gid);
+int glfs_fchown (glfs_fd_t *fd, uid_t uid, gid_t gid) __THROW;
-int glfs_utimens (glfs_t *fs, const char *path, struct timespec times[2]);
+int glfs_utimens (glfs_t *fs, const char *path,
+ struct timespec times[2]) __THROW;
-int glfs_lutimens (glfs_t *fs, const char *path, struct timespec times[2]);
+int glfs_lutimens (glfs_t *fs, const char *path,
+ struct timespec times[2]) __THROW;
-int glfs_futimens (glfs_fd_t *fd, struct timespec times[2]);
+int glfs_futimens (glfs_fd_t *fd, struct timespec times[2]) __THROW;
ssize_t glfs_getxattr (glfs_t *fs, const char *path, const char *name,
- void *value, size_t size);
+ void *value, size_t size) __THROW;
ssize_t glfs_lgetxattr (glfs_t *fs, const char *path, const char *name,
- void *value, size_t size);
+ void *value, size_t size) __THROW;
ssize_t glfs_fgetxattr (glfs_fd_t *fd, const char *name,
- void *value, size_t size);
+ void *value, size_t size) __THROW;
-ssize_t glfs_listxattr (glfs_t *fs, const char *path, void *value, size_t size);
+ssize_t glfs_listxattr (glfs_t *fs, const char *path,
+ void *value, size_t size) __THROW;
ssize_t glfs_llistxattr (glfs_t *fs, const char *path, void *value,
- size_t size);
+ size_t size) __THROW;
-ssize_t glfs_flistxattr (glfs_fd_t *fd, void *value, size_t size);
+ssize_t glfs_flistxattr (glfs_fd_t *fd, void *value, size_t size) __THROW;
int glfs_setxattr (glfs_t *fs, const char *path, const char *name,
- const void *value, size_t size, int flags);
+ const void *value, size_t size, int flags) __THROW;
int glfs_lsetxattr (glfs_t *fs, const char *path, const char *name,
- const void *value, size_t size, int flags);
+ const void *value, size_t size, int flags) __THROW;
int glfs_fsetxattr (glfs_fd_t *fd, const char *name,
- const void *value, size_t size, int flags);
+ const void *value, size_t size, int flags) __THROW;
-int glfs_removexattr (glfs_t *fs, const char *path, const char *name);
+int glfs_removexattr (glfs_t *fs, const char *path, const char *name) __THROW;
-int glfs_lremovexattr (glfs_t *fs, const char *path, const char *name);
+int glfs_lremovexattr (glfs_t *fs, const char *path, const char *name) __THROW;
-int glfs_fremovexattr (glfs_fd_t *fd, const char *name);
+int glfs_fremovexattr (glfs_fd_t *fd, const char *name) __THROW;
-int glfs_fallocate(glfs_fd_t *fd, int keep_size, off_t offset, size_t len);
+int glfs_fallocate(glfs_fd_t *fd, int keep_size,
+ off_t offset, size_t len) __THROW;
-int glfs_discard(glfs_fd_t *fd, off_t offset, size_t len);
+int glfs_discard(glfs_fd_t *fd, off_t offset, size_t len) __THROW;
int glfs_discard_async (glfs_fd_t *fd, off_t length, size_t lent,
- glfs_io_cbk fn, void *data);
+ glfs_io_cbk fn, void *data) __THROW;
-int glfs_zerofill(glfs_fd_t *fd, off_t offset, off_t len);
+int glfs_zerofill(glfs_fd_t *fd, off_t offset, off_t len) __THROW;
int glfs_zerofill_async (glfs_fd_t *fd, off_t length, off_t len,
- glfs_io_cbk fn, void *data);
+ glfs_io_cbk fn, void *data) __THROW;
-char *glfs_getcwd (glfs_t *fs, char *buf, size_t size);
+char *glfs_getcwd (glfs_t *fs, char *buf, size_t size) __THROW;
-int glfs_chdir (glfs_t *fs, const char *path);
+int glfs_chdir (glfs_t *fs, const char *path) __THROW;
-int glfs_fchdir (glfs_fd_t *fd);
+int glfs_fchdir (glfs_fd_t *fd) __THROW;
-char *glfs_realpath (glfs_t *fs, const char *path, char *resolved_path);
+char *glfs_realpath (glfs_t *fs, const char *path, char *resolved_path) __THROW;
/*
* @cmd and @flock are as specified in man fcntl(2).
*/
-int glfs_posix_lock (glfs_fd_t *fd, int cmd, struct flock *flock);
+int glfs_posix_lock (glfs_fd_t *fd, int cmd, struct flock *flock) __THROW;
-glfs_fd_t *glfs_dup (glfs_fd_t *fd);
+glfs_fd_t *glfs_dup (glfs_fd_t *fd) __THROW;
__END_DECLS