From d8e6c0b5d933a2fad79c014509e0824103652d41 Mon Sep 17 00:00:00 2001 From: Kamalesh Babulal Date: Thu, 30 Jun 2022 19:32:56 +0530 Subject: [PATCH] tools/cgcreate: increase the column width to 100 100 column width is more comfortable to read over 80 columns, lets increase it. This patch, also introduced/removes empty lines across the file, making it more readable. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- src/tools/cgcreate.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/tools/cgcreate.c b/src/tools/cgcreate.c index 198caa3b..96d015a9 100644 --- a/src/tools/cgcreate.c +++ b/src/tools/cgcreate.c @@ -27,17 +27,14 @@ static void usage(int status, const char *program_name) { if (status != 0) { - err("Wrong input parameters, "); - err(" try %s -h' for more information.\n", program_name); + err("Wrong input parameters, try %s -h for more information.\n", program_name); return; } info("Usage: %s [-h] [-f mode] [-d mode] [-s mode] ", program_name); - info("[-t :] [-a :] "); - info("-g : [-g ...]\n"); + info("[-t :] [-a :] -g : [-g ...]\n"); info("Create control group(s)\n"); - info(" -a : Owner of the group and all "); - info("its files\n"); + info(" -a : Owner of the group and all its files\n"); info(" -d, --dperm=mode Group directory permissions\n"); info(" -f, --fperm=mode Group file permissions\n"); info(" -g : Control group which should be added\n"); @@ -94,8 +91,7 @@ int main(int argc, char *argv[]) } /* parse arguments */ - while ((c = getopt_long(argc, argv, "a:t:g:hd:f:s:", long_opts, - NULL)) > 0) { + while ((c = getopt_long(argc, argv, "a:t:g:hd:f:s:", long_opts, NULL)) > 0) { switch (c) { case 'h': usage(0, argv[0]); @@ -114,8 +110,8 @@ int main(int argc, char *argv[]) case 'g': ret = parse_cgroup_spec(cgroup_list, optarg, capacity); if (ret) { - err("%s: cgroup controller and path", argv[0]); - err("parsing failed (%s)\n", argv[optind]); + err("%s: cgroup controller and path parsing failed (%s)\n", + argv[0], argv[optind]); ret = -1; goto err; } @@ -155,8 +151,7 @@ int main(int argc, char *argv[]) /* initialize libcg */ ret = cgroup_init(); if (ret) { - err("%s: libcgroup initialization failed: %s\n", argv[0], - cgroup_strerror(ret)); + err("%s: libcgroup initialization failed: %s\n", argv[0], cgroup_strerror(ret)); goto err; } @@ -169,8 +164,7 @@ int main(int argc, char *argv[]) cgroup = cgroup_new_cgroup(cgroup_list[i]->path); if (!cgroup) { ret = ECGFAIL; - err("%s: can't add new cgroup: %s\n", argv[0], - cgroup_strerror(ret)); + err("%s: can't add new cgroup: %s\n", argv[0], cgroup_strerror(ret)); goto err; } @@ -187,8 +181,7 @@ int main(int argc, char *argv[]) ret = cgroup_add_all_controllers(cgroup); if (ret != 0) { ret = ECGINVAL; - err("%s: can't add all controllers\n", - argv[0]); + err("%s: can't add all controllers\n", argv[0]); cgroup_free(&cgroup); goto err; } @@ -197,8 +190,7 @@ int main(int argc, char *argv[]) cgroup_list[i]->controllers[j]); if (!cgc) { ret = ECGINVAL; - err("%s: controller %s can't be add\n", - argv[0], + err("%s: controller %s can't be add\n", argv[0], cgroup_list[i]->controllers[j]); cgroup_free(&cgroup); goto err; @@ -209,13 +201,12 @@ int main(int argc, char *argv[]) /* all variables set so create cgroup */ if (dirm_change | filem_change) - cgroup_set_permissions(cgroup, dir_mode, file_mode, - tasks_mode); + cgroup_set_permissions(cgroup, dir_mode, file_mode, tasks_mode); ret = cgroup_create_cgroup(cgroup, 0); if (ret) { - err("%s: can't create cgroup %s: %s\n", - argv[0], cgroup->name, cgroup_strerror(ret)); + err("%s: can't create cgroup %s: %s\n", argv[0], cgroup->name, + cgroup_strerror(ret)); cgroup_free(&cgroup); goto err; } -- 2.47.2