diff --git a/align/scan.c b/align/scan.c index ef92f42af..118529311 100644 --- a/align/scan.c +++ b/align/scan.c @@ -90,8 +90,8 @@ usage (int status) " -V|--version Display version and exit\n" " -x Trace libguestfs API calls\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name); } exit (status); } @@ -151,7 +151,8 @@ main (int argc, char *argv[]) uuid = 1; } else { fprintf (stderr, _("%s: unknown long option: %s (%d)\n"), - guestfs_int_program_name, long_options[option_index].name, option_index); + guestfs_int_program_name, + long_options[option_index].name, option_index); exit (EXIT_FAILURE); } break; @@ -170,7 +171,8 @@ main (int argc, char *argv[]) case 'P': if (sscanf (optarg, "%zu", &max_threads) != 1) { - fprintf (stderr, _("%s: -P option is not numeric\n"), guestfs_int_program_name); + fprintf (stderr, _("%s: -P option is not numeric\n"), + guestfs_int_program_name); exit (EXIT_FAILURE); } break; diff --git a/builder/pxzcat-c.c b/builder/pxzcat-c.c index 0c4a4bef2..552e25353 100644 --- a/builder/pxzcat-c.c +++ b/builder/pxzcat-c.c @@ -51,8 +51,8 @@ extern void unix_error (int errcode, char * cmdname, value arg) Noreturn; #endif -#if defined (HAVE_LIBLZMA) && \ - defined (HAVE_LZMA_INDEX_STREAM_FLAGS) && \ +#if defined (HAVE_LIBLZMA) && \ + defined (HAVE_LZMA_INDEX_STREAM_FLAGS) && \ defined (HAVE_LZMA_INDEX_STREAM_PADDING) #define PARALLEL_XZCAT 1 #else diff --git a/cat/cat.c b/cat/cat.c index 222cfa97c..bf8b371d1 100644 --- a/cat/cat.c +++ b/cat/cat.c @@ -72,8 +72,8 @@ usage (int status) " -V|--version Display version and exit\n" " -x Trace libguestfs API calls\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name); } exit (status); } @@ -138,7 +138,8 @@ main (int argc, char *argv[]) OPTION_format; } else { fprintf (stderr, _("%s: unknown long option: %s (%d)\n"), - guestfs_int_program_name, long_options[option_index].name, option_index); + guestfs_int_program_name, + long_options[option_index].name, option_index); exit (EXIT_FAILURE); } break; diff --git a/cat/filesystems.c b/cat/filesystems.c index ef4f6ba1c..3013115f5 100644 --- a/cat/filesystems.c +++ b/cat/filesystems.c @@ -121,8 +121,8 @@ usage (int status) " Display LVM volume groups\n" " -x Trace libguestfs API calls\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name); } exit (status); } @@ -239,7 +239,8 @@ main (int argc, char *argv[]) output |= OUTPUT_VGS; } else { fprintf (stderr, _("%s: unknown long option: %s (%d)\n"), - guestfs_int_program_name, long_options[option_index].name, option_index); + guestfs_int_program_name, + long_options[option_index].name, option_index); exit (EXIT_FAILURE); } break; diff --git a/cat/log.c b/cat/log.c index a8e55d8f9..506939852 100644 --- a/cat/log.c +++ b/cat/log.c @@ -79,8 +79,8 @@ usage (int status) " -V|--version Display version and exit\n" " -x Trace libguestfs API calls\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name); } exit (status); } @@ -140,7 +140,8 @@ main (int argc, char *argv[]) OPTION_format; } else { fprintf (stderr, _("%s: unknown long option: %s (%d)\n"), - guestfs_int_program_name, long_options[option_index].name, option_index); + guestfs_int_program_name, + long_options[option_index].name, option_index); exit (EXIT_FAILURE); } break; @@ -470,7 +471,7 @@ do_log_windows_evtx (void) fprintf (stderr, "%s: %s\n", guestfs_int_program_name, guestfs_int_exit_status_to_string (status, "evtxdump.py", - buf, sizeof buf)); + buf, sizeof buf)); return -1; } diff --git a/cat/ls.c b/cat/ls.c index b8f901d2b..c49d1ceed 100644 --- a/cat/ls.c +++ b/cat/ls.c @@ -113,8 +113,8 @@ usage (int status) " -V|--version Display version and exit\n" " -x Trace libguestfs API calls\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name); } exit (status); } diff --git a/daemon/augeas.c b/daemon/augeas.c index ce49726e8..59d350860 100644 --- a/daemon/augeas.c +++ b/daemon/augeas.c @@ -39,9 +39,9 @@ const char *minor = aug_error_minor_message (aug); \ const char *details = aug_error_details (aug); \ fprintf (stderr, fs ": %s%s%s%s%s", ##__VA_ARGS__, \ - message, \ - minor ? ": " : "", minor ? minor : "", \ - details ? ": " : "", details ? details : ""); \ + message, \ + minor ? ": " : "", minor ? minor : "", \ + details ? ": " : "", details ? details : ""); \ } \ } while (0) diff --git a/daemon/blkid.c b/daemon/blkid.c index 74d2fa64c..99546b47d 100644 --- a/daemon/blkid.c +++ b/daemon/blkid.c @@ -191,7 +191,7 @@ blkid_with_p_i_opt (const char *device) return ret.argv; -error: + error: if (ret.argv) free_strings (ret.argv); @@ -225,7 +225,7 @@ blkid_without_p_i_opt (const char *device) if (end_stringsbuf (&ret) == -1) goto error; return ret.argv; -error: + error: if (ret.argv) free_stringslen (ret.argv, ret.size); return NULL; diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 50b0ba8f6..ddb029d1b 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -517,26 +517,26 @@ do_btrfs_subvolume_list (const mountable_t *fs) * freed by the calling (XDR) code. */ char *line = lines[i]; - #define N_MATCHES 4 +#define N_MATCHES 4 int ovector[N_MATCHES * 3]; if (pcre_exec (re, NULL, line, strlen (line), 0, 0, ovector, N_MATCHES * 3) < 0) - #undef N_MATCHES - { - unexpected_output: - reply_with_error ("unexpected output from 'btrfs subvolume list' command: %s", line); - goto error; - } +#undef N_MATCHES + { + unexpected_output: + reply_with_error ("unexpected output from 'btrfs subvolume list' command: %s", line); + goto error; + } struct guestfs_int_btrfssubvolume *this = &ret->guestfs_int_btrfssubvolume_list_val[i]; - #if __WORDSIZE == 64 - #define XSTRTOU64 xstrtoul - #else - #define XSTRTOU64 xstrtoull - #endif +#if __WORDSIZE == 64 +#define XSTRTOU64 xstrtoul +#else +#define XSTRTOU64 xstrtoull +#endif if (XSTRTOU64 (line + ovector[2], NULL, 10, &this->btrfssubvolume_id, NULL) != LONGINT_OK) @@ -545,7 +545,7 @@ do_btrfs_subvolume_list (const mountable_t *fs) &this->btrfssubvolume_top_level_id, NULL) != LONGINT_OK) goto unexpected_output; - #undef XSTRTOU64 +#undef XSTRTOU64 this->btrfssubvolume_path = strndup (line + ovector[6], ovector[7] - ovector[6]); @@ -557,7 +557,7 @@ do_btrfs_subvolume_list (const mountable_t *fs) return ret; -error: + error: if (ret->guestfs_int_btrfssubvolume_list_val) { for (i = 0; i < nr_subvolumes; ++i) free (ret->guestfs_int_btrfssubvolume_list_val[i].btrfssubvolume_path); @@ -639,7 +639,7 @@ do_btrfs_subvolume_get_default (const mountable_t *fs) goto error; } -error: + error: if (fs_buf && umount (fs_buf, fs) != 0) return -1; return ret; @@ -1096,18 +1096,18 @@ do_btrfs_subvolume_show (const char *subvolume) p = analyze_line (p, &key, &value, ':'); while (key && !value) { - ss = realloc (ss, ss_len + strlen (key) + 1); - if (!ss) - return NULL; + ss = realloc (ss, ss_len + strlen (key) + 1); + if (!ss) + return NULL; - if (ss_len != 0) - ss[ss_len++] = ','; + if (ss_len != 0) + ss[ss_len++] = ','; - memcpy (ss + ss_len, key, strlen (key)); - ss_len += strlen (key); - ss[ss_len] = '\0'; + memcpy (ss + ss_len, key, strlen (key)); + ss_len += strlen (key); + ss[ss_len] = '\0'; - p = analyze_line (p, &key, &value, ':'); + p = analyze_line (p, &key, &value, ':'); } if (ss) { @@ -1169,7 +1169,7 @@ do_btrfs_quota_enable (const mountable_t *fs, int enable) goto error; } -error: + error: if (fs_buf && umount (fs_buf, fs) != 0) return -1; return r; @@ -1201,7 +1201,7 @@ do_btrfs_quota_rescan (const mountable_t *fs) goto error; } -error: + error: if (fs_buf && umount (fs_buf, fs) != 0) return -1; return r; @@ -1412,7 +1412,7 @@ do_btrfs_qgroup_show (const char *path) return ret; -error: + error: if (ret->guestfs_int_btrfsqgroup_list_val) { for (i = 0; i < nr_qgroups; ++i) free (ret->guestfs_int_btrfsqgroup_list_val[i].btrfsqgroup_id); @@ -1890,7 +1890,7 @@ do_btrfs_balance_status (const char *path) pcre_free (re); return ret; -error: + error: free (ret->btrfsbalance_status); free (ret); pcre_free (re); @@ -1979,49 +1979,49 @@ do_btrfs_scrub_status (const char *path) else if (STRPREFIX (lines[i], "\tscrub started at")) continue; else if (sscanf (lines[i], "\tdata_extents_scrubbed: %" SCNu64, - &ret->btrfsscrub_data_extents_scrubbed) == 1) + &ret->btrfsscrub_data_extents_scrubbed) == 1) continue; else if (sscanf (lines[i], "\ttree_extents_scrubbed: %" SCNu64, - &ret->btrfsscrub_tree_extents_scrubbed) == 1) + &ret->btrfsscrub_tree_extents_scrubbed) == 1) continue; else if (sscanf (lines[i], "\tdata_bytes_scrubbed: %" SCNu64, - &ret->btrfsscrub_data_bytes_scrubbed) == 1) + &ret->btrfsscrub_data_bytes_scrubbed) == 1) continue; else if (sscanf (lines[i], "\ttree_bytes_scrubbed: %" SCNu64, - &ret->btrfsscrub_tree_bytes_scrubbed) == 1) + &ret->btrfsscrub_tree_bytes_scrubbed) == 1) continue; else if (sscanf (lines[i], "\tread_errors: %" SCNu64, - &ret->btrfsscrub_read_errors) == 1) + &ret->btrfsscrub_read_errors) == 1) continue; else if (sscanf (lines[i], "\tcsum_errors: %" SCNu64, - &ret->btrfsscrub_csum_errors) == 1) + &ret->btrfsscrub_csum_errors) == 1) continue; else if (sscanf (lines[i], "\tverify_errors: %" SCNu64, - &ret->btrfsscrub_verify_errors) == 1) + &ret->btrfsscrub_verify_errors) == 1) continue; else if (sscanf (lines[i], "\tno_csum: %" SCNu64, - &ret->btrfsscrub_no_csum) == 1) + &ret->btrfsscrub_no_csum) == 1) continue; else if (sscanf (lines[i], "\tcsum_discards: %" SCNu64, - &ret->btrfsscrub_csum_discards) == 1) + &ret->btrfsscrub_csum_discards) == 1) continue; else if (sscanf (lines[i], "\tsuper_errors: %" SCNu64, - &ret->btrfsscrub_super_errors) == 1) + &ret->btrfsscrub_super_errors) == 1) continue; else if (sscanf (lines[i], "\tmalloc_errors: %" SCNu64, - &ret->btrfsscrub_malloc_errors) == 1) + &ret->btrfsscrub_malloc_errors) == 1) continue; else if (sscanf (lines[i], "\tuncorrectable_errors: %" SCNu64, - &ret->btrfsscrub_uncorrectable_errors) == 1) + &ret->btrfsscrub_uncorrectable_errors) == 1) continue; else if (sscanf (lines[i], "\tunverified_errors: %" SCNu64, - &ret->btrfsscrub_unverified_errors) == 1) + &ret->btrfsscrub_unverified_errors) == 1) continue; else if (sscanf (lines[i], "\tcorrected_errors: %" SCNu64, - &ret->btrfsscrub_corrected_errors) == 1) + &ret->btrfsscrub_corrected_errors) == 1) continue; else if (sscanf (lines[i], "\tlast_physical: %" SCNu64, - &ret->btrfsscrub_last_physical) == 1) + &ret->btrfsscrub_last_physical) == 1) continue; else goto error; @@ -2035,7 +2035,7 @@ do_btrfs_scrub_status (const char *path) return ret; -error: + error: reply_with_error ("%s: could not parse btrfs scrub status.", lines[i]); free (ret); return NULL; @@ -2116,7 +2116,7 @@ do_btrfstune_enable_skinny_metadata_extent_refs (const char *device) int do_btrfs_image (char *const *sources, const char *image, - int compresslevel) + int compresslevel) { size_t nr_sources = count_strings (sources); const size_t MAX_ARGS = 64 + nr_sources; @@ -2127,14 +2127,14 @@ do_btrfs_image (char *const *sources, const char *image, int r; if (nr_sources == 0) { - reply_with_error ("list of sources must be non-empty"); - return -1; + reply_with_error ("list of sources must be non-empty"); + return -1; } ADD_ARG (argv, i, str_btrfsimage); if ((optargs_bitmask & GUESTFS_BTRFS_IMAGE_COMPRESSLEVEL_BITMASK) - && compresslevel >= 0) { + && compresslevel >= 0) { snprintf (compresslevel_s, sizeof compresslevel_s, "%d", compresslevel); ADD_ARG (argv, i, "-c"); ADD_ARG (argv, i, compresslevel_s); @@ -2157,7 +2157,7 @@ do_btrfs_image (char *const *sources, const char *image, int do_btrfs_replace (const char *srcdev, const char *targetdev, - const char* mntpoint) + const char* mntpoint) { const size_t MAX_ARGS = 64; const char *argv[MAX_ARGS]; diff --git a/daemon/devsparts.c b/daemon/devsparts.c index aebc21393..46ca4c1be 100644 --- a/daemon/devsparts.c +++ b/daemon/devsparts.c @@ -173,10 +173,10 @@ add_partitions (const char *device, struct stringsbuf *r) /* Check if readdir failed */ if (0 != errno) { - reply_with_perror ("readdir: %s", devdir); - free_stringslen (r->argv, r->size); - closedir (dir); - return -1; + reply_with_perror ("readdir: %s", devdir); + free_stringslen (r->argv, r->size); + closedir (dir); + return -1; } /* Close the directory handle */ @@ -252,8 +252,7 @@ do_is_whole_device (const char *device) * /sys/block directory */ CLEANUP_FREE char *devpath = NULL; if (asprintf (&devpath, "/sys/block/%s/device", - device + strlen ("/dev/")) == -1) - { + device + strlen ("/dev/")) == -1) { reply_with_perror ("asprintf"); return -1; } diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 5edfc6960..7b33a3ab6 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -132,7 +132,7 @@ static void usage (void) { fprintf (stderr, - "guestfsd [-r] [-v|--verbose]\n"); + "guestfsd [-r] [-v|--verbose]\n"); } int @@ -1394,18 +1394,18 @@ mountable_to_string (const mountable_t *mountable) char *desc; switch (mountable->type) { - case MOUNTABLE_DEVICE: - case MOUNTABLE_PATH: - return strdup (mountable->device); + case MOUNTABLE_DEVICE: + case MOUNTABLE_PATH: + return strdup (mountable->device); - case MOUNTABLE_BTRFSVOL: - if (asprintf (&desc, "btrfsvol:%s/%s", - mountable->device, mountable->volume) == -1) - return NULL; - return desc; - - default: + case MOUNTABLE_BTRFSVOL: + if (asprintf (&desc, "btrfsvol:%s/%s", + mountable->device, mountable->volume) == -1) return NULL; + return desc; + + default: + return NULL; } } diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c index 72fe6aca0..12c4ca76b 100644 --- a/daemon/lvm-filter.c +++ b/daemon/lvm-filter.c @@ -270,7 +270,7 @@ make_filter_strings (char *const *devices) return ret.argv; -error: + error: if (ret.argv) free_stringslen (ret.argv, ret.size); return NULL; diff --git a/daemon/lvm.c b/daemon/lvm.c index f9acfcbcc..421c1c57e 100644 --- a/daemon/lvm.c +++ b/daemon/lvm.c @@ -286,7 +286,7 @@ static int ignore_same_size_error (const char *err) { return strstr (err, "New size (") != NULL && - strstr (err, "extents) matches existing size (") != NULL; + strstr (err, "extents) matches existing size (") != NULL; } int @@ -391,7 +391,7 @@ do_lvm_remove_all (void) } { - /* Remove PVs. */ + /* Remove PVs. */ CLEANUP_FREE_STRING_LIST char **xs = do_pvs (); if (xs == NULL) return -1; diff --git a/daemon/md.c b/daemon/md.c index 06b5142e8..cf826c526 100644 --- a/daemon/md.c +++ b/daemon/md.c @@ -264,7 +264,7 @@ do_list_md_devices (void) return ret.argv; -error: + error: globfree (&mds); if (ret.argv != NULL) free_stringslen (ret.argv, ret.size); @@ -337,7 +337,7 @@ do_md_detail (const char *md) return ret.argv; -error: + error: if (ret.argv != NULL) free_stringslen (ret.argv, ret.size); diff --git a/daemon/mknod.c b/daemon/mknod.c index 9af8701ae..d2ae02dd7 100644 --- a/daemon/mknod.c +++ b/daemon/mknod.c @@ -38,13 +38,13 @@ optgroup_mknod_available (void) return 1; } -#define CHECK_MODE \ - do { \ - if ((mode & ~07777) != 0) { \ +#define CHECK_MODE \ + do { \ + if ((mode & ~07777) != 0) { \ reply_with_error ("%o: mode must specify only file permission bits", \ - (unsigned int) mode); \ - return -1; \ - } \ + (unsigned int) mode); \ + return -1; \ + } \ } while (0) int diff --git a/daemon/mount.c b/daemon/mount.c index c5b7d89e4..5dd7da282 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -160,8 +160,7 @@ mount_vfs_nochroot (const char *options, const char *vfstype, if (mountable->type == MOUNTABLE_BTRFSVOL) { if (options && strlen (options) > 0) { if (asprintf (&options_plus, "subvol=%s,%s", - mountable->volume, options) == -1) - { + mountable->volume, options) == -1) { reply_with_perror ("asprintf"); return -1; } @@ -227,7 +226,7 @@ do_umount (const char *pathordevice, is_dev = STREQLEN (pathordevice, "/dev/", 5); buf = is_dev ? strdup (pathordevice) - : sysroot_path (pathordevice); + : sysroot_path (pathordevice); if (buf == NULL) { reply_with_perror ("malloc"); return -1; diff --git a/daemon/parted.c b/daemon/parted.c index b7f560caa..fab3423a1 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -1094,42 +1094,42 @@ do_part_get_mbr_part_type (const char *device, int partnum) if (STREQ (parttype, "gpt")) { memcpy (temp_type, "primary", strlen ("primary")); if (sscanf (lines[row], "%d%" SCNi64 "B%" SCNi64 "B%" SCNi64 "B", - &part_num, - &temp_int64, - &temp_int64, - &temp_int64) != 4) { + &part_num, + &temp_int64, + &temp_int64, + &temp_int64) != 4) { reply_with_error ("could not parse row from output of parted print command: %s", lines[row]); return NULL; } } else { if (sscanf (lines[row], "%d%" SCNi64 "B%" SCNi64 "B%" SCNi64 "B" "%15s", - &part_num, - &temp_int64, - &temp_int64, - &temp_int64, - temp_type) != 5) { + &part_num, + &temp_int64, + &temp_int64, + &temp_int64, + temp_type) != 5) { reply_with_error ("could not parse row from output of parted print command: %s", lines[row]); return NULL; } } if (part_num != partnum) - continue; + continue; if (STRPREFIX (temp_type, "primary")) { part_type = strdup ("primary"); if (part_type == NULL) - goto error; + goto error; } else if (STRPREFIX (temp_type, "logical")) { part_type = strdup ("logical"); if (part_type == NULL) - goto error; + goto error; } else if (STRPREFIX (temp_type, "extended")) { part_type = strdup ("extended"); if (part_type == NULL) - goto error; + goto error; } else - goto error; + goto error; return part_type; } @@ -1139,7 +1139,7 @@ do_part_get_mbr_part_type (const char *device, int partnum) return NULL; } - error: - reply_with_error ("strdup failed"); - return NULL; + error: + reply_with_error ("strdup failed"); + return NULL; } diff --git a/daemon/proto.c b/daemon/proto.c index df63bfdb4..7a6fa4df5 100644 --- a/daemon/proto.c +++ b/daemon/proto.c @@ -459,7 +459,7 @@ receive_file (receive_cb cb, void *opaque) if (chunk.cancel) { if (verbose) fprintf (stderr, - "guestfsd: receive_file: received cancellation from library\n"); + "guestfsd: receive_file: received cancellation from library\n"); xdr_free ((xdrproc_t) xdr_guestfs_chunk, (char *) &chunk); return -2; } diff --git a/daemon/uuids.c b/daemon/uuids.c index e6287c57c..7e6986263 100644 --- a/daemon/uuids.c +++ b/daemon/uuids.c @@ -79,7 +79,7 @@ do_set_uuid (const char *device, const char *uuid) else NOT_SUPPORTED (-1, "don't know how to set the UUID for '%s' filesystems", - vfs_type); + vfs_type); return r; } @@ -112,6 +112,6 @@ do_set_uuid_random (const char *device) else NOT_SUPPORTED (-1, "don't know how to set the random UUID for '%s' filesystems", - vfs_type); + vfs_type); return r; } diff --git a/daemon/xattr.c b/daemon/xattr.c index 8aa28d103..c05124d92 100644 --- a/daemon/xattr.c +++ b/daemon/xattr.c @@ -27,11 +27,11 @@ #include "actions.h" #include "optgroups.h" -#if (defined(HAVE_ATTR_XATTR_H) || defined(HAVE_SYS_XATTR_H)) && \ - defined(HAVE_LISTXATTR) && defined(HAVE_LLISTXATTR) && \ - defined(HAVE_GETXATTR) && defined(HAVE_LGETXATTR) && \ - defined(HAVE_REMOVEXATTR) && defined(HAVE_LREMOVEXATTR) && \ - defined(HAVE_SETXATTR) && defined(HAVE_LSETXATTR) +#if (defined(HAVE_ATTR_XATTR_H) || defined(HAVE_SYS_XATTR_H)) && \ + defined(HAVE_LISTXATTR) && defined(HAVE_LLISTXATTR) && \ + defined(HAVE_GETXATTR) && defined(HAVE_LGETXATTR) && \ + defined(HAVE_REMOVEXATTR) && defined(HAVE_LREMOVEXATTR) && \ + defined(HAVE_SETXATTR) && defined(HAVE_LSETXATTR) # define HAVE_LINUX_XATTRS #endif diff --git a/daemon/xfs.c b/daemon/xfs.c index c1a18541a..f74890201 100644 --- a/daemon/xfs.c +++ b/daemon/xfs.c @@ -316,7 +316,7 @@ parse_xfs_info (char **lines) return ret; -error: + error: free (ret->xfs_mntpoint); free (ret->xfs_logname); free (ret->xfs_rtname); diff --git a/df/main.c b/df/main.c index ae5f250f4..5b9b00a36 100644 --- a/df/main.c +++ b/df/main.c @@ -87,8 +87,8 @@ usage (int status) " -V|--version Display version and exit\n" " -x Trace libguestfs API calls\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name); } exit (status); } @@ -182,7 +182,8 @@ main (int argc, char *argv[]) case 'P': if (sscanf (optarg, "%zu", &max_threads) != 1) { - fprintf (stderr, _("%s: -P option is not numeric\n"), guestfs_int_program_name); + fprintf (stderr, _("%s: -P option is not numeric\n"), + guestfs_int_program_name); exit (EXIT_FAILURE); } break; diff --git a/df/parallel.c b/df/parallel.c index fe6d144aa..2d1d1d330 100644 --- a/df/parallel.c +++ b/df/parallel.c @@ -259,7 +259,8 @@ worker_thread (void *thread_data_vp) static void thread_failure (const char *fn, int err) { - fprintf (stderr, "%s: %s: %s\n", guestfs_int_program_name, fn, strerror (err)); + fprintf (stderr, "%s: %s: %s\n", + guestfs_int_program_name, fn, strerror (err)); } #endif /* HAVE_LIBVIRT */ diff --git a/diff/diff.c b/diff/diff.c index 52c29ea6a..6664a27c0 100644 --- a/diff/diff.c +++ b/diff/diff.c @@ -125,8 +125,8 @@ usage (int status) " -x Trace libguestfs API calls\n" " --xattrs Display extended attributes\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name); } exit (status); } @@ -261,7 +261,8 @@ main (int argc, char *argv[]) enable_xattrs = 1; } else { fprintf (stderr, _("%s: unknown long option: %s (%d)\n"), - guestfs_int_program_name, long_options[option_index].name, option_index); + guestfs_int_program_name, + long_options[option_index].name, option_index); exit (EXIT_FAILURE); } break; @@ -675,7 +676,7 @@ changed (guestfs_h *g1, struct file *file1, output_start_line (); output_string ("#"); output_string ("changed:"); -#define COMPARE_STAT(n) \ +#define COMPARE_STAT(n) \ if (file1->stat->n != file2->stat->n) output_string (#n) COMPARE_STAT (st_dev); COMPARE_STAT (st_ino); diff --git a/edit/edit.c b/edit/edit.c index 9df99c3c5..a2a83ce37 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -84,8 +84,8 @@ usage (int status) " -V|--version Display version and exit\n" " -x Trace libguestfs API calls\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name); } exit (status); } @@ -155,7 +155,8 @@ main (int argc, char *argv[]) OPTION_format; } else { fprintf (stderr, _("%s: unknown long option: %s (%d)\n"), - guestfs_int_program_name, long_options[option_index].name, option_index); + guestfs_int_program_name, + long_options[option_index].name, option_index); exit (EXIT_FAILURE); } break; diff --git a/examples/copy-over.c b/examples/copy-over.c index 03441a73e..d92a4d2bb 100644 --- a/examples/copy-over.c +++ b/examples/copy-over.c @@ -39,17 +39,17 @@ static void usage (void) { fprintf (stderr, - "Usage: copy-over source srcdir dest destdir\n" - "\n" - " source : the source domain (a libvirt guest name)\n" - " srcdir : the directory to copy from the source guest\n" - " dest : the destination domain (a libvirt guest name)\n" - " destdir : the destination directory (must exist at destination)\n" - "\n" - "eg: copy-over Src /home/rjones Dest /tmp/dir\n" - "would copy /home/rjones from Src to /tmp/dir on Dest\n" - "\n" - "The destination guest cannot be running.\n"); + "Usage: copy-over source srcdir dest destdir\n" + "\n" + " source : the source domain (a libvirt guest name)\n" + " srcdir : the directory to copy from the source guest\n" + " dest : the destination domain (a libvirt guest name)\n" + " destdir : the destination directory (must exist at destination)\n" + "\n" + "eg: copy-over Src /home/rjones Dest /tmp/dir\n" + "would copy /home/rjones from Src to /tmp/dir on Dest\n" + "\n" + "The destination guest cannot be running.\n"); } int diff --git a/examples/create-disk.c b/examples/create-disk.c index 4326a45e4..81e4dbd6e 100644 --- a/examples/create-disk.c +++ b/examples/create-disk.c @@ -29,9 +29,9 @@ main (int argc, char *argv[]) /* Add the disk image to libguestfs. */ if (guestfs_add_drive_opts (g, "disk.img", - GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", /* raw format */ - GUESTFS_ADD_DRIVE_OPTS_READONLY, 0, /* for write */ - -1) /* this marks end of optional arguments */ + GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", /* raw format */ + GUESTFS_ADD_DRIVE_OPTS_READONLY, 0, /* for write */ + -1) /* this marks end of optional arguments */ == -1) exit (EXIT_FAILURE); diff --git a/examples/display-icon.c b/examples/display-icon.c index 5453e535c..b4083646f 100644 --- a/examples/display-icon.c +++ b/examples/display-icon.c @@ -49,9 +49,9 @@ main (int argc, char *argv[]) /* Attach the disk image read-only to libguestfs. */ if (guestfs_add_drive_opts (g, disk, - /* GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", */ - GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, - -1) /* this marks end of optional arguments */ + /* GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", */ + GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, + -1) /* this marks end of optional arguments */ == -1) exit (EXIT_FAILURE); diff --git a/examples/inspect-vm.c b/examples/inspect-vm.c index a2491136c..50fe49a97 100644 --- a/examples/inspect-vm.c +++ b/examples/inspect-vm.c @@ -45,9 +45,9 @@ main (int argc, char *argv[]) /* Attach the disk image read-only to libguestfs. */ if (guestfs_add_drive_opts (g, disk, - /* GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", */ - GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, - -1) /* this marks end of optional arguments */ + /* GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", */ + GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, + -1) /* this marks end of optional arguments */ == -1) exit (EXIT_FAILURE); diff --git a/examples/libvirt-auth.c b/examples/libvirt-auth.c index 8a5db775a..12825f4e0 100644 --- a/examples/libvirt-auth.c +++ b/examples/libvirt-auth.c @@ -14,25 +14,25 @@ static void usage (void) { fprintf (stderr, - "Usage:\n" - "\n" - " libvirt-auth URI domain\n" - "\n" - "where:\n" - "\n" - " URI is the libvirt URI, eg. qemu+libssh2://USER@localhost/system\n" - " domain is the name of the guest\n" - "\n" - "Example:\n" - "\n" - " libvirt-auth 'qemu+libssh2://USER@localhost/system' 'foo'\n" - "\n" - "would connect (read-only) to libvirt URI given and open the guest\n" - "called 'foo' and list some information about its filesystems.\n" - "\n" - "The important point of this example is that any libvirt authentication\n" - "required to connect to the server should be done.\n" - "\n"); + "Usage:\n" + "\n" + " libvirt-auth URI domain\n" + "\n" + "where:\n" + "\n" + " URI is the libvirt URI, eg. qemu+libssh2://USER@localhost/system\n" + " domain is the name of the guest\n" + "\n" + "Example:\n" + "\n" + " libvirt-auth 'qemu+libssh2://USER@localhost/system' 'foo'\n" + "\n" + "would connect (read-only) to libvirt URI given and open the guest\n" + "called 'foo' and list some information about its filesystems.\n" + "\n" + "The important point of this example is that any libvirt authentication\n" + "required to connect to the server should be done.\n" + "\n"); } static void auth_callback (guestfs_h *g, void *opaque, uint64_t event, int event_handle, int flags, const char *buf, size_t buf_len, const uint64_t *array, size_t array_len); diff --git a/fish/destpaths.c b/fish/destpaths.c index a0713ff27..02034e91e 100644 --- a/fish/destpaths.c +++ b/fish/destpaths.c @@ -45,8 +45,8 @@ sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for exactly-SIZE_MAX allocations on such hosts; this avoids a test and branch when S is known to be 1. */ -# define xalloc_oversized(n, s) \ - ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) +# define xalloc_oversized(n, s) \ + ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) #endif /* Readline completion for paths on the guest filesystem, also for @@ -103,33 +103,33 @@ complete_dest_paths_generator (const char *text, int state) guestfs_push_error_handler (g, NULL, NULL); -/* Silently do nothing if an allocation fails */ + /* Silently do nothing if an allocation fails */ #define APPEND_STRS_AND_FREE \ - do { \ - if (strs) { \ - size_t i; \ - size_t n = guestfs_int_count_strings (strs); \ + do { \ + if (strs) { \ + size_t i; \ + size_t n = guestfs_int_count_strings (strs); \ \ - if ( n > 0 && ! xalloc_oversized (nr_words + n, sizeof (struct word))) { \ - struct word *w; \ - w = realloc (words, sizeof (struct word) * (nr_words + n)); \ + if ( n > 0 && ! xalloc_oversized (nr_words + n, sizeof (struct word))) { \ + struct word *w; \ + w = realloc (words, sizeof (struct word) * (nr_words + n)); \ \ - if (w == NULL) { \ - free_words (words, nr_words); \ - words = NULL; \ - nr_words = 0; \ - } else { \ - words = w; \ - for (i = 0; i < n; ++i) { \ - words[nr_words].name = strs[i]; \ - words[nr_words].is_dir = 0; \ - nr_words++; \ - } \ - } \ + if (w == NULL) { \ + free_words (words, nr_words); \ + words = NULL; \ + nr_words = 0; \ + } else { \ + words = w; \ + for (i = 0; i < n; ++i) { \ + words[nr_words].name = strs[i]; \ + words[nr_words].is_dir = 0; \ + nr_words++; \ + } \ + } \ + } \ + free (strs); \ } \ - free (strs); \ - } \ - } while (0) + } while (0) /* Is it a device? */ if (len < 5 || STREQLEN (text, "/dev/", 5)) { diff --git a/fish/file-edit.c b/fish/file-edit.c index a703021da..3978c1b81 100644 --- a/fish/file-edit.c +++ b/fish/file-edit.c @@ -252,7 +252,7 @@ do_upload (guestfs_h *g, const char *fn, const char *tempfile, * file to match the old file (RHBZ#788641). */ if (guestfs_copy_attributes (g, filename, newname, - GUESTFS_COPY_ATTRIBUTES_ALL, 1, -1) == -1) + GUESTFS_COPY_ATTRIBUTES_ALL, 1, -1) == -1) return -1; /* Backup or overwrite the file. */ diff --git a/fish/fish.c b/fish/fish.c index 12a62a1e7..6e5213c03 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -151,9 +151,10 @@ usage (int status) "run again without -i and use 'run' + 'list-filesystems' + 'mount' cmds.\n" "\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name); } exit (status); } @@ -1090,7 +1091,7 @@ cmdline (char *argv[], size_t optind, size_t argc) if (optind == argc) { if (issue_command (cmd, params, NULL, exit_on_error) == -1 && exit_on_error) - exit (EXIT_FAILURE); + exit (EXIT_FAILURE); } else { argv[optind] = NULL; if (issue_command (cmd, params, NULL, exit_on_error) == -1 && exit_on_error) diff --git a/fish/inspect.c b/fish/inspect.c index eb5ecc646..97e46ae8b 100644 --- a/fish/inspect.c +++ b/fish/inspect.c @@ -72,20 +72,20 @@ inspect_mount_handle (guestfs_h *g) if (roots[0] == NULL) { fprintf (stderr, - _("%s: no operating system was found on this disk\n" - "\n" - "If using guestfish '-i' option, remove this option and instead\n" - "use the commands 'run' followed by 'list-filesystems'.\n" - "You can then mount filesystems you want by hand using the\n" - "'mount' or 'mount-ro' command.\n" - "\n" - "If using guestmount '-i', remove this option and choose the\n" - "filesystem(s) you want to see by manually adding '-m' option(s).\n" - "Use 'virt-filesystems' to see what filesystems are available.\n" - "\n" - "If using other virt tools, this disk image won't work\n" - "with these tools. Use the guestfish equivalent commands\n" - "(see the virt tool manual page).\n"), + _("%s: no operating system was found on this disk\n" + "\n" + "If using guestfish '-i' option, remove this option and instead\n" + "use the commands 'run' followed by 'list-filesystems'.\n" + "You can then mount filesystems you want by hand using the\n" + "'mount' or 'mount-ro' command.\n" + "\n" + "If using guestmount '-i', remove this option and choose the\n" + "filesystem(s) you want to see by manually adding '-m' option(s).\n" + "Use 'virt-filesystems' to see what filesystems are available.\n" + "\n" + "If using other virt tools, this disk image won't work\n" + "with these tools. Use the guestfish equivalent commands\n" + "(see the virt tool manual page).\n"), guestfs_int_program_name); guestfs_int_free_string_list (roots); exit (EXIT_FAILURE); @@ -93,20 +93,20 @@ inspect_mount_handle (guestfs_h *g) if (roots[1] != NULL) { fprintf (stderr, - _("%s: multi-boot operating systems are not supported\n" - "\n" - "If using guestfish '-i' option, remove this option and instead\n" - "use the commands 'run' followed by 'list-filesystems'.\n" - "You can then mount filesystems you want by hand using the\n" - "'mount' or 'mount-ro' command.\n" - "\n" - "If using guestmount '-i', remove this option and choose the\n" - "filesystem(s) you want to see by manually adding '-m' option(s).\n" - "Use 'virt-filesystems' to see what filesystems are available.\n" - "\n" - "If using other virt tools, multi-boot operating systems won't work\n" - "with these tools. Use the guestfish equivalent commands\n" - "(see the virt tool manual page).\n"), + _("%s: multi-boot operating systems are not supported\n" + "\n" + "If using guestfish '-i' option, remove this option and instead\n" + "use the commands 'run' followed by 'list-filesystems'.\n" + "You can then mount filesystems you want by hand using the\n" + "'mount' or 'mount-ro' command.\n" + "\n" + "If using guestmount '-i', remove this option and choose the\n" + "filesystem(s) you want to see by manually adding '-m' option(s).\n" + "Use 'virt-filesystems' to see what filesystems are available.\n" + "\n" + "If using other virt tools, multi-boot operating systems won't work\n" + "with these tools. Use the guestfish equivalent commands\n" + "(see the virt tool manual page).\n"), guestfs_int_program_name); guestfs_int_free_string_list (roots); exit (EXIT_FAILURE); diff --git a/fish/man.c b/fish/man.c index f1ba1a4c9..f16bd4299 100644 --- a/fish/man.c +++ b/fish/man.c @@ -56,8 +56,8 @@ run_man (const char *cmd, size_t argc, char *argv[]) fprintf (stderr, "%s\n", guestfs_int_exit_status_to_string (r, "man", - status_string, - sizeof status_string)); + status_string, + sizeof status_string)); return -1; } diff --git a/fish/uri.c b/fish/uri.c index 593e62aae..33e820c9b 100644 --- a/fish/uri.c +++ b/fish/uri.c @@ -101,7 +101,7 @@ is_uri (const char *arg) static int parse (const char *arg, char **path_ret, char **protocol_ret, - char ***server_ret, char **username_ret, char **password_ret) + char ***server_ret, char **username_ret, char **password_ret) { CLEANUP_XMLFREEURI xmlURIPtr uri = NULL; CLEANUP_FREE char *socket = NULL; diff --git a/format/format.c b/format/format.c index ba8fe8cfa..23c44da87 100644 --- a/format/format.c +++ b/format/format.c @@ -87,8 +87,9 @@ usage (int status) "For more information, see the manpage %s(1).\n" "\n" "%s\n\n"), - guestfs_int_program_name, warning, guestfs_int_program_name, guestfs_int_program_name, - warning); + guestfs_int_program_name, warning, + guestfs_int_program_name, guestfs_int_program_name, + warning); } exit (status); } @@ -181,7 +182,8 @@ main (int argc, char *argv[]) label = optarg; } else { fprintf (stderr, _("%s: unknown long option: %s (%d)\n"), - guestfs_int_program_name, long_options[option_index].name, option_index); + guestfs_int_program_name, + long_options[option_index].name, option_index); exit (EXIT_FAILURE); } break; diff --git a/fuse/guestmount.c b/fuse/guestmount.c index 661d0b469..3a4dc5408 100644 --- a/fuse/guestmount.c +++ b/fuse/guestmount.c @@ -130,7 +130,8 @@ usage (int status) " -w|--rw Mount read-write\n" " -x|--trace Trace guestfs API calls\n" ), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name); } exit (status); } @@ -249,7 +250,8 @@ main (int argc, char *argv[]) } } else { fprintf (stderr, _("%s: unknown long option: %s (%d)\n"), - guestfs_int_program_name, long_options[option_index].name, option_index); + guestfs_int_program_name, + long_options[option_index].name, option_index); exit (EXIT_FAILURE); } break; diff --git a/fuse/guestunmount.c b/fuse/guestunmount.c index c04cfad83..e952c63b4 100644 --- a/fuse/guestunmount.c +++ b/fuse/guestunmount.c @@ -65,7 +65,7 @@ usage (int status) " -v|--verbose Verbose messages\n" " -V|--version Display version and exit\n" ), - guestfs_int_program_name, guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name); } exit (status); } diff --git a/fuse/test-guestmount-fd.c b/fuse/test-guestmount-fd.c index d6fe12b11..f8fe09257 100644 --- a/fuse/test-guestmount-fd.c +++ b/fuse/test-guestmount-fd.c @@ -144,8 +144,8 @@ main (int argc, char *argv[]) fprintf (stderr, "%s: test failed: %s\n", guestfs_int_program_name, guestfs_int_exit_status_to_string (r, GUESTUNMOUNT_BINARY, - status_string, - sizeof status_string)); + status_string, + sizeof status_string)); ignore_value (rmdir (MOUNTPOINT)); exit (EXIT_FAILURE); } @@ -165,8 +165,8 @@ main (int argc, char *argv[]) fprintf (stderr, "%s: test failed: %s\n", guestfs_int_program_name, guestfs_int_exit_status_to_string (status, GUESTMOUNT_BINARY, - status_string, - sizeof status_string)); + status_string, + sizeof status_string)); ignore_value (rmdir (MOUNTPOINT)); exit (EXIT_FAILURE); } diff --git a/fuse/test-guestunmount-fd.c b/fuse/test-guestunmount-fd.c index c4b833fed..93adc98e1 100644 --- a/fuse/test-guestunmount-fd.c +++ b/fuse/test-guestunmount-fd.c @@ -101,8 +101,8 @@ main (int argc, char *argv[]) fprintf (stderr, "%s: test failed: %s\n", guestfs_int_program_name, guestfs_int_exit_status_to_string (r, "guestunmount", - status_string, - sizeof status_string)); + status_string, + sizeof status_string)); exit (EXIT_FAILURE); } @@ -123,8 +123,8 @@ main (int argc, char *argv[]) fprintf (stderr, "%s: test failed: guestunmount didn't return status code 2; %s\n", guestfs_int_program_name, guestfs_int_exit_status_to_string (status, "guestunmount", - status_string, - sizeof status_string)); + status_string, + sizeof status_string)); exit (EXIT_FAILURE); } diff --git a/inspector/inspector.c b/inspector/inspector.c index fd596b5e6..295e39f68 100644 --- a/inspector/inspector.c +++ b/inspector/inspector.c @@ -85,8 +85,8 @@ usage (int status) " -x Trace libguestfs API calls\n" " --xpath query Perform an XPath query\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name); } exit (status); } @@ -149,7 +149,8 @@ main (int argc, char *argv[]) xpath = optarg; } else { fprintf (stderr, _("%s: unknown long option: %s (%d)\n"), - guestfs_int_program_name, long_options[option_index].name, option_index); + guestfs_int_program_name, + long_options[option_index].name, option_index); exit (EXIT_FAILURE); } break; @@ -291,7 +292,7 @@ main (int argc, char *argv[]) #define XMLERROR(code,e) do { \ if ((e) == (code)) { \ fprintf (stderr, _("%s: XML write error at \"%s\": %m\n"), \ - #e, guestfs_int_program_name); \ + #e, guestfs_int_program_name); \ exit (EXIT_FAILURE); \ } \ } while (0) @@ -351,66 +352,66 @@ output_root (xmlTextWriterPtr xo, char *root) if (canonical_root == NULL) exit (EXIT_FAILURE); XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "root", BAD_CAST canonical_root)); + xmlTextWriterWriteElement (xo, BAD_CAST "root", BAD_CAST canonical_root)); free (canonical_root); str = guestfs_inspect_get_type (g, root); if (!str) exit (EXIT_FAILURE); if (STRNEQ (str, "unknown")) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "name", BAD_CAST str)); + xmlTextWriterWriteElement (xo, BAD_CAST "name", BAD_CAST str)); free (str); str = guestfs_inspect_get_arch (g, root); if (!str) exit (EXIT_FAILURE); if (STRNEQ (str, "unknown")) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "arch", BAD_CAST str)); + xmlTextWriterWriteElement (xo, BAD_CAST "arch", BAD_CAST str)); free (str); str = guestfs_inspect_get_distro (g, root); if (!str) exit (EXIT_FAILURE); if (STRNEQ (str, "unknown")) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "distro", BAD_CAST str)); + xmlTextWriterWriteElement (xo, BAD_CAST "distro", BAD_CAST str)); free (str); str = guestfs_inspect_get_product_name (g, root); if (!str) exit (EXIT_FAILURE); if (STRNEQ (str, "unknown")) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "product_name", BAD_CAST str)); + xmlTextWriterWriteElement (xo, BAD_CAST "product_name", BAD_CAST str)); free (str); str = guestfs_inspect_get_product_variant (g, root); if (!str) exit (EXIT_FAILURE); if (STRNEQ (str, "unknown")) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "product_variant", BAD_CAST str)); + xmlTextWriterWriteElement (xo, BAD_CAST "product_variant", BAD_CAST str)); free (str); i = guestfs_inspect_get_major_version (g, root); snprintf (buf, sizeof buf, "%d", i); XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "major_version", BAD_CAST buf)); + xmlTextWriterWriteElement (xo, BAD_CAST "major_version", BAD_CAST buf)); i = guestfs_inspect_get_minor_version (g, root); snprintf (buf, sizeof buf, "%d", i); XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "minor_version", BAD_CAST buf)); + xmlTextWriterWriteElement (xo, BAD_CAST "minor_version", BAD_CAST buf)); str = guestfs_inspect_get_package_format (g, root); if (!str) exit (EXIT_FAILURE); if (STRNEQ (str, "unknown")) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "package_format", BAD_CAST str)); + xmlTextWriterWriteElement (xo, BAD_CAST "package_format", BAD_CAST str)); free (str); str = guestfs_inspect_get_package_management (g, root); if (!str) exit (EXIT_FAILURE); if (STRNEQ (str, "unknown")) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "package_management", - BAD_CAST str)); + xmlTextWriterWriteElement (xo, BAD_CAST "package_management", + BAD_CAST str)); free (str); /* inspect-get-windows-systemroot will fail with non-windows guests, @@ -436,16 +437,16 @@ output_root (xmlTextWriterPtr xo, char *root) if (!str) exit (EXIT_FAILURE); if (STRNEQ (str, "unknown")) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "hostname", - BAD_CAST str)); + xmlTextWriterWriteElement (xo, BAD_CAST "hostname", + BAD_CAST str)); free (str); str = guestfs_inspect_get_format (g, root); if (!str) exit (EXIT_FAILURE); if (STRNEQ (str, "unknown")) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "format", - BAD_CAST str)); + xmlTextWriterWriteElement (xo, BAD_CAST "format", + BAD_CAST str)); free (str); r = guestfs_inspect_is_live (g, root); @@ -700,8 +701,8 @@ output_applications (xmlTextWriterPtr xo, char *root) if (apps->val[i].app2_display_name && apps->val[i].app2_display_name[0]) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "display_name", - BAD_CAST apps->val[i].app2_display_name)); + xmlTextWriterWriteElement (xo, BAD_CAST "display_name", + BAD_CAST apps->val[i].app2_display_name)); if (apps->val[i].app2_epoch != 0) { char buf[32]; @@ -709,45 +710,45 @@ output_applications (xmlTextWriterPtr xo, char *root) snprintf (buf, sizeof buf, "%d", apps->val[i].app2_epoch); XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "epoch", BAD_CAST buf)); + xmlTextWriterWriteElement (xo, BAD_CAST "epoch", BAD_CAST buf)); } if (apps->val[i].app2_version && apps->val[i].app2_version[0]) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "version", - BAD_CAST apps->val[i].app2_version)); + xmlTextWriterWriteElement (xo, BAD_CAST "version", + BAD_CAST apps->val[i].app2_version)); if (apps->val[i].app2_release && apps->val[i].app2_release[0]) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "release", - BAD_CAST apps->val[i].app2_release)); + xmlTextWriterWriteElement (xo, BAD_CAST "release", + BAD_CAST apps->val[i].app2_release)); if (apps->val[i].app2_arch && apps->val[i].app2_arch[0]) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "arch", - BAD_CAST apps->val[i].app2_arch)); + xmlTextWriterWriteElement (xo, BAD_CAST "arch", + BAD_CAST apps->val[i].app2_arch)); if (apps->val[i].app2_install_path && apps->val[i].app2_install_path[0]) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "install_path", - BAD_CAST apps->val[i].app2_install_path)); + xmlTextWriterWriteElement (xo, BAD_CAST "install_path", + BAD_CAST apps->val[i].app2_install_path)); if (apps->val[i].app2_publisher && apps->val[i].app2_publisher[0]) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "publisher", - BAD_CAST apps->val[i].app2_publisher)); + xmlTextWriterWriteElement (xo, BAD_CAST "publisher", + BAD_CAST apps->val[i].app2_publisher)); if (apps->val[i].app2_url && apps->val[i].app2_url[0]) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "url", - BAD_CAST apps->val[i].app2_url)); + xmlTextWriterWriteElement (xo, BAD_CAST "url", + BAD_CAST apps->val[i].app2_url)); if (apps->val[i].app2_source_package && apps->val[i].app2_source_package[0]) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "source_package", - BAD_CAST apps->val[i].app2_source_package)); + xmlTextWriterWriteElement (xo, BAD_CAST "source_package", + BAD_CAST apps->val[i].app2_source_package)); if (apps->val[i].app2_summary && apps->val[i].app2_summary[0]) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "summary", - BAD_CAST apps->val[i].app2_summary)); + xmlTextWriterWriteElement (xo, BAD_CAST "summary", + BAD_CAST apps->val[i].app2_summary)); if (apps->val[i].app2_description && apps->val[i].app2_description[0]) XMLERROR (-1, - xmlTextWriterWriteElement (xo, BAD_CAST "description", - BAD_CAST apps->val[i].app2_description)); + xmlTextWriterWriteElement (xo, BAD_CAST "description", + BAD_CAST apps->val[i].app2_description)); XMLERROR (-1, xmlTextWriterEndElement (xo)); } @@ -770,7 +771,8 @@ do_xpath (const char *query) doc = xmlReadFd (STDIN_FILENO, NULL, "utf8", XML_PARSE_NOBLANKS); if (doc == NULL) { - fprintf (stderr, _("%s: unable to parse XML from stdin\n"), guestfs_int_program_name); + fprintf (stderr, _("%s: unable to parse XML from stdin\n"), + guestfs_int_program_name); exit (EXIT_FAILURE); } @@ -808,14 +810,16 @@ do_xpath (const char *query) } wrnode = xmlCopyNode (nodes->nodeTab[i], 1); if (wrnode == NULL) { - fprintf (stderr, _("%s: xmlCopyNode failed\n"), guestfs_int_program_name); + fprintf (stderr, _("%s: xmlCopyNode failed\n"), + guestfs_int_program_name); exit (EXIT_FAILURE); } xmlDocSetRootElement (wrdoc, wrnode); if (xmlSaveDoc (saveCtx, wrdoc) == -1) { - fprintf (stderr, _("%s: xmlSaveDoc failed\n"), guestfs_int_program_name); + fprintf (stderr, _("%s: xmlSaveDoc failed\n"), + guestfs_int_program_name); exit (EXIT_FAILURE); } } diff --git a/make-fs/make-fs.c b/make-fs/make-fs.c index 67b0456c1..5431ce89d 100644 --- a/make-fs/make-fs.c +++ b/make-fs/make-fs.c @@ -92,8 +92,9 @@ usage (int status) " -V|--version Display version and exit\n" " -x Trace libguestfs API calls\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name); } exit (status); } @@ -143,7 +144,8 @@ main (int argc, char *argv[]) partition = optarg; } else { fprintf (stderr, _("%s: unknown long option: %s (%d)\n"), - guestfs_int_program_name, long_options[option_index].name, option_index); + guestfs_int_program_name, + long_options[option_index].name, option_index); exit (EXIT_FAILURE); } break; @@ -181,7 +183,8 @@ main (int argc, char *argv[]) } if (optind + 2 != argc) { - fprintf (stderr, _("%s: missing input and output arguments on the command line\n"), + fprintf (stderr, + _("%s: missing input and output arguments on the command line\n"), guestfs_int_program_name); usage (EXIT_FAILURE); } @@ -199,7 +202,8 @@ check_ntfs_available (void) if (STREQ (type, "ntfs") && guestfs_feature_available (g, (char **) ntfs_features) == 0) { - fprintf (stderr, _("%s: NTFS support was disabled when libguestfs was compiled\n"), + fprintf (stderr, + _("%s: NTFS support was disabled when libguestfs was compiled\n"), guestfs_int_program_name); return -1; } @@ -249,7 +253,8 @@ exec_command (char **argv, const char *file) return -1; } if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) { - fprintf (stderr, _("%s: %s command failed\n"), guestfs_int_program_name, argv[0]); + fprintf (stderr, _("%s: %s command failed\n"), + guestfs_int_program_name, argv[0]); return -1; } return 0; @@ -306,7 +311,8 @@ exec_command_count_output (char **argv, uint64_t *bytes_rtn) return -1; } if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) { - fprintf (stderr, _("%s: %s command failed\n"), guestfs_int_program_name, argv[0]); + fprintf (stderr, _("%s: %s command failed\n"), + guestfs_int_program_name, argv[0]); return -1; } return 0; diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c index 03e36597d..cbff84684 100644 --- a/ocaml/guestfs-c.c +++ b/ocaml/guestfs-c.c @@ -49,11 +49,11 @@ static void event_callback_wrapper (guestfs_h *g, void *data, uint64_t event, in /* This macro was added in OCaml 3.10. Backport for earlier versions. */ #ifndef CAMLreturnT -#define CAMLreturnT(type, result) do{ \ - type caml__temp_result = (result); \ - caml_local_roots = caml__frame; \ - return (caml__temp_result); \ -}while(0) +#define CAMLreturnT(type, result) do{ \ + type caml__temp_result = (result); \ + caml_local_roots = caml__frame; \ + return (caml__temp_result); \ + }while(0) #endif /* These prototypes are solely to quiet gcc warning. */ diff --git a/p2v/conversion.c b/p2v/conversion.c index b19bd49cd..e2f37cd70 100644 --- a/p2v/conversion.c +++ b/p2v/conversion.c @@ -584,7 +584,7 @@ wait_qemu_nbd (int nbd_local_port, int timeout_seconds) } result = 0; -cleanup: + cleanup: close (sockfd); return result; @@ -615,25 +615,25 @@ cleanup_data_conns (struct data_conn *data_conns, size_t nr) /* Macros "inspired" by src/launch-libvirt.c */ /* */ -#define end_element() \ - while (0); \ - do { \ - if (xmlTextWriterEndElement (xo) == -1) { \ - set_conversion_error ("xmlTextWriterEndElement: %m"); \ - return NULL; \ - } \ +#define end_element() \ + while (0); \ + do { \ + if (xmlTextWriterEndElement (xo) == -1) { \ + set_conversion_error ("xmlTextWriterEndElement: %m"); \ + return NULL; \ + } \ } while (0) /* */ -#define empty_element(element) \ +#define empty_element(element) \ do { start_element(element) {} end_element (); } while (0) /* key=value attribute of the current element. */ @@ -646,16 +646,16 @@ cleanup_data_conns (struct data_conn *data_conns, size_t nr) /* key=value, but value is a printf-style format string. */ #define attribute_format(key,fs,...) \ if (xmlTextWriterWriteFormatAttribute (xo, BAD_CAST (key), \ - fs, ##__VA_ARGS__) == -1) { \ + fs, ##__VA_ARGS__) == -1) { \ set_conversion_error ("xmlTextWriterWriteFormatAttribute: %m"); \ return NULL; \ } /* A string, eg. within an element. */ -#define string(str) \ - if (xmlTextWriterWriteString (xo, BAD_CAST (str)) == -1) { \ - set_conversion_error ("xmlTextWriterWriteString: %m"); \ - return NULL; \ +#define string(str) \ + if (xmlTextWriterWriteString (xo, BAD_CAST (str)) == -1) { \ + set_conversion_error ("xmlTextWriterWriteString: %m"); \ + return NULL; \ } /* A string, using printf-style formatting. */ @@ -666,10 +666,10 @@ cleanup_data_conns (struct data_conn *data_conns, size_t nr) } /* An XML comment. */ -#define comment(str) \ - if (xmlTextWriterWriteComment (xo, BAD_CAST (str)) == -1) { \ - set_conversion_error ("xmlTextWriterWriteComment: %m"); \ - return NULL; \ +#define comment(str) \ + if (xmlTextWriterWriteComment (xo, BAD_CAST (str)) == -1) { \ + set_conversion_error ("xmlTextWriterWriteComment: %m"); \ + return NULL; \ } /* Write the libvirt XML for this physical machine. Note this is not diff --git a/p2v/main.c b/p2v/main.c index 83fcd8c9b..57e14ac41 100644 --- a/p2v/main.c +++ b/p2v/main.c @@ -75,7 +75,8 @@ usage (int status) " -v|--verbose Verbose messages\n" " -V|--version Display version and exit\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name); } exit (status); } diff --git a/rescue/rescue.c b/rescue/rescue.c index f25a86b56..ddd8d7dd5 100644 --- a/rescue/rescue.c +++ b/rescue/rescue.c @@ -80,8 +80,8 @@ usage (int status) " -w|--rw Mount read-write\n" " -x Trace libguestfs API calls\n" "For more information, see the manpage %s(1).\n"), - guestfs_int_program_name, guestfs_int_program_name, guestfs_int_program_name, - guestfs_int_program_name); + guestfs_int_program_name, guestfs_int_program_name, + guestfs_int_program_name, guestfs_int_program_name); } exit (status); } diff --git a/src/actions-support.c b/src/actions-support.c index ca125acc5..3bb830572 100644 --- a/src/actions-support.c +++ b/src/actions-support.c @@ -30,8 +30,8 @@ /* Check the return message from a call for validity. */ int guestfs_int_check_reply_header (guestfs_h *g, - const struct guestfs_message_header *hdr, - unsigned int proc_nr, unsigned int serial) + const struct guestfs_message_header *hdr, + unsigned int proc_nr, unsigned int serial) { if (hdr->prog != GUESTFS_PROGRAM) { error (g, "wrong program (%u/%d)", hdr->prog, GUESTFS_PROGRAM); diff --git a/src/alloc.c b/src/alloc.c index 866eb21a3..7b17cc523 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -46,8 +46,8 @@ guestfs_int_safe_malloc (guestfs_h *g, size_t nbytes) sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for exactly-SIZE_MAX allocations on such hosts; this avoids a test and branch when S is known to be 1. */ -# define xalloc_oversized(n, s) \ - ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) +# define xalloc_oversized(n, s) \ + ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) /* Technically we should add an autoconf test for this, testing for the desired functionality, like what's done in gnulib, but for now, this is fine. */ diff --git a/src/appliance.c b/src/appliance.c index 137cd697a..020324c8e 100644 --- a/src/appliance.c +++ b/src/appliance.c @@ -93,10 +93,10 @@ static int run_supermin_build (guestfs_h *g, const char *lockfile, const char *a */ int guestfs_int_build_appliance (guestfs_h *g, - char **kernel_rtn, - char **dtb_rtn, - char **initrd_rtn, - char **appliance_rtn) + char **kernel_rtn, + char **dtb_rtn, + char **initrd_rtn, + char **appliance_rtn) { char *kernel = NULL, *dtb = NULL, *initrd = NULL, *appliance = NULL; diff --git a/src/conn-socket.c b/src/conn-socket.c index 252b942a5..a935cc479 100644 --- a/src/conn-socket.c +++ b/src/conn-socket.c @@ -380,8 +380,8 @@ static struct connection_ops ops = { */ struct connection * guestfs_int_new_conn_socket_listening (guestfs_h *g, - int daemon_accept_sock, - int console_sock) + int daemon_accept_sock, + int console_sock) { struct connection_socket *conn; @@ -419,8 +419,8 @@ guestfs_int_new_conn_socket_listening (guestfs_h *g, */ struct connection * guestfs_int_new_conn_socket_connected (guestfs_h *g, - int daemon_sock, - int console_sock) + int daemon_sock, + int console_sock) { struct connection_socket *conn; diff --git a/src/create.c b/src/create.c index 7f31bdb4e..cbcdbc5bd 100644 --- a/src/create.c +++ b/src/create.c @@ -46,8 +46,8 @@ static char *qemu_escape_param (guestfs_h *g, const char *param); int guestfs_impl_disk_create (guestfs_h *g, const char *filename, - const char *format, int64_t size, - const struct guestfs_disk_create_argv *optargs) + const char *format, int64_t size, + const struct guestfs_disk_create_argv *optargs) { const char *backingfile; diff --git a/src/dbdump.c b/src/dbdump.c index 95a8dfba8..7c17ce6b3 100644 --- a/src/dbdump.c +++ b/src/dbdump.c @@ -53,8 +53,8 @@ struct cb_data { */ int guestfs_int_read_db_dump (guestfs_h *g, - const char *dumpfile, void *opaque, - guestfs_int_db_dump_callback callback) + const char *dumpfile, void *opaque, + guestfs_int_db_dump_callback callback) { struct cb_data data; CLEANUP_CMD_CLOSE struct command *cmd = guestfs_int_new_command (g); diff --git a/src/drives.c b/src/drives.c index d957fc42e..b9cc81328 100644 --- a/src/drives.c +++ b/src/drives.c @@ -729,7 +729,7 @@ parse_servers (guestfs_h *g, char *const *strs, int guestfs_impl_add_drive_opts (guestfs_h *g, const char *filename, - const struct guestfs_add_drive_opts_argv *optargs) + const struct guestfs_add_drive_opts_argv *optargs) { struct drive_create_data data; const char *protocol; @@ -954,7 +954,7 @@ guestfs_impl_add_drive_ro (guestfs_h *g, const char *filename) int guestfs_impl_add_drive_with_if (guestfs_h *g, const char *filename, - const char *iface) + const char *iface) { const struct guestfs_add_drive_opts_argv optargs = { .bitmask = GUESTFS_ADD_DRIVE_OPTS_IFACE_BITMASK, @@ -980,7 +980,7 @@ guestfs_impl_add_drive_ro_with_if (guestfs_h *g, const char *filename, int guestfs_impl_add_drive_scratch (guestfs_h *g, int64_t size, - const struct guestfs_add_drive_scratch_argv *optargs) + const struct guestfs_add_drive_scratch_argv *optargs) { struct guestfs_add_drive_opts_argv add_drive_optargs = { .bitmask = 0 }; CLEANUP_FREE char *filename = NULL; diff --git a/src/errors.c b/src/errors.c index c259884ec..04bb89e74 100644 --- a/src/errors.c +++ b/src/errors.c @@ -291,9 +291,9 @@ guestfs_int_launch_failed_error (guestfs_h *g) error (g, _("guestfs_launch failed, see earlier error messages")); else error (g, _( -"guestfs_launch failed.\n" -"This usually means the libguestfs appliance failed to start or crashed.\n" -DEBUG_ADVICE)); + "guestfs_launch failed.\n" + "This usually means the libguestfs appliance failed to start or crashed.\n" + DEBUG_ADVICE)); } /* As above, but for crashes that occur after launch. */ @@ -304,9 +304,9 @@ guestfs_int_unexpected_close_error (guestfs_h *g) error (g, _("appliance closed the connection unexpectedly, see earlier error messages")); else error (g, _( -"appliance closed the connection unexpectedly.\n" -"This usually means the libguestfs appliance crashed.\n" -DEBUG_ADVICE)); + "appliance closed the connection unexpectedly.\n" + "This usually means the libguestfs appliance crashed.\n" + DEBUG_ADVICE)); } /* As above, but for appliance kernel hanging. */ @@ -317,15 +317,15 @@ guestfs_int_launch_timeout (guestfs_h *g) error (g, _("appliance launch timed out, see earlier error messages")); else error (g, _( -"appliance launch timed out.\n" -"This usually means the kernel or appliance hung during launch.\n" -DEBUG_ADVICE)); + "appliance launch timed out.\n" + "This usually means the kernel or appliance hung during launch.\n" + DEBUG_ADVICE)); } /* External command failed. */ void guestfs_int_external_command_failed (guestfs_h *g, int status, - const char *cmd_name, const char *extra) + const char *cmd_name, const char *extra) { size_t len = 80 + strlen (cmd_name); char status_string[len]; @@ -342,15 +342,15 @@ guestfs_int_external_command_failed (guestfs_h *g, int status, else { if (!extra) error (g, _( -"%s.\n" -"To see full error messages you may need to enable debugging.\n" -DEBUG_ADVICE), + "%s.\n" + "To see full error messages you may need to enable debugging.\n" + DEBUG_ADVICE), status_string); else error (g, _( -"%s: %s: %s.\n" -"To see full error messages you may need to enable debugging.\n" -DEBUG_ADVICE), + "%s: %s: %s.\n" + "To see full error messages you may need to enable debugging.\n" + DEBUG_ADVICE), cmd_name, extra, status_string); } } diff --git a/src/events.c b/src/events.c index 3e5f16536..d5efefe7d 100644 --- a/src/events.c +++ b/src/events.c @@ -104,7 +104,7 @@ guestfs_int_call_callbacks_void (guestfs_h *g, uint64_t event) void guestfs_int_call_callbacks_message (guestfs_h *g, uint64_t event, - const char *buf, size_t buf_len) + const char *buf, size_t buf_len) { size_t i, count = 0; @@ -167,8 +167,8 @@ guestfs_int_call_callbacks_message (guestfs_h *g, uint64_t event, * try to send longest possible strings in single fwrite calls * (thanks to Jim Meyering for the basic approach). */ -#define NO_ESCAPING(c) \ - (c_isprint ((c)) || (from_appliance && ((c) == '\n' || (c) == '\r'))) +#define NO_ESCAPING(c) \ + (c_isprint ((c)) || (from_appliance && ((c) == '\n' || (c) == '\r'))) for (i = 0; i < buf_len; ++i) { if (NO_ESCAPING (buf[i])) { @@ -204,7 +204,7 @@ guestfs_int_call_callbacks_message (guestfs_h *g, uint64_t event, void guestfs_int_call_callbacks_array (guestfs_h *g, uint64_t event, - const uint64_t *array, size_t array_len) + const uint64_t *array, size_t array_len) { size_t i; diff --git a/src/file.c b/src/file.c index 5c783ef24..d57c4e103 100644 --- a/src/file.c +++ b/src/file.c @@ -363,14 +363,14 @@ write_or_append (guestfs_h *g, const char *path, int guestfs_impl_write (guestfs_h *g, const char *path, - const char *content, size_t size) + const char *content, size_t size) { return write_or_append (g, path, content, size, 0); } int guestfs_impl_write_append (guestfs_h *g, const char *path, - const char *content, size_t size) + const char *content, size_t size) { return write_or_append (g, path, content, size, 1); } diff --git a/src/fuse.c b/src/fuse.c index 1fcc97a14..b155e4c87 100644 --- a/src/fuse.c +++ b/src/fuse.c @@ -66,24 +66,24 @@ static const char *rlc_lookup (guestfs_h *, const char *pathname); gl_lock_define_initialized (static, mount_local_lock); #define DECL_G() guestfs_h *g = fuse_get_context()->private_data -#define DEBUG_CALL(fs,...) \ - if (g->ml_debug_calls) { \ - debug (g, \ - "%s: %s (" fs ")", \ - g->localmountpoint, __func__, ## __VA_ARGS__); \ +#define DEBUG_CALL(fs,...) \ + if (g->ml_debug_calls) { \ + debug (g, \ + "%s: %s (" fs ")", \ + g->localmountpoint, __func__, ## __VA_ARGS__); \ } -#define RETURN_ERRNO \ - do { \ - int ret_errno = guestfs_last_errno (g); \ - \ - /* 0 doesn't mean "no error". It means the errno was not \ - * captured. Therefore we have to substitute an errno here. \ - */ \ - if (ret_errno == 0) \ - ret_errno = EINVAL; \ - \ - return -ret_errno; \ +#define RETURN_ERRNO \ + do { \ + int ret_errno = guestfs_last_errno (g); \ + \ + /* 0 doesn't mean "no error". It means the errno was not \ + * captured. Therefore we have to substitute an errno here. \ + */ \ + if (ret_errno == 0) \ + ret_errno = EINVAL; \ + \ + return -ret_errno; \ } while (0) static struct guestfs_xattr_list * @@ -751,7 +751,7 @@ mount_local_fsync (const char *path, int isdatasync, static int mount_local_setxattr (const char *path, const char *name, const char *value, - size_t size, int flags) + size_t size, int flags) { int r; DECL_G (); @@ -824,7 +824,7 @@ mount_local_getxattr (const char *path, const char *name, char *value, } memcpy (value, xattrs->val[i].attrval, sz); -out: + out: if (free_attrs) guestfs_free_xattr_list ((struct guestfs_xattr_list *) xattrs); @@ -954,7 +954,7 @@ static struct fuse_operations mount_local_operations = { int guestfs_impl_mount_local (guestfs_h *g, const char *localmountpoint, - const struct guestfs_mount_local_argv *optargs) + const struct guestfs_mount_local_argv *optargs) { const char *t; struct fuse_args args = FUSE_ARGS_INIT (0, NULL); @@ -1102,7 +1102,7 @@ guestfs_int_free_fuse (guestfs_h *g) int guestfs_impl_umount_local (guestfs_h *g, - const struct guestfs_umount_local_argv *optargs) + const struct guestfs_umount_local_argv *optargs) { const char *retry; int r; @@ -1505,7 +1505,7 @@ dir_cache_invalidate (guestfs_h *g, const char *path) int guestfs_impl_mount_local (guestfs_h *g, const char *localmountpoint, - const struct guestfs_mount_local_argv *optargs) + const struct guestfs_mount_local_argv *optargs) { FUSE_NOT_SUPPORTED (); } @@ -1518,7 +1518,7 @@ guestfs_impl_mount_local_run (guestfs_h *g) int guestfs_impl_umount_local (guestfs_h *g, - const struct guestfs_umount_local_argv *optargs) + const struct guestfs_umount_local_argv *optargs) { FUSE_NOT_SUPPORTED (); } diff --git a/src/handle.c b/src/handle.c index 6505bb7c3..e2d0aa3d6 100644 --- a/src/handle.c +++ b/src/handle.c @@ -331,7 +331,7 @@ guestfs_close (guestfs_h *g) const char trace_msg[] = "close"; guestfs_int_call_callbacks_message (g, GUESTFS_EVENT_TRACE, - trace_msg, strlen (trace_msg)); + trace_msg, strlen (trace_msg)); } debug (g, "closing guestfs handle %p (state %d)", g, (int) g->state); diff --git a/src/info.c b/src/info.c index 02a1cf67c..d7f45f055 100644 --- a/src/info.c +++ b/src/info.c @@ -349,8 +349,8 @@ which_parser (guestfs_h *g) guestfs_int_cmd_add_arg (cmd, "qemu-img"); guestfs_int_cmd_add_arg (cmd, "--help"); guestfs_int_cmd_set_stdout_callback (cmd, - help_contains_output_json, - &qemu_img_supports_json, 0); + help_contains_output_json, + &qemu_img_supports_json, 0); guestfs_int_cmd_run (cmd); /* ignore return code, which would usually be 1 */ diff --git a/src/inspect-apps.c b/src/inspect-apps.c index dfe721321..a7da1dc72 100644 --- a/src/inspect-apps.c +++ b/src/inspect-apps.c @@ -391,14 +391,14 @@ list_applications_rpm (guestfs_h *g, struct inspect_fs *fs) struct read_package_data data; Name = guestfs_int_download_to_tmp (g, fs, - "/var/lib/rpm/Name", "rpm_Name", - MAX_PKG_DB_SIZE); + "/var/lib/rpm/Name", "rpm_Name", + MAX_PKG_DB_SIZE); if (Name == NULL) goto error; Packages = guestfs_int_download_to_tmp (g, fs, - "/var/lib/rpm/Packages", "rpm_Packages", - MAX_PKG_DB_SIZE); + "/var/lib/rpm/Packages", "rpm_Packages", + MAX_PKG_DB_SIZE); if (Packages == NULL) goto error; @@ -446,7 +446,7 @@ list_applications_deb (guestfs_h *g, struct inspect_fs *fs) int installed_flag = 0; status = guestfs_int_download_to_tmp (g, fs, "/var/lib/dpkg/status", "status", - MAX_PKG_DB_SIZE); + MAX_PKG_DB_SIZE); if (status == NULL) return NULL; @@ -617,8 +617,8 @@ list_applications_pacman (guestfs_h *g, struct inspect_fs *fs) } if ((name == NULL) || (version == NULL) || (arch == NULL)) - /* Those are mandatory fields. The file is corrupted */ - goto after_add_application; + /* Those are mandatory fields. The file is corrupted */ + goto after_add_application; /* version: [epoch:]ver-rel */ p = strchr (version, ':'); @@ -642,28 +642,28 @@ list_applications_pacman (guestfs_h *g, struct inspect_fs *fs) add_application (g, apps, name, "", epoch, ver, rel, arch, "", "", url ? : "", desc ? : ""); - after_add_application: - key = NULL; - free (name); - free (version); - free (desc); - free (arch); - free (url); - name = version = desc = arch = url = NULL; - rel = ver = NULL; /* haven't allocated memory for those */ + after_add_application: + key = NULL; + free (name); + free (version); + free (desc); + free (arch); + free (url); + name = version = desc = arch = url = NULL; + rel = ver = NULL; /* haven't allocated memory for those */ - if (fclose (fp) == -1) { - perrorf (g, "fclose: %s", desc_file); - goto out; - } + if (fclose (fp) == -1) { + perrorf (g, "fclose: %s", desc_file); + goto out; + } } ret = apps; - out: - if (ret == NULL) - guestfs_free_application2_list (apps); + out: + if (ret == NULL) + guestfs_free_application2_list (apps); return ret; } diff --git a/src/inspect-fs-cd.c b/src/inspect-fs-cd.c index 3c3a515e0..b008f582a 100644 --- a/src/inspect-fs-cd.c +++ b/src/inspect-fs-cd.c @@ -182,7 +182,7 @@ check_fedora_installer_root (guestfs_h *g, struct inspect_fs *fs) fs->type = OS_TYPE_LINUX; r = guestfs_int_first_egrep_of_file (g, "/.treeinfo", - "^family = Fedora$", 0, &str); + "^family = Fedora$", 0, &str); if (r == -1) return -1; if (r > 0) { @@ -191,8 +191,8 @@ check_fedora_installer_root (guestfs_h *g, struct inspect_fs *fs) } r = guestfs_int_first_egrep_of_file (g, "/.treeinfo", - "^family = Red Hat Enterprise Linux$", - 0, &str); + "^family = Red Hat Enterprise Linux$", + 0, &str); if (r == -1) return -1; if (r > 0) { @@ -201,8 +201,8 @@ check_fedora_installer_root (guestfs_h *g, struct inspect_fs *fs) } r = guestfs_int_first_egrep_of_file (g, "/.treeinfo", - "^family = Oracle Linux Server$", - 0, &str); + "^family = Oracle Linux Server$", + 0, &str); if (r == -1) return -1; if (r > 0) { @@ -212,7 +212,7 @@ check_fedora_installer_root (guestfs_h *g, struct inspect_fs *fs) /* XXX should do major.minor before this */ r = guestfs_int_first_egrep_of_file (g, "/.treeinfo", - "^version = [[:digit:]]+", 0, &str); + "^version = [[:digit:]]+", 0, &str); if (r == -1) return -1; if (r > 0) { @@ -224,7 +224,7 @@ check_fedora_installer_root (guestfs_h *g, struct inspect_fs *fs) } r = guestfs_int_first_egrep_of_file (g, "/.treeinfo", - "^arch = [-_[:alnum:]]+$", 0, &str); + "^arch = [-_[:alnum:]]+$", 0, &str); if (r == -1) return -1; if (r > 0) { @@ -234,7 +234,7 @@ check_fedora_installer_root (guestfs_h *g, struct inspect_fs *fs) } r = guestfs_int_first_egrep_of_file (g, "/.treeinfo", - "^discnum = [[:digit:]]+$", 0, &str); + "^discnum = [[:digit:]]+$", 0, &str); if (r == -1) return -1; if (r > 0) { @@ -246,7 +246,7 @@ check_fedora_installer_root (guestfs_h *g, struct inspect_fs *fs) } r = guestfs_int_first_egrep_of_file (g, "/.treeinfo", - "^totaldiscs = [[:digit:]]+$", 0, &str); + "^totaldiscs = [[:digit:]]+$", 0, &str); if (r == -1) return -1; if (r > 0) { @@ -280,8 +280,8 @@ check_isolinux_installer_root (guestfs_h *g, struct inspect_fs *fs) fs->type = OS_TYPE_LINUX; r = guestfs_int_first_egrep_of_file (g, "/isolinux/isolinux.cfg", - "^menu title Welcome to Fedora [[:digit:]]+", - 0, &str); + "^menu title Welcome to Fedora [[:digit:]]+", + 0, &str); if (r == -1) return -1; if (r > 0) { @@ -295,8 +295,8 @@ check_isolinux_installer_root (guestfs_h *g, struct inspect_fs *fs) /* XXX parse major.minor */ r = guestfs_int_first_egrep_of_file (g, "/isolinux/isolinux.cfg", - "^menu title Welcome to Red Hat Enterprise Linux [[:digit:]]+", - 0, &str); + "^menu title Welcome to Red Hat Enterprise Linux [[:digit:]]+", + 0, &str); if (r == -1) return -1; if (r > 0) { @@ -310,8 +310,8 @@ check_isolinux_installer_root (guestfs_h *g, struct inspect_fs *fs) /* XXX parse major.minor */ r = guestfs_int_first_egrep_of_file (g, "/isolinux/isolinux.cfg", - "^menu title Welcome to RHEL[[:digit:]]+", - 0, &str); + "^menu title Welcome to RHEL[[:digit:]]+", + 0, &str); if (r == -1) return -1; if (r > 0) { @@ -325,8 +325,8 @@ check_isolinux_installer_root (guestfs_h *g, struct inspect_fs *fs) /* XXX parse major.minor */ r = guestfs_int_first_egrep_of_file (g, "/isolinux/isolinux.cfg", - "^menu title Welcome to Oracle Linux Server [[:digit:]]+", - 0, &str); + "^menu title Welcome to Oracle Linux Server [[:digit:]]+", + 0, &str); if (r == -1) return -1; if (r > 0) { @@ -374,7 +374,7 @@ check_w2k3_installer_root (guestfs_h *g, struct inspect_fs *fs, fs->distro = OS_DISTRO_WINDOWS; r = guestfs_int_first_egrep_of_file (g, txtsetup, - "^productname[[:space:]]*=[[:space:]]*\"", 1, &str); + "^productname[[:space:]]*=[[:space:]]*\"", 1, &str); if (r == -1) return -1; if (r > 0) { @@ -386,8 +386,8 @@ check_w2k3_installer_root (guestfs_h *g, struct inspect_fs *fs, } r = guestfs_int_first_egrep_of_file (g, txtsetup, - "^majorversion[[:space:]]*=[[:space:]]*[[:digit:]]+", - 1, &str); + "^majorversion[[:space:]]*=[[:space:]]*[[:digit:]]+", + 1, &str); if (r == -1) return -1; if (r > 0) { @@ -400,8 +400,8 @@ check_w2k3_installer_root (guestfs_h *g, struct inspect_fs *fs, } r = guestfs_int_first_egrep_of_file (g, txtsetup, - "^minorversion[[:space:]]*=[[:space:]]*[[:digit:]]+", - 1, &str); + "^minorversion[[:space:]]*=[[:space:]]*[[:digit:]]+", + 1, &str); if (r == -1) return -1; if (r > 0) { @@ -418,8 +418,8 @@ check_w2k3_installer_root (guestfs_h *g, struct inspect_fs *fs, * the user will finally choose. */ r = guestfs_int_first_egrep_of_file (g, txtsetup, - "^defaultpath[[:space:]]*=[[:space:]]*", - 1, &str); + "^defaultpath[[:space:]]*=[[:space:]]*", + 1, &str); if (r == -1) return -1; if (r > 0) { @@ -505,7 +505,7 @@ guestfs_int_check_installer_root (guestfs_h *g, struct inspect_fs *fs) */ int guestfs_int_check_installer_iso (guestfs_h *g, struct inspect_fs *fs, - const char *device) + const char *device) { CLEANUP_FREE_ISOINFO struct guestfs_isoinfo *isoinfo = NULL; const struct osinfo *osinfo; diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c index a371f4da3..cda1b5de5 100644 --- a/src/inspect-fs-unix.c +++ b/src/inspect-fs-unix.c @@ -458,7 +458,7 @@ parse_suse_release (guestfs_h *g, struct inspect_fs *fs, const char *filename) r = 0; -out: + out: return r; } @@ -532,7 +532,7 @@ guestfs_int_check_linux_root (guestfs_h *g, struct inspect_fs *fs) return -1; if (match2 (g, fs->product_name, re_centos_old, &major, &minor) || - match2 (g, fs->product_name, re_centos, &major, &minor)) { + match2 (g, fs->product_name, re_centos, &major, &minor)) { fs->major_version = guestfs_int_parse_unsigned_int (g, major); free (major); if (fs->major_version == -1) { @@ -1337,14 +1337,14 @@ check_fstab (guestfs_h *g, struct inspect_fs *fs) * disklabel. For more info see here: * http://www.openbsd.org/faq/faq14.html#intro */ - char device[10]; /* /dev/sd[0-9][a-z] */ - char part = spec[17]; + char device[10]; /* /dev/sd[0-9][a-z] */ + char part = spec[17]; - /* We cannot peep into disklables, we can only assume that this is the - * first disk. - */ - snprintf(device, 10, "%s%c", "/dev/sd0", part); - mountable = resolve_fstab_device (g, device, md_map, fs->type); + /* We cannot peep into disklables, we can only assume that this is the + * first disk. + */ + snprintf(device, 10, "%s%c", "/dev/sd0", part); + mountable = resolve_fstab_device (g, device, md_map, fs->type); } /* If we haven't resolved the device successfully by this point, @@ -1530,32 +1530,32 @@ map_app_md_devices (guestfs_h *g, Hash_table **map) if (parse_uuid(*i, entry->uuid) == -1) { /* Invalid UUID is weird, but not fatal. */ debug(g, "inspect-os: guestfs_md_detail returned invalid " - "uuid for %s: %s", *md, *i); + "uuid for %s: %s", *md, *i); md_uuid_free(entry); continue; } const void *matched = NULL; switch (hash_insert_if_absent(*map, entry, &matched)) { - case -1: - g->abort_cb(); + case -1: + g->abort_cb(); - case 0: - /* Duplicate uuid in for md device is weird, but not fatal. */ - debug(g, "inspect-os: md devices %s and %s have the same uuid", - ((md_uuid *)matched)->path, entry->path); - md_uuid_free(entry); - break; + case 0: + /* Duplicate uuid in for md device is weird, but not fatal. */ + debug(g, "inspect-os: md devices %s and %s have the same uuid", + ((md_uuid *)matched)->path, entry->path); + md_uuid_free(entry); + break; - default: - n++; + default: + n++; } } } return n; -error: + error: hash_free (*map); *map = NULL; return -1; @@ -1612,12 +1612,12 @@ map_md_devices(guestfs_h *g, Hash_table **map) /* Log a debug message if we've got md devices, but nothing in mdadm.conf */ if (matches[0] == NULL) { debug(g, "Appliance has MD devices, but augeas returned no array matches " - "in mdadm.conf"); + "in mdadm.conf"); return 0; } *map = hash_initialize(16, NULL, mdadm_app_hash, mdadm_app_cmp, - mdadm_app_free); + mdadm_app_free); if (!*map) g->abort_cb(); for (char **m = matches; *m != NULL; m++) { @@ -1654,15 +1654,15 @@ map_md_devices(guestfs_h *g, Hash_table **map) entry->app = safe_strdup(g, app->path); switch (hash_insert_if_absent(*map, entry, NULL)) { - case -1: - g->abort_cb(); + case -1: + g->abort_cb(); - case 0: - /* Duplicate uuid in for md device is weird, but not fatal. */ - debug(g, "inspect-os: mdadm.conf contains multiple entries for %s", - app->path); - mdadm_app_free(entry); - continue; + case 0: + /* Duplicate uuid in for md device is weird, but not fatal. */ + debug(g, "inspect-os: mdadm.conf contains multiple entries for %s", + app->path); + mdadm_app_free(entry); + continue; } } else free (dev); @@ -1670,7 +1670,7 @@ map_md_devices(guestfs_h *g, Hash_table **map) return 0; -error: + error: if (*map) hash_free (*map); return -1; diff --git a/src/inspect-fs-windows.c b/src/inspect-fs-windows.c index 99d384379..50d495350 100644 --- a/src/inspect-fs-windows.c +++ b/src/inspect-fs-windows.c @@ -152,49 +152,49 @@ guestfs_int_get_windows_systemroot (guestfs_h *g) * of what this line means */ if (match6 (g, line, re_boot_ini_os, &controller_type, &controller, &disk, &rdisk, &partition, &path)) - { - /* The Windows system root may be on any disk. However, there - * are currently (at least) 2 practical problems preventing us - * from locating it on another disk: - * - * 1. We don't have enough metadata about the disks we were - * given to know if what controller they were on and what - * index they had. - * - * 2. The way inspection of filesystems currently works, we - * can't mark another filesystem, which we may have already - * inspected, to be inspected for a specific Windows system - * root. - * - * Solving 1 properly would require a new API at a minimum. We - * might be able to fudge something practical without this, - * though, e.g. by looking at the th partition of - * every disk for the specific windows root. - * - * Solving 2 would probably require a significant refactoring - * of the way filesystems are inspected. We should probably do - * this some time. - * - * For the moment, we ignore all partition information and - * assume the system root is on the current partition. In - * practice, this will normally be correct. - */ + { + /* The Windows system root may be on any disk. However, there + * are currently (at least) 2 practical problems preventing us + * from locating it on another disk: + * + * 1. We don't have enough metadata about the disks we were + * given to know if what controller they were on and what + * index they had. + * + * 2. The way inspection of filesystems currently works, we + * can't mark another filesystem, which we may have already + * inspected, to be inspected for a specific Windows system + * root. + * + * Solving 1 properly would require a new API at a minimum. We + * might be able to fudge something practical without this, + * though, e.g. by looking at the th partition of + * every disk for the specific windows root. + * + * Solving 2 would probably require a significant refactoring + * of the way filesystems are inspected. We should probably do + * this some time. + * + * For the moment, we ignore all partition information and + * assume the system root is on the current partition. In + * practice, this will normally be correct. + */ - /* Swap backslashes for forward slashes in the system root - * path */ - for (char *j = path; *j != '\0'; j++) { - if (*j == '\\') *j = '/'; - } + /* Swap backslashes for forward slashes in the system root + * path */ + for (char *j = path; *j != '\0'; j++) { + if (*j == '\\') *j = '/'; + } - char *systemroot = guestfs_int_case_sensitive_path_silently (g, path); - if (systemroot && is_systemroot (g, systemroot)) { - debug (g, "windows %%SYSTEMROOT%% = %s", systemroot); + char *systemroot = guestfs_int_case_sensitive_path_silently (g, path); + if (systemroot && is_systemroot (g, systemroot)) { + debug (g, "windows %%SYSTEMROOT%% = %s", systemroot); - return systemroot; - } else { - free (systemroot); - } - } + return systemroot; + } else { + free (systemroot); + } + } } } @@ -203,7 +203,7 @@ guestfs_int_get_windows_systemroot (guestfs_h *g) int guestfs_int_check_windows_root (guestfs_h *g, struct inspect_fs *fs, - char *const systemroot) + char *const systemroot) { fs->type = OS_TYPE_WINDOWS; fs->distro = OS_DISTRO_WINDOWS; diff --git a/src/inspect-fs.c b/src/inspect-fs.c index 5c8d6d7ad..19e1389cc 100644 --- a/src/inspect-fs.c +++ b/src/inspect-fs.c @@ -263,12 +263,12 @@ check_filesystem (guestfs_h *g, const char *mountable, ; /* Windows root? */ else if ((windows_systemroot = guestfs_int_get_windows_systemroot (g)) != NULL) - { - fs->is_root = 1; - fs->format = OS_FORMAT_INSTALLED; - if (guestfs_int_check_windows_root (g, fs, windows_systemroot) == -1) - return -1; - } + { + fs->is_root = 1; + fs->format = OS_FORMAT_INSTALLED; + if (guestfs_int_check_windows_root (g, fs, windows_systemroot) == -1) + return -1; + } /* Windows volume with installed applications (but not root)? */ else if (guestfs_int_is_dir_nocase (g, "/System Volume Information") > 0 && guestfs_int_is_dir_nocase (g, "/Program Files") > 0) @@ -630,7 +630,7 @@ guestfs_int_first_line_of_file (guestfs_h *g, const char *filename) */ int guestfs_int_first_egrep_of_file (guestfs_h *g, const char *filename, - const char *eregex, int iflag, char **ret) + const char *eregex, int iflag, char **ret) { char **lines; int64_t size; diff --git a/src/inspect-icon.c b/src/inspect-icon.c index fe3826645..748680df6 100644 --- a/src/inspect-icon.c +++ b/src/inspect-icon.c @@ -32,8 +32,8 @@ #if defined(PBMTEXT) && defined (PNMTOPNG) #define CAN_DO_CIRROS 1 #endif -#if defined(WRESTOOL) && defined(BMPTOPNM) && defined(PNMTOPNG) && \ - defined(PAMCUT) +#if defined(WRESTOOL) && defined(BMPTOPNM) && defined(PNMTOPNG) && \ + defined(PAMCUT) #define CAN_DO_WINDOWS 1 #endif @@ -78,7 +78,7 @@ static char *NOT_FOUND = (char *) "not_found"; */ char * guestfs_impl_inspect_get_icon (guestfs_h *g, const char *root, size_t *size_r, - const struct guestfs_inspect_get_icon_argv *optargs) + const struct guestfs_inspect_get_icon_argv *optargs) { struct inspect_fs *fs; char *r = NOT_FOUND; @@ -462,8 +462,8 @@ icon_windows_xp (guestfs_h *g, struct inspect_fs *fs, size_t *size_r) return NOT_FOUND; filename_downloaded = guestfs_int_download_to_tmp (g, fs, filename_case, - "explorer.exe", - MAX_WINDOWS_EXPLORER_SIZE); + "explorer.exe", + MAX_WINDOWS_EXPLORER_SIZE); if (filename_downloaded == NULL) return NOT_FOUND; @@ -472,7 +472,7 @@ icon_windows_xp (guestfs_h *g, struct inspect_fs *fs, size_t *size_r) guestfs_int_cmd_add_string_unquoted (cmd, WRESTOOL " -x --type=2 --name=143 "); guestfs_int_cmd_add_string_quoted (cmd, filename_downloaded); guestfs_int_cmd_add_string_unquoted (cmd, - " | " BMPTOPNM " | " PNMTOPNG " > "); + " | " BMPTOPNM " | " PNMTOPNG " > "); guestfs_int_cmd_add_string_quoted (cmd, pngfile); r = guestfs_int_cmd_run (cmd); if (r == -1) @@ -512,8 +512,8 @@ icon_windows_7 (guestfs_h *g, struct inspect_fs *fs, size_t *size_r) return NOT_FOUND; filename_downloaded = guestfs_int_download_to_tmp (g, fs, filename_case, - "explorer.exe", - MAX_WINDOWS_EXPLORER_SIZE); + "explorer.exe", + MAX_WINDOWS_EXPLORER_SIZE); if (filename_downloaded == NULL) return NOT_FOUND; @@ -522,9 +522,9 @@ icon_windows_7 (guestfs_h *g, struct inspect_fs *fs, size_t *size_r) guestfs_int_cmd_add_string_unquoted (cmd, WRESTOOL " -x --type=2 --name=6801 "); guestfs_int_cmd_add_string_quoted (cmd, filename_downloaded); guestfs_int_cmd_add_string_unquoted (cmd, - " | " BMPTOPNM " | " - PAMCUT " -bottom 54 | " - PNMTOPNG " > "); + " | " BMPTOPNM " | " + PAMCUT " -bottom 54 | " + PNMTOPNG " > "); guestfs_int_cmd_add_string_quoted (cmd, pngfile); r = guestfs_int_cmd_run (cmd); if (r == -1) @@ -565,7 +565,7 @@ icon_windows_8 (guestfs_h *g, struct inspect_fs *fs, size_t *size_r) return NOT_FOUND; filename_downloaded = guestfs_int_download_to_tmp (g, fs, filename_case, - "wlive48x48.png", 8192); + "wlive48x48.png", 8192); if (filename_downloaded == NULL) return NOT_FOUND; diff --git a/src/inspect.c b/src/inspect.c index 1eac037c7..eedc745d2 100644 --- a/src/inspect.c +++ b/src/inspect.c @@ -350,7 +350,7 @@ guestfs_impl_inspect_get_windows_systemroot (guestfs_h *g, const char *root) char * guestfs_impl_inspect_get_windows_current_control_set (guestfs_h *g, - const char *root) + const char *root) { struct inspect_fs *fs = guestfs_int_search_for_root (g, root); if (!fs) @@ -623,8 +623,8 @@ guestfs_int_free_inspect_info (guestfs_h *g) */ char * guestfs_int_download_to_tmp (guestfs_h *g, struct inspect_fs *fs, - const char *filename, - const char *basename, uint64_t max_size) + const char *filename, + const char *basename, uint64_t max_size) { char *r; int fd; diff --git a/src/launch-direct.c b/src/launch-direct.c index 2ffbff187..7540c198d 100644 --- a/src/launch-direct.c +++ b/src/launch-direct.c @@ -156,7 +156,7 @@ add_cmdline_shell_unquoted (guestfs_h *g, struct stringsbuf *sb, nextp++; guestfs_int_add_string_nodup (g, sb, - safe_strndup (g, startp, endp-startp)); + safe_strndup (g, startp, endp-startp)); options = nextp; } @@ -215,10 +215,10 @@ debian_kvm_warning (guestfs_h *g) * in warnings. */ warning (g, - _("current user is not a member of the KVM group (group ID %d). " - "This user cannot access /dev/kvm, so libguestfs may run very slowly. " - "It is recommended that you 'chmod 0666 /dev/kvm' or add the current user " - "to the KVM group (you might need to log out and log in again)."), + _("current user is not a member of the KVM group (group ID %d). " + "This user cannot access /dev/kvm, so libguestfs may run very slowly. " + "It is recommended that you 'chmod 0666 /dev/kvm' or add the current user " + "to the KVM group (you might need to log out and log in again)."), (int) kvm_group); #endif /* __linux__ */ } @@ -333,11 +333,11 @@ launch_direct (guestfs_h *g, void *datav, const char *arg) * forking, because after fork we are not allowed to use * non-signal-safe functions such as malloc. */ -#define ADD_CMDLINE(str) \ +#define ADD_CMDLINE(str) \ guestfs_int_add_string (g, &cmdline, (str)) -#define ADD_CMDLINE_STRING_NODUP(str) \ +#define ADD_CMDLINE_STRING_NODUP(str) \ guestfs_int_add_string_nodup (g, &cmdline, (str)) -#define ADD_CMDLINE_PRINTF(fs,...) \ +#define ADD_CMDLINE_PRINTF(fs,...) \ guestfs_int_add_sprintf (g, &cmdline, (fs), ##__VA_ARGS__) ADD_CMDLINE (g->hv); @@ -615,7 +615,7 @@ launch_direct (guestfs_h *g, void *datav, const char *arg) if (!has_kvm || force_tcg) flags |= APPLIANCE_COMMAND_LINE_IS_TCG; ADD_CMDLINE_STRING_NODUP (guestfs_int_appliance_command_line (g, appliance_dev, - flags)); + flags)); /* Note: custom command line parameters must come last so that * qemu -set parameters can modify previously added options. @@ -963,7 +963,7 @@ test_qemu (guestfs_h *g, struct backend_direct_data *data) guestfs_int_cmd_add_arg (cmd1, "none"); guestfs_int_cmd_add_arg (cmd1, "-help"); guestfs_int_cmd_set_stdout_callback (cmd1, read_all, &data->qemu_help, - CMD_STDOUT_FLAG_WHOLE_BUFFER); + CMD_STDOUT_FLAG_WHOLE_BUFFER); r = guestfs_int_cmd_run (cmd1); if (r == -1 || !WIFEXITED (r) || WEXITSTATUS (r) != 0) goto error; @@ -973,7 +973,7 @@ test_qemu (guestfs_h *g, struct backend_direct_data *data) guestfs_int_cmd_add_arg (cmd2, "none"); guestfs_int_cmd_add_arg (cmd2, "-version"); guestfs_int_cmd_set_stdout_callback (cmd2, read_all, &data->qemu_version, - CMD_STDOUT_FLAG_WHOLE_BUFFER); + CMD_STDOUT_FLAG_WHOLE_BUFFER); r = guestfs_int_cmd_run (cmd2); if (r == -1 || !WIFEXITED (r) || WEXITSTATUS (r) != 0) goto error; @@ -994,7 +994,7 @@ test_qemu (guestfs_h *g, struct backend_direct_data *data) guestfs_int_cmd_clear_capture_errors (cmd3); guestfs_int_cmd_set_stderr_to_stdout (cmd3); guestfs_int_cmd_set_stdout_callback (cmd3, read_all, &data->qemu_devices, - CMD_STDOUT_FLAG_WHOLE_BUFFER); + CMD_STDOUT_FLAG_WHOLE_BUFFER); r = guestfs_int_cmd_run (cmd3); if (r == -1 || !WIFEXITED (r) || WEXITSTATUS (r) != 0) goto error; @@ -1331,13 +1331,13 @@ guestfs_int_drive_source_qemu_param (guestfs_h *g, const struct drive_source *sr mon_host[n] = '\0'; if (src->username) - username = safe_asprintf (g, ":id=%s", src->username); + username = safe_asprintf (g, ":id=%s", src->username); if (src->secret) - secret = safe_asprintf (g, ":key=%s", src->secret); + secret = safe_asprintf (g, ":key=%s", src->secret); if (username || secret) - auth = ":auth_supported=cephx\\;none"; + auth = ":auth_supported=cephx\\;none"; else - auth = ":auth_supported=none"; + auth = ":auth_supported=none"; return safe_asprintf (g, "rbd:%s%s%s%s%s%s", src->u.exportname, @@ -1379,7 +1379,7 @@ guestfs_int_drive_source_qemu_param (guestfs_h *g, const struct drive_source *sr */ bool guestfs_int_discard_possible (guestfs_h *g, struct drive *drv, - unsigned long qemu_version) + unsigned long qemu_version) { /* qemu >= 1.5. This was the first version that supported the * discard option on -drive at all. diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c index 8560aa330..1a690e8f2 100644 --- a/src/launch-libvirt.c +++ b/src/launch-libvirt.c @@ -72,11 +72,11 @@ #define MIN_LIBVIRT_MAJOR 0 #define MIN_LIBVIRT_MINOR 10 #define MIN_LIBVIRT_MICRO 2 /* XXX patches in > 2 already */ -#define MIN_LIBVIRT_VERSION (MIN_LIBVIRT_MAJOR * 1000000 + \ - MIN_LIBVIRT_MINOR * 1000 + \ +#define MIN_LIBVIRT_VERSION (MIN_LIBVIRT_MAJOR * 1000000 + \ + MIN_LIBVIRT_MINOR * 1000 + \ MIN_LIBVIRT_MICRO) -#if defined(HAVE_LIBVIRT) && \ +#if defined(HAVE_LIBVIRT) && \ LIBVIR_VERSION_NUMBER >= MIN_LIBVIRT_VERSION #ifndef HAVE_XMLBUFFERDETACH @@ -322,7 +322,7 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri) conn = guestfs_int_open_libvirt_connection (g, libvirt_uri, 0); if (!conn) { libvirt_error (g, _("could not connect to libvirt (URI = %s)"), - libvirt_uri ? : "NULL"); + libvirt_uri ? : "NULL"); goto cleanup; } @@ -396,7 +396,7 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri) guestfs_int_print_timestamped_message (g, "build appliance"); if (guestfs_int_build_appliance (g, ¶ms.kernel, ¶ms.dtb, - ¶ms.initrd, &appliance) == -1) + ¶ms.initrd, &appliance) == -1) goto cleanup; guestfs_int_launch_send_progress (g, 3); @@ -547,12 +547,12 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri) dom = virDomainCreateXML (conn, (char *) xml, VIR_DOMAIN_START_AUTODESTROY); if (!dom) { libvirt_error (g, _( - "could not create appliance through libvirt.\n" - "\n" - "Try running qemu directly without libvirt using this environment variable:\n" - "export LIBGUESTFS_BACKEND=direct\n" - "\n" - "Original error from libvirt")); + "could not create appliance through libvirt.\n" + "\n" + "Try running qemu directly without libvirt using this environment variable:\n" + "export LIBGUESTFS_BACKEND=direct\n" + "\n" + "Original error from libvirt")); goto cleanup; } @@ -912,30 +912,30 @@ static int construct_libvirt_xml_appliance (guestfs_h *g, const struct libvirt_x */ /* */ -#define end_element() \ - while (0); \ - do { \ - if (xmlTextWriterEndElement (xo) == -1) { \ - xml_error ("xmlTextWriterEndElement"); \ - return -1; \ - } \ +#define end_element() \ + while (0); \ + do { \ + if (xmlTextWriterEndElement (xo) == -1) { \ + xml_error ("xmlTextWriterEndElement"); \ + return -1; \ + } \ } while (0) /* */ -#define empty_element(element) \ +#define empty_element(element) \ do { start_element(element) {} end_element (); } while (0) /* key=value attribute of the current element. */ #define attribute(key,value) \ - if (xmlTextWriterWriteAttribute (xo, BAD_CAST (key), BAD_CAST (value)) == -1){\ + if (xmlTextWriterWriteAttribute (xo, BAD_CAST (key), BAD_CAST (value)) == -1){ \ xml_error ("xmlTextWriterWriteAttribute"); \ return -1; \ } @@ -958,10 +958,10 @@ static int construct_libvirt_xml_appliance (guestfs_h *g, const struct libvirt_x } /* A string, eg. within an element. */ -#define string(str) \ - if (xmlTextWriterWriteString (xo, BAD_CAST (str)) == -1) { \ - xml_error ("xmlTextWriterWriteString"); \ - return -1; \ +#define string(str) \ + if (xmlTextWriterWriteString (xo, BAD_CAST (str)) == -1) { \ + xml_error ("xmlTextWriterWriteString"); \ + return -1; \ } /* A string, using printf-style formatting. */ @@ -972,8 +972,8 @@ static int construct_libvirt_xml_appliance (guestfs_h *g, const struct libvirt_x } #define xml_error(fn) \ - perrorf (g, _("%s:%d: error constructing libvirt XML near call to \"%s\""), \ - __FILE__, __LINE__, (fn)); + perrorf (g, _("%s:%d: error constructing libvirt XML near call to \"%s\""), \ + __FILE__, __LINE__, (fn)); static xmlChar * construct_libvirt_xml (guestfs_h *g, const struct libvirt_xml_params *params) @@ -2023,7 +2023,7 @@ check_bridge_exists (guestfs_h *g, const char *brname) "\n" "You may also need to allow the bridge in /etc/qemu/bridge.conf.\n" "For further information see guestfs(3)."), - brname); + brname); return -1; } diff --git a/src/launch-uml.c b/src/launch-uml.c index 8171ff070..2ec7022ea 100644 --- a/src/launch-uml.c +++ b/src/launch-uml.c @@ -200,9 +200,9 @@ launch_uml (guestfs_h *g, void *datav, const char *arg) * forking, because after fork we are not allowed to use * non-signal-safe functions such as malloc. */ -#define ADD_CMDLINE(str) \ +#define ADD_CMDLINE(str) \ guestfs_int_add_string (g, &cmdline, (str)) -#define ADD_CMDLINE_PRINTF(fs,...) \ +#define ADD_CMDLINE_PRINTF(fs,...) \ guestfs_int_add_sprintf (g, &cmdline, (fs), ##__VA_ARGS__) ADD_CMDLINE (g->hv); @@ -270,7 +270,7 @@ launch_uml (guestfs_h *g, void *datav, const char *arg) ADD_CMDLINE (hp->hv_param); if (hp->hv_value) ADD_CMDLINE (hp->hv_value); - } + } /* Finish off the command line. */ guestfs_int_end_stringsbuf (g, &cmdline); diff --git a/src/launch.c b/src/launch.c index 27e0a2aaf..99c558234 100644 --- a/src/launch.c +++ b/src/launch.c @@ -244,16 +244,16 @@ guestfs_impl_get_state (guestfs_h *g) /* Add arbitrary qemu parameters. Useful for testing. */ int guestfs_impl_config (guestfs_h *g, - const char *hv_param, const char *hv_value) + const char *hv_param, const char *hv_value) { struct hv_param *hp; /* XXX For qemu this made sense, but not for uml. - if (hv_param[0] != '-') { + if (hv_param[0] != '-') { error (g, _("parameter must begin with '-' character")); return -1; - } + } */ /* A bit fascist, but the user will probably break the extra @@ -310,7 +310,7 @@ guestfs_impl_config (guestfs_h *g, char * guestfs_int_appliance_command_line (guestfs_h *g, const char *appliance_dev, - int flags) + int flags) { char root[64] = ""; char *term = getenv ("TERM"); diff --git a/src/libvirt-auth.c b/src/libvirt-auth.c index a4a249ceb..dad61cd81 100644 --- a/src/libvirt-auth.c +++ b/src/libvirt-auth.c @@ -136,8 +136,8 @@ libvirt_auth_callback (virConnectCredentialPtr cred, g->nr_requested_credentials = ncred; guestfs_int_call_callbacks_message (g, GUESTFS_EVENT_LIBVIRT_AUTH, - g->saved_libvirt_uri, - strlen (g->saved_libvirt_uri)); + g->saved_libvirt_uri, + strlen (g->saved_libvirt_uri)); /* Clarified with Dan that it is not an error for some fields to be * left as NULL. @@ -189,7 +189,7 @@ exists_libvirt_auth_event (guestfs_h *g) /* Open a libvirt connection (called from other parts of the library). */ virConnectPtr guestfs_int_open_libvirt_connection (guestfs_h *g, const char *uri, - unsigned int flags) + unsigned int flags) { virConnectAuth authdata; virConnectPtr conn; @@ -256,7 +256,7 @@ guestfs_impl_get_libvirt_requested_credentials (guestfs_h *g) /* Convert the requested_credentials types to a list of strings. */ for (i = 0; i < g->nr_requested_credentials; ++i) guestfs_int_add_string (g, &ret, - get_string_of_credtype (g->requested_credentials[i].type)); + get_string_of_credtype (g->requested_credentials[i].type)); guestfs_int_end_stringsbuf (g, &ret); return ret.argv; /* caller frees */ @@ -324,7 +324,7 @@ guestfs_impl_get_libvirt_requested_credential_defresult (guestfs_h *g, int index int guestfs_impl_set_libvirt_requested_credential (guestfs_h *g, int index, - const char *cred, size_t cred_size) + const char *cred, size_t cred_size) { size_t i; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 79e7ba689..124eef093 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -52,7 +52,7 @@ ignore_errors (void *ignore, virErrorPtr ignore2) int guestfs_impl_add_domain (guestfs_h *g, const char *domain_name, - const struct guestfs_add_domain_argv *optargs) + const struct guestfs_add_domain_argv *optargs) { virErrorPtr err; virConnectPtr conn = NULL; @@ -70,23 +70,23 @@ guestfs_impl_add_domain (guestfs_h *g, const char *domain_name, struct guestfs_add_libvirt_dom_argv optargs2 = { .bitmask = 0 }; libvirturi = optargs->bitmask & GUESTFS_ADD_DOMAIN_LIBVIRTURI_BITMASK - ? optargs->libvirturi : NULL; + ? optargs->libvirturi : NULL; readonly = optargs->bitmask & GUESTFS_ADD_DOMAIN_READONLY_BITMASK - ? optargs->readonly : 0; + ? optargs->readonly : 0; iface = optargs->bitmask & GUESTFS_ADD_DOMAIN_IFACE_BITMASK - ? optargs->iface : NULL; + ? optargs->iface : NULL; live = optargs->bitmask & GUESTFS_ADD_DOMAIN_LIVE_BITMASK - ? optargs->live : 0; + ? optargs->live : 0; allowuuid = optargs->bitmask & GUESTFS_ADD_DOMAIN_ALLOWUUID_BITMASK - ? optargs->allowuuid : 0; + ? optargs->allowuuid : 0; readonlydisk = optargs->bitmask & GUESTFS_ADD_DOMAIN_READONLYDISK_BITMASK - ? optargs->readonlydisk : NULL; + ? optargs->readonlydisk : NULL; cachemode = optargs->bitmask & GUESTFS_ADD_DOMAIN_CACHEMODE_BITMASK - ? optargs->cachemode : NULL; + ? optargs->cachemode : NULL; discard = optargs->bitmask & GUESTFS_ADD_DOMAIN_DISCARD_BITMASK - ? optargs->discard : NULL; + ? optargs->discard : NULL; copyonread = optargs->bitmask & GUESTFS_ADD_DOMAIN_COPYONREAD_BITMASK - ? optargs->copyonread : false; + ? optargs->copyonread : false; if (live && readonly) { error (g, _("you cannot set both live and readonly flags")); @@ -180,7 +180,7 @@ struct add_disk_data { int guestfs_impl_add_libvirt_dom (guestfs_h *g, void *domvp, - const struct guestfs_add_libvirt_dom_argv *optargs) + const struct guestfs_add_libvirt_dom_argv *optargs) { virDomainPtr dom = domvp; ssize_t r; @@ -591,7 +591,7 @@ for_each_disk (guestfs_h *g, } xphost = xmlXPathEvalExpression (BAD_CAST "./source/host", - xpathCtx); + xpathCtx); if (xphost == NULL || xphost->nodesetval == NULL) continue; @@ -707,11 +707,11 @@ connect_live (guestfs_h *g, virDomainPtr dom) * guestfsd virtio-serial channel. */ xpathObj = xmlXPathEvalExpression (BAD_CAST - "//devices/channel[@type=\"unix\" and " - "./source/@mode=\"bind\" and " - "./source/@path and " - "./target/@type=\"virtio\" and " - "./target/@name=\"org.libguestfs.channel.0\"]", + "//devices/channel[@type=\"unix\" and " + "./source/@mode=\"bind\" and " + "./source/@path and " + "./target/@type=\"virtio\" and " + "./target/@name=\"org.libguestfs.channel.0\"]", xpathCtx); if (xpathObj == NULL) { error (g, _("unable to evaluate XPath expression")); @@ -788,14 +788,14 @@ get_domain_xml (guestfs_h *g, virDomainPtr dom) int guestfs_impl_add_domain (guestfs_h *g, const char *dom, - const struct guestfs_add_domain_argv *optargs) + const struct guestfs_add_domain_argv *optargs) { NOT_IMPL(-1); } int guestfs_impl_add_libvirt_dom (guestfs_h *g, void *domvp, - const struct guestfs_add_libvirt_dom_argv *optargs) + const struct guestfs_add_libvirt_dom_argv *optargs) { NOT_IMPL(-1); } diff --git a/src/libvirt-is-version.c b/src/libvirt-is-version.c index bb7c610c2..212368a80 100644 --- a/src/libvirt-is-version.c +++ b/src/libvirt-is-version.c @@ -63,7 +63,7 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); return ver >= (major * 1000000 + minor * 1000 + release) - ? EXIT_SUCCESS : EXIT_FAILURE; + ? EXIT_SUCCESS : EXIT_FAILURE; } static unsigned int diff --git a/src/listfs.c b/src/listfs.c index 046cd4efa..98e74c70d 100644 --- a/src/listfs.c +++ b/src/listfs.c @@ -172,8 +172,8 @@ check_with_vfs_type (guestfs_h *g, const char *device, struct stringsbuf *sb) for (size_t i = 0; i < vols->len; i++) { struct guestfs_btrfssubvolume *this = &vols->val[i]; guestfs_int_add_sprintf (g, sb, - "btrfsvol:%s/%s", - device, this->btrfssubvolume_path); + "btrfsvol:%s/%s", + device, this->btrfssubvolume_path); guestfs_int_add_string (g, sb, "btrfs"); } diff --git a/src/lpj.c b/src/lpj.c index e84b7fcc4..37dfe2f25 100644 --- a/src/lpj.c +++ b/src/lpj.c @@ -143,7 +143,7 @@ read_lpj_common (guestfs_h *g, const char *func, struct command *cmd) CLEANUP_FREE char *buf = NULL; guestfs_int_cmd_set_stdout_callback (cmd, read_all, &buf, - CMD_STDOUT_FLAG_WHOLE_BUFFER); + CMD_STDOUT_FLAG_WHOLE_BUFFER); r = guestfs_int_cmd_run (cmd); if (r == -1) return -1; @@ -152,8 +152,8 @@ read_lpj_common (guestfs_h *g, const char *func, struct command *cmd) debug (g, "%s: %s", func, guestfs_int_exit_status_to_string (r, "external command", - status_string, - sizeof status_string)); + status_string, + sizeof status_string)); return -1; } diff --git a/src/match.c b/src/match.c index 8371321a2..0a9f3b9a5 100644 --- a/src/match.c +++ b/src/match.c @@ -63,7 +63,7 @@ guestfs_int_match1 (guestfs_h *g, const char *str, const pcre *re) /* Match a regular expression which contains exactly two captures. */ int guestfs_int_match2 (guestfs_h *g, const char *str, const pcre *re, - char **ret1, char **ret2) + char **ret1, char **ret2) { size_t len = strlen (str); int vec[30], r; @@ -84,7 +84,7 @@ guestfs_int_match2 (guestfs_h *g, const char *str, const pcre *re, /* Match a regular expression which contains exactly three captures. */ int guestfs_int_match3 (guestfs_h *g, const char *str, const pcre *re, - char **ret1, char **ret2, char **ret3) + char **ret1, char **ret2, char **ret3) { size_t len = strlen (str); int vec[30], r; @@ -107,7 +107,7 @@ guestfs_int_match3 (guestfs_h *g, const char *str, const pcre *re, /* Match a regular expression which contains exactly four captures. */ int guestfs_int_match4 (guestfs_h *g, const char *str, const pcre *re, - char **ret1, char **ret2, char **ret3, char **ret4) + char **ret1, char **ret2, char **ret3, char **ret4) { size_t len = strlen (str); int vec[30], r; @@ -132,8 +132,8 @@ guestfs_int_match4 (guestfs_h *g, const char *str, const pcre *re, /* Match a regular expression which contains exactly six captures. */ int guestfs_int_match6 (guestfs_h *g, const char *str, const pcre *re, - char **ret1, char **ret2, char **ret3, char **ret4, - char **ret5, char **ret6) + char **ret1, char **ret2, char **ret3, char **ret4, + char **ret5, char **ret6) { size_t len = strlen (str); int vec[30], r; diff --git a/src/osinfo.c b/src/osinfo.c index 3a8a709c6..b1cfa091c 100644 --- a/src/osinfo.c +++ b/src/osinfo.c @@ -85,7 +85,7 @@ static void free_osinfo_db_entry (struct osinfo *); */ int guestfs_int_osinfo_map (guestfs_h *g, const struct guestfs_isoinfo *isoinfo, - const struct osinfo **osinfo_ret) + const struct osinfo **osinfo_ret) { size_t i; diff --git a/src/proto.c b/src/proto.c index 3db3ac017..efe9dfbab 100644 --- a/src/proto.c +++ b/src/proto.c @@ -102,7 +102,7 @@ child_cleanup (guestfs_h *g) /* Convenient wrapper to generate a progress message callback. */ void guestfs_int_progress_message_callback (guestfs_h *g, - const guestfs_progress *message) + const guestfs_progress *message) { uint64_t array[4]; @@ -112,7 +112,7 @@ guestfs_int_progress_message_callback (guestfs_h *g, array[3] = message->total; guestfs_int_call_callbacks_array (g, GUESTFS_EVENT_PROGRESS, - array, sizeof array / sizeof array[0]); + array, sizeof array / sizeof array[0]); } /* Connection modules call us back here when they get a log message. */ @@ -201,8 +201,8 @@ check_daemon_socket (guestfs_h *g) int guestfs_int_send (guestfs_h *g, int proc_nr, - uint64_t progress_hint, uint64_t optargs_bitmask, - xdrproc_t xdrp, char *args) + uint64_t progress_hint, uint64_t optargs_bitmask, + xdrproc_t xdrp, char *args) { struct guestfs_message_header hdr; XDR xdr; @@ -633,9 +633,9 @@ guestfs_int_recv_from_daemon (guestfs_h *g, uint32_t *size_rtn, void **buf_rtn) /* Receive a reply. */ int guestfs_int_recv (guestfs_h *g, const char *fn, - guestfs_message_header *hdr, - guestfs_message_error *err, - xdrproc_t xdrp, char *ret) + guestfs_message_header *hdr, + guestfs_message_error *err, + xdrproc_t xdrp, char *ret) { XDR xdr; CLEANUP_FREE void *buf = NULL; diff --git a/src/stringsbuf.c b/src/stringsbuf.c index 984a46676..1486998a1 100644 --- a/src/stringsbuf.c +++ b/src/stringsbuf.c @@ -47,7 +47,7 @@ guestfs_int_add_string (guestfs_h *g, struct stringsbuf *sb, const char *str) void guestfs_int_add_sprintf (guestfs_h *g, struct stringsbuf *sb, - const char *fs, ...) + const char *fs, ...) { va_list args; char *str; diff --git a/src/utils.c b/src/utils.c index e9ec38e64..1f6350aac 100644 --- a/src/utils.c +++ b/src/utils.c @@ -189,7 +189,7 @@ guestfs_int_split_string (char sep, const char *str) */ char * guestfs_int_exit_status_to_string (int status, const char *cmd_name, - char *buffer, size_t buflen) + char *buffer, size_t buflen) { if (WIFEXITED (status)) { if (WEXITSTATUS (status) == 0) diff --git a/test-tool/test-tool.c b/test-tool/test-tool.c index 627bdf195..e1f2d5630 100644 --- a/test-tool/test-tool.c +++ b/test-tool/test-tool.c @@ -342,8 +342,8 @@ set_qemu (guestfs_h *g, const char *path, int use_wrapper) if (getenv ("LIBGUESTFS_QEMU") != NULL || getenv ("LIBGUESTFS_HV") != NULL) { fprintf (stderr, - _("LIBGUESTFS_HV/LIBGUESTFS_QEMU environment variable is already set, so\n" - "--qemu/--qemudir options cannot be used.\n")); + _("LIBGUESTFS_HV/LIBGUESTFS_QEMU environment variable is already set, so\n" + "--qemu/--qemudir options cannot be used.\n")); exit (EXIT_FAILURE); } diff --git a/tests/mount-local/test-parallel-mount-local.c b/tests/mount-local/test-parallel-mount-local.c index 2032cbd80..021033011 100644 --- a/tests/mount-local/test-parallel-mount-local.c +++ b/tests/mount-local/test-parallel-mount-local.c @@ -243,9 +243,9 @@ start_thread (void *statevp) fprintf (stderr, "%s: %s\n", state->mp, guestfs_int_exit_status_to_string (status, "test", - status_string, - sizeof status_string)); - goto error; + status_string, + sizeof status_string)); + goto error; } if (r == -1) /* guestfs_mount_local_run above failed */ diff --git a/tests/mountable/test-internal-parse-mountable.c b/tests/mountable/test-internal-parse-mountable.c index 0e0f8bfc1..c63c501c9 100644 --- a/tests/mountable/test-internal-parse-mountable.c +++ b/tests/mountable/test-internal-parse-mountable.c @@ -80,8 +80,7 @@ main (int argc, char *argv[]) if (mountable == NULL) goto error; if (mountable->im_type != MOUNTABLE_DEVICE || - STRNEQ ("/dev/VG/LV", mountable->im_device)) - { + STRNEQ ("/dev/VG/LV", mountable->im_device)) { fprintf (stderr, "incorrectly parsed /dev/VG/LV: im_device=%s\n", mountable->im_device); goto error; @@ -94,12 +93,11 @@ main (int argc, char *argv[]) if (mountable->im_type != MOUNTABLE_BTRFSVOL || STRNEQ ("/dev/VG/LV", mountable->im_device) || - STRNEQ ("sv", mountable->im_volume)) - { + STRNEQ ("sv", mountable->im_volume)) { fprintf (stderr, "incorrectly parsed /dev/VG/LV/sv: im_device=%s, im_volume=%s\n", mountable->im_device, mountable->im_volume); goto error; - } + } guestfs_free_internal_mountable (mountable); guestfs_close (g); diff --git a/tests/qemu/qemu-speed-test.c b/tests/qemu/qemu-speed-test.c index 0d0f0981f..1d3c5a37e 100644 --- a/tests/qemu/qemu-speed-test.c +++ b/tests/qemu/qemu-speed-test.c @@ -180,7 +180,7 @@ print_rate (const char *msg, int64_t rate) /* The maximum amount of data to copy. You can safely make this very * large because it's only making sparse files. */ -#define TEST_SERIAL_MAX_SIZE \ +#define TEST_SERIAL_MAX_SIZE \ (INT64_C(1024) * INT64_C(1024) * INT64_C(1024) * INT64_C(1024)) static guestfs_h *g; diff --git a/v2v/xml-c.c b/v2v/xml-c.c index d4f11c551..97b8a2046 100644 --- a/v2v/xml-c.c +++ b/v2v/xml-c.c @@ -191,7 +191,7 @@ v2v_xml_xpathctx_ptr_register_ns (value xpathctxv, value prefix, value uri) xpathctx = Xpathctx_ptr_val (xpathctxv); r = xmlXPathRegisterNs (xpathctx, BAD_CAST String_val (prefix), BAD_CAST String_val (uri)); if (r == -1) - caml_invalid_argument ("xpath_register_ns: unable to register namespace"); + caml_invalid_argument ("xpath_register_ns: unable to register namespace"); CAMLreturn (Val_unit); }