doc
|
00001 /* 00002 * libcsync -- a library to sync a directory with another 00003 * 00004 * Copyright (c) 2008 by Andreas Schneider <mail@cynapses.org> 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * vim: ft=c.doxygen ts=2 sw=2 et cindent 00021 */ 00022 00023 #ifndef _CSYNC_VIO_H 00024 #define _CSYNC_VIO_H 00025 00026 #include <sys/types.h> 00027 #include <sys/stat.h> 00028 #include <fcntl.h> 00029 #include "c_private.h" 00030 #include "vio/csync_vio_handle.h" 00031 #include "vio/csync_vio_file_stat.h" 00032 00033 typedef struct fhandle_s { 00034 int fd; 00035 } fhandle_t; 00036 00037 int csync_vio_init(CSYNC *ctx, const char *module, const char *args); 00038 void csync_vio_shutdown(CSYNC *ctx); 00039 00040 csync_vio_handle_t *csync_vio_open(CSYNC *ctx, const char *uri, int flags, mode_t mode); 00041 csync_vio_handle_t *csync_vio_creat(CSYNC *ctx, const char *uri, mode_t mode); 00042 int csync_vio_close(CSYNC *ctx, csync_vio_handle_t *handle); 00043 ssize_t csync_vio_read(CSYNC *ctx, csync_vio_handle_t *fhandle, void *buf, size_t count); 00044 ssize_t csync_vio_write(CSYNC *ctx, csync_vio_handle_t *fhandle, const void *buf, size_t count); 00045 int csync_vio_sendfile(CSYNC *ctx, csync_vio_handle_t *sfp, csync_vio_handle_t *dst); 00046 int64_t csync_vio_lseek(CSYNC *ctx, csync_vio_handle_t *fhandle, int64_t offset, int whence); 00047 00048 csync_vio_handle_t *csync_vio_opendir(CSYNC *ctx, const char *name); 00049 int csync_vio_closedir(CSYNC *ctx, csync_vio_handle_t *dhandle); 00050 csync_vio_file_stat_t *csync_vio_readdir(CSYNC *ctx, csync_vio_handle_t *dhandle); 00051 00052 int csync_vio_mkdir(CSYNC *ctx, const char *uri, mode_t mode); 00053 int csync_vio_mkdirs(CSYNC *ctx, const char *uri, mode_t mode); 00054 int csync_vio_rmdir(CSYNC *ctx, const char *uri); 00055 00056 const char *csync_vio_file_id(CSYNC *ctx, const char *path); 00057 int csync_vio_stat(CSYNC *ctx, const char *uri, csync_vio_file_stat_t *buf); 00058 int csync_vio_rename(CSYNC *ctx, const char *olduri, const char *newuri); 00059 int csync_vio_unlink(CSYNC *ctx, const char *uri); 00060 00061 int csync_vio_chmod(CSYNC *ctx, const char *uri, mode_t mode); 00062 int csync_vio_chown(CSYNC *ctx, const char *uri, uid_t owner, gid_t group); 00063 00064 int csync_vio_utimes(CSYNC *ctx, const char *uri, const struct timeval *times); 00065 00066 int csync_vio_set_property(CSYNC *ctx, const char *key, void *data); 00067 00068 char *csync_vio_get_error_string(CSYNC *ctx); 00069 00070 void csync_vio_commit(CSYNC *ctx); 00071 00072 #endif /* _CSYNC_VIO_H */