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 <[email protected]> Index: trunk/tests/libcgrouptest.h =================================================================== --- trunk.orig/tests/libcgrouptest.h +++ trunk/tests/libcgrouptest.h @@ -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: trunk/tests/libcgrouptest01.c =================================================================== --- trunk.orig/tests/libcgrouptest01.c +++ trunk/tests/libcgrouptest01.c @@ -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 @@ -260,8 +260,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 @@ -467,8 +466,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 @@ -567,7 +565,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 @@ -577,7 +575,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 @@ -598,7 +596,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 @@ -782,7 +780,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 @@ -936,7 +934,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]; @@ -958,7 +956,7 @@ void test_cgroup_attach_task(int retcode 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)) { ------------------------------------------------------------------------------ _______________________________________________ Libcg-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libcg-devel
