1. 15 10月, 2013 21 次提交
    • R
      vbox: handle 'saved' state of VMs · e06d23fd
      Ryota Ozaki 提交于
      VirtualBox has 'saved' state for VMs saved by the hypervisor.
      However, the state is treated as VIR_DOMAIN_NOSTATE by the vbox
      driver, resulting that virsh shows 'no state' for saved VMs.
      
      The fix treats the state as VIR_DOMAIN_SHUTOFF as same as
      other domains such as qemu.
      Signed-off-by: NRyota Ozaki <ozaki.ryota@gmail.com>
      e06d23fd
    • R
      vbox: merge duplicate state conversions · b98654fa
      Ryota Ozaki 提交于
      The code for converting between virtualbox API states
      and libvirt states was duplicated in two places. Pull
      the code out into a shared helper method.
      Signed-off-by: NRyota Ozaki <ozaki.ryota@gmail.com>
      b98654fa
    • G
      esx: Fix floppy.fileName handling in the vmx file parser · 842f6fd3
      Geoff Hickey 提交于
      The vmx file parsing code was reporting errors when parsing floppy.fileName
      entries if the filename didn't end in .flp. There is no such restriction in
      ESX; even using the GUI to configure floppy filenames you can specify any
      arbitrary file with any extension.
      
      Fix by changing the vmx parsing code so that it uses the floppy.fileType
      value to determine whether floppy.fileName refers to a block device or a
      regular file.
      
      Also remove code that would have generated an error if no floppy.fileName
      was specified. This is not an error either.
      
      Updated the floppy tests in vmx2xmltest.c and xml2vmxtest.c.
      842f6fd3
    • D
      Add some notes about secure usage of libvirt · 8f35fd21
      Daniel P. Berrange 提交于
      Start a page describing some of the things that applications
      using libvirt need to bear in mind to ensure security of their
      systems.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      8f35fd21
    • J
    • P
      xenapi: Fix build after const correctnes changes · 342cd2dd
      Peter Krempa 提交于
      In commit d2467709 the header of one of
      the post parse callbacks was changed, but the function used as the
      callback in the xenapi driver wasn't adapted. This resulted into:
      
        CC       xenapi/libvirt_driver_xenapi_la-xenapi_utils.lo
       xenapi/xenapi_driver.c:63:5: error: initialization from incompatible pointer type [-Werror]
       xenapi/xenapi_driver.c:63:5: error: (near initialization for 'xenapiDomainDefParserConfig.devicesPostParseCallback') [-Werror]
      342cd2dd
    • E
      build: syntax check to avoid 'const fooPtr' · e7981016
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Now that the code base has been cleaned, enforce it with a syntax
      checker.
      
      * cfg.mk (sc_forbid_const_pointer_typedef): New rule.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e7981016
    • E
      maint: avoid 'const fooPtr' in all remaining places · 33aec506
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up all remaining offenders.
      
      * src/lxc/lxc_process.c (virLXCProcessSetupInterfaceBridged): Drop
      needless const.
      * src/uml/uml_driver.c (umlMonitorCommand): Use intended type.
      (umlMonitorAddress): Fix fallout.
      * src/xen/xm_internal.c (xenXMDomainSearchForUUID): Use intended type.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      33aec506
    • E
      maint: avoid 'const fooPtr' in qemu · 9a520a59
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in src/qemu.
      
      * src/qemu/qemu_bridge_filter.h (networkAllowMacOnPort)
      (networkDisallowMacOnPort): Use intended type.
      * src/qemu/qemu_bridge_filter.c (networkAllowMacOnPort)
      (networkDisallowMacOnPort): Likewise.
      * src/qemu/qemu_command.c (qemuBuildTPMBackendStr)
      (qemuBuildTPMDevStr, qemuBuildCpuArgStr)
      (qemuBuildObsoleteAccelArg, qemuBuildMachineArgStr)
      (qemuBuildSmpArgStr, qemuBuildNumaArgStr): Likewise.
      * src/qemu/qemu_conf.c (qemuSharedDeviceEntryCopy): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSaveImageStartVM): Likewise.
      * src/qemu/qemu_hostdev.c
      (qemuDomainHostdevNetConfigVirtPortProfile): Likewise.
      * src/qemu/qemu_monitor_json.c
      (qemuMonitorJSONAttachCharDevCommand): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      9a520a59
    • E
      maint: avoid 'const fooPtr' in security · 84e80917
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in src/security.
      
      * src/security/security_apparmor.c (reload_profile)
      (AppArmorSetSecurityHostdevLabelHelper)
      (AppArmorReleaseSecurityLabel, AppArmorRestoreSecurityAllLabel)
      (AppArmorSetSecurityProcessLabel)
      (AppArmorSetSecurityChildProcessLabel)
      (AppArmorSetSecurityImageLabel, AppArmorSecurityVerify)
      (AppArmorSetSecurityHostdevLabel)
      (AppArmorRestoreSecurityHostdevLabel, AppArmorSetFDLabel): Drop
      needless const.
      * src/security/security_selinux.c
      (virSecuritySELinuxSetSecurityFileLabel): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      84e80917
    • E
      maint: avoid 'const fooPtr' in conf · 539a9fae
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up remaining offenders in src/conf, and their fallout.
      
      * src/conf/snapshot_conf.h (virDomainSnapshotAssignDef)
      (virDomainSnapshotFindByName): Drop attempt at const.
      * src/conf/interface_conf.h (virInterfaceObjIsActive)
      (virInterfaceDefFormat): Use intended type.
      (virInterfaceFindByMACString, virInterfaceFindByName)
      (virInterfaceAssignDef, virInterfaceRemove): Drop attempt at
      const.
      * src/conf/network_conf.h (virNetworkObjIsActive)
      (virNetworkDefFormat, virNetworkDefForwardIf)
      (virNetworkDefGetIpByIndex, virNetworkIpDefPrefix)
      (virNetworkIpDefNetmask): Use intended type.
      (virNetworkFindByUUID, virNetworkFindByName, virNetworkAssignDef)
      (virNetworkObjAssignDef, virNetworkRemoveInactive)
      (virNetworkBridgeInUse, virNetworkSetBridgeName)
      (virNetworkAllocateBridge): Drop attempt at const.
      * src/conf/netdev_vlan_conf.h (virNetDevVlanFormat): Make
      const-correct.
      * src/conf/node_device_conf.h (virNodeDeviceHasCap)
      (virNodeDeviceDefFormat): Use intended type.
      (virNodeDeviceFindByName, virNodeDeviceFindBySysfsPath)
      (virNodeDeviceAssignDef, virNodeDeviceObjRemove)
      (virNodeDeviceGetParentHost): Drop attempt at const.
      * src/conf/secret_conf.h (virSecretDefFormat): Use intended type.
      * src/conf/snapshot_conf.c (virDomainSnapshotAssignDef)
      (virDomainSnapshotFindByName): Fix fallout.
      * src/conf/interface_conf.c (virInterfaceBridgeDefFormat)
      (virInterfaceBondDefFormat, virInterfaceVlanDefFormat)
      (virInterfaceProtocolDefFormat, virInterfaceDefDevFormat)
      (virInterfaceDefFormat, virInterfaceFindByMACString)
      (virInterfaceFindByName, virInterfaceAssignDef)
      (virInterfaceRemove): Likewise.
      * src/conf/network_conf.c
      (VIR_ENUM_IMPL, virNetworkFindByName, virNetworkObjAssignDef)
      (virNetworkAssignDef, virNetworkRemoveInactive)
      (virNetworkDefGetIpByIndex, virNetworkIpDefPrefix)
      (virNetworkIpDefNetmask, virNetworkDHCPHostDefParseXML)
      (virNetworkIpDefFormat, virNetworkRouteDefFormat)
      (virPortGroupDefFormat, virNetworkForwardNatDefFormat)
      (virNetworkDefFormatInternal, virNetworkBridgeInUse)
      (virNetworkAllocateBridge, virNetworkSetBridgeName)
      (virNetworkDNSDefFormat, virNetworkDefFormat): Likewise.
      * src/conf/netdev_vlan_conf.c (virNetDevVlanFormat): Likewise.
      * src/conf/node_device_conf.c (virNodeDeviceHasCap)
      (virNodeDeviceFindBySysfsPath, virNodeDeviceFindByName)
      (virNodeDeviceAssignDef, virNodeDeviceObjRemove)
      (virNodeDeviceDefFormat, virNodeDeviceGetParentHost): Likewise.
      * src/conf/secret_conf.c (virSecretDefFormatUsage)
      (virSecretDefFormat): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      539a9fae
    • E
      maint: avoid 'const fooPtr' in domain_conf · d2467709
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in src/conf/domain_conf, and their fallout.
      
      Several things to note: virObjectLock() requires a non-const
      argument; if this were C++, we could treat the locking field
      as 'mutable' and allow locking an otherwise 'const' object, but
      that is a more invasive change, so I instead dropped attempts
      to be const-correct on domain lookup.  virXMLPropString and
      friends require a non-const xmlNodePtr - this is because libxml2
      is not a const-correct library.  We could make the src/util/virxml
      wrappers cast away const, but I figured it was easier to not
      try to mark xmlNodePtr as const.  Finally, virDomainDeviceDefCopy
      was a rather hard conversion - it calls virDomainDeviceDefPostParse,
      which in turn in the xen driver was actually modifying the domain
      outside of the current device being visited.  We should not be
      adding a device on the first per-device callback, but waiting until
      after all per-device callbacks are complete.
      
      * src/conf/domain_conf.h (virDomainObjListFindByID)
      (virDomainObjListFindByUUID, virDomainObjListFindByName)
      (virDomainObjAssignDef, virDomainObjListAdd): Drop attempt at
      const.
      (virDomainDeviceDefCopy): Use intended type.
      (virDomainDeviceDefParse, virDomainDeviceDefPostParseCallback)
      (virDomainVideoDefaultType, virDomainVideoDefaultRAM)
      (virDomainChrGetDomainPtrs): Make const-correct.
      * src/conf/domain_conf.c (virDomainObjListFindByID)
      (virDomainObjListFindByUUID, virDomainObjListFindByName)
      (virDomainDeviceDefCopy, virDomainObjListAdd)
      (virDomainObjAssignDef, virDomainHostdevSubsysUsbDefParseXML)
      (virDomainHostdevSubsysPciOrigStatesDefParseXML)
      (virDomainHostdevSubsysPciDefParseXML)
      (virDomainHostdevSubsysScsiDefParseXML)
      (virDomainControllerModelTypeFromString)
      (virDomainTPMDefParseXML, virDomainTimerDefParseXML)
      (virDomainSoundCodecDefParseXML, virDomainSoundDefParseXML)
      (virDomainWatchdogDefParseXML, virDomainRNGDefParseXML)
      (virDomainMemballoonDefParseXML, virDomainNVRAMDefParseXML)
      (virSysinfoParseXML, virDomainVideoAccelDefParseXML)
      (virDomainVideoDefParseXML, virDomainHostdevDefParseXML)
      (virDomainRedirdevDefParseXML)
      (virDomainRedirFilterUsbDevDefParseXML)
      (virDomainRedirFilterDefParseXML, virDomainIdMapEntrySort)
      (virDomainIdmapDefParseXML, virDomainVcpuPinDefParseXML)
      (virDiskNameToBusDeviceIndex, virDomainDeviceDefCopy)
      (virDomainVideoDefaultType, virDomainHostdevAssignAddress)
      (virDomainDeviceDefPostParseInternal, virDomainDeviceDefPostParse)
      (virDomainChrGetDomainPtrs, virDomainControllerSCSINextUnit)
      (virDomainSCSIDriveAddressIsUsed)
      (virDomainDriveAddressIsUsedByDisk)
      (virDomainDriveAddressIsUsedByHostdev): Fix fallout.
      * src/openvz/openvz_driver.c (openvzDomainDeviceDefPostParse):
      Likewise.
      * src/libxl/libxl_domain.c (libxlDomainDeviceDefPostParse):
      Likewise.
      * src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse)
      (qemuDomainDefaultNetModel): Likewise.
      * src/lxc/lxc_domain.c (virLXCDomainDeviceDefPostParse):
      Likewise.
      * src/uml/uml_driver.c (umlDomainDeviceDefPostParse): Likewise.
      * src/xen/xen_driver.c (xenDomainDeviceDefPostParse): Split...
      (xenDomainDefPostParse): ...since per-device callback is not the
      time to be adding a device.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d2467709
    • E
      maint: fix awkward typing of virDomainChrGetDomainPtrs · f8fa2b3e
      Eric Blake 提交于
      virDomainChrGetDomainPtrs() required 4 levels of pointers (taking
      a parameter that will be used as an output variable to return the
      address of another variable that contains an array of pointers).
      This is rather complex to reason about, especially when outside
      of the domain_conf file, no other caller should be modifying
      the resulting array of pointers directly.  Changing the public
      signature gives something is easier to reason with, and actually
      make const-correct; which is important as it was the only function
      that was blocking virDomainDeviceDefCopy from treating its source
      as const.
      
      * src/conf/domain_conf.h (virDomainChrGetDomainPtrs): Use simpler
      types, and make const-correct for external users.
      * src/conf/domain_conf.c (virDomainChrGetDomainPtrs): Split...
      (virDomainChrGetDomainPtrsInternal): ...into an internal version
      that lets us modify terms, vs. external form that is read-only.
      (virDomainDeviceDefPostParseInternal, virDomainChrFind)
      (virDomainChrInsert): Adjust callers.
      * src/qemu/qemu_command.c (qemuGetNextChrDevIndex): Adjust caller.
      (qemuDomainDeviceAliasIndex): Make const-correct.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f8fa2b3e
    • E
      maint: avoid 'const fooPtr' in python bindings · d3f9d851
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in the python bindings.
      
      * python/generator.py (py_types): Drop useless conversions.
      * python/libvirt-override.c (getPyVirTypedParameter)
      (setPyVirTypedParameter): Use intended type.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d3f9d851
    • E
      maint: avoid 'const fooPtr' in tests · b8984770
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in the testsuite.
      
      * tests/cputest.c (cpuTestCompareXML): Use intended type.
      * tests/qemucapabilitiestest.c (testQemuCaps): Likewise.
      * tests/qemumonitorjsontest.c: Drop const.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b8984770
    • E
      maint: avoid 'const fooPtr' in nwfilter files · 1b7ec657
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in nwfilter code.
      
      This patch does nothing about the stupidity evident in having
      __virNWFilterInstantiateFilter, _virNWFilterInstantiateFilter,
      and virNWFilterInstantiateFilter, which differ only by leading
      underscores, and which infringes on the namespace reserved to
      the implementation - that would need to be a separate cleanup.
      
      * src/nwfilter/nwfilter_dhcpsnoop.h (virNWFilterDHCPSnoopReq): Use
      intended type.
      * src/nwfilter/nwfilter_gentech_driver.h
      (virNWFilterInstantiateFilter)
      (virNWFilterUpdateInstantiateFilter)
      (virNWFilterInstantiataeFilterLate, virNWFilterTeardownFilter)
      (virNWFilterCreateVarHashmap): Likewise.
      * src/nwfilter/nwfilter_learnipaddr.h (virNWFilterLearnIPAddress):
      Likewise.
      * src/conf/nwfilter_conf.h (virNWFilterApplyBasicRules)
      (virNWFilterApplyDHCPOnlyRules): Likewise.
      (virNWFilterDefFormat): Make const-correct.
      * src/conf/nwfilter_params.h (virNWFilterVarValueCopy)
      (virNWFilterVarValueGetSimple, virNWFilterVarValueGetCardinality)
      (virNWFilterVarValueEqual, virNWFilterVarAccessEqual)
      (virNWFilterVarAccessGetVarName, virNWFilterVarAccessGetType)
      (virNWFilterVarAccessGetIterId, virNWFilterVarAccessGetIndex)
      (virNWFilterVarAccessIsAvailable)
      (virNWFilterVarCombIterGetVarValue): Use intended type.
      (virNWFilterVarValueGetNthValue): Make const-correct.
      * src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopReqLeaseDel)
      (virNWFilterSnoopIFKeyFMT, virNWFilterDHCPSnoopReq)
      (virNWFilterSnoopPruneIter, virNWFilterSnoopRemAllReqIter)
      (virNWFilterDHCPSnoopReq): Fix fallout.
      * src/nwfilter/nwfilter_gentech_driver.c
      (virNWFilterVarHashmapAddStdValues, virNWFilterCreateVarHashmap)
      (virNWFilterInstantiate, __virNWFilterInstantiateFilter)
      (_virNWFilterInstantiateFilter, virNWFilterInstantiateFilterLate)
      (virNWFilterInstantiateFilter)
      (virNWFilterUpdateInstantiateFilter)
      (virNWFilterRollbackUpdateFilter, virNWFilterTeardownFilter):
      Likewise.
      * src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnIPAddress):
      Likewise.
      * src/conf/nwfilter_params.c (virNWFilterVarValueCopy)
      (virNWFilterVarValueGetSimple)
      (virNWFilterVarValueGetCardinality, virNWFilterVarValueEqual)
      (virNWFilterVarCombIterAddVariable)
      (virNWFilterVarCombIterGetVarValue, virNWFilterVarValueCompare)
      (virNWFilterFormatParamAttributes, virNWFilterVarAccessEqual)
      (virNWFilterVarAccessGetVarName, virNWFilterVarAccessGetType)
      (virNWFilterVarAccessGetIterId, virNWFilterVarAccessGetIndex)
      (virNWFilterVarAccessGetIntIterId)
      (virNWFilterVarAccessIsAvailable)
      (virNWFilterVarValueGetNthValue): Likewise.
      * src/nwfilter/nwfilter_ebiptables_driver.c (ebtablesApplyBasicRules)
      (ebtablesApplyDHCPOnlyRules, ebiptablesRuleOrderSort)
      (ebiptablesRuleOrderSortPtr): Likewise.
      * src/conf/nwfilter_conf.c (virNWFilterDefEqual)
      (virNWFilterDefFormat): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1b7ec657
    • E
      maint: avoid 'const fooPtr' in cpu files · d694ae0c
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in src/cpu.
      
      * src/cpu/cpu.h (cpuArchDecode, cpuArchEncode, cpuArchUpdate)
      (cpuArchHasFeature, cpuDecode, cpuEncode, cpuUpdate)
      (cpuHasFeature): Use intended type.
      * src/conf/cpu_conf.h (virCPUDefCopyModel, virCPUDefCopy):
      Likewise.
      (virCPUDefParseXML): Drop const.
      * src/cpu/cpu.c (cpuDecode, cpuEncode, cpuUpdate, cpuHasFeature):
      Fix fallout.
      * src/cpu/cpu_x86.c (x86ModelFromCPU, x86ModelSubtractCPU)
      (x86DecodeCPUData, x86EncodePolicy, x86Encode, x86UpdateCustom)
      (x86UpdateHostModel, x86Update, x86HasFeature): Likewise.
      * src/cpu/cpu_s390.c (s390Decode): Likewise.
      * src/cpu/cpu_arm.c (ArmDecode): Likewise.
      * src/cpu/cpu_powerpc.c (ppcModelFromCPU, ppcCompute, ppcDecode)
      (ppcUpdate): Likewise.
      * src/conf/cpu_conf.c (virCPUDefCopyModel, virCPUDefCopy)
      (virCPUDefParseXML): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d694ae0c
    • E
      maint: avoid 'const fooPtr' in virnet files · 955af4d4
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up remaining offenders in src/util.
      
      * src/util/virnetdev.h (virNetDevSetMAC)
      (virNetDevReplaceMacAddress, virNetDevValidateConfig)
      (virNetDevReplaceNetConfig): Use intended type.
      * src/util/virnetdevbandwidth.h (virNetDevBandwidthCopy)
      (virNetDevBandwidthPlug): Likewise.
      * src/util/virnetdevmacvlan.h (virNetDevMacVLanCreate)
      (virNetDevMacVLanCreateWithVPortProfile)
      (virNetDevMacVLanDeleteWithVPortProfile)
      (virNetDevMacVLanRestartWithVPortProfile)
      (virNetDevMacVLanVPortProfileRegisterCallback): Likewise.
      * src/util/virnetdevopenvswitch.h (virNetDevOpenvswitchAddPort):
      Likewise.
      * src/util/virnetdevtap.h (virNetDevTapCreateInBridgePort):
      Likewise.
      * src/util/virnetdevvlan.h (virNetDevVlanEqual)
      (virNetDevVlanCopy): Likewise.
      * src/util/virnetdevvportprofile.h
      (virNetDevVPortProfileAssociate)
      (virNetDevVPortProfileDisassociate): Likewise.
      * src/util/virnetlink.h (virNetlinkEventRemoveCallback)
      (virNetlinkEventAddClient, virNetlinkEventRemoveClient):
      Likewise.
      * src/util/virnetdev.c (virNetDevSetMAC)
      (virNetDevReplaceMacAddress, virNetDevValidateConfig)
      (virNetDevReplaceNetConfig): Fix fallout.
      * src/util/virnetdevbandwidth.c (virNetDevBandwidthCopy)
      (virNetDevBandwidthPlug): Likewise.
      * src/util/virnetdevmacvlan.c (virNetDevMacVLanCreate)
      (virNetDevMacVLanCreateWithVPortProfile)
      (virNetDevMacVLanDeleteWithVPortProfile)
      (virNetDevMacVLanRestartWithVPortProfile)
      (virNetDevMacVLanVPortProfileRegisterCallback): Likewise.
      * src/util/virnetdevopenvswitch.c (virNetDevOpenvswitchAddPort):
      Likewise.
      * src/util/virnetdevtap.c (virNetDevTapCreateInBridgePort):
      Likewise.
      * src/util/virnetdevvlan.c (virNetDevVlanEqual)
      (virNetDevVlanCopy): Likewise.
      * src/util/virnetdevvportprofile.c
      (virNetDevVPortProfileAssociate)
      (virNetDevVPortProfileDisassociate)
      (virNetDevVPortProfileOpSetLink, virNetDevVPortProfileOpCommon)
      (virNetDevVPortProfileOp8021Qbg, virNetDevVPortProfileOp8021Qbh):
      Likewise.
      * src/util/virnetlink.c (virNetlinkEventRemoveCallback)
      (virNetlinkEventAddClient, virNetlinkEventRemoveClient):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      955af4d4
    • E
      maint: avoid 'const fooPtr' in several util files · 1b0bc416
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in src/util outside of the virnet namespace.
      
      Also, make a few virSocketAddr functions const-correct, for easier
      conversions in future patches.
      
      * src/util/virbuffer.h (virBufferError, virBufferUse)
      (virBufferGetIndent): Use intended type.
      * src/util/virmacaddr.h (virMacAddrCmp, virMacAddrCmpRaw)
      (virMacAddrSet, virMcAddrFormat, virMacAddrIsUnicast)
      (virMacAddrIsMulticast): Likewise.
      * src/util/virebtables.h (ebtablesAddForwardAllowIn)
      (ebtablesRemoveForwardAllowIn): Likewise.
      * src/util/virsocketaddr.h (virSocketAddrSetIPv4Addr): Drop
      incorrect const.
      (virMacAddrGetRaw, virSocketAddrFormat, virSocketAddrFormatFull):
      Make const-correct.
      (virSocketAddrMask, virSocketAddrMaskByPrefix)
      (virSocketAddrBroadcast, virSocketAddrBroadcastByPrefix)
      (virSocketAddrGetNumNetmaskBits, virSocketAddrGetIpPrefix)
      (virSocketAddrEqual, virSocketAddrIsPrivate)
      (virSocketAddrIsWildcard): Use intended type.
      * src/util/virbuffer.c (virBufferError, virBufferUse)
      (virBufferGetIndent): Fix fallout.
      * src/util/virmacaddr.c (virMacAddrCmp, virMacAddrCmpRaw)
      (virMacAddrSet, virMcAddrFormat, virMacAddrIsUnicast)
      (virMacAddrIsMulticast): Likewise.
      * src/util/virebtables.c (ebtablesAddForwardAllowIn)
      (ebtablesRemoveForwardAllowIn): Likewise.
      * src/util/virsocketaddr.c (virSocketAddrMask, virMacAddrGetRaw)
      (virSocketAddrMaskByPrefix, virSocketAddrBroadcast)
      (virSocketAddrBroadcastByPrefix, virSocketAddrGetNumNetmaskBits)
      (virSocketAddrGetIpPrefix, virSocketAddrEqual)
      (virSocketAddrIsPrivate, virSocketAddrIsWildcard)
      (virSocketAddrGetIPv4Addr, virSocketAddrGetIPv6Addr)
      (virSocketAddrFormat, virSocketAddrFormatFull): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1b0bc416
    • E
      maint: avoid 'const fooPtr' in hashes · b43efdaa
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up virhash to provide a const-correct interface: all actions
      that don't modify the table take a const table.  Note that in
      one case (virHashSearch), we actually strip const away - we aren't
      modifying the contents of the table, so much as associated data
      for ensuring that the code uses the table correctly (if this were
      C++, it would be a case for the 'mutable' keyword).
      
      * src/util/virhash.h (virHashKeyComparator, virHashEqual): Use
      intended type.
      (virHashSize, virHashTableSize, virHashLookup, virHashSearch):
      Make const-correct.
      * src/util/virhash.c (virHashEqualData, virHashEqual)
      (virHashLookup, virHashSize, virHashTableSize, virHashSearch)
      (virHashComputeKey): Fix fallout.
      * src/conf/nwfilter_params.c
      (virNWFilterFormatParameterNameSorter): Likewise.
      * src/nwfilter/nwfilter_ebiptables_driver.c
      (ebiptablesFilterOrderSort): Likewise.
      * tests/virhashtest.c (testHashGetItemsCompKey)
      (testHashGetItemsCompValue): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b43efdaa
    • E
      maint: avoid 'const fooPtr' in public API · a5da5423
      Eric Blake 提交于
      'const fooPtr' is the same as 'foo * const' (the pointer won't
      change, but it's contents can).  But in general, if an interface
      is trying to be const-correct, it should be using 'const foo *'
      (the pointer is to data that can't be changed).
      
      Fix up offenders in the public API.  Note that this is an API change;
      but see commit 6ac6f59c, where we first argued that this change is
      harmless (but with that commit not actually making the change that it
      claimed to be making):
      
          Although this is an API change (not ABI though), real callers won't be
          impacted. Why?
           1. these callback members are read-only, so it is less likely that
          someone is trying to assign into the struct members.
           2. The only way to register a virConnectDomainEventGraphicsCallback is
          to cast it through a call to virConnectDomainEventRegisterAny.  That is,
          even if the user's callback function leaves out the const, we never use
          the typedef as the direct type of any API parameter.  Since they are
          already casting their function pointer into a munged type before
          registering it, their code will continue to compile.
      
      * include/libvirt/libvirt.h.in
      (virConnectDomainEventGraphicsCallback): Use intended type.
      a5da5423
  2. 14 10月, 2013 16 次提交
  3. 11 10月, 2013 3 次提交