search for: close_callback

Displaying 20 results from an estimated 37 matches for "close_callback".

2019 Jul 25
0
[PATCH libnbd v3 2/2] lib: Remove nbd_add_close_callback.
We previously needed nbd_add_close_callback to do cleanup from language bindings. However now we have closure lifetimes this is no longer needed and can be removed. See also: https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html --- generator/generator | 18 ------------------ lib/handle.c | 35 ------------------------...
2019 Jun 05
2
Re: [PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
...> pr "}\n"; > pr "\n"; > diff --git a/lib/connect.c b/lib/connect.c > index b889f80..4e3141f 100644 > --- a/lib/connect.c > +++ b/lib/internal.h > @@ -80,7 +80,17 @@ struct nbd_handle { > /* Linked list of close callbacks. */ > struct close_callback *close_callbacks; > > - _Atomic enum state state; /* State machine. */ > + /* State machine. > + * > + * The actual current state is ‘next_state’. ‘state’ is updated > + * before we release the lock. > + * > + * Note don't access these fields directly,...
2019 Jul 25
4
[PATCH libnbd v3 0/2] lib: Implement closure lifetimes.
I think I've addressed everything that was raised in review. Some of the highlights: - Callbacks should be freed reliably along all exit paths. - There's a simple test of closure lifetimes. - I've tried to use VALID|FREE in all the places where I'm confident that it's safe and correct to do. There may be more places. Note this is an optimization and shouldn't
2019 Jul 16
2
[PATCH libnbd] generator: Define new Closure type
** INCOMPLETE ** This is the generator change as discussed on the list already. The Python and OCaml bindings are not yet done. It passes all [C only] tests and valgrind. Note that nbd_add_close_callback is inconsistent with other closure types because it passes the user_data parameter after the function. (This is not caused by the current patch, it was already inconsistent). We decided that nbd_add_close_callback should be manually generated and not automatically generated because it should only...
2019 Jun 08
0
Re: [PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
...pr "\n"; > > diff --git a/lib/connect.c b/lib/connect.c > > index b889f80..4e3141f 100644 > > --- a/lib/connect.c > > > +++ b/lib/internal.h > > @@ -80,7 +80,17 @@ struct nbd_handle { > > /* Linked list of close callbacks. */ > > struct close_callback *close_callbacks; > > > > - _Atomic enum state state; /* State machine. */ > > + /* State machine. > > + * > > + * The actual current state is ‘next_state’. ‘state’ is updated > > + * before we release the lock. > > + * > > + * Note...
2019 Jun 05
0
[PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
...next_state = STATE_START; h->pid = -1; h->export_name = strdup (""); diff --git a/lib/internal.h b/lib/internal.h index 7290247..1bef1c2 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -80,7 +80,17 @@ struct nbd_handle { /* Linked list of close callbacks. */ struct close_callback *close_callbacks; - _Atomic enum state state; /* State machine. */ + /* State machine. + * + * The actual current state is ‘next_state’. ‘state’ is updated + * before we release the lock. + * + * Note don't access these fields directly, use the SET_NEXT_STATE + * macro in g...
2016 May 04
9
[PATCH 0/8] python: PEP 8 fixes
Hi, this series cleans up the Python sources, either static or generated, including also tests, to make them PEP 8 compliant; see https://www.python.org/dev/peps/pep-0008/ and tools like pep8. Almost all the issues reported by pep8 are fixed, reducing the issues from 3818 to 7. The changes should have no effect on the actual code, while it will help Python users with consistency with other
2016 Feb 22
3
[PATCH 1/3] python: tests: refactor to use unittest's discovery
...details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -import unittest -import os -import guestfs - -close_invoked = 0 - -def close_callback (ev, eh, buf, array): - global close_invoked - close_invoked += 1 - -class Test410CloseEvent (unittest.TestCase): - def test_close_event (self): - g = guestfs.GuestFS (python_return_dict=True) - - # Register a callback for the close event. - g.set_event_callback (close...
2019 Jul 16
1
[libnbd PATCH] generator: Prefer closure opaque after function pointer in C
...n -> pr "uint32_t %s" n | Int n -> pr "int %s" n | Int64 n -> pr "int64_t %s" n @@ -3305,8 +3306,8 @@ let generate_include_libnbd_h () = pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n"; pr "\n"; pr "extern int nbd_add_close_callback (struct nbd_handle *h,\n"; - pr " void *user_data,\n"; - pr " nbd_close_callback cb);\n"; + pr " nbd_close_callback cb,\n"; + pr "...
2019 Jun 04
0
[PATCH libnbd v2 2/4] generator: Callback returns int instead of void.
...b/internal.h +++ b/lib/internal.h @@ -75,7 +75,7 @@ struct nbd_handle { /* For debugging. */ bool debug; void *debug_data; - void (*debug_fn) (void *, const char *, const char *); + int (*debug_fn) (void *, const char *, const char *); /* Linked list of close callbacks. */ struct close_callback *close_callbacks; @@ -212,7 +212,7 @@ struct socket { const struct socket_ops *ops; }; -typedef void (*extent_fn) (void *data, const char *metacontext, uint64_t offset, uint32_t *entries, size_t nr_entries); +typedef int (*extent_fn) (void *data, const char *metacontext, uint64_t offset, uint...
2019 Jul 16
2
[PATCH libnbd v2] generator: Define new Closure type
As before, but this one has working Python bindings. OCaml still TBD. Rich.
2019 Jul 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...| Path n | String n -> pr "const char *%s" n | StringList n -> pr "char **%s" n @@ -3258,7 +3274,7 @@ let generate_include_libnbd_h () = pr "\n"; pr "struct nbd_handle;\n"; pr "\n"; - pr "typedef void (*nbd_close_callback) (void *data);\n"; + pr "typedef void (*nbd_close_callback) (void *user_data);\n"; pr "\n"; List.iter (fun (n, i) -> pr "#define LIBNBD_%-30s %d\n" n i) constants; pr "\n"; @@ -3275,7 +3291,8 @@ let generate_include_libnbd_h () = pr &quot...
2019 Jun 08
0
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
...blic_state = STATE_START; h->pid = -1; h->export_name = strdup (""); diff --git a/lib/internal.h b/lib/internal.h index 61ddbde..503bf34 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -80,7 +80,17 @@ struct nbd_handle { /* Linked list of close callbacks. */ struct close_callback *close_callbacks; - _Atomic enum state state; /* State machine. */ + /* State machine. + * + * The actual current state is ‘state’. ‘public_state’ is updated + * before we release the lock. + * + * Note don't access these fields directly, use the SET_NEXT_STATE + * macro in...
2019 Jul 24
8
[PATCH libnbd v2 0/5] lib: Implement closure lifetimes.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-July/thread.html#00231 The changes address everything that Eric picked up in his review of the first two patches. I have also added two more patches (4 and 5) which respectively fix docs and change int status -> unsigned status, as discussed. Passes make, check, check-valgrind. 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
[PATCH libnbd v2] lib: Atomically update h->state when leaving the locked region.
...blic_state = STATE_START; h->pid = -1; h->export_name = strdup (""); diff --git a/lib/internal.h b/lib/internal.h index 5b6152b..ce4bf5b 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -80,7 +80,17 @@ struct nbd_handle { /* Linked list of close callbacks. */ struct close_callback *close_callbacks; - _Atomic enum state state; /* State machine. */ + /* State machine. + * + * The actual current state is ‘state’. ‘public_state’ is updated + * before we release the lock. + * + * Note don't access these fields directly, use the SET_NEXT_STATE + * macro in...
2019 Jul 16
2
[PATCH libnbd] generator: Swap parameters of nbd_add_close_callback.
The API changes from: int nbd_add_close_callback (struct nbd_handle *h, nbd_close_callback cb, void *user_data); to: int nbd_add_close_callback (struct nbd_handle *h, void *user_data, nbd_close_callback cb); The second way...
2019 Jul 24
6
[PATCH libnbd 0/3] Implement closure lifetimes.
This implements most of what I wrote here: https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html
2019 Jun 03
0
[PATCH libnbd discussion only 3/5] lib: Pass handle to socket recv and send calls.
...ocket *sock, const void *buf, size_t len) +tls_send (struct nbd_handle *h, + struct socket *sock, const void *buf, size_t len) { ssize_t r; diff --git a/lib/internal.h b/lib/internal.h index 73cb3f9..c8e5094 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -188,8 +188,10 @@ struct close_callback { }; struct socket_ops { - ssize_t (*recv) (struct socket *sock, void *buf, size_t len); - ssize_t (*send) (struct socket *sock, const void *buf, size_t len); + ssize_t (*recv) (struct nbd_handle *h, + struct socket *sock, void *buf, size_t len); + ssize_t (*send) (struct...
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.