search for: seen_base

Displaying 8 results from an estimated 8 matches for "seen_base".

Did you mean: screen_base
2019 Jun 04
0
[libnbd PATCH 2/2] api: Recover from block status callback failure
...tion"; -static int calls; /* Track which contexts passed through callback */ +struct data { + bool req_one; /* input: true if req_one was passed to request */ + int count; /* input: count of expected remaining calls */ + bool fail; /* input: true to return failure */ + bool seen_base; /* output: true if base:allocation encountered */ + bool seen_dirty; /* output: true if qemu:dirty-bitmap encountered */ +}; static int -cb (void *data, const char *metacontext, uint64_t offset, +cb (void *opaque, const char *metacontext, uint64_t offset, uint32_t *entries, size_t len) {...
2019 Jun 04
3
[libnbd PATCH 0/2] Better handling of failed block_status callback
Rather than moving the connection to DEAD, we can just ignore further contexts to the existing command handle, and fail the overall command with the same errno as the failed callback. Eric Blake (2): states: Track cmd->error as errno, not wire value api: Recover from block status callback failure generator/generator | 5 ++- generator/states-reply-simple.c | 2 +-
2019 Jun 27
1
[libnbd PATCH] block-status: Make callback usage consistent with pread_structured
...if (data->fail) { - errno = EPROTO; /* Something NBD servers can't send */ + /* Something NBD servers can't send */ + *error = data->count == 1 ? EPROTO : ECONNREFUSED; return -1; } return 0; @@ -147,17 +149,14 @@ main (int argc, char *argv[]) } assert (data.seen_base && data.seen_dirty); - /* Trigger a failed callback, to prove connection stays up. No way - * to know which context will respond first, but we can check that - * the other one did not get visited. - */ - data = (struct data) { .count = 1, .fail = true, }; + /* Trigger a failed cal...
2019 Jun 27
0
Re: [libnbd PATCH] generator: Add support for namespace constants
...-53,7 +52,7 @@ cb (void *opaque, const char *metacontext, uint64_t offset, assert (offset == 0); assert (data->count-- > 0); /* [qemu-nbd] */ - if (strcmp (metacontext, base_allocation) == 0) { + if (strcmp (metacontext, LIBNBD_CONTEXT_BASE_ALLOCATION) == 0) { assert (!data->seen_base); /* [qemu-nbd] */ data->seen_base = true; assert (len == (data->req_one ? 2 : 8)); /* [qemu-nbd] */ @@ -62,11 +61,13 @@ cb (void *opaque, const char *metacontext, uint64_t offset, assert (entries[0] == 131072); assert (entries[1] == 0); if (!data->req_one) { /*...
2019 Jun 27
3
[libnbd PATCH] generator: Add support for namespace constants
This just defines the namespace, its contexts and related constants and the only supported one is currently base:allocation. The names of the constants are not very future-proof, but shorter than LIBNBD_META_NS_CONTEXT_BASE_ALLOCATION or similar. Currently the output looks like this: /* "base" namespace */ /* "base" namespace contexts */ /* "base:allocation"
2019 Jul 16
1
[libnbd PATCH] generator: Prefer closure opaque after function pointer in C
...]) } data = (struct data) { .count = 2, }; - if (nbd_block_status (nbd, exportsize, 0, &data, cb, 0) == -1) { + if (nbd_block_status (nbd, exportsize, 0, cb, &data, 0) == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); exit (EXIT_FAILURE); } assert (data.seen_base && data.seen_dirty); data = (struct data) { .req_one = true, .count = 2, }; - if (nbd_block_status (nbd, exportsize, 0, &data, cb, + if (nbd_block_status (nbd, exportsize, 0, cb, &data, LIBNBD_CMD_FLAG_REQ_ONE) == -1) { fprintf (stderr, "%s\n...
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...mp;data, 0) == -1) { + if (nbd_block_status (nbd, exportsize, 0, + (nbd_extent_callback) { .callback = cb, .user_data = &data }, + 0) == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); exit (EXIT_FAILURE); } assert (data.seen_base && data.seen_dirty); data = (struct data) { .req_one = true, .count = 2, }; - if (nbd_block_status (nbd, exportsize, 0, cb, &data, + if (nbd_block_status (nbd, exportsize, 0, + (nbd_extent_callback) { .callback = cb, .user_data = &data },...
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