[Libguestfs] [libnbd PATCH 13/18] tests/meta-base-allocation: wrap source code at 80 characters
Laszlo Ersek
lersek at redhat.com
Tue Apr 18 17:26:26 UTC 2023
The extent callback struct is created with a triplicate compound
initializer. Introduce just one local variable for the callback struct,
also bringing the width of the source file under 80 characters.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
tests/meta-base-allocation.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/tests/meta-base-allocation.c b/tests/meta-base-allocation.c
index cc49ba41efee..a7b3af0967f8 100644
--- a/tests/meta-base-allocation.c
+++ b/tests/meta-base-allocation.c
@@ -43,6 +43,8 @@ main (int argc, char *argv[])
struct nbd_handle *nbd;
char plugin_path[256];
int id;
+ nbd_extent_callback extent_callback = { .callback = check_extent,
+ .user_data = &id };
int r;
const char *s;
char *tmp;
@@ -148,24 +150,19 @@ main (int argc, char *argv[])
/* Read the block status. */
id = 1;
- if (nbd_block_status (nbd, 65536, 0,
- (nbd_extent_callback) { .callback = check_extent, .user_data = &id },
- 0) == -1) {
+ if (nbd_block_status (nbd, 65536, 0, extent_callback, 0) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
id = 2;
- if (nbd_block_status (nbd, 1024, 32768-512,
- (nbd_extent_callback) { .callback = check_extent, .user_data = &id },
- 0) == -1) {
+ if (nbd_block_status (nbd, 1024, 32768-512, extent_callback, 0) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
id = 3;
- if (nbd_block_status (nbd, 1024, 32768-512,
- (nbd_extent_callback) { .callback = check_extent, .user_data = &id },
+ if (nbd_block_status (nbd, 1024, 32768-512, extent_callback,
LIBNBD_CMD_FLAG_REQ_ONE) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
More information about the Libguestfs
mailing list