提交 a8c8685e 编写于 作者: D Daniel P. Berrange

Fix sorting of libvirt_private.syms and add syntax check rule

Add check-symsorting.pl to perform case-insensitive alphabetical
sorting of groups of symbols. Fix all violations it reports
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 7b97030a
......@@ -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
......
#!/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;
......@@ -3,5 +3,5 @@
#
esxUtil_EscapeDatastoreItem;
esxVI_DateTime_ConvertToCalendarTime;
esxUtil_ParseDatastorePath;
esxVI_DateTime_ConvertToCalendarTime;
#
# These symbols are dependent upon --with-openvz via WITH_OPENVZ
#
openvzLocateConfFile;
openvzReadConfigParam;
openvzReadNetworkConf;
openvzLocateConfFile;
openvzVEGetStringParam;
......@@ -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,32 +1051,34 @@ virSecurityManagerFree;
virSecurityManagerGenLabel;
virSecurityManagerGetDOI;
virSecurityManagerGetModel;
virSecurityManagerGetMountOptions;
virSecurityManagerGetNested;
virSecurityManagerGetProcessLabel;
virSecurityManagerNew;
virSecurityManagerNewStack;
virSecurityManagerNewDAC;
virSecurityManagerNewStack;
virSecurityManagerReleaseLabel;
virSecurityManagerReserveLabel;
virSecurityManagerRestoreImageLabel;
virSecurityManagerRestoreAllLabel;
virSecurityManagerRestoreHostdevLabel;
virSecurityManagerRestoreImageLabel;
virSecurityManagerRestoreSavedStateLabel;
virSecurityManagerSetAllLabel;
virSecurityManagerSetDaemonSocketLabel;
virSecurityManagerSetHostdevLabel;
virSecurityManagerSetHugepages;
virSecurityManagerSetImageFDLabel;
virSecurityManagerSetImageLabel;
virSecurityManagerSetHostdevLabel;
virSecurityManagerSetProcessLabel;
virSecurityManagerSetSavedStateLabel;
virSecurityManagerSetSocketLabel;
virSecurityManagerSetTapFDLabel;
virSecurityManagerStackAddNested;
virSecurityManagerVerify;
virSecurityManagerGetMountOptions;
virSecurityManagerSetHugepages;
# sexpr.h
sexpr2string;
sexpr_append;
sexpr_cons;
sexpr_float;
......@@ -1090,7 +1092,6 @@ sexpr_node;
sexpr_node_copy;
sexpr_string;
sexpr_u64;
sexpr2string;
string2sexpr;
......@@ -1187,11 +1188,11 @@ virSysinfoRead;
# threadpool.h
virThreadPoolFree;
virThreadPoolNew;
virThreadPoolSendJob;
virThreadPoolGetMinWorkers;
virThreadPoolGetMaxWorkers;
virThreadPoolGetMinWorkers;
virThreadPoolGetPriorityWorkers;
virThreadPoolNew;
virThreadPoolSendJob;
# threads.h
......@@ -1256,9 +1257,9 @@ virFileExists;
virFileFindMountPoint;
virFileHasSuffix;
virFileIsAbsPath;
virFileIsDir;
virFileIsExecutable;
virFileIsLink;
virFileIsDir;
virFileLinkPointsTo;
virFileLock;
virFileMakePath;
......@@ -1281,12 +1282,12 @@ virFormatIntDecimal;
virGetGroupID;
virGetGroupName;
virGetHostname;
virGetUserDirectory;
virGetUserConfigDirectory;
virGetUserCacheDirectory;
virGetUserRuntimeDirectory;
virGetUserConfigDirectory;
virGetUserDirectory;
virGetUserID;
virGetUserName;
virGetUserRuntimeDirectory;
virHexToBin;
virIndexToDiskName;
virIsDevMapperDevice;
......@@ -1302,7 +1303,9 @@ virSetUIDGID;
virSkipSpaces;
virSkipSpacesAndBackslash;
virSkipSpacesBackwards;
virStrcpy;
virStrIsPrint;
virStrncpy;
virStrToDouble;
virStrToLong_i;
virStrToLong_l;
......@@ -1310,8 +1313,6 @@ virStrToLong_ll;
virStrToLong_ui;
virStrToLong_ul;
virStrToLong_ull;
virStrcpy;
virStrncpy;
virTrimSpaces;
virValidateWWN;
virVasprintf;
......@@ -1359,18 +1360,18 @@ virDBusGetSystemBus;
# virfile.h
virFileLoopDeviceAssociate;
virFileClose;
virFileDirectFdFlag;
virFileWrapperFdCatchError;
virFileWrapperFdClose;
virFileWrapperFdFree;
virFileWrapperFdNew;
virFileFclose;
virFileFdopen;
virFileLoopDeviceAssociate;
virFileRewrite;
virFileTouch;
virFileUpdatePerm;
virFileWrapperFdCatchError;
virFileWrapperFdClose;
virFileWrapperFdFree;
virFileWrapperFdNew;
# virinitctl.h
......@@ -1385,13 +1386,13 @@ virKeycodeValueTranslate;
# virkeyfile.h
virKeyFileNew;
virKeyFileLoadFile;
virKeyFileLoadData;
virKeyFileFree;
virKeyFileHasValue;
virKeyFileHasGroup;
virKeyFileGetValueString;
virKeyFileHasGroup;
virKeyFileHasValue;
virKeyFileLoadData;
virKeyFileLoadFile;
virKeyFileNew;
# virlockspace.h
......@@ -1445,8 +1446,8 @@ virNetClientRegisterAsyncIO;
virNetClientRegisterKeepAlive;
virNetClientRemoteAddrString;
virNetClientRemoveStream;
virNetClientSendNoReply;
virNetClientSendNonBlock;
virNetClientSendNoReply;
virNetClientSendWithReply;
virNetClientSendWithReplyStream;
virNetClientSetCloseCallback;
......@@ -1479,15 +1480,15 @@ virNetClientStreamSetError;
# virnetdev.h
virNetDevClearIPv4Address;
virNetDevExists;
virNetDevGetIPv4Address;
virNetDevGetIndex;
virNetDevGetIPv4Address;
virNetDevGetMAC;
virNetDevGetMTU;
virNetDevGetPhysicalFunction;
virNetDevGetVLanID;
virNetDevGetVirtualFunctionIndex;
virNetDevGetVirtualFunctionInfo;
virNetDevGetVirtualFunctions;
virNetDevGetVLanID;
virNetDevIsOnline;
virNetDevIsVirtualFunction;
virNetDevLinkDump;
......@@ -1529,8 +1530,8 @@ virNetDevBridgeSetSTPDelay;
# virnetdevmacvlan.h
virNetDevMacVLanCreate;
virNetDevMacVLanDelete;
virNetDevMacVLanCreateWithVPortProfile;
virNetDevMacVLanDelete;
virNetDevMacVLanDeleteWithVPortProfile;
virNetDevMacVLanRestartWithVPortProfile;
virNetDevMacVLanVPortProfileRegisterCallback;
......@@ -1577,9 +1578,9 @@ virNetlinkEventAddClient;
virNetlinkEventRemoveClient;
virNetlinkEventServiceIsRunning;
virNetlinkEventServiceLocalPid;
virNetlinkEventServiceStart;
virNetlinkEventServiceStop;
virNetlinkEventServiceStopAll;
virNetlinkEventServiceStart;
virNetlinkShutdown;
virNetlinkStartup;
......@@ -1587,14 +1588,14 @@ virNetlinkStartup;
# virnetmessage.h
virNetMessageClear;
virNetMessageDecodeHeader;
virNetMessageDecodeNumFDs;
virNetMessageDecodeLength;
virNetMessageDecodeNumFDs;
virNetMessageDecodePayload;
virNetMessageDupFD;
virNetMessageEncodeHeader;
virNetMessageEncodeNumFDs;
virNetMessageEncodePayload;
virNetMessageEncodePayloadRaw;
virNetMessageEncodeNumFDs;
virNetMessageFree;
virNetMessageNew;
virNetMessageQueuePush;
......@@ -1767,6 +1768,8 @@ virObjectUnref;
virPidFileAcquire;
virPidFileAcquirePath;
virPidFileBuildPath;
virPidFileDelete;
virPidFileDeletePath;
virPidFileRead;
virPidFileReadIfAlive;
virPidFileReadPath;
......@@ -1775,8 +1778,6 @@ virPidFileRelease;
virPidFileReleasePath;
virPidFileWrite;
virPidFileWritePath;
virPidFileDelete;
virPidFileDeletePath;
# virprocess.h
......@@ -1828,9 +1829,9 @@ virStrerror;
# virstring.h
virStringSplit;
virStringJoin;
virStringFreeList;
virStringJoin;
virStringSplit;
# virtime.h
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册