search for: nbd_unlocked_aio_is_created

Displaying 12 results from an estimated 12 matches for "nbd_unlocked_aio_is_created".

2019 May 22
8
[PATCH libnbd v2 0/6] Test connection states.
Patch 1/6 was posted before and I didn't change it: https://www.redhat.com/archives/libguestfs/2019-May/thread.html#00134 That doesn't necessarily mean I shouldn't change it, I'm posting it again because the other patches depend on it. The main change in this series is we add three new API functions: nbd_aio_is_created - connection has just been created
2019 Jun 05
0
[PATCH libnbd 1/4] lib: Move nbd_aio_is_* function impls to separate source file.
...l.c \ protocol.c \ diff --git a/lib/aio.c b/lib/aio.c index a129af2..38e0318 100644 --- a/lib/aio.c +++ b/lib/aio.c @@ -48,84 +48,6 @@ nbd_unlocked_aio_notify_write (struct nbd_handle *h) return nbd_internal_run (h, notify_write); } -/* NB: is_locked = false, may_set_error = false. */ -int -nbd_unlocked_aio_is_created (struct nbd_handle *h) -{ - return h->state == STATE_START; -} - -static int -is_connecting_group (enum state_group group) -{ - switch (group) { - case GROUP_TOP: - return 0; - case GROUP_CONNECT: - case GROUP_CONNECT_TCP: - case GROUP_CONNECT_COMMAND: - case GROUP_MAGIC: - case GROUP...
2019 Jun 05
0
[PATCH libnbd 2/4] lib: Split nbd_aio_is_* functions into internal.
...extern const char *nbd_internal_name_of_nbd_cmd (uint16_t type); diff --git a/lib/is-state.c b/lib/is-state.c index 5ed2ee9..55d103b 100644 --- a/lib/is-state.c +++ b/lib/is-state.c @@ -26,11 +26,12 @@ #include "internal.h" -/* NB: is_locked = false, may_set_error = false. */ -int -nbd_unlocked_aio_is_created (struct nbd_handle *h) +/* Internal functions to test state or groups of states. */ + +bool +nbd_internal_is_state_created (enum state state) { - return h->state == STATE_START; + return state == STATE_START; } static int @@ -51,20 +52,18 @@ is_connecting_group (enum state_group group)...
2019 Jun 05
9
[PATCH libnbd 0/4] lib: Atomically update h->state.
I need to think about this patch series a bit more, but it does at least pass the tests. Rich.
2019 May 30
3
[PATCH libnbd 0/2] Avoid lock and error overhead on some calls.
This works. I'm in the middle of testing whether there is any noticable benefit. Rich.
2019 Jun 05
1
Re: [PATCH libnbd 2/4] lib: Split nbd_aio_is_* functions into internal.
...(h) || > - nbd_unlocked_aio_is_processing (h)) { > + if (nbd_internal_is_state_ready (h->state) || > + nbd_internal_is_state_processing (h->state)) { Likewise safe for multiple h->state reads. > +/* NB: is_locked = false, may_set_error = false. */ > +int > +nbd_unlocked_aio_is_created (struct nbd_handle *h) > +{ > + return nbd_internal_is_state_created (h->state); > +} > + > +/* NB: is_locked = false, may_set_error = false. */ > +int > +nbd_unlocked_aio_is_connecting (struct nbd_handle *h) > +{ > + return nbd_internal_is_state_connecting (h->st...
2019 May 23
2
[PATCH libnbd] api: Get rid of nbd_connection.
This isn't quite finished because not all of the tests or examples have been updated, but it demonstrates an idea: Should we forget about the concept of having multiple connections managed under a single handle? In this patch there is a single ‘struct nbd_handle *’ which manages a single state machine and connection (and therefore no nbd_connection). To connect to a multi-conn server you must
2019 Jun 05
0
[PATCH libnbd 3/4] lib: Add set_state / get_state macros.
...mp (const void *data, size_t len, FILE *fp); extern size_t nbd_internal_string_list_length (char **argv); diff --git a/lib/is-state.c b/lib/is-state.c index 55d103b..51a2d47 100644 --- a/lib/is-state.c +++ b/lib/is-state.c @@ -104,40 +104,40 @@ nbd_internal_is_state_closed (enum state state) int nbd_unlocked_aio_is_created (struct nbd_handle *h) { - return nbd_internal_is_state_created (h->state); + return nbd_internal_is_state_created (get_state (h)); } /* NB: is_locked = false, may_set_error = false. */ int nbd_unlocked_aio_is_connecting (struct nbd_handle *h) { - return nbd_internal_is_state_connecti...
2019 Jun 08
0
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
...Is + * for reading the state of the handle. + * + * They all have: is_locked = false, may_set_error = false. + * + * They all read the public state, not the real state. Therefore you + * SHOULD NOT call these functions from elsewhere in the library (use + * nbd_internal_is_* instead). + */ + int nbd_unlocked_aio_is_created (struct nbd_handle *h) { - return nbd_internal_is_state_created (get_state (h)); + return nbd_internal_is_state_created (get_public_state (h)); } -/* NB: is_locked = false, may_set_error = false. */ int nbd_unlocked_aio_is_connecting (struct nbd_handle *h) { - return nbd_internal_is_state...
2019 May 23
5
[PATCH libnbd 0/3] Prevent some misuse of multi-conn.
Per recent discussion here: https://www.redhat.com/archives/libguestfs/2019-May/thread.html#00175
2019 Jun 05
1
[PATCH libnbd v2] lib: Atomically update h->state when leaving the locked region.
...Is + * for reading the state of the handle. + * + * They all have: is_locked = false, may_set_error = false. + * + * They all read the public state, not the real state. Therefore you + * SHOULD NOT call these functions from elsewhere in the library (use + * nbd_internal_is_* instead). + */ + int nbd_unlocked_aio_is_created (struct nbd_handle *h) { - return nbd_internal_is_state_created (get_state (h)); + return nbd_internal_is_state_created (get_public_state (h)); } -/* NB: is_locked = false, may_set_error = false. */ int nbd_unlocked_aio_is_connecting (struct nbd_handle *h) { - return nbd_internal_is_state...
2019 Jun 08
4
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-June/thread.html#00055 v2 was here: https://www.redhat.com/archives/libguestfs/2019-June/thread.html#00067 v3: - Fix atomicly -> atomically in commit message. - Fix a comment. - Fix TOCTTOU: There is now an inline function generated called <name>_is_permitted_state, and this is called twice, first outside the