Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 0 warnings, 84 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
// SPDX-License-Identifier: LGPL-2.1-only
-#include <stdio.h>
+#include <libcgroup.h>
+
#include <stdlib.h>
-#include <sys/types.h>
#include <unistd.h>
#include <string.h>
-#include <libcgroup.h>
+#include <stdio.h>
+
+#include <sys/types.h>
int read_stats(char *path, char *controller)
{
- int ret;
- void *handle;
struct cgroup_stat stat;
+ void *handle;
+ int ret;
ret = cgroup_read_stats_begin(controller, path, &handle, &stat);
-
if (ret != 0) {
fprintf(stderr, "stats read failed\n");
return -1;
int main(int argc, char *argv[])
{
- int ret;
- char *controller;
- void *handle;
struct cgroup_file_info info;
- int lvl;
char cgroup_path[FILENAME_MAX];
+ char *controller;
int root_len;
+ void *handle;
+ int lvl;
+ int ret;
if (argc < 2) {
fprintf(stderr, "Usage %s: <controller name>\n",