]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
libcgroup: cleanup: remove redundant parameter to function
authorDhaval Giani <dhaval@linux.vnet.ibm.com>
Mon, 22 Dec 2008 18:53:49 +0000 (18:53 +0000)
committerDhaval Giani <dhaval@linux.vnet.ibm.com>
Mon, 22 Dec 2008 18:53:49 +0000 (18:53 +0000)
From: Sudhir Kumar <skumar@linux.vnet.ibm.com>

There is no need to pass a separate variable for getting single/multiple
mount info, as we can get this info from the varaible received from script.
So this patch does that modification and puts the variaable fs_mounted as
global as it is never modified.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@284 4f4bb910-9a46-0410-90c8-c897d4f1cd53

tests/libcgrouptest.h
tests/libcgrouptest01.c

index e5a1f14018e492169826a9ebb783348f8f6f5453..369a965aef96c7bf4c3c453a8d91ec7609de5331 100644 (file)
@@ -68,7 +68,9 @@ uid_t control_uid;
 gid_t control_gid;
 uid_t tasks_uid;
 gid_t tasks_gid;
-static int i;
+
+/* this variable is never modified */
+int fs_mounted;
 
 /* The mountpoints as received from script */
 char mountpoint[FILENAME_MAX], mountpoint2[FILENAME_MAX];
@@ -80,7 +82,7 @@ char extra[SIZE] = "\n";
 void test_cgroup_init(int retcode, int i);
 void test_cgroup_attach_task(int retcode, struct cgroup *cgroup1,
                                const char *group1, const char *group2,
-                               int fs_info, int k, int i);
+                                                               int k, int i);
 struct cgroup *create_new_cgroup_ds(int ctl, const char *grpname,
                                                 int value_type, int i);
 /* API test functions end here */
index 46a5bb3d6ad1ae02880d596fada5d20a03cad67c..b0a9bd99891e6b69dde2224fe9ba48908684070a 100644 (file)
@@ -18,7 +18,7 @@
 
 int main(int argc, char *argv[])
 {
-       int fs_mounted, retval;
+       int retval;
        struct cgroup *cgroup1, *cgroup2, *cgroup3, *nullcgroup = NULL;
        struct cgroup_controller *sec_controller;
        /* In case of multimount for readability we use the controller name
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
                 */
 
                test_cgroup_attach_task(ECGROUPNOTINITIALIZED, nullcgroup,
-                                        NULL, NULL, FS_NOT_MOUNTED, 0, 2);
+                                        NULL, NULL, 0, 2);
 
                /*
                 * Test03: Create a valid cgroup ds and check all return values
@@ -179,7 +179,7 @@ int main(int argc, char *argv[])
                 */
 
                test_cgroup_attach_task(ECGROUPNOTINITIALIZED, nullcgroup,
-                                                NULL, NULL, FS_MOUNTED, 0, 1);
+                                                NULL, NULL, 0, 1);
 
                /*
                 * Test02: call cgroup_init() and check return values
@@ -197,7 +197,7 @@ int main(int argc, char *argv[])
                 */
 
                test_cgroup_attach_task(0, nullcgroup,
-                                                NULL, NULL, FS_MOUNTED, 0, 3);
+                                                NULL, NULL, 0, 3);
                /*
                 * Test04: Call cgroup_attach_task_pid() with null group
                 * and invalid pid
@@ -261,8 +261,7 @@ int main(int argc, char *argv[])
                 * Exp outcome: current task should be attached to that group
                 */
 
-               test_cgroup_attach_task(0, cgroup1, "group1", NULL,
-                                                        FS_MOUNTED, 20, 7);
+               test_cgroup_attach_task(0, cgroup1, "group1", NULL, 20, 7);
 
                /*
                 * Test08: modify cgroup with the same cgroup
@@ -469,8 +468,7 @@ int main(int argc, char *argv[])
                 * Exp outcome: current task should be attached to root groups
                 */
 
-               test_cgroup_attach_task(0, nullcgroup,
-                                        NULL, NULL, FS_MULTI_MOUNTED, 0, 2);
+               test_cgroup_attach_task(0, nullcgroup, NULL, NULL, 0, 2);
 
                /*
                 * Test03: Create a valid cgroup structure
@@ -569,7 +567,7 @@ int main(int argc, char *argv[])
                 */
 
                test_cgroup_attach_task(0, ctl1_cgroup1, "ctl1_group1",
-                                                NULL, FS_MULTI_MOUNTED, 20, 8);
+                                                                NULL, 20, 8);
 
                /*
                 * Test07: Call cgroup_attach_task() with a group with ctl2
@@ -579,7 +577,7 @@ int main(int argc, char *argv[])
                 */
 
                test_cgroup_attach_task(0, ctl2_cgroup1, "ctl1_group1",
-                                "ctl2_group1", FS_MULTI_MOUNTED, 20, 9);
+                                                        "ctl2_group1", 20, 9);
 
                /*
                 * Test: Create a valid cgroup structure
@@ -600,7 +598,7 @@ int main(int argc, char *argv[])
                 */
 
                test_cgroup_attach_task(ECGROUPNOTEXIST, ctl2_cgroup2,
-                                        NULL, NULL, FS_MULTI_MOUNTED, 2, 11);
+                                                        NULL, NULL, 2, 11);
 
                /*
                 * Create another valid cgroup structure with same group name
@@ -784,7 +782,7 @@ int main(int argc, char *argv[])
                 */
 
                test_cgroup_attach_task(0, common_cgroup, "commongroup",
-                                "commongroup", FS_MULTI_MOUNTED, 1, 20);
+                                                        "commongroup", 1, 20);
 
                /*
                 * Test18: Create a valid cgroup structure to modify the
@@ -938,7 +936,7 @@ void test_cgroup_init(int retcode, int i)
 
 void test_cgroup_attach_task(int retcode, struct cgroup *cgrp,
                                 const char *group1, const char *group2,
-                                int fs_info, int k, int i)
+                                                               int k, int i)
 {
        int retval;
        char tasksfile[FILENAME_MAX], tasksfile2[FILENAME_MAX];
@@ -960,7 +958,7 @@ void test_cgroup_attach_task(int retcode, struct cgroup *cgrp,
                                         group1, "tasks");
 
                if (check_task(tasksfile)) {
-                       if (fs_info == 2) { /* multiple mounts */
+                       if (fs_mounted == 2) { /* multiple mounts */
                                build_path(tasksfile2, mountpoint2,
                                                         group2, "tasks");
                                if (check_task(tasksfile2)) {