[Devel] [PATCH 7/7] Now it's obvious SCALE_UBC and SCALE_PARAM are aliases

Igor Podlesny openvz at poige.ru
Mon May 13 01:39:23 PDT 2013


Lets use SCALE_PARAM since it's more general
---
 src/vzcfgscale.c |   49 +++++++++++++++++++++----------------------------
 1 file changed, 21 insertions(+), 28 deletions(-)

diff --git a/src/vzcfgscale.c b/src/vzcfgscale.c
index 36db710..0504218 100644
--- a/src/vzcfgscale.c
+++ b/src/vzcfgscale.c
@@ -73,12 +73,6 @@ do { \
 void scale(float ubc_k, float cpu_k, float disk_k, float net_k,
 		struct CParam *param)
 {
-#define SCALE_UBC(name, k) \
-if (param->name != NULL) { \
-	MUL_BOUND(param->name[0], k, LONG_MAX); \
-	MUL_BOUND(param->name[1], k, LONG_MAX); \
-} else
-
 #define SCALE_PARAM(name, k) \
 if (param->name != NULL) { \
 	MUL_BOUND(param->name[0], k, LONG_MAX); \
@@ -87,27 +81,27 @@ if (param->name != NULL) { \
 
 	if (ubc_k)
 	{
-		SCALE_UBC(kmemsize,	ubc_k);
-		SCALE_UBC(avnumproc,	ubc_k);
-		SCALE_UBC(numproc,	ubc_k);
-		SCALE_UBC(vmguarpages,	ubc_k);
-		SCALE_UBC(oomguarpages,	ubc_k);
-		SCALE_UBC(lockedpages,	ubc_k);
-		SCALE_UBC(shmpages,	ubc_k);
-		SCALE_UBC(privvmpages,	ubc_k);
-		SCALE_UBC(numfile,	ubc_k);
-		SCALE_UBC(numflock,	ubc_k);
-		SCALE_UBC(numpty,	ubc_k);
-		SCALE_UBC(numsiginfo,	ubc_k);
-		SCALE_UBC(dcachesize,	ubc_k);
-		SCALE_UBC(physpages,	ubc_k);
-		SCALE_UBC(numtcpsock,	ubc_k);
-		SCALE_UBC(numothersock,	ubc_k);
-		SCALE_UBC(tcpsndbuf,	ubc_k);
-		SCALE_UBC(tcprcvbuf,	ubc_k);
-		SCALE_UBC(othersockbuf,	ubc_k);
-		SCALE_UBC(dgramrcvbuf,	ubc_k);
-		SCALE_UBC(numiptent,	ubc_k);
+		SCALE_PARAM(kmemsize,		ubc_k);
+		SCALE_PARAM(avnumproc,		ubc_k);
+		SCALE_PARAM(numproc,		ubc_k);
+		SCALE_PARAM(vmguarpages,	ubc_k);
+		SCALE_PARAM(oomguarpages,	ubc_k);
+		SCALE_PARAM(lockedpages,	ubc_k);
+		SCALE_PARAM(shmpages,		ubc_k);
+		SCALE_PARAM(privvmpages,	ubc_k);
+		SCALE_PARAM(numfile,		ubc_k);
+		SCALE_PARAM(numflock,		ubc_k);
+		SCALE_PARAM(numpty,		ubc_k);
+		SCALE_PARAM(numsiginfo,		ubc_k);
+		SCALE_PARAM(dcachesize,		ubc_k);
+		SCALE_PARAM(physpages,		ubc_k);
+		SCALE_PARAM(numtcpsock,		ubc_k);
+		SCALE_PARAM(numothersock,	ubc_k);
+		SCALE_PARAM(tcpsndbuf,		ubc_k);
+		SCALE_PARAM(tcprcvbuf,		ubc_k);
+		SCALE_PARAM(othersockbuf,	ubc_k);
+		SCALE_PARAM(dgramrcvbuf,	ubc_k);
+		SCALE_PARAM(numiptent,		ubc_k);
 	}
 	if (cpu_k && param->cpu_units != NULL)
 		MUL_BOUND(*param->cpu_units, cpu_k, MAXCPUUNITS);
@@ -126,7 +120,6 @@ if (param->name != NULL) { \
 	}
 
 #undef SCALE_PARAM
-#undef SCALE_UBC
 }
 
 int check_file(char *file1, char *file2)
-- 
1.7.9.5




More information about the Devel mailing list