[libvirt] [PATCH 00/11] enforce comma style

This series was started in part by the current attempts to split out libvirt-python (and consistently using LIBVIR_CHECK_VERSION), and in part by seeing odd spacing in storage_conf.c (which annoyed me enough on my work on gluster). Eric Blake (11): maint: fix comma style issues: nwfilter maint: fix comma style issues: conf maint: fix comma style issues: xen maint: fix comma style issues: qemu maint: fix comma style issues: tests, tools maint: fix comma style issues: util maint: fix comma style issues: python maint: fix comma style issues: vbox maint: fix comma style issues: remaining drivers maint: fix comma style issues: remaining code maint: enforce comma style usage HACKING | 25 ++++++++ build-aux/bracket-spacing.pl | 15 +++-- docs/hacking.html.in | 31 ++++++++++ python/libvirt-override.c | 12 ++-- src/conf/capabilities.c | 2 +- src/conf/domain_conf.c | 4 +- src/conf/network_conf.c | 6 +- src/conf/nwfilter_conf.c | 92 +++++++++++++++-------------- src/conf/storage_conf.c | 97 ++++++++++++++++--------------- src/libxl/libxl_driver.c | 2 +- src/lxc/lxc_container.c | 2 +- src/network/bridge_driver.c | 2 +- src/node_device/node_device_hal.c | 4 +- src/node_device/node_device_udev.c | 2 +- src/nwfilter/nwfilter_ebiptables_driver.c | 40 ++++++------- src/nwfilter/nwfilter_gentech_driver.c | 2 +- src/nwfilter/nwfilter_learnipaddr.c | 2 +- src/openvz/openvz_driver.c | 4 +- src/openvz/openvz_util.c | 3 +- src/qemu/qemu_cgroup.c | 2 +- src/qemu/qemu_command.c | 4 +- src/qemu/qemu_conf.c | 3 +- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_monitor.c | 12 ++-- src/remote/remote_driver.c | 2 +- src/storage/storage_backend_rbd.c | 2 +- src/test/test_driver.c | 12 ++-- src/util/vircommand.c | 4 +- src/util/virlog.c | 2 +- src/util/virnetdevbandwidth.c | 4 +- src/util/virnetdevmacvlan.c | 2 +- src/util/virnetdevvportprofile.c | 2 +- src/util/virnetlink.c | 2 +- src/util/virpci.c | 3 +- src/util/virsysinfo.c | 2 +- src/util/virusb.c | 2 +- src/vbox/vbox_tmpl.c | 27 ++++----- src/xen/xend_internal.c | 2 +- src/xen/xs_internal.c | 4 +- src/xenapi/xenapi_driver.c | 10 ++-- src/xenapi/xenapi_utils.c | 30 +++++----- src/xenxs/xen_sxpr.c | 2 +- src/xenxs/xen_xm.c | 2 +- tests/sysinfotest.c | 3 +- tests/viratomictest.c | 4 +- tests/vircgroupmock.c | 2 +- tools/virsh-domain.c | 2 +- tools/virsh-volume.c | 9 +-- 48 files changed, 290 insertions(+), 216 deletions(-) -- 1.8.3.1

Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * src/nwfilter/nwfilter_ebiptables_driver.c: Consistently use commas. * src/nwfilter/nwfilter_gentech_driver.c: Likewise. * src/nwfilter/nwfilter_learnipaddr.c: Likewise. * src/conf/nwfilter_conf.c: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com> --- src/conf/nwfilter_conf.c | 92 ++++++++++++++++--------------- src/nwfilter/nwfilter_ebiptables_driver.c | 40 +++++++------- src/nwfilter/nwfilter_gentech_driver.c | 2 +- src/nwfilter/nwfilter_learnipaddr.c | 2 +- 4 files changed, 70 insertions(+), 66 deletions(-) diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 4c48411..793cb0e 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -135,7 +135,7 @@ static const struct int_map chain_priorities[] = { INTMAP_ENTRY(NWFILTER_VLAN_FILTER_PRI, "vlan"), INTMAP_ENTRY(NWFILTER_IPV4_FILTER_PRI, "ipv4"), INTMAP_ENTRY(NWFILTER_IPV6_FILTER_PRI, "ipv6"), - INTMAP_ENTRY(NWFILTER_ARP_FILTER_PRI , "arp"), + INTMAP_ENTRY(NWFILTER_ARP_FILTER_PRI, "arp"), INTMAP_ENTRY(NWFILTER_RARP_FILTER_PRI, "rarp"), INTMAP_ENTRY_LAST, }; @@ -462,11 +462,11 @@ struct _virXMLAttr2Struct static const struct int_map macProtoMap[] = { - INTMAP_ENTRY(ETHERTYPE_ARP , "arp"), + INTMAP_ENTRY(ETHERTYPE_ARP, "arp"), INTMAP_ENTRY(ETHERTYPE_REVARP, "rarp"), - INTMAP_ENTRY(ETHERTYPE_IP , "ipv4"), - INTMAP_ENTRY(ETHERTYPE_IPV6 , "ipv6"), - INTMAP_ENTRY(ETHERTYPE_VLAN , "vlan"), + INTMAP_ENTRY(ETHERTYPE_IP, "ipv4"), + INTMAP_ENTRY(ETHERTYPE_IPV6, "ipv6"), + INTMAP_ENTRY(ETHERTYPE_VLAN, "vlan"), INTMAP_ENTRY_LAST }; @@ -772,11 +772,11 @@ dscpValidator(enum attrDatatype datatype, union data *val, static const struct int_map stateMatchMap[] = { - INTMAP_ENTRY(RULE_FLAG_STATE_NEW , "NEW"), - INTMAP_ENTRY(RULE_FLAG_STATE_ESTABLISHED , "ESTABLISHED"), - INTMAP_ENTRY(RULE_FLAG_STATE_RELATED , "RELATED"), - INTMAP_ENTRY(RULE_FLAG_STATE_INVALID , "INVALID"), - INTMAP_ENTRY(RULE_FLAG_STATE_NONE , "NONE"), + INTMAP_ENTRY(RULE_FLAG_STATE_NEW, "NEW"), + INTMAP_ENTRY(RULE_FLAG_STATE_ESTABLISHED, "ESTABLISHED"), + INTMAP_ENTRY(RULE_FLAG_STATE_RELATED, "RELATED"), + INTMAP_ENTRY(RULE_FLAG_STATE_INVALID, "INVALID"), + INTMAP_ENTRY(RULE_FLAG_STATE_NONE, "NONE"), INTMAP_ENTRY_LAST, }; @@ -901,14 +901,14 @@ stateFormatter(virBufferPtr buf, static const struct int_map tcpFlags[] = { - INTMAP_ENTRY(0x1 , "FIN"), - INTMAP_ENTRY(0x2 , "SYN"), - INTMAP_ENTRY(0x4 , "RST"), - INTMAP_ENTRY(0x8 , "PSH"), + INTMAP_ENTRY(0x1, "FIN"), + INTMAP_ENTRY(0x2, "SYN"), + INTMAP_ENTRY(0x4, "RST"), + INTMAP_ENTRY(0x8, "PSH"), INTMAP_ENTRY(0x10, "ACK"), INTMAP_ENTRY(0x20, "URG"), INTMAP_ENTRY(0x3F, "ALL"), - INTMAP_ENTRY(0x0 , "NONE"), + INTMAP_ENTRY(0x0, "NONE"), INTMAP_ENTRY_LAST }; @@ -931,7 +931,7 @@ tcpFlagsValidator(enum attrDatatype datatype ATTRIBUTE_UNUSED, union data *val, *sep = '\0'; - if (parseStringItems(tcpFlags, s_mask , &mask , ',') == 0 && + if (parseStringItems(tcpFlags, s_mask, &mask, ',') == 0 && parseStringItems(tcpFlags, s_flags, &flags, ',') == 0) { item->u.tcpFlags.mask = mask & 0x3f; item->u.tcpFlags.flags = flags & 0x3f; @@ -1075,22 +1075,26 @@ ipsetFlagsFormatter(virBufferPtr buf, {\ .name = SRCMACADDR,\ .datatype = DATATYPE_MACADDR,\ - .dataIdx = offsetof(virNWFilterRuleDef,p.STRUCT.ethHdr.dataSrcMACAddr),\ + .dataIdx = offsetof(virNWFilterRuleDef,\ + p.STRUCT.ethHdr.dataSrcMACAddr),\ },\ {\ .name = SRCMACMASK,\ .datatype = DATATYPE_MACMASK,\ - .dataIdx = offsetof(virNWFilterRuleDef, p.STRUCT.ethHdr.dataSrcMACMask),\ + .dataIdx = offsetof(virNWFilterRuleDef,\ + p.STRUCT.ethHdr.dataSrcMACMask),\ },\ {\ .name = DSTMACADDR,\ .datatype = DATATYPE_MACADDR,\ - .dataIdx = offsetof(virNWFilterRuleDef, p.STRUCT.ethHdr.dataDstMACAddr),\ + .dataIdx = offsetof(virNWFilterRuleDef,\ + p.STRUCT.ethHdr.dataDstMACAddr),\ },\ {\ .name = DSTMACMASK,\ .datatype = DATATYPE_MACMASK,\ - .dataIdx = offsetof(virNWFilterRuleDef, p.STRUCT.ethHdr.dataDstMACMask),\ + .dataIdx = offsetof(virNWFilterRuleDef,\ + p.STRUCT.ethHdr.dataDstMACMask),\ } @@ -1742,30 +1746,30 @@ struct _virAttributes { static const virAttributes virAttr[] = { - PROTOCOL_ENTRY("arp" , arpAttributes , VIR_NWFILTER_RULE_PROTOCOL_ARP), - PROTOCOL_ENTRY("rarp" , arpAttributes , VIR_NWFILTER_RULE_PROTOCOL_RARP), - PROTOCOL_ENTRY("mac" , macAttributes , VIR_NWFILTER_RULE_PROTOCOL_MAC), - PROTOCOL_ENTRY("vlan" , vlanAttributes , VIR_NWFILTER_RULE_PROTOCOL_VLAN), - PROTOCOL_ENTRY("stp" , stpAttributes , VIR_NWFILTER_RULE_PROTOCOL_STP), - PROTOCOL_ENTRY("ip" , ipAttributes , VIR_NWFILTER_RULE_PROTOCOL_IP), - PROTOCOL_ENTRY("ipv6" , ipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_IPV6), - PROTOCOL_ENTRY("tcp" , tcpAttributes , VIR_NWFILTER_RULE_PROTOCOL_TCP), - PROTOCOL_ENTRY("udp" , udpAttributes , VIR_NWFILTER_RULE_PROTOCOL_UDP), + PROTOCOL_ENTRY("arp", arpAttributes, VIR_NWFILTER_RULE_PROTOCOL_ARP), + PROTOCOL_ENTRY("rarp", arpAttributes, VIR_NWFILTER_RULE_PROTOCOL_RARP), + PROTOCOL_ENTRY("mac", macAttributes, VIR_NWFILTER_RULE_PROTOCOL_MAC), + PROTOCOL_ENTRY("vlan", vlanAttributes, VIR_NWFILTER_RULE_PROTOCOL_VLAN), + PROTOCOL_ENTRY("stp", stpAttributes, VIR_NWFILTER_RULE_PROTOCOL_STP), + PROTOCOL_ENTRY("ip", ipAttributes, VIR_NWFILTER_RULE_PROTOCOL_IP), + PROTOCOL_ENTRY("ipv6", ipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_IPV6), + PROTOCOL_ENTRY("tcp", tcpAttributes, VIR_NWFILTER_RULE_PROTOCOL_TCP), + PROTOCOL_ENTRY("udp", udpAttributes, VIR_NWFILTER_RULE_PROTOCOL_UDP), PROTOCOL_ENTRY("udplite", udpliteAttributes, VIR_NWFILTER_RULE_PROTOCOL_UDPLITE), - PROTOCOL_ENTRY("esp" , espAttributes , VIR_NWFILTER_RULE_PROTOCOL_ESP), - PROTOCOL_ENTRY("ah" , ahAttributes , VIR_NWFILTER_RULE_PROTOCOL_AH), - PROTOCOL_ENTRY("sctp" , sctpAttributes , VIR_NWFILTER_RULE_PROTOCOL_SCTP), - PROTOCOL_ENTRY("icmp" , icmpAttributes , VIR_NWFILTER_RULE_PROTOCOL_ICMP), - PROTOCOL_ENTRY("all" , allAttributes , VIR_NWFILTER_RULE_PROTOCOL_ALL), - PROTOCOL_ENTRY("igmp" , igmpAttributes , VIR_NWFILTER_RULE_PROTOCOL_IGMP), - PROTOCOL_ENTRY("tcp-ipv6" , tcpipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_TCPoIPV6), - PROTOCOL_ENTRY("udp-ipv6" , udpipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_UDPoIPV6), + PROTOCOL_ENTRY("esp", espAttributes, VIR_NWFILTER_RULE_PROTOCOL_ESP), + PROTOCOL_ENTRY("ah", ahAttributes, VIR_NWFILTER_RULE_PROTOCOL_AH), + PROTOCOL_ENTRY("sctp", sctpAttributes, VIR_NWFILTER_RULE_PROTOCOL_SCTP), + PROTOCOL_ENTRY("icmp", icmpAttributes, VIR_NWFILTER_RULE_PROTOCOL_ICMP), + PROTOCOL_ENTRY("all", allAttributes, VIR_NWFILTER_RULE_PROTOCOL_ALL), + PROTOCOL_ENTRY("igmp", igmpAttributes, VIR_NWFILTER_RULE_PROTOCOL_IGMP), + PROTOCOL_ENTRY("tcp-ipv6", tcpipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_TCPoIPV6), + PROTOCOL_ENTRY("udp-ipv6", udpipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_UDPoIPV6), PROTOCOL_ENTRY("udplite-ipv6", udpliteipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_UDPLITEoIPV6), - PROTOCOL_ENTRY("esp-ipv6" , espipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_ESPoIPV6), - PROTOCOL_ENTRY("ah-ipv6" , ahipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_AHoIPV6), - PROTOCOL_ENTRY("sctp-ipv6" , sctpipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_SCTPoIPV6), - PROTOCOL_ENTRY("icmpv6" , icmpv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_ICMPV6), - PROTOCOL_ENTRY("all-ipv6" , allipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6), + PROTOCOL_ENTRY("esp-ipv6", espipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_ESPoIPV6), + PROTOCOL_ENTRY("ah-ipv6", ahipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_AHoIPV6), + PROTOCOL_ENTRY("sctp-ipv6", sctpipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_SCTPoIPV6), + PROTOCOL_ENTRY("icmpv6", icmpv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_ICMPV6), + PROTOCOL_ENTRY("all-ipv6", allipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6), PROTOCOL_ENTRY_LAST }; @@ -1779,7 +1783,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node, char *prop; bool found = false; enum attrDatatype datatype, att_datatypes; - enum virNWFilterEntryItemFlags *flags ,match_flag = 0, flags_set = 0; + enum virNWFilterEntryItemFlags *flags, match_flag = 0, flags_set = 0; nwItemDesc *item; int int_val; unsigned int uint_val; @@ -3428,7 +3432,7 @@ virNWFilterDefFormat(const virNWFilterDef *def) virBufferAddLit(&buf, ">\n"); virUUIDFormat(def->uuid, uuid); - virBufferAsprintf(&buf," <uuid>%s</uuid>\n", uuid); + virBufferAsprintf(&buf, " <uuid>%s</uuid>\n", uuid); for (i = 0; i < def->nentries; i++) { xml = virNWFilterEntryFormat(def->filterEntries[i]); diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c index 4962ddd..dc651a2 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -236,14 +236,14 @@ enum l3_proto_idx { * for prefix matching. */ static const struct ushort_map l3_protocols[] = { - USHORTMAP_ENTRY_IDX(L3_PROTO_IPV4_IDX, ETHERTYPE_IP , "ipv4"), - USHORTMAP_ENTRY_IDX(L3_PROTO_IPV6_IDX, ETHERTYPE_IPV6 , "ipv6"), - USHORTMAP_ENTRY_IDX(L3_PROTO_ARP_IDX , ETHERTYPE_ARP , "arp"), + USHORTMAP_ENTRY_IDX(L3_PROTO_IPV4_IDX, ETHERTYPE_IP, "ipv4"), + USHORTMAP_ENTRY_IDX(L3_PROTO_IPV6_IDX, ETHERTYPE_IPV6, "ipv6"), + USHORTMAP_ENTRY_IDX(L3_PROTO_ARP_IDX, ETHERTYPE_ARP, "arp"), USHORTMAP_ENTRY_IDX(L3_PROTO_RARP_IDX, ETHERTYPE_REVARP, "rarp"), - USHORTMAP_ENTRY_IDX(L2_PROTO_VLAN_IDX, ETHERTYPE_VLAN , "vlan"), - USHORTMAP_ENTRY_IDX(L2_PROTO_STP_IDX, 0 , "stp"), - USHORTMAP_ENTRY_IDX(L2_PROTO_MAC_IDX, 0 , "mac"), - USHORTMAP_ENTRY_IDX(L3_PROTO_LAST_IDX, 0 , NULL), + USHORTMAP_ENTRY_IDX(L2_PROTO_VLAN_IDX, ETHERTYPE_VLAN, "vlan"), + USHORTMAP_ENTRY_IDX(L2_PROTO_STP_IDX, 0, "stp"), + USHORTMAP_ENTRY_IDX(L2_PROTO_MAC_IDX, 0, "mac"), + USHORTMAP_ENTRY_IDX(L3_PROTO_LAST_IDX, 0, NULL), }; @@ -471,7 +471,7 @@ printCommentVar(virBufferPtr dest, const char *buf) else virBufferAddChar(dest, buf[i]); } - virBufferAddLit(dest,"'" CMD_SEPARATOR); + virBufferAddLit(dest, "'" CMD_SEPARATOR); } @@ -623,13 +623,13 @@ static int iptablesCreateBaseChains(virBufferPtr buf) "$IPT -N " VIRT_IN_POST_CHAIN CMD_SEPARATOR "$IPT -N " HOST_IN_CHAIN CMD_SEPARATOR); iptablesLinkIPTablesBaseChain(buf, - VIRT_IN_CHAIN , "FORWARD", 1, 1); + VIRT_IN_CHAIN, "FORWARD", 1, 1); iptablesLinkIPTablesBaseChain(buf, - VIRT_OUT_CHAIN , "FORWARD", 2, 1); + VIRT_OUT_CHAIN, "FORWARD", 2, 1); iptablesLinkIPTablesBaseChain(buf, VIRT_IN_POST_CHAIN, "FORWARD", 3, 1); iptablesLinkIPTablesBaseChain(buf, - HOST_IN_CHAIN , "INPUT" , 1, 1); + HOST_IN_CHAIN, "INPUT", 1, 1); return 0; } @@ -782,8 +782,8 @@ iptablesLinkTmpRootChains(virBufferPtr buf, const char *ifname) { iptablesLinkTmpRootChain(buf, VIRT_OUT_CHAIN, 'F', 0, ifname, 1); - iptablesLinkTmpRootChain(buf, VIRT_IN_CHAIN , 'F', 1, ifname, 1); - iptablesLinkTmpRootChain(buf, HOST_IN_CHAIN , 'H', 1, ifname, 1); + iptablesLinkTmpRootChain(buf, VIRT_IN_CHAIN, 'F', 1, ifname, 1); + iptablesLinkTmpRootChain(buf, HOST_IN_CHAIN, 'H', 1, ifname, 1); return 0; } @@ -896,8 +896,8 @@ iptablesUnlinkRootChains(virBufferPtr buf, const char *ifname) { iptablesUnlinkRootChain(buf, VIRT_OUT_CHAIN, 'F', 0, ifname); - iptablesUnlinkRootChain(buf, VIRT_IN_CHAIN , 'F', 1, ifname); - iptablesUnlinkRootChain(buf, HOST_IN_CHAIN , 'H', 1, ifname); + iptablesUnlinkRootChain(buf, VIRT_IN_CHAIN, 'F', 1, ifname); + iptablesUnlinkRootChain(buf, HOST_IN_CHAIN, 'H', 1, ifname); return 0; } @@ -908,8 +908,8 @@ iptablesUnlinkTmpRootChains(virBufferPtr buf, const char *ifname) { iptablesUnlinkTmpRootChain(buf, VIRT_OUT_CHAIN, 'F', 0, ifname); - iptablesUnlinkTmpRootChain(buf, VIRT_IN_CHAIN , 'F', 1, ifname); - iptablesUnlinkTmpRootChain(buf, HOST_IN_CHAIN , 'H', 1, ifname); + iptablesUnlinkTmpRootChain(buf, VIRT_IN_CHAIN, 'F', 1, ifname); + iptablesUnlinkTmpRootChain(buf, HOST_IN_CHAIN, 'H', 1, ifname); return 0; } @@ -3355,7 +3355,7 @@ ebtablesApplyDHCPOnlyRules(const char *ifname, ebtablesCreateTmpRootChain(&buf, 1, ifname, 1); ebtablesCreateTmpRootChain(&buf, 0, ifname, 1); - PRINT_ROOT_CHAIN(chain_in , CHAINPREFIX_HOST_IN_TEMP , ifname); + PRINT_ROOT_CHAIN(chain_in, CHAINPREFIX_HOST_IN_TEMP, ifname); PRINT_ROOT_CHAIN(chain_out, CHAINPREFIX_HOST_OUT_TEMP, ifname); virBufferAsprintf(&buf, @@ -3487,7 +3487,7 @@ ebtablesApplyDropAllRules(const char *ifname) ebtablesCreateTmpRootChain(&buf, 1, ifname, 1); ebtablesCreateTmpRootChain(&buf, 0, ifname, 1); - PRINT_ROOT_CHAIN(chain_in , CHAINPREFIX_HOST_IN_TEMP , ifname); + PRINT_ROOT_CHAIN(chain_in, CHAINPREFIX_HOST_IN_TEMP, ifname); PRINT_ROOT_CHAIN(chain_out, CHAINPREFIX_HOST_OUT_TEMP, ifname); virBufferAsprintf(&buf, @@ -3759,7 +3759,7 @@ ebiptablesApplyNewRules(const char *ifname, /* create needed chains */ if ((virHashSize(chains_in_set) > 0 && - ebtablesCreateTmpRootAndSubChains(&buf, ifname, chains_in_set , 1, + ebtablesCreateTmpRootAndSubChains(&buf, ifname, chains_in_set, 1, &ebtChains, &nEbtChains) < 0) || (virHashSize(chains_out_set) > 0 && ebtablesCreateTmpRootAndSubChains(&buf, ifname, chains_out_set, 0, diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c index c1dcdfe..89913cf8 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -591,7 +591,7 @@ virNWFilterRuleInstancesToArray(int nEntries, void ***ptrs, int *nptrs) { - size_t i,j; + size_t i, j; *nptrs = 0; diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index 4fc851e..00f9992 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -636,7 +636,7 @@ learnIPAddressThread(void *arg) memset(&req->thread, 0x0, sizeof(req->thread)); - VIR_DEBUG("pcap thread terminating for interface %s\n",req->ifname); + VIR_DEBUG("pcap thread terminating for interface %s\n", req->ifname); virNWFilterUnlockIface(req->ifname); -- 1.8.3.1

On 20/11/13 08:30, Eric Blake wrote:
Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check.
* src/nwfilter/nwfilter_ebiptables_driver.c: Consistently use commas. * src/nwfilter/nwfilter_gentech_driver.c: Likewise. * src/nwfilter/nwfilter_learnipaddr.c: Likewise. * src/conf/nwfilter_conf.c: Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com> --- src/conf/nwfilter_conf.c | 92 ++++++++++++++++--------------- src/nwfilter/nwfilter_ebiptables_driver.c | 40 +++++++------- src/nwfilter/nwfilter_gentech_driver.c | 2 +- src/nwfilter/nwfilter_learnipaddr.c | 2 +- 4 files changed, 70 insertions(+), 66 deletions(-)
ACK

Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * src/conf/capabilities.c: Consistently use commas. * src/conf/domain_conf.c: Likewise. * src/conf/network_conf.c: Likewise. * src/conf/storage_conf.c: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com> --- src/conf/capabilities.c | 2 +- src/conf/domain_conf.c | 4 +- src/conf/network_conf.c | 6 +-- src/conf/storage_conf.c | 97 +++++++++++++++++++++++++------------------------ 4 files changed, 55 insertions(+), 54 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 2b3166f..726ec3f 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -813,7 +813,7 @@ virCapabilitiesFormatXML(virCapsPtr caps) virBufferAddLit(&xml, " <host>\n"); if (virUUIDIsValid(caps->host.host_uuid)) { virUUIDFormat(caps->host.host_uuid, host_uuid); - virBufferAsprintf(&xml," <uuid>%s</uuid>\n", host_uuid); + virBufferAsprintf(&xml, " <uuid>%s</uuid>\n", host_uuid); } virBufferAddLit(&xml, " <cpu>\n"); if (caps->host.arch) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d3f1ca2..7b0e3ea 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14336,7 +14336,7 @@ virDomainDiskBlockIoDefFormat(virBufferPtr buf, { if (def->blockio.logical_block_size > 0 || def->blockio.physical_block_size > 0) { - virBufferAddLit(buf," <blockio"); + virBufferAddLit(buf, " <blockio"); if (def->blockio.logical_block_size > 0) { virBufferAsprintf(buf, " logical_block_size='%u'", @@ -14363,7 +14363,7 @@ virDomainDiskSourceDefFormat(virBufferPtr buf, def->startupPolicy) { switch (def->type) { case VIR_DOMAIN_DISK_TYPE_FILE: - virBufferAddLit(buf," <source"); + virBufferAddLit(buf, " <source"); if (def->src) virBufferEscapeString(buf, " file='%s'", def->src); if (def->startupPolicy) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 447eca4..481fc5b 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -2393,7 +2393,7 @@ virNetworkIpDefFormat(virBufferPtr buf, VIR_FREE(addr); } if (def->prefix > 0) { - virBufferAsprintf(buf," prefix='%u'", def->prefix); + virBufferAsprintf(buf, " prefix='%u'", def->prefix); } virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); @@ -2492,7 +2492,7 @@ virNetworkRouteDefFormat(virBufferPtr buf, VIR_FREE(addr); } if (def->has_prefix) { - virBufferAsprintf(buf," prefix='%u'", def->prefix); + virBufferAsprintf(buf, " prefix='%u'", def->prefix); } if (VIR_SOCKET_ADDR_VALID(&def->gateway)) { char *addr = virSocketAddrFormat(&def->gateway); @@ -2502,7 +2502,7 @@ virNetworkRouteDefFormat(virBufferPtr buf, VIR_FREE(addr); } if (def->has_metric && def->metric > 0) { - virBufferAsprintf(buf," metric='%u'", def->metric); + virBufferAsprintf(buf, " metric='%u'", def->metric); } virBufferAddLit(buf, "/>\n"); diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 975e662..33e4caf 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1053,7 +1053,7 @@ virStoragePoolSourceFormat(virBufferPtr buf, size_t i, j; char uuid[VIR_UUID_STRING_BUFLEN]; - virBufferAddLit(buf," <source>\n"); + virBufferAddLit(buf, " <source>\n"); if ((options->flags & VIR_STORAGE_POOL_SOURCE_HOST) && src->nhost) { for (i = 0; i < src->nhost; i++) { virBufferAsprintf(buf, " <host name='%s'", src->hosts[i].name); @@ -1067,14 +1067,14 @@ virStoragePoolSourceFormat(virBufferPtr buf, src->ndevice) { for (i = 0; i < src->ndevice; i++) { if (src->devices[i].nfreeExtent) { - virBufferAsprintf(buf," <device path='%s'>\n", + virBufferAsprintf(buf, " <device path='%s'>\n", src->devices[i].path); for (j = 0; j < src->devices[i].nfreeExtent; j++) { virBufferAsprintf(buf, " <freeExtent start='%llu' end='%llu'/>\n", src->devices[i].freeExtents[j].start, src->devices[i].freeExtents[j].end); } - virBufferAddLit(buf," </device>\n"); + virBufferAddLit(buf, " </device>\n"); } else { virBufferAsprintf(buf, " <device path='%s'/>\n", src->devices[i].path); @@ -1084,7 +1084,7 @@ virStoragePoolSourceFormat(virBufferPtr buf, if ((options->flags & VIR_STORAGE_POOL_SOURCE_DIR) && src->dir) - virBufferAsprintf(buf," <dir path='%s'/>\n", src->dir); + virBufferAsprintf(buf, " <dir path='%s'/>\n", src->dir); if ((options->flags & VIR_STORAGE_POOL_SOURCE_ADAPTER)) { if (src->adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST || @@ -1095,24 +1095,25 @@ virStoragePoolSourceFormat(virBufferPtr buf, if (src->adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) { virBufferEscapeString(buf, " parent='%s'", src->adapter.data.fchost.parent); - virBufferAsprintf(buf," wwnn='%s' wwpn='%s'/>\n", + virBufferAsprintf(buf, " wwnn='%s' wwpn='%s'/>\n", src->adapter.data.fchost.wwnn, src->adapter.data.fchost.wwpn); } else if (src->adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) { - virBufferAsprintf(buf," name='%s'/>\n", src->adapter.data.name); + virBufferAsprintf(buf, " name='%s'/>\n", src->adapter.data.name); } } if ((options->flags & VIR_STORAGE_POOL_SOURCE_NAME) && src->name) - virBufferAsprintf(buf," <name>%s</name>\n", src->name); + virBufferAsprintf(buf, " <name>%s</name>\n", src->name); if ((options->flags & VIR_STORAGE_POOL_SOURCE_INITIATOR_IQN) && src->initiator.iqn) { - virBufferAddLit(buf," <initiator>\n"); - virBufferEscapeString(buf," <iqn name='%s'/>\n", src->initiator.iqn); - virBufferAddLit(buf," </initiator>\n"); + virBufferAddLit(buf, " <initiator>\n"); + virBufferEscapeString(buf, " <iqn name='%s'/>\n", + src->initiator.iqn); + virBufferAddLit(buf, " </initiator>\n"); } if (options->formatToString) { @@ -1123,40 +1124,40 @@ virStoragePoolSourceFormat(virBufferPtr buf, src->format); return -1; } - virBufferAsprintf(buf," <format type='%s'/>\n", format); + virBufferAsprintf(buf, " <format type='%s'/>\n", format); } if (src->authType == VIR_STORAGE_POOL_AUTH_CHAP || src->authType == VIR_STORAGE_POOL_AUTH_CEPHX) { - virBufferAsprintf(buf," <auth type='%s' username='%s'>\n", + virBufferAsprintf(buf, " <auth type='%s' username='%s'>\n", virStoragePoolAuthTypeTypeToString(src->authType), (src->authType == VIR_STORAGE_POOL_AUTH_CHAP ? src->auth.chap.username : src->auth.cephx.username)); - virBufferAddLit(buf," <secret"); + virBufferAddLit(buf, " <secret"); if (src->auth.cephx.secret.uuidUsable) { virUUIDFormat(src->auth.cephx.secret.uuid, uuid); - virBufferAsprintf(buf," uuid='%s'", uuid); + virBufferAsprintf(buf, " uuid='%s'", uuid); } if (src->auth.cephx.secret.usage != NULL) { - virBufferAsprintf(buf," usage='%s'", src->auth.cephx.secret.usage); + virBufferAsprintf(buf, " usage='%s'", src->auth.cephx.secret.usage); } - virBufferAddLit(buf,"/>\n"); + virBufferAddLit(buf, "/>\n"); - virBufferAddLit(buf," </auth>\n"); + virBufferAddLit(buf, " </auth>\n"); } if (src->vendor != NULL) { - virBufferEscapeString(buf," <vendor name='%s'/>\n", src->vendor); + virBufferEscapeString(buf, " <vendor name='%s'/>\n", src->vendor); } if (src->product != NULL) { - virBufferEscapeString(buf," <product name='%s'/>\n", src->product); + virBufferEscapeString(buf, " <product name='%s'/>\n", src->product); } - virBufferAddLit(buf," </source>\n"); + virBufferAddLit(buf, " </source>\n"); return 0; } @@ -1181,16 +1182,16 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) goto cleanup; } virBufferAsprintf(&buf, "<pool type='%s'>\n", type); - virBufferAsprintf(&buf," <name>%s</name>\n", def->name); + virBufferAsprintf(&buf, " <name>%s</name>\n", def->name); virUUIDFormat(def->uuid, uuid); - virBufferAsprintf(&buf," <uuid>%s</uuid>\n", uuid); + virBufferAsprintf(&buf, " <uuid>%s</uuid>\n", uuid); - virBufferAsprintf(&buf," <capacity unit='bytes'>%llu</capacity>\n", + virBufferAsprintf(&buf, " <capacity unit='bytes'>%llu</capacity>\n", def->capacity); - virBufferAsprintf(&buf," <allocation unit='bytes'>%llu</allocation>\n", + virBufferAsprintf(&buf, " <allocation unit='bytes'>%llu</allocation>\n", def->allocation); - virBufferAsprintf(&buf," <available unit='bytes'>%llu</available>\n", + virBufferAsprintf(&buf, " <available unit='bytes'>%llu</available>\n", def->available); if (virStoragePoolSourceFormat(&buf, options, &def->source) < 0) @@ -1200,27 +1201,27 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) * doesn't have a target */ if (def->type != VIR_STORAGE_POOL_RBD && def->type != VIR_STORAGE_POOL_SHEEPDOG) { - virBufferAddLit(&buf," <target>\n"); + virBufferAddLit(&buf, " <target>\n"); if (def->target.path) - virBufferAsprintf(&buf," <path>%s</path>\n", def->target.path); + virBufferAsprintf(&buf, " <path>%s</path>\n", def->target.path); - virBufferAddLit(&buf," <permissions>\n"); - virBufferAsprintf(&buf," <mode>0%o</mode>\n", + virBufferAddLit(&buf, " <permissions>\n"); + virBufferAsprintf(&buf, " <mode>0%o</mode>\n", def->target.perms.mode); - virBufferAsprintf(&buf," <owner>%d</owner>\n", + virBufferAsprintf(&buf, " <owner>%d</owner>\n", (int) def->target.perms.uid); - virBufferAsprintf(&buf," <group>%d</group>\n", + virBufferAsprintf(&buf, " <group>%d</group>\n", (int) def->target.perms.gid); if (def->target.perms.label) - virBufferAsprintf(&buf," <label>%s</label>\n", + virBufferAsprintf(&buf, " <label>%s</label>\n", def->target.perms.label); - virBufferAddLit(&buf," </permissions>\n"); - virBufferAddLit(&buf," </target>\n"); + virBufferAddLit(&buf, " </permissions>\n"); + virBufferAddLit(&buf, " </target>\n"); } - virBufferAddLit(&buf,"</pool>\n"); + virBufferAddLit(&buf, "</pool>\n"); if (virBufferError(&buf)) goto no_memory; @@ -1488,7 +1489,7 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options, virBufferAsprintf(buf, " <%s>\n", type); if (def->path) - virBufferAsprintf(buf," <path>%s</path>\n", def->path); + virBufferAsprintf(buf, " <path>%s</path>\n", def->path); if (options->formatToString) { const char *format = (options->formatToString)(def->format); @@ -1498,23 +1499,23 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options, def->format); return -1; } - virBufferAsprintf(buf," <format type='%s'/>\n", format); + virBufferAsprintf(buf, " <format type='%s'/>\n", format); } - virBufferAddLit(buf," <permissions>\n"); - virBufferAsprintf(buf," <mode>0%o</mode>\n", + virBufferAddLit(buf, " <permissions>\n"); + virBufferAsprintf(buf, " <mode>0%o</mode>\n", def->perms.mode); - virBufferAsprintf(buf," <owner>%u</owner>\n", + virBufferAsprintf(buf, " <owner>%u</owner>\n", (unsigned int) def->perms.uid); - virBufferAsprintf(buf," <group>%u</group>\n", + virBufferAsprintf(buf, " <group>%u</group>\n", (unsigned int) def->perms.gid); if (def->perms.label) - virBufferAsprintf(buf," <label>%s</label>\n", + virBufferAsprintf(buf, " <label>%s</label>\n", def->perms.label); - virBufferAddLit(buf," </permissions>\n"); + virBufferAddLit(buf, " </permissions>\n"); if (def->timestamps) { virBufferAddLit(buf, " <timestamps>\n"); @@ -1571,8 +1572,8 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool, return NULL; virBufferAddLit(&buf, "<volume>\n"); - virBufferAsprintf(&buf," <name>%s</name>\n", def->name); - virBufferAsprintf(&buf," <key>%s</key>\n", NULLSTR(def->key)); + virBufferAsprintf(&buf, " <name>%s</name>\n", def->name); + virBufferAsprintf(&buf, " <key>%s</key>\n", NULLSTR(def->key)); virBufferAddLit(&buf, " <source>\n"); if (def->source.nextent) { @@ -1599,9 +1600,9 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool, } virBufferAddLit(&buf, " </source>\n"); - virBufferAsprintf(&buf," <capacity unit='bytes'>%llu</capacity>\n", + virBufferAsprintf(&buf, " <capacity unit='bytes'>%llu</capacity>\n", def->capacity); - virBufferAsprintf(&buf," <allocation unit='bytes'>%llu</allocation>\n", + virBufferAsprintf(&buf, " <allocation unit='bytes'>%llu</allocation>\n", def->allocation); if (virStorageVolTargetDefFormat(options, &buf, @@ -1613,7 +1614,7 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool, &def->backingStore, "backingStore") < 0) goto cleanup; - virBufferAddLit(&buf,"</volume>\n"); + virBufferAddLit(&buf, "</volume>\n"); if (virBufferError(&buf)) goto no_memory; -- 1.8.3.1

On 20/11/13 08:30, Eric Blake wrote:
Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check.
* src/conf/capabilities.c: Consistently use commas. * src/conf/domain_conf.c: Likewise. * src/conf/network_conf.c: Likewise. * src/conf/storage_conf.c: Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com> --- src/conf/capabilities.c | 2 +- src/conf/domain_conf.c | 4 +- src/conf/network_conf.c | 6 +-- src/conf/storage_conf.c | 97 +++++++++++++++++++++++++------------------------ 4 files changed, 55 insertions(+), 54 deletions(-)
ACK

Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * src/libxl/libxl_driver.c: Consistently use commas. * src/xen/xend_internal.c: Likewise. * src/xen/xs_internal.c: Likewise. * src/xenapi/xenapi_driver.c: Likewise. * src/xenapi/xenapi_utils.c: Likewise. * src/xenxs/xen_sxpr.c: Likewise. * src/xenxs/xen_xm.c: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com> --- src/libxl/libxl_driver.c | 2 +- src/xen/xend_internal.c | 2 +- src/xen/xs_internal.c | 4 ++-- src/xenapi/xenapi_driver.c | 10 +++++----- src/xenapi/xenapi_utils.c | 30 +++++++++++++++--------------- src/xenxs/xen_sxpr.c | 2 +- src/xenxs/xen_xm.c | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 7a75a04..1b42f14 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1501,7 +1501,7 @@ libxlDomainDestroyFlags(virDomainPtr dom, goto cleanup; } - event = virDomainEventNewFromObj(vm,VIR_DOMAIN_EVENT_STOPPED, + event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); if (libxlVmReap(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED) != 0) { diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index dc57350..dac9a79 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -549,7 +549,7 @@ xend_op(virConnectPtr xend, const char *name, const char *key, ...) * Returns a parsed S-Expression in case of success, NULL in case of failure */ static struct sexpr *sexpr_get(virConnectPtr xend, const char *fmt, ...) - ATTRIBUTE_FMT_PRINTF(2,3); + ATTRIBUTE_FMT_PRINTF(2, 3); static struct sexpr * sexpr_get(virConnectPtr xend, const char *fmt, ...) diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index 4368f85..9748a77 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -815,7 +815,7 @@ retry: if (new_domain_cnt < 0) return -1; - if (VIR_ALLOC_N(new_domids,new_domain_cnt) < 0) + if (VIR_ALLOC_N(new_domids, new_domain_cnt) < 0) return -1; nread = xenStoreDoListDomains(conn, priv, new_domids, new_domain_cnt); if (nread != new_domain_cnt) { @@ -898,7 +898,7 @@ retry: if (new_domain_cnt < 0) return -1; - if (VIR_ALLOC_N(new_domids,new_domain_cnt) < 0) + if (VIR_ALLOC_N(new_domids, new_domain_cnt) < 0) return -1; nread = xenStoreDoListDomains(conn, priv, new_domids, new_domain_cnt); if (nread != new_domain_cnt) { diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c index 5a798e7..2c6fdce 100644 --- a/src/xenapi/xenapi_driver.c +++ b/src/xenapi/xenapi_driver.c @@ -1,6 +1,6 @@ /* * xenapi_driver.c: Xen API driver. - * Copyright (C) 2011-2012 Red Hat, Inc. + * Copyright (C) 2011-2013 Red Hat, Inc. * Copyright (C) 2009, 2010 Citrix Ltd. * * This library is free software; you can redistribute it and/or @@ -637,7 +637,7 @@ xenapiDomainLookupByUUID(virConnectPtr conn, char uuidStr[VIR_UUID_STRING_BUFLEN]; virDomainPtr domP = NULL; xen_session *session = ((struct _xenapiPrivate *)(conn->privateData))->session; - virUUIDFormat(uuid,uuidStr); + virUUIDFormat(uuid, uuidStr); if (xen_vm_get_by_uuid(session, &vm, uuidStr)) { xen_vm_get_record(session, &record, vm); if (record != NULL) { @@ -1393,7 +1393,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) if (VIR_STRDUP(defPtr->name, dom->name) < 0) goto error; xen_vm_get_hvm_boot_policy(session, &boot_policy, vm); - if (STREQ(boot_policy,"BIOS order")) { + if (STREQ(boot_policy, "BIOS order")) { if (VIR_STRDUP(defPtr->os.type, "hvm") < 0) { VIR_FREE(boot_policy); goto error; @@ -2019,7 +2019,7 @@ write_func(void *ptr, size_t size, size_t nmemb, void *comms_) size_t n = size * nmemb; #ifdef PRINT_XML printf("\n\n---Result from server -----------------------\n"); - printf("%s\n",((char*) ptr)); + printf("%s\n", (char*) ptr); fflush(stdout); #endif return (size_t) (comms->func(ptr, n, comms->handle) ? n : 0); @@ -2036,7 +2036,7 @@ call_func(const void *data, size_t len, void *user_handle, struct _xenapiPrivate *priv = (struct _xenapiPrivate *)user_handle; #ifdef PRINT_XML printf("\n\n---Data to server: -----------------------\n"); - printf("%s\n",((char*) data)); + printf("%s\n", (char*) data); fflush(stdout); #endif CURL *curl = curl_easy_init(); diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c index 02d4885..427fc21 100644 --- a/src/xenapi/xenapi_utils.c +++ b/src/xenapi/xenapi_utils.c @@ -1,6 +1,6 @@ /* * xenapi_utils.c: Xen API driver -- utils parts. - * Copyright (C) 2011-2012 Red Hat, Inc. + * Copyright (C) 2011-2013 Red Hat, Inc. * Copyright (C) 2009, 2010 Citrix Ltd. * * This library is free software; you can redistribute it and/or @@ -172,7 +172,7 @@ createXenAPIBootOrderString(int nboot, int *bootDevs) else if (bootDevs[i] == VIR_DOMAIN_BOOT_NET) val = (char *)"n"; if (val) - virBufferEscapeString(&ret,"%s",val); + virBufferEscapeString(&ret, "%s", val); } return virBufferContentAndReset(&ret); } @@ -231,20 +231,20 @@ xenapiCrashExitEnum2virDomainLifecycle(enum xen_on_crash_behaviour action) int getStorageVolumeType(char *type) { - if (STREQ(type,"lvmoiscsi") || - STREQ(type,"lvmohba") || - STREQ(type,"lvm") || - STREQ(type,"file") || - STREQ(type,"iso") || - STREQ(type,"ext") || - STREQ(type,"nfs")) + if (STREQ(type, "lvmoiscsi") || + STREQ(type, "lvmohba") || + STREQ(type, "lvm") || + STREQ(type, "file") || + STREQ(type, "iso") || + STREQ(type, "ext") || + STREQ(type, "nfs")) return (int)VIR_STORAGE_VOL_FILE; - else if (STREQ(type,"iscsi") || - STREQ(type,"equal") || - STREQ(type,"hba") || - STREQ(type,"cslg") || - STREQ(type,"udev") || - STREQ(type,"netapp")) + else if (STREQ(type, "iscsi") || + STREQ(type, "equal") || + STREQ(type, "hba") || + STREQ(type, "cslg") || + STREQ(type, "udev") || + STREQ(type, "netapp")) return (int)VIR_STORAGE_VOL_BLOCK; return -1; } diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index d23a3ca..d514725 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -2257,7 +2257,7 @@ xenFormatSxpr(virConnectPtr conn, if (hvm && def->os.loader == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, - "%s",_("no HVM domain loader")); + "%s", _("no HVM domain loader")); goto error; } diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c index 88374f4..5e89876 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -1891,7 +1891,7 @@ virConfPtr xenFormatXM(virConnectPtr conn, netVal->list = NULL; for (i = 0; i < def->nnets; i++) { - if (xenFormatXMNet(conn, netVal,def->nets[i], + if (xenFormatXMNet(conn, netVal, def->nets[i], hvm, xendConfigVersion) < 0) goto cleanup; } -- 1.8.3.1

On 20/11/13 08:30, Eric Blake wrote:
Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check.
* src/libxl/libxl_driver.c: Consistently use commas. * src/xen/xend_internal.c: Likewise. * src/xen/xs_internal.c: Likewise. * src/xenapi/xenapi_driver.c: Likewise. * src/xenapi/xenapi_utils.c: Likewise. * src/xenxs/xen_sxpr.c: Likewise. * src/xenxs/xen_xm.c: Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
ACK

Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * src/qemu/qemu_cgroup.c: Consistently use commas. * src/qemu/qemu_command.c: Likewise. * src/qemu/qemu_conf.c: Likewise. * src/qemu/qemu_driver.c: Likewise. * src/qemu/qemu_monitor.c: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com> --- src/qemu/qemu_cgroup.c | 2 +- src/qemu/qemu_command.c | 4 ++-- src/qemu/qemu_conf.c | 3 ++- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_monitor.c | 12 ++++++------ 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index ace7e35..f0cacd0 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -417,7 +417,7 @@ qemuSetupMemoryCgroup(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; - if (!virCgroupHasController(priv->cgroup,VIR_CGROUP_CONTROLLER_MEMORY)) { + if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) { if (vm->def->mem.hard_limit != 0 || vm->def->mem.soft_limit != 0 || vm->def->mem.swap_hard_limit != 0) { diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6668fed..bf325a9 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1149,7 +1149,7 @@ int qemuDomainCCWAddressAssign(virDomainDeviceInfoPtr dev, return 0; } - if (virHashAddEntry(addrs->defined,addr,addr) < 0) + if (virHashAddEntry(addrs->defined, addr, addr) < 0) goto cleanup; else addr = NULL; /* memory will be freed by hash table */ @@ -1179,7 +1179,7 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def, } for (i = 0; i < def->nnets; i++) { - if (STREQ(def->nets[i]->model,"virtio") && + if (STREQ(def->nets[i]->model, "virtio") && def->nets[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { def->nets[i]->info.type = type; } diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 03c9c7d..5803850 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -216,7 +216,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged) if (VIR_STRDUP(cfg->spiceListen, "127.0.0.1") < 0) goto error; - if (VIR_STRDUP(cfg->spiceTLSx509certdir , SYSCONFDIR "/pki/libvirt-spice") < 0) + if (VIR_STRDUP(cfg->spiceTLSx509certdir, + SYSCONFDIR "/pki/libvirt-spice") < 0) goto error; cfg->remotePortMin = QEMU_REMOTE_PORT_MIN; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 378b542..795e72a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1918,7 +1918,7 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags) int agentFlag = QEMU_AGENT_SHUTDOWN_REBOOT; virCheckFlags(VIR_DOMAIN_REBOOT_ACPI_POWER_BTN | - VIR_DOMAIN_REBOOT_GUEST_AGENT , -1); + VIR_DOMAIN_REBOOT_GUEST_AGENT, -1); /* At most one of these two flags should be set. */ if ((flags & VIR_DOMAIN_REBOOT_ACPI_POWER_BTN) && diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f7bf49a..1514715 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -239,8 +239,8 @@ static char * qemuMonitorEscapeNonPrintable(const char *text) for (i = 0; text[i] != '\0'; i++) { if (c_isprint(text[i]) || text[i] == '\n' || - (text[i] == '\r' && text[i+1] == '\n')) - virBufferAsprintf(&buf,"%c", text[i]); + (text[i] == '\r' && text[i + 1] == '\n')) + virBufferAddChar(&buf, text[i]); else virBufferAsprintf(&buf, "0x%02x", text[i]); } @@ -3040,7 +3040,7 @@ int qemuMonitorCreateSnapshot(qemuMonitorPtr mon, const char *name) { int ret; - VIR_DEBUG("mon=%p, name=%s",mon,name); + VIR_DEBUG("mon=%p, name=%s", mon, name); if (!mon) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -3059,7 +3059,7 @@ int qemuMonitorLoadSnapshot(qemuMonitorPtr mon, const char *name) { int ret; - VIR_DEBUG("mon=%p, name=%s",mon,name); + VIR_DEBUG("mon=%p, name=%s", mon, name); if (!mon) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -3078,7 +3078,7 @@ int qemuMonitorDeleteSnapshot(qemuMonitorPtr mon, const char *name) { int ret; - VIR_DEBUG("mon=%p, name=%s",mon,name); + VIR_DEBUG("mon=%p, name=%s", mon, name); if (!mon) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -3276,7 +3276,7 @@ int qemuMonitorScreendump(qemuMonitorPtr mon, VIR_DEBUG("mon=%p, file=%s", mon, file); if (!mon) { - virReportError(VIR_ERR_INVALID_ARG,"%s", + virReportError(VIR_ERR_INVALID_ARG, "%s", _("monitor must not be NULL")); return -1; } -- 1.8.3.1

On 20/11/13 08:30, Eric Blake wrote:
Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check.
* src/qemu/qemu_cgroup.c: Consistently use commas. * src/qemu/qemu_command.c: Likewise. * src/qemu/qemu_conf.c: Likewise. * src/qemu/qemu_driver.c: Likewise. * src/qemu/qemu_monitor.c: Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com> --- src/qemu/qemu_cgroup.c | 2 +- src/qemu/qemu_command.c | 4 ++-- src/qemu/qemu_conf.c | 3 ++- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_monitor.c | 12 ++++++------ 5 files changed, 12 insertions(+), 11 deletions(-)
ACK

Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * tests/sysinfotest.c: Consistently use commas. * tests/viratomictest.c: Likewise. * tests/vircgroupmock.c: Likewise. * tools/virsh-domain.c: Likewise. * tools/virsh-volume.c: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com> --- tests/sysinfotest.c | 3 ++- tests/viratomictest.c | 4 ++-- tests/vircgroupmock.c | 2 +- tools/virsh-domain.c | 2 +- tools/virsh-volume.c | 9 +++++---- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/sysinfotest.c b/tests/sysinfotest.c index 6d287b1..8357701 100644 --- a/tests/sysinfotest.c +++ b/tests/sysinfotest.c @@ -1,6 +1,7 @@ /* * sysinfotest.c: Testcase(s) for virSysinfoRead * + * Copyright (C) 2013 Red Hat, Inc. * Copyright IBM Corp. 2012 * * This library is free software; you can redistribute it and/or @@ -75,7 +76,7 @@ testSysinfo(const void *data) goto cleanup; } - if (virSysinfoFormat(&buf,ret) < 0) + if (virSysinfoFormat(&buf, ret) < 0) goto cleanup; if (!(sysfsActualData = virBufferCurrentContent(&buf))) diff --git a/tests/viratomictest.c b/tests/viratomictest.c index d092b95..49dd388 100644 --- a/tests/viratomictest.c +++ b/tests/viratomictest.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2012 Red Hat, Inc. + * Copyright (C) 2011-2013 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -123,7 +123,7 @@ thread_func(void *data) bucket[idx] += d; virAtomicIntAdd(&atomic, d); #ifdef WIN32 - SleepEx(0,0); + SleepEx(0, 0); #else sched_yield(); #endif diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c index 3167a5c..6542973 100644 --- a/tests/vircgroupmock.c +++ b/tests/vircgroupmock.c @@ -399,7 +399,7 @@ static void init_sysfs(void) # define MAKE_CONTROLLER(subpath) \ do { \ char *path; \ - if (asprintf(&path,"%s/%s", fakesysfsdir, subpath) < 0) \ + if (asprintf(&path, "%s/%s", fakesysfsdir, subpath) < 0)\ abort(); \ if (make_controller(path, 0755) < 0) { \ fprintf(stderr, "Cannot initialize %s\n", path); \ diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 60abd3d..1fe138c 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2568,7 +2568,7 @@ cmdDomIftune(vshControl *ctl, const vshCmd *cmd) goto cleanup; if (vshCommandOptStringReq(ctl, cmd, "inbound", &inboundStr) < 0 || - vshCommandOptStringReq(ctl,cmd, "outbound", &outboundStr) < 0) + vshCommandOptStringReq(ctl, cmd, "outbound", &outboundStr) < 0) goto cleanup; memset(&inbound, 0, sizeof(inbound)); diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 55a99d0..cbdb3f0 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -1,7 +1,7 @@ /* * virsh-volume.c: Commands to manage storage volume * - * Copyright (C) 2005, 2007-2012 Red Hat, Inc. + * Copyright (C) 2005, 2007-2013 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -211,7 +211,7 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) if (format) { virBufferAddLit(&buf, " <target>\n"); - virBufferAsprintf(&buf, " <format type='%s'/>\n",format); + virBufferAsprintf(&buf, " <format type='%s'/>\n", format); virBufferAddLit(&buf, " </target>\n"); } @@ -265,9 +265,10 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) /* Create XML for the backing store */ virBufferAddLit(&buf, " <backingStore>\n"); - virBufferAsprintf(&buf, " <path>%s</path>\n",snapshotStrVolPath); + virBufferAsprintf(&buf, " <path>%s</path>\n", snapshotStrVolPath); if (snapshotStrFormat) - virBufferAsprintf(&buf, " <format type='%s'/>\n",snapshotStrFormat); + virBufferAsprintf(&buf, " <format type='%s'/>\n", + snapshotStrFormat); virBufferAddLit(&buf, " </backingStore>\n"); /* Cleanup snapshot allocations */ -- 1.8.3.1

On 20/11/13 08:30, Eric Blake wrote:
Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check.
* tests/sysinfotest.c: Consistently use commas. * tests/viratomictest.c: Likewise. * tests/vircgroupmock.c: Likewise. * tools/virsh-domain.c: Likewise. * tools/virsh-volume.c: Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com> --- tests/sysinfotest.c | 3 ++- tests/viratomictest.c | 4 ++-- tests/vircgroupmock.c | 2 +- tools/virsh-domain.c | 2 +- tools/virsh-volume.c | 9 +++++---- 5 files changed, 11 insertions(+), 9 deletions(-)
ACK

Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * src/util/vircommand.c: Consistently use commas. * src/util/virlog.c: Likewise. * src/util/virnetdevbandwidth.c: Likewise. * src/util/virnetdevmacvlan.c: Likewise. * src/util/virnetdevvportprofile.c: Likewise. * src/util/virnetlink.c: Likewise. * src/util/virpci.c: Likewise. * src/util/virsysinfo.c: Likewise. * src/util/virusb.c: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com> --- src/util/vircommand.c | 4 ++-- src/util/virlog.c | 2 +- src/util/virnetdevbandwidth.c | 4 ++-- src/util/virnetdevmacvlan.c | 2 +- src/util/virnetdevvportprofile.c | 2 +- src/util/virnetlink.c | 2 +- src/util/virpci.c | 3 ++- src/util/virsysinfo.c | 2 +- src/util/virusb.c | 2 +- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 8dcf9e7..a52a1ab 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -399,8 +399,8 @@ virExec(virCommandPtr cmd) { pid_t pid; int null = -1, fd, openmax; - int pipeout[2] = {-1,-1}; - int pipeerr[2] = {-1,-1}; + int pipeout[2] = {-1, -1}; + int pipeerr[2] = {-1, -1}; int childin = cmd->infd; int childout = -1; int childerr = -1; diff --git a/src/util/virlog.c b/src/util/virlog.c index 5b7e7b0..dfb4d69 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1183,7 +1183,7 @@ virLogOutputToJournald(virLogSource source, state.bufs = iov_bufs; state.bufs_end = iov_bufs + ARRAY_CARDINALITY(iov_bufs); - journalAddString(&state ,"MESSAGE", rawstr); + journalAddString(&state, "MESSAGE", rawstr); journalAddInt(&state, "PRIORITY", priority); journalAddString(&state, "LIBVIRT_SOURCE", virLogSourceTypeToString(source)); diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c index 317aa21..ed6a19d 100644 --- a/src/util/virnetdevbandwidth.c +++ b/src/util/virnetdevbandwidth.c @@ -167,7 +167,7 @@ virNetDevBandwidthSet(const char *ifname, } virCommandFree(cmd); cmd = virCommandNew(TC); - virCommandAddArgList(cmd,"class", "add", "dev", ifname, "parent", + virCommandAddArgList(cmd, "class", "add", "dev", ifname, "parent", hierarchical_class ? "1:1" : "1:", "classid", hierarchical_class ? "1:2" : "1:1", "htb", "rate", average, NULL); @@ -192,7 +192,7 @@ virNetDevBandwidthSet(const char *ifname, virCommandFree(cmd); cmd = virCommandNew(TC); - virCommandAddArgList(cmd,"filter", "add", "dev", ifname, "parent", + virCommandAddArgList(cmd, "filter", "add", "dev", ifname, "parent", "1:0", "protocol", "ip", "handle", "1", "fw", "flowid", "1", NULL); diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index 77cbd6d..e984bf2 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -332,7 +332,7 @@ int virNetDevMacVLanTapOpen(const char *ifname, if (fscanf(file, "%d", &ifindex) != 1) { virReportSystemError(errno, - "%s",_("cannot determine macvtap's tap device " + "%s", _("cannot determine macvtap's tap device " "interface index")); VIR_FORCE_FCLOSE(file); return -1; diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c index b84001a..c87837c 100644 --- a/src/util/virnetdevvportprofile.c +++ b/src/util/virnetdevvportprofile.c @@ -841,7 +841,7 @@ virNetDevVPortProfileOpCommon(const char *ifname, int ifindex, int rc; int src_pid = 0; uint32_t dst_pid = 0; - struct nlattr *tb[IFLA_MAX + 1] = { NULL , }; + struct nlattr *tb[IFLA_MAX + 1] = { NULL, }; int repeats = STATUS_POLL_TIMEOUT_USEC / STATUS_POLL_INTERVL_USEC; uint16_t status = 0; bool is8021Qbg = (profileId == NULL); diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c index 901df6e..ba6c4b5 100644 --- a/src/util/virnetlink.c +++ b/src/util/virnetlink.c @@ -660,7 +660,7 @@ addentry: virMacAddrSet(&srv->handles[r].macaddr, macaddr); else virMacAddrSetRaw(&srv->handles[r].macaddr, - (unsigned char[VIR_MAC_BUFLEN]){0,0,0,0,0,0}); + (unsigned char[VIR_MAC_BUFLEN]){0, 0, 0, 0, 0, 0}); VIR_DEBUG("added client to loop slot: %d. with macaddr ptr=%p", r, macaddr); diff --git a/src/util/virpci.c b/src/util/virpci.c index 8a3a492..8ec642f 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -374,7 +374,8 @@ virPCIDeviceWrite32(virPCIDevicePtr dev, int cfgfd, unsigned int pos, uint32_t v virPCIDeviceWrite(dev, cfgfd, pos, &buf[0], sizeof(buf)); } -typedef int (*virPCIDeviceIterPredicate)(virPCIDevicePtr , virPCIDevicePtr , void *); +typedef int (*virPCIDeviceIterPredicate)(virPCIDevicePtr, virPCIDevicePtr, + void *); /* Iterate over available PCI devices calling @predicate * to compare each one to @dev. diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 1c8cae5..18f426d 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -756,7 +756,7 @@ virSysinfoParseMemory(const char *base, virSysinfoDefPtr ret) cur += 9; eol = strchr(cur, '\n'); virSkipSpacesBackwards(cur, &eol); - if (eol && VIR_STRNDUP(memory->memory_locator,cur, eol - cur) < 0) + if (eol && VIR_STRNDUP(memory->memory_locator, cur, eol - cur) < 0) return -1; } if ((cur = strstr(base, "Bank Locator: ")) != NULL) { diff --git a/src/util/virusb.c b/src/util/virusb.c index e901618..3c82200 100644 --- a/src/util/virusb.c +++ b/src/util/virusb.c @@ -216,7 +216,7 @@ virUSBDeviceFindByVendor(unsigned int vendor, virUSBDeviceListPtr list; int count; - if (!(list = virUSBDeviceSearch(vendor, product, 0 , 0, + if (!(list = virUSBDeviceSearch(vendor, product, 0, 0, vroot, USB_DEVICE_FIND_BY_VENDOR))) return -1; -- 1.8.3.1

On 20/11/13 08:30, Eric Blake wrote:
Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check.
* src/util/vircommand.c: Consistently use commas. * src/util/virlog.c: Likewise. * src/util/virnetdevbandwidth.c: Likewise. * src/util/virnetdevmacvlan.c: Likewise. * src/util/virnetdevvportprofile.c: Likewise. * src/util/virnetlink.c: Likewise. * src/util/virpci.c: Likewise. * src/util/virsysinfo.c: Likewise. * src/util/virusb.c: Likewise.
Signed-off-by: Eric Blake<eblake@redhat.com> --- src/util/vircommand.c | 4 ++-- src/util/virlog.c | 2 +- src/util/virnetdevbandwidth.c | 4 ++-- src/util/virnetdevmacvlan.c | 2 +- src/util/virnetdevvportprofile.c | 2 +- src/util/virnetlink.c | 2 +- src/util/virpci.c | 3 ++- src/util/virsysinfo.c | 2 +- src/util/virusb.c | 2 +- 9 files changed, 12 insertions(+), 11 deletions(-)
ACK

Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * python/libvirt-override.c: Consistently use commas. Signed-off-by: Eric Blake <eblake@redhat.com> --- python/libvirt-override.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 747c877..6546dd1 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -461,7 +461,7 @@ libvirt_virDomainBlockStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *info; if (!PyArg_ParseTuple(args, (char *)"Oz:virDomainBlockStats", - &pyobj_domain,&path)) + &pyobj_domain, &path)) return NULL; domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); @@ -676,7 +676,7 @@ libvirt_virDomainInterfaceStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) PyObject *info; if (!PyArg_ParseTuple(args, (char *)"Oz:virDomainInterfaceStats", - &pyobj_domain,&path)) + &pyobj_domain, &path)) return NULL; domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); @@ -4924,12 +4924,12 @@ libvirt_virConnectDomainEventCallback(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainRef(dom); pyobj_dom = libvirt_virDomainPtrWrap(dom); pyobj_dom_args = PyTuple_New(2); - if (PyTuple_SetItem(pyobj_dom_args, 0, pyobj_conn_inst)!=0) { - DEBUG("%s error creating tuple",__FUNCTION__); + if (PyTuple_SetItem(pyobj_dom_args, 0, pyobj_conn_inst) != 0) { + DEBUG("%s error creating tuple", __FUNCTION__); goto cleanup; } - if (PyTuple_SetItem(pyobj_dom_args, 1, pyobj_dom)!=0) { - DEBUG("%s error creating tuple",__FUNCTION__); + if (PyTuple_SetItem(pyobj_dom_args, 1, pyobj_dom) != 0) { + DEBUG("%s error creating tuple", __FUNCTION__); goto cleanup; } Py_INCREF(pyobj_conn_inst); -- 1.8.3.1

On 20/11/13 08:30, Eric Blake wrote:
Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check.
* python/libvirt-override.c: Consistently use commas.
Signed-off-by: Eric Blake<eblake@redhat.com> --- python/libvirt-override.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) ACK

Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * src/vbox/vbox_tmpl.c: Consistently use commas. Signed-off-by: Eric Blake <eblake@redhat.com> --- src/vbox/vbox_tmpl.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index f4cd5cf..942570f 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -1071,7 +1071,7 @@ static virDrvOpenStatus vboxConnectOpen(virConnectPtr conn, static int vboxConnectClose(virConnectPtr conn) { vboxGlobalData *data = conn->privateData; - VIR_DEBUG("%s: in vboxClose",conn->driver->name); + VIR_DEBUG("%s: in vboxClose", conn->driver->name); vboxUninitialize(data); conn->privateData = NULL; @@ -1081,7 +1081,7 @@ static int vboxConnectClose(virConnectPtr conn) { static int vboxConnectGetVersion(virConnectPtr conn, unsigned long *version) { vboxGlobalData *data = conn->privateData; - VIR_DEBUG("%s: in vboxGetVersion",conn->driver->name); + VIR_DEBUG("%s: in vboxGetVersion", conn->driver->name); vboxDriverLock(data); *version = data->version; @@ -1154,7 +1154,8 @@ static int vboxConnectListDomains(virConnectPtr conn, int *ids, int nids) { rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of Domains, rc=%08x"),(unsigned)rc); + _("Could not get list of Domains, rc=%08x"), + (unsigned)rc); goto cleanup; } @@ -4374,18 +4375,18 @@ vboxAttachNetwork(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) adapter->vtbl->SetEnabled(adapter, 1); if (def->nets[i]->model) { - if (STRCASEEQ(def->nets[i]->model , "Am79C970A")) { + if (STRCASEEQ(def->nets[i]->model, "Am79C970A")) { adapterType = NetworkAdapterType_Am79C970A; - } else if (STRCASEEQ(def->nets[i]->model , "Am79C973")) { + } else if (STRCASEEQ(def->nets[i]->model, "Am79C973")) { adapterType = NetworkAdapterType_Am79C973; - } else if (STRCASEEQ(def->nets[i]->model , "82540EM")) { + } else if (STRCASEEQ(def->nets[i]->model, "82540EM")) { adapterType = NetworkAdapterType_I82540EM; - } else if (STRCASEEQ(def->nets[i]->model , "82545EM")) { + } else if (STRCASEEQ(def->nets[i]->model, "82545EM")) { adapterType = NetworkAdapterType_I82545EM; - } else if (STRCASEEQ(def->nets[i]->model , "82543GC")) { + } else if (STRCASEEQ(def->nets[i]->model, "82543GC")) { adapterType = NetworkAdapterType_I82543GC; #if VBOX_API_VERSION >= 3001 - } else if (STRCASEEQ(def->nets[i]->model , "virtio")) { + } else if (STRCASEEQ(def->nets[i]->model, "virtio")) { adapterType = NetworkAdapterType_Virtio; #endif /* VBOX_API_VERSION >= 3001 */ } @@ -7730,7 +7731,7 @@ static virNetworkPtr vboxNetworkDefineCreateXML(virConnectPtr conn, const char * } } - VBOX_UTF8_TO_UTF16(networkNameUtf8 , &networkNameUtf16); + VBOX_UTF8_TO_UTF16(networkNameUtf8, &networkNameUtf16); /* Currently support only one dhcp server per network * with contigious address space from start to end @@ -7922,7 +7923,7 @@ static int vboxNetworkUndefineDestroy(virNetworkPtr network, bool removeinterfac } #endif /* VBOX_API_VERSION != 2002 */ - VBOX_UTF8_TO_UTF16(networkNameUtf8 , &networkNameUtf16); + VBOX_UTF8_TO_UTF16(networkNameUtf8, &networkNameUtf16); data->vboxObj->vtbl->FindDHCPServerByNetworkName(data->vboxObj, networkNameUtf16, @@ -7985,7 +7986,7 @@ static int vboxNetworkCreate(virNetworkPtr network) { IDHCPServer *dhcpServer = NULL; - VBOX_UTF8_TO_UTF16(networkNameUtf8 , &networkNameUtf16); + VBOX_UTF8_TO_UTF16(networkNameUtf8, &networkNameUtf16); data->vboxObj->vtbl->FindDHCPServerByNetworkName(data->vboxObj, networkNameUtf16, @@ -8066,7 +8067,7 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr network, networkInterface->vtbl->GetId(networkInterface, &vboxnet0IID.value); vboxIIDToUUID(&vboxnet0IID, def->uuid); - VBOX_UTF8_TO_UTF16(networkNameUtf8 , &networkNameUtf16); + VBOX_UTF8_TO_UTF16(networkNameUtf8, &networkNameUtf16); def->forward.type = VIR_NETWORK_FORWARD_NONE; -- 1.8.3.1

On 20/11/13 08:30, Eric Blake wrote:
Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check.
* src/vbox/vbox_tmpl.c: Consistently use commas.
Signed-off-by: Eric Blake<eblake@redhat.com> --- src/vbox/vbox_tmpl.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
ACK

Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * src/lxc/lxc_container.c: Consistently use commas. * src/openvz/openvz_driver.c: Likewise. * src/openvz/openvz_util.c: Likewise. * src/remote/remote_driver.c: Likewise. * src/test/test_driver.c: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com> --- src/lxc/lxc_container.c | 2 +- src/openvz/openvz_driver.c | 4 ++-- src/openvz/openvz_util.c | 3 ++- src/remote/remote_driver.c | 2 +- src/test/test_driver.c | 12 ++++++------ 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 2bdf957..2059b83 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -483,7 +483,7 @@ error_out: /*_syscall2(int, pivot_root, char *, newroot, const char *, oldroot)*/ -extern int pivot_root(const char * new_root,const char * put_old); +extern int pivot_root(const char * new_root, const char * put_old); static int lxcContainerChildMountSort(const void *a, const void *b) { diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index df55568..aee7390 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1280,7 +1280,7 @@ openvzDomainGetAutostart(virDomainPtr dom, int *autostart) } *autostart = 0; - if (STREQ(value,"yes")) + if (STREQ(value, "yes")) *autostart = 1; ret = 0; @@ -1523,7 +1523,7 @@ static int openvzConnectListDomains(virConnectPtr conn ATTRIBUTE_UNUSED, int ret; char buf[32]; char *endptr; - virCommandPtr cmd = virCommandNewArgList(VZLIST, "-ovpsid", "-H" , NULL); + virCommandPtr cmd = virCommandNewArgList(VZLIST, "-ovpsid", "-H", NULL); virCommandSetOutputFD(cmd, &outfd); if (virCommandRunAsync(cmd, NULL) < 0) diff --git a/src/openvz/openvz_util.c b/src/openvz/openvz_util.c index dc69df2..8920d14 100644 --- a/src/openvz/openvz_util.c +++ b/src/openvz/openvz_util.c @@ -1,6 +1,7 @@ /* * openvz_driver.c: core driver methods for managing OpenVZ VEs * + * Copyright (C) 2013 Red Hat, Inc. * Copyright (C) 2012 Guido Günther * * This library is free software; you can redistribute it and/or @@ -64,7 +65,7 @@ openvzVEGetStringParam(virDomainPtr domain, const char* param) "-o", param, domain->name, - "-H" , NULL); + "-H", NULL); virCommandSetOutputBuffer(cmd, &output); if (virCommandRun(cmd, NULL) < 0) { diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 7181949..df7558b 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -4484,7 +4484,7 @@ remoteDomainBuildEventIOErrorReason(virNetClientProgramPtr prog ATTRIBUTE_UNUSED virDomainPtr dom; virDomainEventPtr event = NULL; - dom = get_nonnull_domain(conn,msg->dom); + dom = get_nonnull_domain(conn, msg->dom); if (!dom) return; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2678247..469223e 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1,7 +1,7 @@ /* * test.c: A "mock" hypervisor for use by application unit tests * - * Copyright (C) 2006-2012 Red Hat, Inc. + * Copyright (C) 2006-2013 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -306,7 +306,7 @@ testBuildCapabilities(virConnectPtr conn) { if (virCapabilitiesAddHostFeature(caps, "pae") < 0) goto error; - if (virCapabilitiesAddHostFeature(caps ,"nonpae") < 0) + if (virCapabilitiesAddHostFeature(caps, "nonpae") < 0) goto error; for (i = 0; i < privconn->numCells; i++) { @@ -344,7 +344,7 @@ testBuildCapabilities(virConnectPtr conn) { if (virCapabilitiesAddGuestFeature(guest, "pae", 1, 1) == NULL) goto error; - if (virCapabilitiesAddGuestFeature(guest ,"nonpae", 1, 1) == NULL) + if (virCapabilitiesAddGuestFeature(guest, "nonpae", 1, 1) == NULL) goto error; } @@ -1620,7 +1620,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml, virCheckFlags(0, NULL); testDriverLock(privconn); - if ((def = virDomainDefParseString(xml,privconn->caps, privconn->xmlopt, + if ((def = virDomainDefParseString(xml, privconn->caps, privconn->xmlopt, 1 << VIR_DOMAIN_VIRT_TEST, VIR_DOMAIN_XML_INACTIVE)) == NULL) goto cleanup; @@ -2598,7 +2598,7 @@ static int testDomainGetVcpus(virDomainPtr domain, if (!virDomainObjIsActive(privdom)) { virReportError(VIR_ERR_OPERATION_INVALID, - "%s",_("cannot list vcpus for an inactive domain")); + "%s", _("cannot list vcpus for an inactive domain")); goto cleanup; } @@ -2685,7 +2685,7 @@ static int testDomainPinVcpu(virDomainPtr domain, if (!virDomainObjIsActive(privdom)) { virReportError(VIR_ERR_OPERATION_INVALID, - "%s",_("cannot pin vcpus on an inactive domain")); + "%s", _("cannot pin vcpus on an inactive domain")); goto cleanup; } -- 1.8.3.1

On 20/11/13 08:30, Eric Blake wrote:
Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check.
* src/lxc/lxc_container.c: Consistently use commas. * src/openvz/openvz_driver.c: Likewise. * src/openvz/openvz_util.c: Likewise. * src/remote/remote_driver.c: Likewise. * src/test/test_driver.c: Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com> --- src/lxc/lxc_container.c | 2 +- src/openvz/openvz_driver.c | 4 ++-- src/openvz/openvz_util.c | 3 ++- src/remote/remote_driver.c | 2 +- src/test/test_driver.c | 12 ++++++------ 5 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 2bdf957..2059b83 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -483,7 +483,7 @@ error_out:
/*_syscall2(int, pivot_root, char *, newroot, const char *, oldroot)*/ -extern int pivot_root(const char * new_root,const char * put_old); +extern int pivot_root(const char * new_root, const char * put_old);
static int lxcContainerChildMountSort(const void *a, const void *b) { diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index df55568..aee7390 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1280,7 +1280,7 @@ openvzDomainGetAutostart(virDomainPtr dom, int *autostart) }
*autostart = 0; - if (STREQ(value,"yes")) + if (STREQ(value, "yes")) *autostart = 1; ret = 0;
@@ -1523,7 +1523,7 @@ static int openvzConnectListDomains(virConnectPtr conn ATTRIBUTE_UNUSED, int ret; char buf[32]; char *endptr; - virCommandPtr cmd = virCommandNewArgList(VZLIST, "-ovpsid", "-H" , NULL); + virCommandPtr cmd = virCommandNewArgList(VZLIST, "-ovpsid", "-H", NULL);
virCommandSetOutputFD(cmd, &outfd); if (virCommandRunAsync(cmd, NULL) < 0) diff --git a/src/openvz/openvz_util.c b/src/openvz/openvz_util.c index dc69df2..8920d14 100644 --- a/src/openvz/openvz_util.c +++ b/src/openvz/openvz_util.c @@ -1,6 +1,7 @@ /* * openvz_driver.c: core driver methods for managing OpenVZ VEs * + * Copyright (C) 2013 Red Hat, Inc. * Copyright (C) 2012 Guido Günther * * This library is free software; you can redistribute it and/or @@ -64,7 +65,7 @@ openvzVEGetStringParam(virDomainPtr domain, const char* param) "-o", param, domain->name, - "-H" , NULL); + "-H", NULL);
virCommandSetOutputBuffer(cmd, &output); if (virCommandRun(cmd, NULL) < 0) { diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 7181949..df7558b 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -4484,7 +4484,7 @@ remoteDomainBuildEventIOErrorReason(virNetClientProgramPtr prog ATTRIBUTE_UNUSED virDomainPtr dom; virDomainEventPtr event = NULL;
- dom = get_nonnull_domain(conn,msg->dom); + dom = get_nonnull_domain(conn, msg->dom); if (!dom) return;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2678247..469223e 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1,7 +1,7 @@ /* * test.c: A "mock" hypervisor for use by application unit tests * - * Copyright (C) 2006-2012 Red Hat, Inc. + * Copyright (C) 2006-2013 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -306,7 +306,7 @@ testBuildCapabilities(virConnectPtr conn) {
if (virCapabilitiesAddHostFeature(caps, "pae") < 0) goto error; - if (virCapabilitiesAddHostFeature(caps ,"nonpae") < 0) + if (virCapabilitiesAddHostFeature(caps, "nonpae") < 0) goto error;
for (i = 0; i < privconn->numCells; i++) { @@ -344,7 +344,7 @@ testBuildCapabilities(virConnectPtr conn) {
if (virCapabilitiesAddGuestFeature(guest, "pae", 1, 1) == NULL) goto error; - if (virCapabilitiesAddGuestFeature(guest ,"nonpae", 1, 1) == NULL) + if (virCapabilitiesAddGuestFeature(guest, "nonpae", 1, 1) == NULL) goto error; }
@@ -1620,7 +1620,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml, virCheckFlags(0, NULL);
testDriverLock(privconn); - if ((def = virDomainDefParseString(xml,privconn->caps, privconn->xmlopt, + if ((def = virDomainDefParseString(xml, privconn->caps, privconn->xmlopt, 1 << VIR_DOMAIN_VIRT_TEST, VIR_DOMAIN_XML_INACTIVE)) == NULL) goto cleanup; @@ -2598,7 +2598,7 @@ static int testDomainGetVcpus(virDomainPtr domain,
if (!virDomainObjIsActive(privdom)) { virReportError(VIR_ERR_OPERATION_INVALID, - "%s",_("cannot list vcpus for an inactive domain")); + "%s", _("cannot list vcpus for an inactive domain")); goto cleanup; }
@@ -2685,7 +2685,7 @@ static int testDomainPinVcpu(virDomainPtr domain,
if (!virDomainObjIsActive(privdom)) { virReportError(VIR_ERR_OPERATION_INVALID, - "%s",_("cannot pin vcpus on an inactive domain")); + "%s", _("cannot pin vcpus on an inactive domain")); goto cleanup; }
ACK

Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * src/network/bridge_driver.c: Consistently use commas. * src/node_device/node_device_hal.c: Likewise. * src/node_device/node_device_udev.c: Likewise. * src/storage/storage_backend_rbd.c: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com> --- src/network/bridge_driver.c | 2 +- src/node_device/node_device_hal.c | 4 ++-- src/node_device/node_device_udev.c | 2 +- src/storage/storage_backend_rbd.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 4298576..83dc931 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1700,7 +1700,7 @@ networkAddRouteToBridge(virNetworkObjPtr network, /* this creates an all-0 address of the appropriate family */ ignore_value(virSocketAddrParse(&zero, - (VIR_SOCKET_ADDR_IS_FAMILY(addr,AF_INET) + (VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET) ? "0.0.0.0" : "::"), VIR_SOCKET_ADDR_FAMILY(addr))); diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c index a019a07..fafd520 100644 --- a/src/node_device/node_device_hal.c +++ b/src/node_device/node_device_hal.c @@ -570,7 +570,7 @@ device_removed(LibHalContext *ctx ATTRIBUTE_UNUSED, virNodeDeviceObjPtr dev; nodeDeviceLock(driverState); - dev = virNodeDeviceFindByName(&driverState->devs,name); + dev = virNodeDeviceFindByName(&driverState->devs, name); VIR_DEBUG("%s", name); if (dev) virNodeDeviceObjRemove(&driverState->devs, dev); @@ -588,7 +588,7 @@ device_cap_added(LibHalContext *ctx, virNodeDeviceObjPtr dev; nodeDeviceLock(driverState); - dev = virNodeDeviceFindByName(&driverState->devs,name); + dev = virNodeDeviceFindByName(&driverState->devs, name); nodeDeviceUnlock(driverState); VIR_DEBUG("%s %s", cap, name); if (dev) { diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 785c2fa..5d49968 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -357,7 +357,7 @@ typedef void (*udevLogFunctionPtr)(struct udev *udev, va_list args); static void -ATTRIBUTE_FMT_PRINTF(6,0) +ATTRIBUTE_FMT_PRINTF(6, 0) udevLogFunction(struct udev *udev ATTRIBUTE_UNUSED, int priority, const char *file, diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index b7a41c2..b8a553d 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -454,7 +454,7 @@ static int virStorageBackendRBDCreateVol(virConnectPtr conn, } if (rados_ioctx_create(ptr.cluster, - pool->def->source.name,&ptr.ioctx) < 0) { + pool->def->source.name, &ptr.ioctx) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create the RBD IoCTX. Does the pool '%s' exist?"), pool->def->source.name); -- 1.8.3.1

On 20/11/13 08:30, Eric Blake wrote:
Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check.
* src/network/bridge_driver.c: Consistently use commas. * src/node_device/node_device_hal.c: Likewise. * src/node_device/node_device_udev.c: Likewise. * src/storage/storage_backend_rbd.c: Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com> --- src/network/bridge_driver.c | 2 +- src/node_device/node_device_hal.c | 4 ++-- src/node_device/node_device_udev.c | 2 +- src/storage/storage_backend_rbd.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 4298576..83dc931 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1700,7 +1700,7 @@ networkAddRouteToBridge(virNetworkObjPtr network,
/* this creates an all-0 address of the appropriate family */ ignore_value(virSocketAddrParse(&zero, - (VIR_SOCKET_ADDR_IS_FAMILY(addr,AF_INET) + (VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET) ? "0.0.0.0" : "::"), VIR_SOCKET_ADDR_FAMILY(addr)));
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c index a019a07..fafd520 100644 --- a/src/node_device/node_device_hal.c +++ b/src/node_device/node_device_hal.c @@ -570,7 +570,7 @@ device_removed(LibHalContext *ctx ATTRIBUTE_UNUSED, virNodeDeviceObjPtr dev;
nodeDeviceLock(driverState); - dev = virNodeDeviceFindByName(&driverState->devs,name); + dev = virNodeDeviceFindByName(&driverState->devs, name); VIR_DEBUG("%s", name); if (dev) virNodeDeviceObjRemove(&driverState->devs, dev); @@ -588,7 +588,7 @@ device_cap_added(LibHalContext *ctx, virNodeDeviceObjPtr dev;
nodeDeviceLock(driverState); - dev = virNodeDeviceFindByName(&driverState->devs,name); + dev = virNodeDeviceFindByName(&driverState->devs, name); nodeDeviceUnlock(driverState); VIR_DEBUG("%s %s", cap, name); if (dev) { diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 785c2fa..5d49968 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -357,7 +357,7 @@ typedef void (*udevLogFunctionPtr)(struct udev *udev, va_list args);
static void -ATTRIBUTE_FMT_PRINTF(6,0) +ATTRIBUTE_FMT_PRINTF(6, 0) udevLogFunction(struct udev *udev ATTRIBUTE_UNUSED, int priority, const char *file, diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index b7a41c2..b8a553d 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -454,7 +454,7 @@ static int virStorageBackendRBDCreateVol(virConnectPtr conn, }
if (rados_ioctx_create(ptr.cluster, - pool->def->source.name,&ptr.ioctx) < 0) { + pool->def->source.name, &ptr.ioctx) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create the RBD IoCTX. Does the pool '%s' exist?"), pool->def->source.name);
ACK

Enforce and document the style set up by the previous patches. * build-aux/bracket-spacing.pl: Add comma checks. * docs/hacking.html.in: Document the rules. * HACKING: Regenerate. Signed-off-by: Eric Blake <eblake@redhat.com> --- HACKING | 25 +++++++++++++++++++++++++ build-aux/bracket-spacing.pl | 15 +++++++++++---- docs/hacking.html.in | 31 +++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/HACKING b/HACKING index f8797cc..357a4bd 100644 --- a/HACKING +++ b/HACKING @@ -325,6 +325,31 @@ immediately prior to any closing bracket. E.g. int foo(int wizz); // Good +Commas +====== +Commas should always be followed by a space or end of line, and never have +leading space; this is enforced during 'make check'. + + call(a,b ,c);// Bad + call(a, b, c); // Good + +When declaring an enum or using a struct initializer that occupies more than +one line, use a trailing comma. That way, future edits to extend the list only +have to add a line, rather than modify an existing line to add the +intermediate comma. However, this is harder to enforce, so you will find +counterexamples in existing code. Additionally, any sentinel enumerator value +with a name ending in _LAST is exempt. + + enum { + VALUE_ONE, + VALUE_TWO // Bad + }; + enum { + VALUE_THREE, + VALUE_FOUR, // Good + }; + + Semicolons ========== Semicolons should never have a space beforehand. Inside the condition of a diff --git a/build-aux/bracket-spacing.pl b/build-aux/bracket-spacing.pl index 4c19968..802a640 100755 --- a/build-aux/bracket-spacing.pl +++ b/build-aux/bracket-spacing.pl @@ -32,8 +32,8 @@ foreach my $file (@ARGV) { while (defined (my $line = <FILE>)) { my $data = $line; - # Kill any quoted ; or " - $data =~ s,'[";]','X',g; + # Kill any quoted , ; or " + $data =~ s/'[";,]'/'X'/g; # Kill any quoted strings $data =~ s,"([^\\\"]|\\.)*","XXX",g; @@ -114,7 +114,7 @@ foreach my $file (@ARGV) { last; } - # Forbid whitespace before ";". Things like below are allowed: + # Forbid whitespace before ";" or ",". Things like below are allowed: # # 1) The expression is empty for "for" loop. E.g. # for (i = 0; ; i++) @@ -124,7 +124,7 @@ foreach my $file (@ARGV) { # errno == EINTR) # ; # - while ($data =~ /[^;\s]\s+;/) { + while ($data =~ /[^;\s]\s+[;,]/) { print "$file:$.: $line"; $ret = 1; last; @@ -137,6 +137,13 @@ foreach my $file (@ARGV) { $ret = 1; last; } + + # Require EOL, space, or enum/struct end after comma. + while ($data =~ /,[^ \\\n)}]/) { + print "$file:$.: $line"; + $ret = 1; + last; + } } close FILE; } diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 7f31abf..cc76997 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -402,6 +402,37 @@ int foo(int wizz); // Good </pre> + <h2><a name="comma">Commas</a></h2> + + <p> + Commas should always be followed by a space or end of line, and + never have leading space; this is enforced during 'make check'. + </p> + <pre> + call(a,b ,c);// Bad + call(a, b, c); // Good +</pre> + + <p> + When declaring an enum or using a struct initializer that + occupies more than one line, use a trailing comma. That way, + future edits to extend the list only have to add a line, rather + than modify an existing line to add the intermediate comma. + However, this is harder to enforce, so you will find + counterexamples in existing code. Additionally, any sentinel + enumerator value with a name ending in _LAST is exempt. + </p> + <pre> + enum { + VALUE_ONE, + VALUE_TWO // Bad + }; + enum { + VALUE_THREE, + VALUE_FOUR, // Good + }; +</pre> + <h2><a name="semicolon">Semicolons</a></h2> <p> -- 1.8.3.1

On 20/11/13 08:30, Eric Blake wrote:
Enforce and document the style set up by the previous patches.
* build-aux/bracket-spacing.pl: Add comma checks. * docs/hacking.html.in: Document the rules. * HACKING: Regenerate.
Signed-off-by: Eric Blake <eblake@redhat.com> --- HACKING | 25 +++++++++++++++++++++++++ build-aux/bracket-spacing.pl | 15 +++++++++++---- docs/hacking.html.in | 31 +++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 4 deletions(-)
diff --git a/HACKING b/HACKING index f8797cc..357a4bd 100644 --- a/HACKING +++ b/HACKING @@ -325,6 +325,31 @@ immediately prior to any closing bracket. E.g. int foo(int wizz); // Good
+Commas +====== +Commas should always be followed by a space or end of line, and never have +leading space; this is enforced during 'make check'. + + call(a,b ,c);// Bad + call(a, b, c); // Good + +When declaring an enum or using a struct initializer that occupies more than +one line, use a trailing comma. That way, future edits to extend the list only +have to add a line, rather than modify an existing line to add the +intermediate comma.
Not sure if we need to explain more about the trailing comma for an enum or a struct helps on code auto generation and parsing.
However, this is harder to enforce, so you will find +counterexamples in existing code. Additionally, any sentinel enumerator value +with a name ending in _LAST is exempt. + + enum { + VALUE_ONE, + VALUE_TWO // Bad + }; + enum { + VALUE_THREE, + VALUE_FOUR, // Good + }; + + Semicolons ========== Semicolons should never have a space beforehand. Inside the condition of a diff --git a/build-aux/bracket-spacing.pl b/build-aux/bracket-spacing.pl index 4c19968..802a640 100755 --- a/build-aux/bracket-spacing.pl +++ b/build-aux/bracket-spacing.pl @@ -32,8 +32,8 @@ foreach my $file (@ARGV) { while (defined (my $line = <FILE>)) { my $data = $line;
- # Kill any quoted ; or " - $data =~ s,'[";]','X',g; + # Kill any quoted , ; or " + $data =~ s/'[";,]'/'X'/g;
# Kill any quoted strings $data =~ s,"([^\\\"]|\\.)*","XXX",g; @@ -114,7 +114,7 @@ foreach my $file (@ARGV) { last; }
- # Forbid whitespace before ";". Things like below are allowed: + # Forbid whitespace before ";" or ",". Things like below are allowed: # # 1) The expression is empty for "for" loop. E.g. # for (i = 0; ; i++) @@ -124,7 +124,7 @@ foreach my $file (@ARGV) { # errno == EINTR) # ; # - while ($data =~ /[^;\s]\s+;/) { + while ($data =~ /[^;\s]\s+[;,]/) { print "$file:$.: $line"; $ret = 1; last; @@ -137,6 +137,13 @@ foreach my $file (@ARGV) { $ret = 1; last; } + + # Require EOL, space, or enum/struct end after comma. + while ($data =~ /,[^ \\\n)}]/) { + print "$file:$.: $line"; + $ret = 1; + last; + } } close FILE; } diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 7f31abf..cc76997 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -402,6 +402,37 @@ int foo(int wizz); // Good </pre>
+ <h2><a name="comma">Commas</a></h2> + + <p> + Commas should always be followed by a space or end of line, and + never have leading space; this is enforced during 'make check'. + </p> + <pre> + call(a,b ,c);// Bad + call(a, b, c); // Good +</pre> + + <p> + When declaring an enum or using a struct initializer that + occupies more than one line, use a trailing comma. That way, + future edits to extend the list only have to add a line, rather + than modify an existing line to add the intermediate comma. + However, this is harder to enforce, so you will find + counterexamples in existing code. Additionally, any sentinel + enumerator value with a name ending in _LAST is exempt. + </p> + <pre> + enum { + VALUE_ONE, + VALUE_TWO // Bad + }; + enum { + VALUE_THREE, + VALUE_FOUR, // Good + }; +</pre> + <h2><a name="semicolon">Semicolons</a></h2>
<p>
ACK either way w.r.t the comment. Thanks for the not interesting work. :-) Regards, Osier

On 11/20/2013 06:26 AM, Osier Yang wrote:
On 20/11/13 08:30, Eric Blake wrote:
Enforce and document the style set up by the previous patches.
* build-aux/bracket-spacing.pl: Add comma checks. * docs/hacking.html.in: Document the rules. * HACKING: Regenerate.
+When declaring an enum or using a struct initializer that occupies more than +one line, use a trailing comma. That way, future edits to extend the list only +have to add a line, rather than modify an existing line to add the +intermediate comma.
Not sure if we need to explain more about the trailing comma for an enum or a struct helps on code auto generation and parsing.
Sure; I'll squash this in. diff --git i/docs/hacking.html.in w/docs/hacking.html.in index cc76997..0febee2 100644 --- i/docs/hacking.html.in +++ w/docs/hacking.html.in @@ -417,10 +418,15 @@ When declaring an enum or using a struct initializer that occupies more than one line, use a trailing comma. That way, future edits to extend the list only have to add a line, rather - than modify an existing line to add the intermediate comma. - However, this is harder to enforce, so you will find - counterexamples in existing code. Additionally, any sentinel - enumerator value with a name ending in _LAST is exempt. + than modify an existing line to add the intermediate comma. Any + sentinel enumerator value with a name ending in _LAST is exempt, + since you would extend such an enum before the _LAST element. + Another reason to favor trailing commas is that it requires less + effort to produce via code generators. Note that the syntax + checker is unable to enforce a style of trailing commas, so + there are counterexamples in existing code which do not use it; + also, while C99 allows trailing commas, remember that JSON and + XDR do not. </p> <pre> enum {
ACK either way w.r.t the comment. Thanks for the not interesting work. :-)
Thanks for the quick review. I'll push the series shortly. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Osier Yang