]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools-common.h: fix checkpatch.pl warnings
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 16 Mar 2022 15:51:36 +0000 (21:21 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 16 Mar 2022 21:38:20 +0000 (15:38 -0600)
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types.  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, 7 warnings, 145 lines checked

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/tools/tools-common.h

index 19171e885fdbe0763e42dab2399643af188aadd6..b3e15f3c06c1c302a842f88970c6ecea89f1ef18 100644 (file)
 #ifdef __cplusplus
 extern "C" {
 #endif
+
 #include "config.h"
-#include <libcgroup.h>
 #include "../libcgroup-internal.h"
 
+#include <libcgroup.h>
+
 #define cgroup_err(x...) cgroup_log(CGROUP_LOG_ERROR, "Error: " x)
 #define cgroup_warn(x...) cgroup_log(CGROUP_LOG_WARNING, "Warning: " x)
 #define cgroup_info(x...) cgroup_log(CGROUP_LOG_INFO, "Info: " x)
@@ -30,7 +32,6 @@ struct cgroup_group_spec {
        char *controllers[CG_CONTROLLER_MAX];
 };
 
-
 /**
  * Simple dynamic array of strings.
  */
@@ -48,9 +49,9 @@ struct cgroup_string_list {
  * provided cdptr, i.e. on place of first NULL cgroup_group_spec*.
  *
  * @param cdptr Target data structure to fill. New item is allocated and added
- *             at the end.
+ *             at the end.
  * @param optarg Argument to parse.
- * @param capacity Capacity of the cdptr array.
+ * @param capacity The capacity of the cdptr array.
  * @return 0 on success, != 0 on error.
  */
 int parse_cgroup_spec(struct cgroup_group_spec **cdptr, char *optarg,
@@ -58,33 +59,33 @@ int parse_cgroup_spec(struct cgroup_group_spec **cdptr, char *optarg,
 
 /**
  * Free a single cgroup_group_spec structure.
- *     @param cl The structure to free from memory
+ *     @param cl The structure to free from memory
  */
 void cgroup_free_group_spec(struct cgroup_group_spec *cl);
 
 
 /**
  * Initialize a new list.
- * @param list List to initialize.
- * @param initial_size Initial size of the list to pre-allocate.
+ * @param list The list to initialize.
+ * @param initial_size The initial size of the list to pre-allocate.
  */
 int cgroup_string_list_init(struct cgroup_string_list *list,
-               int initial_size);
+                           int initial_size);
 
 /**
  * Destroy a list, automatically freeing all its items.
- * @param list List to destroy.
+ * @param list The list to destroy.
  */
 void cgroup_string_list_free(struct cgroup_string_list *list);
 
 /**
  * Adds new item to the list. It automatically resizes underlying array if
  * needed.
- * @param list List to modify.
- * @param item Item to add. The item is automatically copied to new buffer.
+ * @param list The list to modify.
+ * @param item The item to add. The item is automatically copied to new buffer.
  */
 int cgroup_string_list_add_item(struct cgroup_string_list *list,
-               const char *item);
+                               const char *item);
 
 /**
  * Add alphabetically sorted files present in given directory (without subdirs)
@@ -96,7 +97,7 @@ int cgroup_string_list_add_item(struct cgroup_string_list *list,
  *
  */
 int cgroup_string_list_add_directory(struct cgroup_string_list *list,
-               char *dirname, char *program_name);
+                                    char *dirname, char *program_name);
 
 
 /**
@@ -115,7 +116,7 @@ int parse_mode(char *string, mode_t *pmode, const char *program_name);
  * @param program_name Argv[0] to show error messages.
  */
 int parse_uid_gid(char *string, uid_t *uid, gid_t *gid,
-               const char *program_name);
+                 const char *program_name);
 
 /**
  * Functions that are defined as STATIC can be placed within the UNIT_TEST