search for: read_verify

Displaying 20 results from an estimated 26 matches for "read_verify".

2019 Aug 14
1
Re: [PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
....user_data = my_data, > + .free = free }, > + NBD_NULL_CALLBACK(completion), Needs rebasing based on the tweak to patch 1. > diff --git a/examples/strict-structured-reads.c b/examples/strict-structured-reads.c > static int > -read_verify (unsigned valid_flag, void *opaque, int *error) > +read_verify (void *opaque, int *error) > { > int ret = 0; > + struct data *data = opaque; > > - if (valid_flag & LIBNBD_CALLBACK_VALID) { > - struct data *data = opaque; > - > - ret = -1; > - total...
2019 Jul 24
2
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
...call.) [1] In my previous reply, I assumed that the nbd_aio_FOO_callback function would use this paradigm... > +++ b/examples/strict-structured-reads.c > @@ -127,11 +131,14 @@ read_chunk (void *opaque, const void *bufv, size_t count, uint64_t offset, > } > > static int > -read_verify (void *opaque, int64_t cookie, int *error) > +read_verify (int valid_flag, void *opaque, int64_t cookie, int *error) > { > struct data *data = opaque; > int ret = -1; > > + if (!(valid_flag & LIBNBD_CALLBACK_VALID)) > + return 0; > + [1] which in turn affec...
2019 Jul 24
0
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
...the nbd_aio_FOO_callback > function would use this paradigm... > > > > +++ b/examples/strict-structured-reads.c > > > @@ -127,11 +131,14 @@ read_chunk (void *opaque, const void *bufv, size_t count, uint64_t offset, > > } > > > > static int > > -read_verify (void *opaque, int64_t cookie, int *error) > > +read_verify (int valid_flag, void *opaque, int64_t cookie, int *error) > > { > > struct data *data = opaque; > > int ret = -1; > > > > + if (!(valid_flag & LIBNBD_CALLBACK_VALID)) > > + return...
2019 Jul 24
2
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
.... > /* libnbd guarantees this: */ > assert (offset >= data->offset); > assert (offset + count <= data->offset + data->count); > @@ -127,11 +131,14 @@ read_chunk (void *opaque, const void *bufv, size_t count, uint64_t offset, > } > > static int > -read_verify (void *opaque, int64_t cookie, int *error) > +read_verify (int valid_flag, void *opaque, int64_t cookie, int *error) > { > struct data *data = opaque; > int ret = -1; > > + if (!(valid_flag & LIBNBD_CALLBACK_VALID)) > + return 0; ...but this one is wrong; it c...
2019 Jul 24
0
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
...about it may be possible to add new features here in future without breaking ABI. > > +++ b/examples/strict-structured-reads.c > > @@ -127,11 +131,14 @@ read_chunk (void *opaque, const void *bufv, size_t count, uint64_t offset, > > } > > > > static int > > -read_verify (void *opaque, int64_t cookie, int *error) > > +read_verify (int valid_flag, void *opaque, int64_t cookie, int *error) > > { > > struct data *data = opaque; > > int ret = -1; > > > > + if (!(valid_flag & LIBNBD_CALLBACK_VALID)) > > + return...
2019 Jun 29
0
[libnbd PATCH 6/6] examples: New example for strict read validations
...{ + struct range *n = malloc (sizeof *n); + assert (n); + n->next = r->next; + r->next = n; + n->last = r->last; + r->last = offset - r->first; + n->first = offset + count; + } + + return 0; + error: + *error = EPROTO; + return -1; +} + +static int +read_verify (void *opaque, int64_t handle, int *error) +{ + struct data *data = opaque; + int ret = -1; + + total_reads++; + total_chunks += data->chunks; + if (*error) + goto cleanup; + assert (data->chunks > 0); + if (data->flags & LIBNBD_CMD_FLAG_DF) { + total_df_reads++; + i...
2019 Jul 25
4
Re: [PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...C<error> are ignored for any other return value or when +C<valid_flag> did not contain C<LIBNBD_CALLBACK_VALID>; similarly, assigning C<0> into C<error> does not have an effect. =head1 SEE ALSO > +++ b/examples/strict-structured-reads.c > static int > -read_verify (void *opaque, int64_t cookie, int *error) > +read_verify (unsigned valid_flag, void *opaque, int64_t cookie, int *error) > { > + int ret = 0; > + > + if (valid_flag & LIBNBD_CALLBACK_VALID) { > struct data *data = opaque; > - int ret = -1; > > + ret = -1;...
2019 Aug 13
0
[PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...; - if (!(valid_flag & LIBNBD_CALLBACK_VALID)) - return 0; - /* libnbd guarantees this: */ assert (offset >= data->offset); assert (offset + count <= data->offset + data->count); @@ -131,46 +128,40 @@ read_chunk (unsigned valid_flag, void *opaque, } static int -read_verify (unsigned valid_flag, void *opaque, int *error) +read_verify (void *opaque, int *error) { int ret = 0; + struct data *data = opaque; - if (valid_flag & LIBNBD_CALLBACK_VALID) { - struct data *data = opaque; - - ret = -1; - total_reads++; - total_chunks += data->chunks; -...
2019 Aug 13
8
[PATCH libnbd 0/4] Add free function to callbacks.
Patches 1 & 2 are rather complex, but the end result is that we pass closures + user_data + free function in single struct parameters as I described previously in this email: https://www.redhat.com/archives/libguestfs/2019-August/msg00210.html Patch 3 adds a convenient FREE_CALLBACK macro which seems a worthwhile simplification if you buy into 1 & 2. Patch 4 adds another macro which is
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
1
[libnbd PATCH] generator: Prefer closure opaque after function pointer in C
...irst = offset, .last = offset + maxsize, }; *d = (struct data) { .offset = offset, .count = maxsize, .flags = flags, .remaining = r, }; - if (nbd_aio_pread_structured_callback (nbd, buf, sizeof buf, offset, d, - read_chunk, read_verify, + if (nbd_aio_pread_structured_callback (nbd, buf, sizeof buf, offset, + read_chunk, read_verify, d, flags) == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); exit (EXIT_FAILURE); dif...
2019 Jul 30
3
[PATCH libnbd] lib: Remove cookie parameter from completion callbacks.
...r *buffer = vp; diff --git a/examples/strict-structured-reads.c b/examples/strict-structured-reads.c index 2279301..db2eaf1 100644 --- a/examples/strict-structured-reads.c +++ b/examples/strict-structured-reads.c @@ -131,7 +131,7 @@ read_chunk (unsigned valid_flag, void *opaque, } static int -read_verify (unsigned valid_flag, void *opaque, int64_t cookie, int *error) +read_verify (unsigned valid_flag, void *opaque, int *error) { int ret = 0; diff --git a/generator/generator b/generator/generator index 99cc411..82f46a2 100755 --- a/generator/generator +++ b/generator/generator @@ -1729,7 +1729...
2019 Aug 12
0
[PATCH libnbd 7/7] api: Remove the valid_flag from all callbacks.
...; - if (!(valid_flag & LIBNBD_CALLBACK_VALID)) - return 0; - /* libnbd guarantees this: */ assert (offset >= data->offset); assert (offset + count <= data->offset + data->count); @@ -131,46 +128,41 @@ read_chunk (unsigned valid_flag, void *opaque, } static int -read_verify (unsigned valid_flag, void *opaque, int *error) +read_verify (void *opaque, int *error) { int ret = 0; - if (valid_flag & LIBNBD_CALLBACK_VALID) { - struct data *data = opaque; + struct data *data = opaque; - ret = -1; - total_reads++; - total_chunks += data->chunks; -...
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 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...; LIBNBD_CALLBACK_VALID)) + return 0; + /* libnbd guarantees this: */ assert (offset >= data->offset); assert (offset + count <= data->offset + data->count); @@ -127,11 +131,14 @@ read_chunk (void *opaque, const void *bufv, size_t count, uint64_t offset, } static int -read_verify (void *opaque, int64_t cookie, int *error) +read_verify (unsigned valid_flag, void *opaque, int64_t cookie, int *error) { + int ret = 0; + + if (valid_flag & LIBNBD_CALLBACK_VALID) { struct data *data = opaque; - int ret = -1; + ret = -1; total_reads++; total_chunks += data-&g...
2019 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...; LIBNBD_CALLBACK_VALID)) + return 0; + /* libnbd guarantees this: */ assert (offset >= data->offset); assert (offset + count <= data->offset + data->count); @@ -127,11 +131,14 @@ read_chunk (void *opaque, const void *bufv, size_t count, uint64_t offset, } static int -read_verify (void *opaque, int64_t cookie, int *error) +read_verify (int valid_flag, void *opaque, int64_t cookie, int *error) { struct data *data = opaque; int ret = -1; + if (!(valid_flag & LIBNBD_CALLBACK_VALID)) + return 0; + total_reads++; total_chunks += data->chunks; if (*er...
2019 Aug 13
0
[PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
...irst = offset, .last = offset + maxsize, }; *d = (struct data) { .offset = offset, .count = maxsize, .flags = flags, .remaining = r, }; - if (nbd_aio_pread_structured_callback (nbd, buf, sizeof buf, offset, - read_chunk, d, read_verify, d, - flags) == -1) { + if (nbd_aio_pread_structured (nbd, buf, sizeof buf, offset, + read_chunk, d, read_verify, d, + flags) == -1) { fprintf (stderr, "%s\n", nbd_get_err...
2018 May 23
3
[PATCH] block drivers/block: Use octal not symbolic permissions
...erval_entry = { - .attr = { .name = "protection_interval_bytes", .mode = S_IRUGO }, + .attr = { .name = "protection_interval_bytes", .mode = 0444 }, .show = integrity_interval_show, }; static struct integrity_sysfs_entry integrity_verify_entry = { - .attr = { .name = "read_verify", .mode = S_IRUGO | S_IWUSR }, + .attr = { .name = "read_verify", .mode = 0644 }, .show = integrity_verify_show, .store = integrity_verify_store, }; static struct integrity_sysfs_entry integrity_generate_entry = { - .attr = { .name = "write_generate", .mode = S_IRUG...
2018 May 23
3
[PATCH] block drivers/block: Use octal not symbolic permissions
...erval_entry = { - .attr = { .name = "protection_interval_bytes", .mode = S_IRUGO }, + .attr = { .name = "protection_interval_bytes", .mode = 0444 }, .show = integrity_interval_show, }; static struct integrity_sysfs_entry integrity_verify_entry = { - .attr = { .name = "read_verify", .mode = S_IRUGO | S_IWUSR }, + .attr = { .name = "read_verify", .mode = 0644 }, .show = integrity_verify_show, .store = integrity_verify_store, }; static struct integrity_sysfs_entry integrity_generate_entry = { - .attr = { .name = "write_generate", .mode = S_IRUG...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...; LIBNBD_CALLBACK_VALID)) + return 0; + /* libnbd guarantees this: */ assert (offset >= data->offset); assert (offset + count <= data->offset + data->count); @@ -127,40 +131,47 @@ read_chunk (void *opaque, const void *bufv, size_t count, uint64_t offset, } static int -read_verify (void *opaque, int64_t cookie, int *error) +read_verify (unsigned valid_flag, void *opaque, int64_t cookie, int *error) { - struct data *data = opaque; - int ret = -1; + int ret = 0; - total_reads++; - total_chunks += data->chunks; - if (*error) - goto cleanup; - assert (data->ch...