/* Functions to test each API */
void test_cgroup_init(int retcode, int i);
void test_cgroup_attach_task(int retcode, struct cgroup *cgroup1,
- char *group1, char *group2, int fs_info, int k, int i);
+ const char *group1, const char *group2,
+ int fs_info, int k, int i);
/* API test functions end here */
-void get_controllers(char *name, int *exist);
+void get_controllers(const char *name, int *exist);
static int group_exist(char *path_group);
static int set_controller(int controller, char *controller_name,
char *control_file);
int check_fsmounted(int multimnt);
static int check_task(char *tasksfile);
/* function to print messages in better format */
-static inline void message(int num, int pass, char *api, int ret, char *extra);
+static inline void message(int num, int pass, const char *api,
+ int ret, char *extra);
static inline void build_path(char *target, char *mountpoint,
- char *group, char *file);
+ const char *group, const char *file);
/* Allocate memory and populate info messages */
void set_info_msgs();
char group[FILENAME_MAX];
/* Get controllers name from script */
- int ctl1, ctl2;
+ int ctl1 = CPU, ctl2 = MEMORY;
if ((argc < 2) || (argc > 6) || (atoi(argv[1]) < 0)) {
printf("ERROR: Wrong no of parameters recieved from script\n");
}
void test_cgroup_attach_task(int retcode, struct cgroup *cgrp,
- char *group1, char *group2, int fs_info, int k, int i)
+ const char *group1, const char *group2,
+ int fs_info, int k, int i)
{
int retval;
char tasksfile[FILENAME_MAX], tasksfile2[FILENAME_MAX];
info[5]);
}
} else {
- message(i, FAIL, "attach_task()", retval, "\n");
+ message(i, FAIL, "attach_task()", retval, (char *)"\n");
}
}
-void get_controllers(char *name, int *exist)
+void get_controllers(const char *name, int *exist)
{
int hierarchy, num_cgroups, enabled;
FILE *fd;
char wr[SIZE]; /* Names of wrapper apis */
struct cgroup *newcgroup;
struct cgroup_controller *newcontroller;
+
newcgroup = cgroup_new_cgroup(group);
if (newcgroup) {
control_uid, control_gid);
if (retval) {
- printf("Test[1:%2d]\tFAIL: cgroup_set_uid_gid()\n",
- ++i);
+ snprintf(wr, SIZE, "set_uid_gid()");
+ message(i++, FAIL, wr, retval, extra);
}
- newcontroller = cgroup_add_controller(newcgroup, controller_name);
+ newcontroller = cgroup_add_controller(newcgroup,
+ controller_name);
if (newcontroller) {
retval = add_control_value(newcontroller,
control_file, wr, value_type);
return pass;
}
-static inline void message(int num, int pass, char *api,
+static inline void message(int num, int pass, const char *api,
int retval, char *extra)
{
char res[10];
/* builds the path to target file/group */
static inline void build_path(char *target, char *mountpoint,
- char *group, char *file)
+ const char *group, const char *file)
{
strncpy(target, mountpoint, FILENAME_MAX);