]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | # cython: embedsignature=True |
2 | ||
3 | from libc.stdint cimport * | |
4 | from libcpp cimport bool | |
5 | from cstat cimport stat | |
6 | ||
7 | ||
8 | cdef extern from "rados/librgw.h" nogil: | |
9 | ctypedef void* librgw_t | |
10 | ||
11 | int librgw_create(librgw_t *rgw, int argc, char **argv) | |
12 | void librgw_shutdown(librgw_t rgw) | |
13 | ||
14 | ||
15 | cdef extern from "rados/rgw_file.h" nogil: | |
16 | enum: | |
17 | RGW_FS_TYPE_FILE | |
18 | RGW_FS_TYPE_DIRECTORY | |
19 | ||
20 | RGW_LOOKUP_FLAG_CREATE | |
21 | ||
22 | RGW_SETATTR_MODE | |
23 | RGW_SETATTR_UID | |
24 | RGW_SETATTR_GID | |
25 | RGW_SETATTR_MTIME | |
26 | RGW_SETATTR_ATIME | |
27 | RGW_SETATTR_SIZE | |
28 | RGW_SETATTR_CTIME | |
29 | ||
30 | RGW_READDIR_FLAG_NONE | |
31 | RGW_READDIR_FLAG_DOTDOT | |
32 | ||
33 | RGW_OPEN_FLAG_CREATE | |
34 | RGW_OPEN_FLAG_V3 # ops have v3 semantics | |
35 | RGW_OPEN_FLAG_STATELESS # alias it | |
36 | ||
37 | RGW_CLOSE_FLAG_RELE | |
38 | ||
39 | ||
40 | ctypedef void *rgw_fh_hk | |
41 | cdef struct rgw_file_handle: | |
42 | pass | |
43 | ||
44 | cdef struct rgw_fs: | |
45 | librgw_t rgw | |
46 | void *fs_private | |
47 | void *root_fh | |
48 | ||
49 | # mount info hypothetical--emulate Unix, support at least UUID-length fsid | |
50 | cdef struct rgw_statvfs: | |
51 | uint64_t f_bsize # file system block size | |
52 | uint64_t f_frsize # fragment size | |
53 | uint64_t f_blocks # size of fs in f_frsize units | |
54 | uint64_t f_bfree # free blocks | |
55 | uint64_t f_bavail # free blocks for unprivileged users | |
56 | uint64_t f_files # inodes | |
57 | uint64_t f_ffree # free inodes | |
58 | uint64_t f_favail # free inodes for unprivileged users | |
59 | uint64_t f_fsid[2] # /* file system ID | |
60 | uint64_t f_flag # mount flags | |
61 | uint64_t f_namemax # maximum filename length | |
62 | ||
63 | void rgwfile_version(int *major, int *minor, int *extra) | |
64 | ||
65 | int rgw_lookup(rgw_fs *fs, | |
66 | rgw_file_handle *parent_fh, const char *path, | |
67 | rgw_file_handle **fh, stat* st, uint32_t st_mask, | |
68 | uint32_t flags) | |
69 | ||
70 | int rgw_lookup_handle(rgw_fs *fs, rgw_fh_hk *fh_hk, | |
71 | rgw_file_handle **fh, uint32_t flags) | |
72 | ||
73 | int rgw_fh_rele(rgw_fs *fs, rgw_file_handle *fh, | |
74 | uint32_t flags) | |
75 | ||
76 | int rgw_mount(librgw_t rgw, const char *uid, const char *key, | |
77 | const char *secret, rgw_fs **fs, uint32_t flags) | |
78 | ||
79 | int rgw_umount(rgw_fs *fs, uint32_t flags) | |
80 | ||
81 | int rgw_statfs(rgw_fs *fs, rgw_file_handle *parent_fh, | |
82 | rgw_statvfs *vfs_st, uint32_t flags) | |
83 | ||
84 | int rgw_create(rgw_fs *fs, rgw_file_handle *parent_fh, | |
85 | const char *name, stat *st, uint32_t mask, | |
86 | rgw_file_handle **fh, uint32_t posix_flags, | |
87 | uint32_t flags) | |
88 | ||
89 | int rgw_mkdir(rgw_fs *fs, | |
90 | rgw_file_handle *parent_fh, | |
91 | const char *name, stat *st, uint32_t mask, | |
92 | rgw_file_handle **fh, uint32_t flags) | |
93 | ||
94 | int rgw_rename(rgw_fs *fs, | |
95 | rgw_file_handle *olddir, const char* old_name, | |
96 | rgw_file_handle *newdir, const char* new_name, | |
97 | uint32_t flags) | |
98 | ||
99 | int rgw_unlink(rgw_fs *fs, | |
100 | rgw_file_handle *parent_fh, const char* path, | |
101 | uint32_t flags) | |
102 | ||
103 | int rgw_readdir(rgw_fs *fs, | |
104 | rgw_file_handle *parent_fh, uint64_t *offset, | |
105 | bool (*cb)(const char *name, void *arg, uint64_t offset, stat *st, uint32_t st_mask, uint32_t flags) nogil except? -9000, | |
106 | void *cb_arg, bool *eof, uint32_t flags) except? -9000 | |
107 | ||
108 | int rgw_getattr(rgw_fs *fs, | |
109 | rgw_file_handle *fh, stat *st, | |
110 | uint32_t flags) | |
111 | ||
112 | int rgw_setattr(rgw_fs *fs, rgw_file_handle *fh, stat *st, | |
113 | uint32_t mask, uint32_t flags) | |
114 | ||
115 | int rgw_truncate(rgw_fs *fs, rgw_file_handle *fh, uint64_t size, uint32_t flags) | |
116 | ||
117 | int rgw_open(rgw_fs *fs, rgw_file_handle *parent_fh, | |
118 | uint32_t posix_flags, uint32_t flags) | |
119 | ||
120 | int rgw_close(rgw_fs *fs, rgw_file_handle *fh, | |
121 | uint32_t flags) | |
122 | ||
123 | int rgw_read(rgw_fs *fs, | |
124 | rgw_file_handle *fh, uint64_t offset, | |
125 | size_t length, size_t *bytes_read, void *buffer, | |
126 | uint32_t flags) | |
127 | ||
128 | int rgw_write(rgw_fs *fs, | |
129 | rgw_file_handle *fh, uint64_t offset, | |
130 | size_t length, size_t *bytes_written, void *buffer, | |
131 | uint32_t flags) | |
132 | ||
133 | int rgw_fsync(rgw_fs *fs, rgw_file_handle *fh, | |
134 | uint32_t flags) | |
135 | ||
136 | int rgw_commit(rgw_fs *fs, rgw_file_handle *fh, | |
137 | uint64_t offset, uint64_t length, uint32_t flags) |