25 }; |
25 }; |
26 |
26 |
27 // XXX: not sure how this should work |
27 // XXX: not sure how this should work |
28 #define CACHE_TIMEOUT 1.0 |
28 #define CACHE_TIMEOUT 1.0 |
29 |
29 |
30 // columns used for stat_info |
|
31 #define DBFS_STAT_COLS " inodes.type, inodes.mode, dbfs_size(inodes.type, inodes.data, inodes.link_path), (SELECT COUNT(*) FROM inodes i LEFT JOIN file_tree ft ON (i.ino = ft.ino) WHERE i.ino = inodes.ino) AS nlink" |
|
32 |
|
33 /* |
30 /* |
34 * Convert the CHAR(4) inodes.type from SQL into a mode_t. |
31 * Convert the CHAR(4) inodes.type from SQL into a mode_t. |
35 * |
32 * |
36 * Returns zero for unknown types. |
33 * Returns zero for unknown types. |
37 */ |
34 */ |
54 * Same as _dbfs_check_res, but returns ENOENT/EIO directly |
51 * Same as _dbfs_check_res, but returns ENOENT/EIO directly |
55 */ |
52 */ |
56 err_t dbfs_check_result (struct evsql_result *res, size_t rows, size_t cols); |
53 err_t dbfs_check_result (struct evsql_result *res, size_t rows, size_t cols); |
57 |
54 |
58 /* |
55 /* |
|
56 * Stat fields |
|
57 */ |
|
58 |
|
59 // columns used for stat_info |
|
60 #define DBFS_STAT_COLS " inodes.type, inodes.mode, dbfs_size(inodes.type, inodes.data, inodes.link_path), (SELECT COUNT(*) FROM inodes i LEFT JOIN file_tree ft ON (i.ino = ft.ino) WHERE i.ino = inodes.ino) AS nlink" |
|
61 |
|
62 |
|
63 #define DBFS_STAT_RESULT_INFO \ |
|
64 { EVSQL_FMT_BINARY, EVSQL_TYPE_STRING }, \ |
|
65 { EVSQL_FMT_BINARY, EVSQL_TYPE_UINT16 }, \ |
|
66 { EVSQL_FMT_BINARY, EVSQL_TYPE_UINT32 }, \ |
|
67 { EVSQL_FMT_BINARY, EVSQL_TYPE_UINT64 } |
|
68 |
|
69 struct dbfs_stat_values { |
|
70 const char *type; |
|
71 uint16_t mode; |
|
72 uint32_t size; |
|
73 uint64_t nlink; |
|
74 }; |
|
75 |
|
76 #define DBFS_STAT_RESULT_VALUES(ptr) \ |
|
77 &(ptr)->type, &(ptr)->mode, &(ptr)->size, &(ptr)->nlink |
|
78 |
|
79 /* |
59 * Fill a `struct state` with info retrieved from a SQL query. |
80 * Fill a `struct state` with info retrieved from a SQL query. |
60 * |
81 * |
61 * The result must contain four columns, starting at the given offset: |
82 * The result must contain four columns, starting at the given offset: |
62 * inodes.type, inodes.mode, inodes.size, count(*) AS nlink |
83 * inodes.type, inodes.mode, inodes.size, count(*) AS nlink |
63 * |
84 * |
64 * Note that this does not fill the st_ino field |
85 * Note that this does not fill the st_ino field |
65 */ |
86 */ |
66 int _dbfs_stat_info (struct stat *st, struct evsql_result *res, size_t row, size_t col_offset); |
87 int _dbfs_stat_info (struct stat *st, struct dbfs_stat_values *values); |
67 |
88 |
68 /** interrupt.c |
89 /** interrupt.c |
69 * |
90 * |
70 * Fuse interrupts are handled using fuse_req_interrupt_func. Calling this registers a callback function with the req, |
91 * Fuse interrupts are handled using fuse_req_interrupt_func. Calling this registers a callback function with the req, |
71 * which may or may not be called either by fuse_req_interrupt_func, or later on via evfuse's event handler. It is |
92 * which may or may not be called either by fuse_req_interrupt_func, or later on via evfuse's event handler. It is |