Chen Hanxiao
2015-Jul-17 09:24 UTC
[Libguestfs] [PATCH] daemon: add a space after func/macro to fit code-style
more daemon codes covered Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> --- daemon/debug.c | 2 +- daemon/devsparts.c | 2 +- daemon/guestfsd.c | 6 +++--- daemon/labels.c | 4 ++-- daemon/ldm.c | 16 ++++++++-------- daemon/md.c | 10 +++++----- daemon/mkfs.c | 2 +- daemon/parted.c | 8 ++++---- daemon/statvfs.c | 8 ++++---- daemon/sync.c | 2 +- daemon/uuids.c | 4 ++-- daemon/xfs.c | 16 ++++++++-------- 12 files changed, 40 insertions(+), 40 deletions(-) diff --git a/daemon/debug.c b/daemon/debug.c index 92f5aa6..a210db1 100644 --- a/daemon/debug.c +++ b/daemon/debug.c @@ -588,7 +588,7 @@ debug_core_pattern (const char *subcmd, size_t argc, char *const *const argv) } const char *pattern = argv[0]; - const size_t pattern_len = strlen(pattern); + const size_t pattern_len = strlen (pattern); #define CORE_PATTERN "/proc/sys/kernel/core_pattern" int fd = open (CORE_PATTERN, O_WRONLY|O_CLOEXEC); diff --git a/daemon/devsparts.c b/daemon/devsparts.c index 875238a..aebc213 100644 --- a/daemon/devsparts.c +++ b/daemon/devsparts.c @@ -53,7 +53,7 @@ foreach_block_device (block_dev_func_t func) for (;;) { errno = 0; - d = readdir(dir); + d = readdir (dir); if (!d) break; if (STREQLEN (d->d_name, "sd", 2) || diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index ee0aa43..5edfc69 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -1203,7 +1203,7 @@ print_shell_quote (FILE *stream, const char *str = *((const char **) (args[0])); for (i = len = 0; str[i]; ++i) { - if (!SAFE(str[i])) { + if (!SAFE (str[i])) { putc ('\\', stream); len ++; } @@ -1399,8 +1399,8 @@ mountable_to_string (const mountable_t *mountable) return strdup (mountable->device); case MOUNTABLE_BTRFSVOL: - if (asprintf(&desc, "btrfsvol:%s/%s", - mountable->device, mountable->volume) == -1) + if (asprintf (&desc, "btrfsvol:%s/%s", + mountable->device, mountable->volume) == -1) return NULL; return desc; diff --git a/daemon/labels.c b/daemon/labels.c index 130f1db..20f27cb 100644 --- a/daemon/labels.c +++ b/daemon/labels.c @@ -86,8 +86,8 @@ do_set_label (const mountable_t *mountable, const char *label) r = xfslabel (mountable->device, label); else - NOT_SUPPORTED(-1, "don't know how to set the label for '%s' filesystems", - vfs_type); + NOT_SUPPORTED (-1, "don't know how to set the label for '%s' filesystems", + vfs_type); return r; } diff --git a/daemon/ldm.c b/daemon/ldm.c index 3563313..3705aa4 100644 --- a/daemon/ldm.c +++ b/daemon/ldm.c @@ -187,9 +187,9 @@ json_value_to_string_list (yajl_val node) if (! YAJL_IS_ARRAY (node)) return TYPE_ERROR; - len = YAJL_GET_ARRAY(node)->len; + len = YAJL_GET_ARRAY (node)->len; for (i = 0; i < len; ++i) { - n = YAJL_GET_ARRAY(node)->values[i]; + n = YAJL_GET_ARRAY (node)->values[i]; if (! YAJL_IS_STRING (n)) return TYPE_ERROR; if (add_string (&strs, YAJL_GET_STRING (n)) == -1) @@ -238,10 +238,10 @@ parse_json_get_object_string (const char *json, const char *key, int flags, if (! YAJL_IS_OBJECT (tree)) goto bad_type; - len = YAJL_GET_OBJECT(tree)->len; + len = YAJL_GET_OBJECT (tree)->len; for (i = 0; i < len; ++i) { - if (STREQ (YAJL_GET_OBJECT(tree)->keys[i], key)) { - node = YAJL_GET_OBJECT(tree)->values[i]; + if (STREQ (YAJL_GET_OBJECT (tree)->keys[i], key)) { + node = YAJL_GET_OBJECT (tree)->values[i]; if ((flags & GET_STRING_NULL_TO_EMPTY) && YAJL_IS_NULL (node)) ret = strdup (""); @@ -282,10 +282,10 @@ parse_json_get_object_string_list (const char *json, const char *key, if (! YAJL_IS_OBJECT (tree)) goto bad_type; - len = YAJL_GET_OBJECT(tree)->len; + len = YAJL_GET_OBJECT (tree)->len; for (i = 0; i < len; ++i) { - if (STREQ (YAJL_GET_OBJECT(tree)->keys[i], key)) { - node = YAJL_GET_OBJECT(tree)->values[i]; + if (STREQ (YAJL_GET_OBJECT (tree)->keys[i], key)) { + node = YAJL_GET_OBJECT (tree)->values[i]; ret = json_value_to_string_list (node); if (ret == TYPE_ERROR) goto bad_type; diff --git a/daemon/md.c b/daemon/md.c index 08a17e3..06b5142 100644 --- a/daemon/md.c +++ b/daemon/md.c @@ -248,7 +248,7 @@ do_list_md_devices (void) n = dev; n = mempcpy (n, DEV, strlen (DEV)); - n = mempcpy (n, &mds.gl_pathv[i][strlen(PREFIX)], len); + n = mempcpy (n, &mds.gl_pathv[i][strlen (PREFIX)], len); *n = '\0'; if (!is_raid_device (dev)) { @@ -273,7 +273,7 @@ error: } char ** -do_md_detail(const char *md) +do_md_detail (const char *md) { size_t i; int r; @@ -345,15 +345,15 @@ error: } int -do_md_stop(const char *md) +do_md_stop (const char *md) { int r; CLEANUP_FREE char *err = NULL; const char *mdadm[] = { str_mdadm, "--stop", md, NULL}; - r = commandv(NULL, &err, mdadm); + r = commandv (NULL, &err, mdadm); if (r == -1) { - reply_with_error("%s", err); + reply_with_error ("%s", err); return -1; } return 0; diff --git a/daemon/mkfs.c b/daemon/mkfs.c index da28e86..ee9e46d 100644 --- a/daemon/mkfs.c +++ b/daemon/mkfs.c @@ -86,7 +86,7 @@ do_mkfs (const char *fstype, const char *device, int blocksize, */ if (STREQ (fstype, "reiserfs") || STREQ (fstype, "jfs") || STREQ (fstype, "xfs")) - ADD_ARG(argv, i, "-f"); + ADD_ARG (argv, i, "-f"); /* For GFS, GFS2, assume a single node. */ if (STREQ (fstype, "gfs") || STREQ (fstype, "gfs2")) { diff --git a/daemon/parted.c b/daemon/parted.c index cb6c486..b7f560c 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -1092,7 +1092,7 @@ do_part_get_mbr_part_type (const char *device, int partnum) char temp_type[16] = {'\0'}; for (i = 0, row = start; row < end; ++i, ++row) { if (STREQ (parttype, "gpt")) { - memcpy (temp_type, "primary", strlen("primary")); + memcpy (temp_type, "primary", strlen ("primary")); if (sscanf (lines[row], "%d%" SCNi64 "B%" SCNi64 "B%" SCNi64 "B", &part_num, &temp_int64, @@ -1117,15 +1117,15 @@ do_part_get_mbr_part_type (const char *device, int partnum) continue; if (STRPREFIX (temp_type, "primary")) { - part_type = strdup("primary"); + part_type = strdup ("primary"); if (part_type == NULL) goto error; } else if (STRPREFIX (temp_type, "logical")) { - part_type = strdup("logical"); + part_type = strdup ("logical"); if (part_type == NULL) goto error; } else if (STRPREFIX (temp_type, "extended")) { - part_type = strdup("extended"); + part_type = strdup ("extended"); if (part_type == NULL) goto error; } else diff --git a/daemon/statvfs.c b/daemon/statvfs.c index a1f2f08..987537d 100644 --- a/daemon/statvfs.c +++ b/daemon/statvfs.c @@ -113,13 +113,13 @@ do_statvfs (const char *path) * the version of Windows. So this code assumes the disk is NTFS * and the version of Windows is >= Win2K. */ - if (total_number_of_bytes < UINT64_C(16) * 1024 * 1024 * 1024 * 1024) + if (total_number_of_bytes < UINT64_C (16) * 1024 * 1024 * 1024 * 1024) ret->bsize = 4096; - else if (total_number_of_bytes < UINT64_C(32) * 1024 * 1024 * 1024 * 1024) + else if (total_number_of_bytes < UINT64_C (32) * 1024 * 1024 * 1024 * 1024) ret->bsize = 8192; - else if (total_number_of_bytes < UINT64_C(64) * 1024 * 1024 * 1024 * 1024) + else if (total_number_of_bytes < UINT64_C (64) * 1024 * 1024 * 1024 * 1024) ret->bsize = 16384; - else if (total_number_of_bytes < UINT64_C(128) * 1024 * 1024 * 1024 * 1024) + else if (total_number_of_bytes < UINT64_C (128) * 1024 * 1024 * 1024 * 1024) ret->bsize = 32768; else ret->bsize = 65536; diff --git a/daemon/sync.c b/daemon/sync.c index ebe9b47..18513ec 100644 --- a/daemon/sync.c +++ b/daemon/sync.c @@ -97,7 +97,7 @@ fsync_devices (void) for (;;) { errno = 0; - d = readdir(dir); + d = readdir (dir); if (!d) break; if (STREQLEN (d->d_name, "sd", 2) || diff --git a/daemon/uuids.c b/daemon/uuids.c index 00c47d8..e6287c5 100644 --- a/daemon/uuids.c +++ b/daemon/uuids.c @@ -78,7 +78,7 @@ do_set_uuid (const char *device, const char *uuid) r = btrfs_set_uuid (device, uuid); else - NOT_SUPPORTED(-1, "don't know how to set the UUID for '%s' filesystems", + NOT_SUPPORTED (-1, "don't know how to set the UUID for '%s' filesystems", vfs_type); return r; @@ -111,7 +111,7 @@ do_set_uuid_random (const char *device) r = btrfs_set_uuid_random (device); else - NOT_SUPPORTED(-1, "don't know how to set the random UUID for '%s' filesystems", + NOT_SUPPORTED (-1, "don't know how to set the random UUID for '%s' filesystems", vfs_type); return r; } diff --git a/daemon/xfs.c b/daemon/xfs.c index e5e8b62..c1a1854 100644 --- a/daemon/xfs.c +++ b/daemon/xfs.c @@ -408,7 +408,7 @@ do_xfs_growfs (const char *path, reply_with_error ("logsize must be >= 0"); return -1; } - snprintf(logsize_s, sizeof logsize_s, "%" PRIi64, logsize); + snprintf (logsize_s, sizeof logsize_s, "%" PRIi64, logsize); ADD_ARG (argv, i, "-L"); ADD_ARG (argv, i, logsize_s); } @@ -418,7 +418,7 @@ do_xfs_growfs (const char *path, reply_with_error ("rtsize must be >= 0"); return -1; } - snprintf(rtsize_s, sizeof rtsize_s, "%" PRIi64, rtsize); + snprintf (rtsize_s, sizeof rtsize_s, "%" PRIi64, rtsize); ADD_ARG (argv, i, "-R"); ADD_ARG (argv, i, rtsize_s); } @@ -428,7 +428,7 @@ do_xfs_growfs (const char *path, reply_with_error ("rtextsize must be >= 0"); return -1; } - snprintf(rtextsize_s, sizeof rtextsize_s, "%" PRIi64, rtextsize); + snprintf (rtextsize_s, sizeof rtextsize_s, "%" PRIi64, rtextsize); ADD_ARG (argv, i, "-e"); ADD_ARG (argv, i, rtextsize_s); } @@ -438,7 +438,7 @@ do_xfs_growfs (const char *path, reply_with_error ("maxpct must be >= 0"); return -1; } - snprintf(maxpct_s, sizeof maxpct_s, "%" PRIi32, maxpct); + snprintf (maxpct_s, sizeof maxpct_s, "%" PRIi32, maxpct); ADD_ARG (argv, i, "-m"); ADD_ARG (argv, i, maxpct_s); } @@ -591,7 +591,7 @@ do_xfs_repair (const char *device, reply_with_error ("maxmem must be >= 0"); return -1; } - snprintf(maxmem_s, sizeof maxmem_s, "%" PRIi64, maxmem); + snprintf (maxmem_s, sizeof maxmem_s, "%" PRIi64, maxmem); ADD_ARG (argv, i, "-m"); ADD_ARG (argv, i, maxmem_s); } @@ -601,7 +601,7 @@ do_xfs_repair (const char *device, reply_with_error ("ihashsize must be >= 0"); return -1; } - snprintf(ihashsize_s, sizeof ihashsize_s, "ihash=" "%" PRIi64, ihashsize); + snprintf (ihashsize_s, sizeof ihashsize_s, "ihash=" "%" PRIi64, ihashsize); ADD_ARG (argv, i, "-o"); ADD_ARG (argv, i, ihashsize_s); } @@ -611,7 +611,7 @@ do_xfs_repair (const char *device, reply_with_error ("bhashsize must be >= 0"); return -1; } - snprintf(bhashsize_s, sizeof bhashsize_s, "bhash=" "%" PRIi64, bhashsize); + snprintf (bhashsize_s, sizeof bhashsize_s, "bhash=" "%" PRIi64, bhashsize); ADD_ARG (argv, i, "-o"); ADD_ARG (argv, i, bhashsize_s); } @@ -621,7 +621,7 @@ do_xfs_repair (const char *device, reply_with_error ("agstride must be >= 0"); return -1; } - snprintf(agstride_s, sizeof agstride_s, "ag_stride=" "%" PRIi64, agstride); + snprintf (agstride_s, sizeof agstride_s, "ag_stride=" "%" PRIi64, agstride); ADD_ARG (argv, i, "-o"); ADD_ARG (argv, i, agstride_s); } -- 2.1.0
Richard W.M. Jones
2015-Jul-17 12:28 UTC
Re: [Libguestfs] [PATCH] daemon: add a space after func/macro to fit code-style
On Fri, Jul 17, 2015 at 05:24:22PM +0800, Chen Hanxiao wrote:> more daemon codes covered > > Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>Thanks - pushed. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW