Displaying 19 results from an estimated 19 matches for "nbd_close_callback".
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 is consistent with how other callbacks work throughout
the API (ie. havi...
2019 Jul 25
0
[PATCH libnbd v3 2/2] lib: Remove nbd_add_close_callback.
...4,6 @@ let generate_include_libnbd_h () =
pr "extern int nbd_get_errno (void);\n";
pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n";
pr "\n";
- pr "extern int nbd_add_close_callback (struct nbd_handle *h,\n";
- pr " nbd_close_callback cb,\n";
- pr " void *user_data);\n";
- pr "#define LIBNBD_HAVE_NBD_ADD_CLOSE_CALLBACK 1\n";
- pr "\n";
List.iter (
fun (name, { args; ret }) -> print_extern_and_define name args ret
) handle_calls;
@@ -3536,18 +35...
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
2019 Jul 16
2
Re: [PATCH libnbd] generator: Swap parameters of nbd_add_close_callback.
On 7/16/19 10:39 AM, Eric Blake wrote:
> On 7/16/19 10:04 AM, Richard W.M. Jones wrote:
>> 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 secon...
2019 Jul 16
1
[libnbd PATCH] generator: Prefer closure opaque after function pointer in C
..._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 " void *user_data);\n";
pr "#define LIBNBD_HAVE_NBD_ADD_CLOSE_CALLBACK 1\n";
pr "\n";
List.iter (
@@ -3593,7 +3594,7 @@ from ot...
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.
...t; n
| 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 "...
2019 Jul 16
0
Re: [PATCH libnbd] generator: Swap parameters of nbd_add_close_callback.
On 7/16/19 10:04 AM, Richard W.M. Jones wrote:
> 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 is consistent with how othe...
2019 Jul 16
0
Re: [PATCH libnbd] generator: Swap parameters of nbd_add_close_callback.
...at 11:38:36AM -0500, Eric Blake wrote:
> On 7/16/19 10:39 AM, Eric Blake wrote:
> > On 7/16/19 10:04 AM, Richard W.M. Jones wrote:
> >> 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_callba...
2019 Jun 03
1
[libnbd PATCH] generator: Add #define witnesses for all API
...ET_ERROR 1\n";
+ pr "\n";
pr "extern int nbd_get_errno (void);\n";
+ pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n";
+ pr "\n";
pr "extern int nbd_add_close_callback (struct nbd_handle *h,\n";
pr " nbd_close_callback cb, void *data);\n";
+ pr "#define LIBNBD_HAVE_NBD_ADD_CLOSE_CALLBACK 1\n";
pr "\n";
List.iter (
- fun (name, { args; ret }) -> print_extern name args ret
+ fun (name, { args; ret }) -> print_extern_and_define name args ret
) handle_calls;
pr "...
2019 Jul 16
1
Re: [PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...from my approach, but it works. Less change to existing
callers, at any rate.
> @@ -3560,9 +3577,9 @@ are called is not defined. This API is only available
> from C and is designed to help when writing bindings to libnbd
> from other programming languages.
>
> - typedef void (*nbd_close_callback) (void *data);
> + typedef void (*nbd_close_callback) (void *user_data);
I might have split out the rename churn (s/\(data\|opaque\)/user_data/)
in a separate patch; but it's probably not worth it now.
> let print_python_binding name { args; ret } =
> - (* Functions with a callbac...
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 Jun 04
0
[PATCH libnbd v2 3/4] api: Implement concurrent writer.
...is.";
+ };
+
"connect_uri", {
default_call with
args = [ String "uri" ]; ret = RErr;
diff --git a/lib/handle.c b/lib/handle.c
index cc311ba..cc5d40f 100644
--- a/lib/handle.c
+++ b/lib/handle.c
@@ -215,6 +215,38 @@ nbd_add_close_callback (struct nbd_handle *h, nbd_close_callback cb, void *data)
return ret;
}
+int
+nbd_unlocked_set_concurrent_writer (struct nbd_handle *h,
+ void *data, writer_cb writer)
+{
+ /* I suppose we could allow this, but it seems more likely that
+ * it's an error rather than intentional.
+ */
+ if...
2019 Jun 03
3
[PATCH libnbd] api: nbd_get_version, nbd_supports_uri and nbd_get_package_name.
...NBD().get_package_name()
+__version__ = NBD().get_version()
if __name__ == \"__main__\":
import argparse
diff --git a/lib/handle.c b/lib/handle.c
index a42b8dc..cc311ba 100644
--- a/lib/handle.c
+++ b/lib/handle.c
@@ -214,3 +214,25 @@ nbd_add_close_callback (struct nbd_handle *h, nbd_close_callback cb, void *data)
pthread_mutex_unlock (&h->lock);
return ret;
}
+
+const char *
+nbd_unlocked_get_package_name (struct nbd_handle *h)
+{
+ return PACKAGE_NAME;
+}
+
+const char *
+nbd_unlocked_get_version (struct nbd_handle *h)
+{
+ return PACKAGE_VERSION;
+}
+
+int
+nbd_unlocked_sup...
2019 Jun 03
0
[PATCH libnbd discussion only 4/5] api: Implement concurrent writer.
...nclude <string.h>\n";
pr "\n";
pr "#include <libnbd.h>\n";
pr "\n";
diff --git a/lib/handle.c b/lib/handle.c
index cc311ba..cc5d40f 100644
--- a/lib/handle.c
+++ b/lib/handle.c
@@ -215,6 +215,38 @@ nbd_add_close_callback (struct nbd_handle *h, nbd_close_callback cb, void *data)
return ret;
}
+int
+nbd_unlocked_set_concurrent_writer (struct nbd_handle *h,
+ void *data, writer_cb writer)
+{
+ /* I suppose we could allow this, but it seems more likely that
+ * it's an error rather than intentional.
+ */
+ if...
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 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
10
[PATCH libnbd discussion only 0/5] api: Implement concurrent writer.
This works, but there's no time saving and I'm still investigating
whether it does what I think it does. Nevertheless I thought I would
post it because it (probably) implements the idea I had last night
outlined in:
https://www.redhat.com/archives/libguestfs/2019-June/msg00010.html
The meat of the change is patch 4. Patch 5 is an example which I
would probably fold into patch 4 for
2019 Jun 04
9
[PATCH libnbd v2 0/4] api: Implement concurrent writer.
v1:
https://www.redhat.com/archives/libguestfs/2019-June/msg00014.html
I pushed a few bits which are uncontroversial. The main
changes since v1 are:
An extra patch removes the want_to_send / check for nbd_aio_is_ready
in examples/threaded-reads-and-writes.c. This logic was wrong since
commit 6af72b87 as was pointed out by Eric in his review. Comments
and structure of