summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src/libglusterfsclient.h
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@zresearch.com>2009-03-25 06:52:05 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-03 19:24:09 +0530
commitcf6f21928dbe3489de5dfdc3513f3be5f5ef529d (patch)
treed9a63fbab63fd185e3801d4c8b42da1efcf0227a /libglusterfsclient/src/libglusterfsclient.h
parent6eb419f1ca68f536a700e63c1521e428560a0d9d (diff)
libglusterfsclient code changes
- add dentry support to libglusterfsclient. - changes related to using array, to store context in inode instead of dictionary. - code changes related to cleanup of libglusterfsclient interface. - added glusterfs_mkdir and glusterfs_rmdir - other changes in libglusterfsclient to make it work with code changes in other parts of glusterfs. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient/src/libglusterfsclient.h')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.h399
1 files changed, 178 insertions, 221 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h
index 017d8a391e9..40d08eced26 100755
--- a/libglusterfsclient/src/libglusterfsclient.h
+++ b/libglusterfsclient/src/libglusterfsclient.h
@@ -1,279 +1,236 @@
/*
- Copyright (c) 2008-2009 Z RESEARCH, Inc. <http://www.zresearch.com>
- This file is part of GlusterFS.
-
- GlusterFS 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.
-
- GlusterFS 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/>.
+ Copyright (c) 2008, 2009 Z RESEARCH, Inc. <http://www.zresearch.com>
+ This file is part of GlusterFS.
+
+ GlusterFS 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.
+
+ GlusterFS 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/>.
*/
-#ifndef __LIBGLUSTERFSCLIENT_H
-#define __LIBGLUSTERFSCLIENT_H
+#ifndef _LIBGLUSTERFSCLIENT_H
+#define _LIBGLUSTERFSCLIENT_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+
+#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
- //#include <unistd.h>
#include <dirent.h>
-#include <errno.h>
-/* #include <logging.h> */
typedef struct {
- int op_ret;
- int op_errno;
struct iovec *vector;
- int count;
+ int count;
void *ref;
-}glusterfs_read_buf_t;
-
+} glusterfs_iobuf_t;
typedef struct {
char *logfile;
char *loglevel;
struct {
- char *specfile;
- FILE *specfp;
+ char *specfile;
+ FILE *specfp;
};
char *volume_name;
- unsigned long lookup_timeout;
- unsigned long stat_timeout;
-}glusterfs_init_ctx_t;
+ unsigned long lookup_timeout;
+ unsigned long stat_timeout;
+} glusterfs_init_params_t;
-typedef struct libglusterfs_client_ctx *libglusterfs_handle_t;
+typedef void * glusterfs_handle_t;
-typedef int (*glusterfs_readv_cbk_t) (glusterfs_read_buf_t *buf,
- void *cbk_data);
+/* FIXME: how is glusterfs_file_t different from glusterfs_dir_t? */
+typedef void * glusterfs_file_t;
+typedef void * glusterfs_dir_t;
-typedef int (*glusterfs_writev_cbk_t) (int op_ret,
- int op_errno,
- void *cbk_data);
+typedef
+int (*glusterfs_readv_cbk_t) (int op_ret, int op_errno, glusterfs_iobuf_t *buf,
+ void *cbk_data);
-typedef int (*glusterfs_lookup_cbk_t) (int op_ret,
- int op_errno,
- void *buf,
- struct stat *st,
- void *cbk_data);
+typedef
+int (*glusterfs_write_cbk_t) (int op_ret, int op_errno, void *cbk_data);
-/* Used to free the glusterfs_read_buf passed to the application from glusterfs_read_async_cbk */
-void
-glusterfs_free (glusterfs_read_buf_t *buf);
+typedef
+int (*glusterfs_get_cbk_t) (int op_ret, int op_errno, glusterfs_iobuf_t *buf,
+ struct stat *stbuf, void *cbk_data);
+
+/* Used to free the glusterfs_read_buf passed to the application from
+ glusterfs_read_async_cbk
+*/
+void
+glusterfs_free (glusterfs_iobuf_t *buf);
/* libglusterfsclient initialization function */
-libglusterfs_handle_t
-glusterfs_init (glusterfs_init_ctx_t *ctx);
+glusterfs_handle_t
+glusterfs_init (glusterfs_init_params_t *ctx);
int
-glusterfs_fini (libglusterfs_handle_t handle);
+glusterfs_fini (glusterfs_handle_t handle);
-/* added for log related initialization for fork implementation in booster */
-void
-glusterfs_reset (void);
+/* For smaller files, application can use just glusterfs_get/glusterfs_get_async
+ * to read the whole content. Limit of the file-sizes to be read in
+ * glusterfs_get/glusterfs_get_async is passed in the size argument
+ */
-void
-glusterfs_log_lock (void);
+/* glusterfs_get:
+ * @handle : glusterfs handle
+ * @path : path to be looked upon
+ * @size : upper limit of file-sizes to be read in lookup
+ * @stbuf : attribute buffer
+ */
-void
-glusterfs_log_unlock (void);
+int
+glusterfs_get (glusterfs_handle_t handle, const char *path, void *buf,
+ size_t size, struct stat *stbuf);
-/* For smaller files, application can use just glusterfs_lookup/glusterfs_lookup_async to read
- * the whole content. Limit of the file-sizes to be read in
- * glusterfs_lookup/glusterfs_lookup_async is passed in the size argument */
+int
+glusterfs_get_async (glusterfs_handle_t handle, const char *path, size_t size,
+ glusterfs_get_cbk_t cbk, void *cbk_data);
-/* glusterfs_lookup:
- * @handle: glusterfs handle
- * @path: path to be looked upon
- * @buf: pointer to pre-allocated buf, in which the file content is returned for files with sizes * less than the size argument.
- * @size: upper limit of file-sizes to be read in lookup
- * @stbuf: stat buffer
- */
+glusterfs_file_t
+glusterfs_open (glusterfs_handle_t handle, const char *path, int flags,
+ mode_t mode);
-int
-glusterfs_lookup (libglusterfs_handle_t handle,
- const char *path,
- void *buf,
- size_t size,
- struct stat *stbuf);
+glusterfs_file_t
+glusterfs_creat (glusterfs_handle_t handle, const char *path, mode_t mode);
int
-glusterfs_lookup_async (libglusterfs_handle_t handle,
- const char *path,
- void *buf,
- size_t size,
- glusterfs_lookup_cbk_t cbk,
- void *cbk_data);
-
-unsigned long
-glusterfs_open (libglusterfs_handle_t handle,
- const char *path,
- int flags,
- mode_t mode);
-
-unsigned long
-glusterfs_creat (libglusterfs_handle_t handle,
- const char *path,
- mode_t mode);
-
-int
-glusterfs_close (unsigned long fd);
-
-int
-glusterfs_stat (libglusterfs_handle_t handle,
- const char *path,
- struct stat *buf);
-
-int
-glusterfs_fstat (unsigned long fd,
- struct stat *buf) ;
-
-int
-glusterfs_setxattr (libglusterfs_handle_t handle,
- const char *path,
- const char *name,
- const void *value,
- size_t size,
- int flags);
-
-int
-glusterfs_lsetxattr (libglusterfs_handle_t handle,
- const char *path,
- const char *name,
- const void *value,
- size_t size,
- int flags);
+glusterfs_mkdir (glusterfs_handle_t handle, const char *path, mode_t mode);
-int
-glusterfs_fsetxattr (unsigned long fd,
- const char *name,
- const void *value,
- size_t size,
+int
+glusterfs_rmdir (glusterfs_handle_t handle, const char *path);
+
+int
+glusterfs_close (glusterfs_file_t fd);
+
+int
+glusterfs_stat (glusterfs_handle_t handle, const char *path,
+ struct stat *stbuf);
+
+int
+glusterfs_fstat (glusterfs_file_t fd, struct stat *stbuf);
+
+int
+glusterfs_setxattr (glusterfs_handle_t handle, const char *path,
+ const char *name, const void *value, size_t size,
+ int flags);
+
+int
+glusterfs_lsetxattr (glusterfs_handle_t handle, const char *path,
+ const char *name, const void *value, size_t size,
int flags);
-ssize_t
-glusterfs_getxattr (libglusterfs_handle_t handle,
- const char *path,
- const char *name,
- void *value,
- size_t size);
-
-ssize_t
-glusterfs_lgetxattr (libglusterfs_handle_t handle,
- const char *path,
- const char *name,
- void *value,
- size_t size);
+int
+glusterfs_fsetxattr (glusterfs_file_t fd, const char *name, const void *value,
+ size_t size, int flags);
-ssize_t
-glusterfs_fgetxattr (unsigned long fd,
- const char *name,
- void *value,
- size_t size);
+ssize_t
+glusterfs_getxattr (glusterfs_handle_t handle, const char *path,
+ const char *name, void *value, size_t size);
+
+ssize_t
+glusterfs_lgetxattr (glusterfs_handle_t handle, const char *path,
+ const char *name, void *value, size_t size);
-ssize_t
-glusterfs_listxattr (libglusterfs_handle_t handle,
- const char *path,
- char *list,
+ssize_t
+glusterfs_fgetxattr (glusterfs_file_t fd, const char *name, void *value,
+ size_t size);
+
+ssize_t
+glusterfs_listxattr (glusterfs_handle_t handle, const char *path, char *list,
size_t size);
-ssize_t
-glusterfs_llistxattr (libglusterfs_handle_t handle,
- const char *path,
- char *list,
+ssize_t
+glusterfs_llistxattr (glusterfs_handle_t handle, const char *path, char *list,
size_t size);
-ssize_t
-glusterfs_flistxattr (unsigned long fd,
- char *list,
- size_t size);
+ssize_t
+glusterfs_flistxattr (glusterfs_file_t fd, char *list, size_t size);
-int
-glusterfs_removexattr (libglusterfs_handle_t handle,
- const char *path,
- const char *name);
-
-int
-glusterfs_lremovexattr (libglusterfs_handle_t handle,
- const char *path,
- const char *name);
-
-int
-glusterfs_fremovexattr (unsigned long fd,
- const char *name);
-
-ssize_t
-glusterfs_read (unsigned long fd,
- void *buf,
- size_t nbytes);
-
-ssize_t
-glusterfs_readv (unsigned long fd,
- const struct iovec *vec,
- int count);
-
-int
-glusterfs_read_async (unsigned long fd,
- size_t nbytes,
- off_t offset,
- glusterfs_readv_cbk_t readv_cbk,
- void *cbk_data);
-
-ssize_t
-glusterfs_write (unsigned long fd,
- const void *buf,
- size_t n);
-
-ssize_t
-glusterfs_writev (unsigned long fd,
- const struct iovec *vector,
- size_t count);
+int
+glusterfs_removexattr (glusterfs_handle_t handle, const char *path,
+ const char *name);
int
-glusterfs_write_async (unsigned long fd,
- const void *buf,
- size_t nbytes,
- off_t offset,
- glusterfs_writev_cbk_t writev_cbk,
- void *cbk_data);
+glusterfs_lremovexattr (glusterfs_handle_t handle, const char *path,
+ const char *name);
int
-glusterfs_readdir (unsigned long fd,
- struct dirent *dirp,
- unsigned int count);
+glusterfs_fremovexattr (glusterfs_file_t fd, const char *name);
+
+ssize_t
+glusterfs_read (glusterfs_file_t fd, void *buf, size_t nbytes);
+
+ssize_t
+glusterfs_readv (glusterfs_file_t fd, const struct iovec *vec, int count);
int
-glusterfs_getdents (unsigned long fd,
- struct dirent *dirp,
- unsigned int count);
+glusterfs_read_async (glusterfs_file_t fd, size_t nbytes, off_t offset,
+ glusterfs_readv_cbk_t readv_cbk, void *cbk_data);
-ssize_t
-glusterfs_pread (unsigned long fd,
- void *buf,
- size_t count,
- off_t offset);
+ssize_t
+glusterfs_write (glusterfs_file_t fd, const void *buf, size_t nbytes);
-ssize_t
-glusterfs_pwrite (unsigned long fd,
- const void *buf,
- size_t count,
- off_t offset);
+ssize_t
+glusterfs_writev (glusterfs_file_t fd, const struct iovec *vector, int count);
+
+int
+glusterfs_write_async (glusterfs_file_t fd, const void *buf, size_t nbytes,
+ off_t offset, glusterfs_write_cbk_t write_cbk,
+ void *cbk_data);
+
+int
+glusterfs_writev_async (glusterfs_file_t fd, const struct iovec *vector,
+ int count, off_t offset,
+ glusterfs_write_cbk_t write_cbk, void *cbk_data);
+
+ssize_t
+glusterfs_pread (glusterfs_file_t fd, void *buf, size_t nbytes, off_t offset);
+
+ssize_t
+glusterfs_pwrite (glusterfs_file_t fd, const void *buf, size_t nbytes,
+ off_t offset);
off_t
-glusterfs_lseek (unsigned long fd, off_t offset, int whence);
+glusterfs_lseek (glusterfs_file_t fd, off_t offset, int whence);
+
+int
+glusterfs_mkdir (glusterfs_handle_t handle, const char *path, mode_t mode);
+
+int
+glusterfs_rmdir (glusterfs_handle_t handle, const char *path);
+
+/* FIXME: implement man 3 readdir semantics */
+int
+glusterfs_readdir (glusterfs_dir_t fd, struct dirent *dirp,
+ unsigned int count);
+
+/* FIXME: remove getdents */
+int
+glusterfs_getdents (glusterfs_dir_t fd, struct dirent *dirp,
+ unsigned int count);
+
+/* FIXME: review the need for these apis */
+/* added for log related initialization in booster fork implementation */
+void
+glusterfs_reset (void);
+
+void
+glusterfs_log_lock (void);
+
+void
+glusterfs_log_unlock (void);
-#ifdef __cplusplus
-}
-#endif
+__END_DECLS
-#endif
+#endif /* !_LIBGLUSTERFSCLIENT_H */