From: "Daniel P. Berrange" <berrange(a)redhat.com>
Add check-symsorting.pl to perform case-insensitive alphabetical
sorting of groups of symbols. Fix all violations it reports
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/Makefile.am | 4 +-
src/check-symsorting.pl | 66 +++++++++++++++++++
src/libvirt_esx.syms | 2 +-
src/libvirt_openvz.syms | 2 +-
src/libvirt_private.syms | 161 ++++++++++++++++++++++++-----------------------
5 files changed, 152 insertions(+), 83 deletions(-)
create mode 100644 src/check-symsorting.pl
diff --git a/src/Makefile.am b/src/Makefile.am
index 6d2816d..7cb1d4a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -326,6 +326,8 @@ check-symfile: libvirt.syms libvirt.la
else
check-symfile:
endif
+check-symsorting:
+ $(AM_V_GEN)$(PERL) $(srcdir)/check-symsorting.pl $(USED_SYM_FILES)
PROTOCOL_STRUCTS = \
$(srcdir)/remote_protocol-structs \
@@ -349,7 +351,7 @@ else !WITH_REMOTE
check-protocol:
endif
EXTRA_DIST += $(PROTOCOL_STRUCTS) check-symfile.pl
-check-local: check-protocol check-symfile
+check-local: check-protocol check-symfile check-symsorting
.PHONY: check-protocol $(PROTOCOL_STRUCTS:structs=struct)
# Mock driver, covering domains, storage, networks, etc
diff --git a/src/check-symsorting.pl b/src/check-symsorting.pl
new file mode 100644
index 0000000..9c62246
--- /dev/null
+++ b/src/check-symsorting.pl
@@ -0,0 +1,66 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+die "syntax: $0 SYMFILE..." unless int(@ARGV) >= 1;
+
+my $ret = 0;
+foreach my $symfile (@ARGV) {
+ open SYMFILE, $symfile or die "cannot read $symfile: $!";
+
+ my $line;
+ my @group;
+
+ while (<SYMFILE>) {
+ chomp;
+ next if /^#/;
+
+ if (/^\s*$/) {
+ if (@group) {
+ &check_sorting(\@group, $symfile, $line);
+ }
+ @group = ();
+ $line = $.;
+ } else {
+ $_ =~ s/;//;
+ push @group, $_;
+ }
+ }
+
+ close SYMFILE;
+ if (@group) {
+ &check_sorting(\@group, $symfile, $line);
+ }
+}
+
+sub check_sorting {
+ my $group = shift;
+ my $symfile = shift;
+ my $line = shift;
+
+ my @group = @{$group};
+ my @sorted = sort { lc $a cmp lc $b } @group;
+ my $sorted = 1;
+ my $first;
+ my $last;
+ for (my $i = 0 ; $i <= $#sorted ; $i++) {
+ if ($sorted[$i] ne $group[$i]) {
+ $first = $i unless defined $first;
+ $last = $i;
+ $sorted = 0;
+ }
+ }
+ if (!$sorted) {
+ @group = splice @group, $first, ($last-$first+1);
+ @sorted = splice @sorted, $first, ($last-$first+1);
+ print "Symbol block at $symfile:$line symbols not sorted\n";
+ print map { " " . $_ . "\n" } @group;
+ print "Correct ordering\n";
+ print map { " " . $_ . "\n" } @sorted;
+ print "\n";
+ $ret = 1;
+ }
+}
+
+exit $ret;
diff --git a/src/libvirt_esx.syms b/src/libvirt_esx.syms
index 3125b20..0341b66 100644
--- a/src/libvirt_esx.syms
+++ b/src/libvirt_esx.syms
@@ -3,5 +3,5 @@
#
esxUtil_EscapeDatastoreItem;
-esxVI_DateTime_ConvertToCalendarTime;
esxUtil_ParseDatastorePath;
+esxVI_DateTime_ConvertToCalendarTime;
diff --git a/src/libvirt_openvz.syms b/src/libvirt_openvz.syms
index 1993eb5..578d8b5 100644
--- a/src/libvirt_openvz.syms
+++ b/src/libvirt_openvz.syms
@@ -1,7 +1,7 @@
#
# These symbols are dependent upon --with-openvz via WITH_OPENVZ
#
+openvzLocateConfFile;
openvzReadConfigParam;
openvzReadNetworkConf;
-openvzLocateConfFile;
openvzVEGetStringParam;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 7d083e4..1e34210 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -85,25 +85,25 @@ virCgroupDenyDeviceMajor;
virCgroupDenyDevicePath;
virCgroupForDomain;
virCgroupForDriver;
-virCgroupGetAppRoot;
virCgroupForEmulator;
virCgroupForVcpu;
virCgroupFree;
+virCgroupGetAppRoot;
virCgroupGetBlkioWeight;
-virCgroupGetCpuCfsPeriod;
-virCgroupGetCpuCfsQuota;
-virCgroupGetCpuShares;
virCgroupGetCpuacctPercpuUsage;
virCgroupGetCpuacctStat;
virCgroupGetCpuacctUsage;
+virCgroupGetCpuCfsPeriod;
+virCgroupGetCpuCfsQuota;
virCgroupGetCpusetCpus;
virCgroupGetCpusetMems;
+virCgroupGetCpuShares;
virCgroupGetFreezerState;
-virCgroupGetMemSwapUsage;
-virCgroupGetMemSwapHardLimit;
virCgroupGetMemoryHardLimit;
virCgroupGetMemorySoftLimit;
virCgroupGetMemoryUsage;
+virCgroupGetMemSwapHardLimit;
+virCgroupGetMemSwapUsage;
virCgroupKill;
virCgroupKillPainfully;
virCgroupKillRecursive;
@@ -115,14 +115,14 @@ virCgroupSetBlkioDeviceWeight;
virCgroupSetBlkioWeight;
virCgroupSetCpuCfsPeriod;
virCgroupSetCpuCfsQuota;
-virCgroupSetCpuShares;
virCgroupSetCpusetCpus;
virCgroupSetCpusetMems;
+virCgroupSetCpuShares;
virCgroupSetFreezerState;
-virCgroupSetMemSwapHardLimit;
virCgroupSetMemory;
virCgroupSetMemoryHardLimit;
virCgroupSetMemorySoftLimit;
+virCgroupSetMemSwapHardLimit;
# command.h
@@ -218,9 +218,9 @@ virGetConnect;
virGetDomain;
virGetDomainSnapshot;
virGetInterface;
-virGetNWFilter;
virGetNetwork;
virGetNodeDevice;
+virGetNWFilter;
virGetSecret;
virGetStoragePool;
virGetStorageVol;
@@ -249,9 +249,9 @@ dnsmasqAddHost;
dnsmasqCapsGet;
dnsmasqCapsGetBinaryPath;
dnsmasqCapsGetVersion;
+dnsmasqCapsNewFromBinary;
dnsmasqCapsNewFromBuffer;
dnsmasqCapsNewFromFile;
-dnsmasqCapsNewFromBinary;
dnsmasqCapsRefresh;
dnsmasqContextFree;
dnsmasqContextNew;
@@ -318,6 +318,7 @@ virDomainControllerTypeToString;
virDomainCpuPlacementModeTypeFromString;
virDomainCpuPlacementModeTypeToString;
virDomainDefAddImplicitControllers;
+virDomainDefAddSecurityLabelDef;
virDomainDefCheckABIStability;
virDomainDefClearDeviceAliases;
virDomainDefClearPCIAddresses;
@@ -327,8 +328,6 @@ virDomainDefFormat;
virDomainDefFormatInternal;
virDomainDefFree;
virDomainDefGetSecurityLabelDef;
-virDomainDiskDefGetSecurityLabelDef;
-virDomainDefAddSecurityLabelDef;
virDomainDefParseFile;
virDomainDefParseNode;
virDomainDefParseString;
@@ -349,6 +348,7 @@ virDomainDiskCopyOnReadTypeToString;
virDomainDiskDefAssignAddress;
virDomainDiskDefForeachPath;
virDomainDiskDefFree;
+virDomainDiskDefGetSecurityLabelDef;
virDomainDiskDeviceTypeToString;
virDomainDiskErrorPolicyTypeFromString;
virDomainDiskErrorPolicyTypeToString;
@@ -370,17 +370,17 @@ virDomainDiskTypeFromString;
virDomainDiskTypeToString;
virDomainEmulatorPinAdd;
virDomainEmulatorPinDel;
+virDomainFeatureStateTypeFromString;
+virDomainFeatureStateTypeToString;
+virDomainFindByID;
+virDomainFindByName;
+virDomainFindByUUID;
virDomainFSDefFree;
virDomainFSIndexByName;
virDomainFSTypeFromString;
virDomainFSTypeToString;
virDomainFSWrpolicyTypeFromString;
virDomainFSWrpolicyTypeToString;
-virDomainFeatureStateTypeFromString;
-virDomainFeatureStateTypeToString;
-virDomainFindByID;
-virDomainFindByName;
-virDomainFindByUUID;
virDomainGetRootFilesystem;
virDomainGraphicsAuthConnectedTypeFromString;
virDomainGraphicsAuthConnectedTypeToString;
@@ -536,14 +536,14 @@ virDomainVcpuPinDefFree;
virDomainVcpuPinDel;
virDomainVcpuPinFindByVcpu;
virDomainVcpuPinIsDuplicate;
-virDomainVideoDefFree;
virDomainVideoDefaultRAM;
virDomainVideoDefaultType;
+virDomainVideoDefFree;
virDomainVideoTypeFromString;
virDomainVideoTypeToString;
-virDomainVirtTypeToString;
virDomainVirtioEventIdxTypeFromString;
virDomainVirtioEventIdxTypeToString;
+virDomainVirtTypeToString;
virDomainWatchdogActionTypeFromString;
virDomainWatchdogActionTypeToString;
virDomainWatchdogModelTypeFromString;
@@ -553,8 +553,8 @@ virDomainWatchdogModelTypeToString;
# domain_event.h
virDomainEventBalloonChangeNewFromDom;
virDomainEventBalloonChangeNewFromObj;
-virDomainEventBlockJobNewFromObj;
virDomainEventBlockJobNewFromDom;
+virDomainEventBlockJobNewFromObj;
virDomainEventControlErrorNewFromDom;
virDomainEventControlErrorNewFromObj;
virDomainEventDiskChangeNewFromDom;
@@ -570,25 +570,25 @@ virDomainEventNew;
virDomainEventNewFromDef;
virDomainEventNewFromDom;
virDomainEventNewFromObj;
+virDomainEventPMSuspendDiskNewFromDom;
+virDomainEventPMSuspendDiskNewFromObj;
virDomainEventPMSuspendNewFromDom;
virDomainEventPMSuspendNewFromObj;
virDomainEventPMWakeupNewFromDom;
virDomainEventPMWakeupNewFromObj;
-virDomainEventRTCChangeNewFromDom;
-virDomainEventRTCChangeNewFromObj;
virDomainEventRebootNew;
virDomainEventRebootNewFromDom;
virDomainEventRebootNewFromObj;
+virDomainEventRTCChangeNewFromDom;
+virDomainEventRTCChangeNewFromObj;
virDomainEventStateDeregister;
virDomainEventStateDeregisterID;
virDomainEventStateEventID;
-virDomainEventStateRegister;
-virDomainEventStateRegisterID;
virDomainEventStateFree;
virDomainEventStateNew;
virDomainEventStateQueue;
-virDomainEventPMSuspendDiskNewFromDom;
-virDomainEventPMSuspendDiskNewFromObj;
+virDomainEventStateRegister;
+virDomainEventStateRegisterID;
virDomainEventTrayChangeNewFromDom;
virDomainEventTrayChangeNewFromObj;
virDomainEventWatchdogNewFromDom;
@@ -596,14 +596,14 @@ virDomainEventWatchdogNewFromObj;
# domain_lock.h
-virDomainLockProcessStart;
-virDomainLockProcessInquire;
-virDomainLockProcessPause;
-virDomainLockProcessResume;
virDomainLockDiskAttach;
virDomainLockDiskDetach;
virDomainLockLeaseAttach;
virDomainLockLeaseDetach;
+virDomainLockProcessInquire;
+virDomainLockProcessPause;
+virDomainLockProcessResume;
+virDomainLockProcessStart;
# domain_nwfilter.h
@@ -635,10 +635,10 @@ virEventPollUpdateTimeout;
# fdstream.h
-virFDStreamOpen;
virFDStreamConnectUNIX;
-virFDStreamOpenFile;
virFDStreamCreateFile;
+virFDStreamOpen;
+virFDStreamOpenFile;
# hash.h
@@ -757,24 +757,24 @@ virJSONValueToString;
# libvirt_internal.h
-virDomainMigrateFinish2;
+virDomainMigrateBegin3;
+virDomainMigrateConfirm3;
virDomainMigrateFinish;
+virDomainMigrateFinish2;
+virDomainMigrateFinish3;
virDomainMigratePerform;
-virDomainMigratePrepare2;
+virDomainMigratePerform3;
virDomainMigratePrepare;
-virDomainMigratePrepareTunnel;
-virDomainMigrateBegin3;
+virDomainMigratePrepare2;
virDomainMigratePrepare3;
+virDomainMigratePrepareTunnel;
virDomainMigratePrepareTunnel3;
-virDomainMigratePerform3;
-virDomainMigrateFinish3;
-virDomainMigrateConfirm3;
virDrvSupportsFeature;
virRegisterDeviceMonitor;
virRegisterDriver;
virRegisterInterfaceDriver;
-virRegisterNWFilterDriver;
virRegisterNetworkDriver;
+virRegisterNWFilterDriver;
virRegisterSecretDriver;
virRegisterStorageDriver;
@@ -785,11 +785,11 @@ virLockManagerAddResource;
virLockManagerFree;
virLockManagerInquire;
virLockManagerNew;
+virLockManagerPluginGetName;
virLockManagerPluginNew;
virLockManagerPluginRef;
virLockManagerPluginUnref;
virLockManagerPluginUsesState;
-virLockManagerPluginGetName;
virLockManagerRelease;
virLockManagerSetPluginDir;
@@ -847,8 +847,8 @@ virNetDevVPortTypeToString;
# network_conf.h
virNetworkAssignDef;
-virNetworkConfigFile;
virNetworkConfigChangeSetup;
+virNetworkConfigFile;
virNetworkDefCopy;
virNetworkDefFormat;
virNetworkDefFree;
@@ -885,9 +885,9 @@ virPortGroupFindByName;
# node_device_conf.h
+virNodeDevCapsDefFree;
virNodeDevCapTypeFromString;
virNodeDevCapTypeToString;
-virNodeDevCapsDefFree;
virNodeDeviceAssignDef;
virNodeDeviceDefFormat;
virNodeDeviceDefFree;
@@ -908,11 +908,11 @@ virNodeDeviceObjUnlock;
# nodeinfo.h
nodeCapsInitNUMA;
+nodeGetCellsFreeMemory;
nodeGetCPUBitmap;
nodeGetCPUCount;
nodeGetCPUMap;
nodeGetCPUStats;
-nodeGetCellsFreeMemory;
nodeGetFreeMemory;
nodeGetInfo;
nodeGetMemoryParameters;
@@ -949,8 +949,8 @@ virNWFilterRuleActionTypeToString;
virNWFilterRuleDirectionTypeToString;
virNWFilterRuleProtocolTypeToString;
virNWFilterTestUnassignDef;
-virNWFilterUnRegisterCallbackDriver;
virNWFilterUnlockFilterUpdates;
+virNWFilterUnRegisterCallbackDriver;
# nwfilter_ipaddrmap
@@ -1051,31 +1051,33 @@ virSecurityManagerFree;
virSecurityManagerGenLabel;
virSecurityManagerGetDOI;
virSecurityManagerGetModel;
+virSecurityManagerGetMountOptions;
virSecurityManagerGetNested;
virSecurityManagerGetProcessLabel;
virSecurityManagerNew;
-virSecurityManagerNewStack;
virSecurityManagerNewDAC;
+virSecurityManagerNewStack;
virSecurityManagerReleaseLabel;
virSecurityManagerReserveLabel;
-virSecurityManagerRestoreImageLabel;
virSecurityManagerRestoreAllLabel;
virSecurityManagerRestoreHostdevLabel;
+virSecurityManagerRestoreImageLabel;
virSecurityManagerRestoreSavedStateLabel;
virSecurityManagerSetAllLabel;
virSecurityManagerSetDaemonSocketLabel;
+virSecurityManagerSetHostdevLabel;
virSecurityManagerSetImageFDLabel;
virSecurityManagerSetImageLabel;
-virSecurityManagerSetHostdevLabel;
virSecurityManagerSetProcessLabel;
virSecurityManagerSetSavedStateLabel;
virSecurityManagerSetSocketLabel;
virSecurityManagerSetTapFDLabel;
virSecurityManagerStackAddNested;
virSecurityManagerVerify;
-virSecurityManagerGetMountOptions;
+
# sexpr.h
+sexpr2string;
sexpr_append;
sexpr_cons;
sexpr_float;
@@ -1089,7 +1091,6 @@ sexpr_node;
sexpr_node_copy;
sexpr_string;
sexpr_u64;
-sexpr2string;
string2sexpr;
@@ -1186,11 +1187,11 @@ virSysinfoRead;
# threadpool.h
virThreadPoolFree;
-virThreadPoolNew;
-virThreadPoolSendJob;
-virThreadPoolGetMinWorkers;
virThreadPoolGetMaxWorkers;
+virThreadPoolGetMinWorkers;
virThreadPoolGetPriorityWorkers;
+virThreadPoolNew;
+virThreadPoolSendJob;
# threads.h
@@ -1255,9 +1256,9 @@ virFileExists;
virFileFindMountPoint;
virFileHasSuffix;
virFileIsAbsPath;
+virFileIsDir;
virFileIsExecutable;
virFileIsLink;
-virFileIsDir;
virFileLinkPointsTo;
virFileLock;
virFileMakePath;
@@ -1280,12 +1281,12 @@ virFormatIntDecimal;
virGetGroupID;
virGetGroupName;
virGetHostname;
-virGetUserDirectory;
-virGetUserConfigDirectory;
virGetUserCacheDirectory;
-virGetUserRuntimeDirectory;
+virGetUserConfigDirectory;
+virGetUserDirectory;
virGetUserID;
virGetUserName;
+virGetUserRuntimeDirectory;
virHexToBin;
virIndexToDiskName;
virIsDevMapperDevice;
@@ -1301,7 +1302,9 @@ virSetUIDGID;
virSkipSpaces;
virSkipSpacesAndBackslash;
virSkipSpacesBackwards;
+virStrcpy;
virStrIsPrint;
+virStrncpy;
virStrToDouble;
virStrToLong_i;
virStrToLong_l;
@@ -1309,8 +1312,6 @@ virStrToLong_ll;
virStrToLong_ui;
virStrToLong_ul;
virStrToLong_ull;
-virStrcpy;
-virStrncpy;
virTrimSpaces;
virValidateWWN;
virVasprintf;
@@ -1358,18 +1359,18 @@ virDBusGetSystemBus;
# virfile.h
-virFileLoopDeviceAssociate;
virFileClose;
virFileDirectFdFlag;
-virFileWrapperFdCatchError;
-virFileWrapperFdClose;
-virFileWrapperFdFree;
-virFileWrapperFdNew;
virFileFclose;
virFileFdopen;
+virFileLoopDeviceAssociate;
virFileRewrite;
virFileTouch;
virFileUpdatePerm;
+virFileWrapperFdCatchError;
+virFileWrapperFdClose;
+virFileWrapperFdFree;
+virFileWrapperFdNew;
# virinitctl.h
@@ -1384,13 +1385,13 @@ virKeycodeValueTranslate;
# virkeyfile.h
-virKeyFileNew;
-virKeyFileLoadFile;
-virKeyFileLoadData;
virKeyFileFree;
-virKeyFileHasValue;
-virKeyFileHasGroup;
virKeyFileGetValueString;
+virKeyFileHasGroup;
+virKeyFileHasValue;
+virKeyFileLoadData;
+virKeyFileLoadFile;
+virKeyFileNew;
# virlockspace.h
@@ -1444,8 +1445,8 @@ virNetClientRegisterAsyncIO;
virNetClientRegisterKeepAlive;
virNetClientRemoteAddrString;
virNetClientRemoveStream;
-virNetClientSendNoReply;
virNetClientSendNonBlock;
+virNetClientSendNoReply;
virNetClientSendWithReply;
virNetClientSendWithReplyStream;
virNetClientSetCloseCallback;
@@ -1478,15 +1479,15 @@ virNetClientStreamSetError;
# virnetdev.h
virNetDevClearIPv4Address;
virNetDevExists;
-virNetDevGetIPv4Address;
virNetDevGetIndex;
+virNetDevGetIPv4Address;
virNetDevGetMAC;
virNetDevGetMTU;
virNetDevGetPhysicalFunction;
-virNetDevGetVLanID;
virNetDevGetVirtualFunctionIndex;
virNetDevGetVirtualFunctionInfo;
virNetDevGetVirtualFunctions;
+virNetDevGetVLanID;
virNetDevIsOnline;
virNetDevIsVirtualFunction;
virNetDevLinkDump;
@@ -1528,8 +1529,8 @@ virNetDevBridgeSetSTPDelay;
# virnetdevmacvlan.h
virNetDevMacVLanCreate;
-virNetDevMacVLanDelete;
virNetDevMacVLanCreateWithVPortProfile;
+virNetDevMacVLanDelete;
virNetDevMacVLanDeleteWithVPortProfile;
virNetDevMacVLanRestartWithVPortProfile;
virNetDevMacVLanVPortProfileRegisterCallback;
@@ -1576,9 +1577,9 @@ virNetlinkEventAddClient;
virNetlinkEventRemoveClient;
virNetlinkEventServiceIsRunning;
virNetlinkEventServiceLocalPid;
+virNetlinkEventServiceStart;
virNetlinkEventServiceStop;
virNetlinkEventServiceStopAll;
-virNetlinkEventServiceStart;
virNetlinkShutdown;
virNetlinkStartup;
@@ -1586,14 +1587,14 @@ virNetlinkStartup;
# virnetmessage.h
virNetMessageClear;
virNetMessageDecodeHeader;
-virNetMessageDecodeNumFDs;
virNetMessageDecodeLength;
+virNetMessageDecodeNumFDs;
virNetMessageDecodePayload;
virNetMessageDupFD;
virNetMessageEncodeHeader;
+virNetMessageEncodeNumFDs;
virNetMessageEncodePayload;
virNetMessageEncodePayloadRaw;
-virNetMessageEncodeNumFDs;
virNetMessageFree;
virNetMessageNew;
virNetMessageQueuePush;
@@ -1766,6 +1767,8 @@ virObjectUnref;
virPidFileAcquire;
virPidFileAcquirePath;
virPidFileBuildPath;
+virPidFileDelete;
+virPidFileDeletePath;
virPidFileRead;
virPidFileReadIfAlive;
virPidFileReadPath;
@@ -1774,8 +1777,6 @@ virPidFileRelease;
virPidFileReleasePath;
virPidFileWrite;
virPidFileWritePath;
-virPidFileDelete;
-virPidFileDeletePath;
# virprocess.h
@@ -1827,9 +1828,9 @@ virStrerror;
# virstring.h
-virStringSplit;
-virStringJoin;
virStringFreeList;
+virStringJoin;
+virStringSplit;
# virtime.h
--
1.7.11.7