From efc2273e5de9cdc055a36f7ec2e36d2c3b5cc9fa Mon Sep 17 00:00:00 2001
From: Tim Wickberg <tim@schedmd.com>
Date: Fri, 8 Sep 2017 12:51:44 -0600
Subject: [PATCH] Remove now-unused xcgroup_set_params().

xgroup_set_param() avoids the string parsing overhead and
should be used instead.
---
 src/slurmd/common/xcgroup.c | 51 -------------------------------------
 src/slurmd/common/xcgroup.h | 15 -----------
 2 files changed, 66 deletions(-)

diff --git a/src/slurmd/common/xcgroup.c b/src/slurmd/common/xcgroup.c
index 33134a7c05b..7e8e54d10cf 100644
--- a/src/slurmd/common/xcgroup.c
+++ b/src/slurmd/common/xcgroup.c
@@ -554,57 +554,6 @@ int xcgroup_get_pids(xcgroup_t* cg, pid_t **pids, int *npids)
 	return fstatus;
 }
 
-int xcgroup_set_params(xcgroup_t* cg, char* parameters)
-{
-	int fstatus = XCGROUP_ERROR;
-	char file_path[PATH_MAX];
-	char* cpath = cg->path;
-	char* params;
-	char* value;
-	char* p;
-	char* next;
-
-	params = (char*) xstrdup(parameters);
-
-	p = params;
-	while (p != NULL && *p != '\0') {
-		next = xstrchr(p, ' ');
-		if (next) {
-			*next='\0';
-			next++;
-			while (*next == ' ')
-				next++;
-		}
-		value = xstrchr(p, '=');
-		if (value != NULL) {
-			*value='\0';
-			value++;
-			if (snprintf(file_path, PATH_MAX, "%s/%s", cpath, p)
-			     >= PATH_MAX) {
-				debug2("unable to build filepath for '%s' and"
-				       " parameter '%s' : %m", cpath, p);
-				goto next_loop;
-			}
-			fstatus = _file_write_content(file_path, value,
-						      strlen(value));
-			if (fstatus != XCGROUP_SUCCESS)
-				debug2("%s: unable to set parameter '%s' to "
-					"'%s' for '%s'", __func__, p, value,
-					cpath);
-			else
-				debug3("%s: parameter '%s' set to '%s' for '%s'",
-					__func__, p, value, cpath);
-		} else
-			debug2("%s: bad parameters format for entry '%s'",
-				__func__, p);
-	next_loop:
-		p = next;
-	}
-
-	xfree(params);
-	return fstatus;
-}
-
 int xcgroup_set_param(xcgroup_t* cg, char* param, char* content)
 {
 	int fstatus = XCGROUP_ERROR;
diff --git a/src/slurmd/common/xcgroup.h b/src/slurmd/common/xcgroup.h
index 304b41c3a4e..c2fec528e5b 100644
--- a/src/slurmd/common/xcgroup.h
+++ b/src/slurmd/common/xcgroup.h
@@ -216,21 +216,6 @@ int xcgroup_add_pids(xcgroup_t* cg, pid_t* pids, int npids);
  */
 int xcgroup_get_pids(xcgroup_t* cg, pid_t **pids, int *npids);
 
-/*
- * set cgroup parameters using string of the form :
- * parameteres="param=value[ param=value]*"
- *
- * param must correspond to a file of the cgroup that
- * will be written with the value content
- *
- * i.e. xcgroup_set_params(&cg,"memory.swappiness=10");
- *
- * returned values:
- *  - XCGROUP_ERROR
- *  - XCGROUP_SUCCESS
- */
-int xcgroup_set_params(xcgroup_t* cg, char* parameters);
-
 /*
  * set a cgroup parameter
  *
-- 
GitLab