doc
csync_vio.h
Go to the documentation of this file.
1 /*
2  * libcsync -- a library to sync a directory with another
3  *
4  * Copyright (c) 2008 by Andreas Schneider <mail@cynapses.org>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  * vim: ft=c.doxygen ts=2 sw=2 et cindent
21  */
22 
23 #ifndef _CSYNC_VIO_H
24 #define _CSYNC_VIO_H
25 
26 #include <sys/types.h>
27 #include <sys/stat.h>
28 #include <fcntl.h>
29 #include "c_private.h"
30 #include "vio/csync_vio_handle.h"
32 
33 typedef struct fhandle_s {
34  int fd;
35 } fhandle_t;
36 
37 int csync_vio_init(CSYNC *ctx, const char *module, const char *args);
38 void csync_vio_shutdown(CSYNC *ctx);
39 
40 csync_vio_handle_t *csync_vio_open(CSYNC *ctx, const char *uri, int flags, mode_t mode);
41 csync_vio_handle_t *csync_vio_creat(CSYNC *ctx, const char *uri, mode_t mode);
42 int csync_vio_close(CSYNC *ctx, csync_vio_handle_t *handle);
43 ssize_t csync_vio_read(CSYNC *ctx, csync_vio_handle_t *fhandle, void *buf, size_t count);
44 ssize_t csync_vio_write(CSYNC *ctx, csync_vio_handle_t *fhandle, const void *buf, size_t count);
46 int64_t csync_vio_lseek(CSYNC *ctx, csync_vio_handle_t *fhandle, int64_t offset, int whence);
47 
48 csync_vio_handle_t *csync_vio_opendir(CSYNC *ctx, const char *name);
49 int csync_vio_closedir(CSYNC *ctx, csync_vio_handle_t *dhandle);
51 
52 int csync_vio_mkdir(CSYNC *ctx, const char *uri, mode_t mode);
53 int csync_vio_mkdirs(CSYNC *ctx, const char *uri, mode_t mode);
54 int csync_vio_rmdir(CSYNC *ctx, const char *uri);
55 
56 const char *csync_vio_file_id(CSYNC *ctx, const char *path);
57 int csync_vio_stat(CSYNC *ctx, const char *uri, csync_vio_file_stat_t *buf);
58 int csync_vio_rename(CSYNC *ctx, const char *olduri, const char *newuri);
59 int csync_vio_unlink(CSYNC *ctx, const char *uri);
60 
61 int csync_vio_chmod(CSYNC *ctx, const char *uri, mode_t mode);
62 int csync_vio_chown(CSYNC *ctx, const char *uri, uid_t owner, gid_t group);
63 
64 int csync_vio_utimes(CSYNC *ctx, const char *uri, const struct timeval *times);
65 
66 int csync_vio_set_property(CSYNC *ctx, const char *key, void *data);
67 
69 
70 void csync_vio_commit(CSYNC *ctx);
71 
72 #endif /* _CSYNC_VIO_H */