author | Tero Marttila <terom@fixme.fi> |
Tue, 18 Nov 2008 02:06:52 +0200 | |
changeset 42 | 40a3b13ffc9d |
parent 41 | 6abda2fa4579 |
child 48 | 8b019d191353 |
permissions | -rw-r--r-- |
29
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
#ifndef DBFS_DBFS_H |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
#define DBFS_DBFS_H |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
|
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
4 |
#include <sys/stat.h> |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
5 |
#include <errno.h> |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
6 |
|
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
7 |
#include <event2/event.h> |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
8 |
|
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
9 |
#include "ops.h" |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
10 |
#include "../evfuse.h" |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
11 |
#include "../evsql.h" |
41
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
12 |
#include "../lib/error.h" |
29
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
13 |
|
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
14 |
/* |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
15 |
* Structs and functions shared between all dbfs components |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
16 |
*/ |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
17 |
|
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
18 |
struct dbfs { |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
19 |
struct event_base *ev_base; |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
20 |
|
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
21 |
const char *db_conninfo; |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
22 |
struct evsql *db; |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
23 |
|
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
24 |
struct evfuse *ev_fuse; |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
25 |
}; |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
26 |
|
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
27 |
// XXX: not sure how this should work |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
28 |
#define CACHE_TIMEOUT 1.0 |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
29 |
|
31 | 30 |
// columns used for stat_info |
33 | 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" |
31 | 32 |
|
29
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
33 |
/* |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
34 |
* Convert the CHAR(4) inodes.type from SQL into a mode_t. |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
35 |
* |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
36 |
* Returns zero for unknown types. |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
37 |
*/ |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
38 |
mode_t _dbfs_mode (const char *type); |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
39 |
|
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
40 |
/* |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
41 |
* Check that the number of rows and columns in the result set matches what we expect. |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
42 |
* |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
43 |
* If rows is nonzero, there must be exactly that many rows (mostly useful for rows=1). |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
44 |
* The number of columns must always be given, and match. |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
45 |
* |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
46 |
* Returns; |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
47 |
* -1 if the query failed, the columns/rows do not match |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
48 |
* 0 the results match |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
49 |
* 1 there were no results (zero rows) |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
50 |
*/ |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
51 |
int _dbfs_check_res (const struct evsql_result_info *res, size_t rows, size_t cols); |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
52 |
|
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
53 |
/* |
36
56427f22e969
tweak debug/info output, implement dbfs_unlink with slightly improved error macros handling
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
54 |
* Same as _dbfs_check_res, but returns ENOENT/EIO directly |
56427f22e969
tweak debug/info output, implement dbfs_unlink with slightly improved error macros handling
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
55 |
*/ |
56427f22e969
tweak debug/info output, implement dbfs_unlink with slightly improved error macros handling
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
56 |
err_t dbfs_check_result (const struct evsql_result_info *res, size_t rows, size_t cols); |
56427f22e969
tweak debug/info output, implement dbfs_unlink with slightly improved error macros handling
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
57 |
|
56427f22e969
tweak debug/info output, implement dbfs_unlink with slightly improved error macros handling
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
58 |
/* |
29
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
59 |
* Fill a `struct state` with info retrieved from a SQL query. |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
60 |
* |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
61 |
* The result must contain four columns, starting at the given offset: |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
62 |
* inodes.type, inodes.mode, inodes.size, count(*) AS nlink |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
63 |
* |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
64 |
* Note that this does not fill the st_ino field |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
65 |
*/ |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
66 |
int _dbfs_stat_info (struct stat *st, const struct evsql_result_info *res, size_t row, size_t col_offset); |
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
67 |
|
41
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
68 |
/** interrupt.c |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
69 |
* |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
70 |
* Fuse interrupts are handled using fuse_req_interrupt_func. Calling this registers a callback function with the req, |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
71 |
* which may or may not be called either by fuse_req_interrupt_func, or later on via evfuse's event handler. It is |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
72 |
* assumed that this will never be called after a call to fuse_reply_*. |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
73 |
* |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
74 |
* Hence, to handle an interrupt, we must first ensure that fuse_reply_* will not be called afterwards (it'll return |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
75 |
* an error), and then we must call fuse_reply_err(req, EINTR). |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
76 |
* |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
77 |
* In the simplest case, we can simply submit a query, and then abort it once the req is interrupted (now or later). |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
78 |
* In the more complicated case, we can check if the request was interrupted, if not, do the query and handle |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
79 |
* interrupts. |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
80 |
*/ |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
81 |
|
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
82 |
/* |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
83 |
* Useable as a callback to fuse_req_interrupt_func, will abort the given query and err the req. |
42
40a3b13ffc9d
defer fuse_reply_err using event_base_once, interrupt happens without deadlock now
Tero Marttila <terom@fixme.fi>
parents:
41
diff
changeset
|
84 |
* |
40a3b13ffc9d
defer fuse_reply_err using event_base_once, interrupt happens without deadlock now
Tero Marttila <terom@fixme.fi>
parents:
41
diff
changeset
|
85 |
* Due to a locking bug in libfuse 2.7.4, this will actually delay the fuse_req_err until the next event-loop iteration. |
41
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
86 |
*/ |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
87 |
void dbfs_interrupt_query (struct fuse_req *req, void *query_ptr); |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
88 |
|
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
89 |
/* |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
90 |
* XXX: More complicated state, is this actually needed? |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
91 |
*/ |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
92 |
struct dbfs_interrupt_ctx { |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
93 |
struct fuse_req *req; |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
94 |
struct evsql_query *query; |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
95 |
|
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
96 |
int interrupted : 1; |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
97 |
}; |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
98 |
|
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
99 |
/* |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
100 |
* Register as a fuse interrupt function for simple requests that only run one query without allocating any resources. |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
101 |
* |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
102 |
* This will abort the query if the interrupt is run, causing it's callback to not be called. |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
103 |
* |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
104 |
* Returns nonzero if the request was already interrupted, zero otherwise. Be careful that the interrupt does not get |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
105 |
* fired between you checking for it and setting query. |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
106 |
*/ |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
107 |
int dbfs_interrupt_register (struct fuse_req *req, struct dbfs_interrupt_ctx *ctx); |
6abda2fa4579
touch up the Makefile, define err_t as unsigned int in error.h, and add some preliminary interrupt support, although it will always deadlock due to a bug in libfuse
Tero Marttila <terom@fixme.fi>
parents:
36
diff
changeset
|
108 |
|
29
5de62ca9a5aa
reorganize evsql into a separate dir, rename dbfs slightly, and split dbfs_op out from dirop (in prep for fileop)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
109 |
#endif /* DBFS_DBFS_H */ |