]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
cgrulesengd.h: fix checkpatch.pl warnings
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 16 Mar 2022 15:53:45 +0000 (21:23 +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, 18 warnings, 129 lines checked

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

index dfb8aca78e645f035a28e4db5c3d0fd963362b03..8ab64d8d122b866f93c2af64757d5f448c54a5a3 100644 (file)
@@ -16,6 +16,7 @@ extern "C" {
 
 #include "config.h"
 #include "libcgroup.h"
+
 #include <linux/connector.h>
 #include <linux/cn_proc.h>
 
@@ -29,15 +30,15 @@ extern "C" {
 
 /* The following ten macros are all for the Netlink code. */
 #define SEND_MESSAGE_LEN (NLMSG_LENGTH(sizeof(struct cn_msg) + \
-       sizeof(enum proc_cn_mcast_op)))
+                         sizeof(enum proc_cn_mcast_op)))
 #define RECV_MESSAGE_LEN (NLMSG_LENGTH(sizeof(struct cn_msg) + \
-       sizeof(struct proc_event)))
+                         sizeof(struct proc_event)))
 
 #define SEND_MESSAGE_SIZE (NLMSG_SPACE(SEND_MESSAGE_LEN))
 #define RECV_MESSAGE_SIZE (NLMSG_SPACE(RECV_MESSAGE_LEN))
 
-#define BUFF_SIZE (max(max(SEND_MESSAGE_SIZE, RECV_MESSAGE_SIZE), 1024))
-#define MIN_RECV_SIZE (min(SEND_MESSAGE_SIZE, RECV_MESSAGE_SIZE))
+#define BUFF_SIZE      (max(max(SEND_MESSAGE_SIZE, RECV_MESSAGE_SIZE), 1024))
+#define MIN_RECV_SIZE  (min(SEND_MESSAGE_SIZE, RECV_MESSAGE_SIZE))
 
 #define PROC_CN_MCAST_LISTEN (1)
 #define PROC_CN_MCAST_IGNORE (2)
@@ -45,9 +46,9 @@ extern "C" {
 /**
  * Prints the usage information for this program and, optionally, an error
  * message.  This function uses vfprintf.
- *     @param fd The file stream to print to
- *     @param msg The error message to print (printf style)
- *     @param ... Any args to msg (printf style)
+ *     @param fd The file stream to print to
+ *     @param msg The error message to print (printf style)
+ *     @param ... Any args to msg (printf style)
  */
 void cgre_usage(FILE *fd, const char *msg, ...);
 
@@ -55,9 +56,9 @@ void cgre_usage(FILE *fd, const char *msg, ...);
  * Prints a formatted message (like printf()) to all log destinations.
  * Flushes the file stream's buffer so that the message is immediately
  * readable.
- *     @param level The log level (LOG_EMERG ... LOG_DEBUG)
- *     @param format The format for the message (printf style)
- *     @param ... Any args to format (printf style)
+ *     @param level The log level (LOG_EMERG ... LOG_DEBUG)
+ *     @param format The format for the message (printf style)
+ *     @param ... Any args to format (printf style)
  */
 void flog(int level, const char *msg, ...);
 
@@ -65,9 +66,9 @@ void flog(int level, const char *msg, ...);
  * Process an event from the kernel, and determine the correct UID/GID/PID to
  * pass to libcgroup.  Then, libcgroup will decide the cgroup to move the PID
  * to, if any.
- *     @param ev The event to process
- *     @param type The type of event to process (part of ev)
- *     @return 0 on success, > 0 on failure
+ *     @param ev The event to process
+ *     @param type The type of event to process (part of ev)
+ *     @return 0 on success, > 0 on failure
  */
 int cgre_process_event(const struct proc_event *ev, const int type);
 
@@ -75,8 +76,8 @@ int cgre_process_event(const struct proc_event *ev, const int type);
  * Handle a netlink message.  In the event of PROC_EVENT_UID or PROC_EVENT_GID,
  * we pass the event along to cgre_process_event for further processing.  All
  * other events are ignored.
- *     @param cn_hdr The netlink message
- *     @return 0 on success, > 0 on error
+ *     @param cn_hdr The netlink message
+ *     @return 0 on success, > 0 on error
  */
 int cgre_handle_message(struct cn_msg *cn_hdr);
 
@@ -84,33 +85,33 @@ int cgre_handle_message(struct cn_msg *cn_hdr);
  * Turns this program into a daemon.  In doing so, we fork() and kill the
  * parent process.  Note too that stdout, stdin, and stderr are closed in
  * daemon mode, and a file descriptor for a log file is opened.
- *     @param logp Path of the log file, NULL if no log file was specified
- *     @param logf Syslog facility, NULL if no facility was specified
- *     @param daemon False to turn off daemon mode (no fork, leave FDs open)
- *     @param logv Log verbosity, 2 is the default, 0 = no logging, 5 = everything
- *     @return 0 on success, > 0 on error
+ *     @param logp Path of the log file, NULL if no log file was specified
+ *     @param logf Syslog facility, NULL if no facility was specified
+ *     @param daemon False to turn off daemon mode (no fork, leave FDs open)
+ *     @param logv Log verbosity, 2 is the default, 0 = no logging, 5 = everything
+ *     @return 0 on success, > 0 on error
  */
 int cgre_start_daemon(const char *logp, const int logf,
-                       const unsigned char daemon, const int logv);
+                     const unsigned char daemon, const int logv);
 
 /**
  * Catch the SIGUSR2 signal and reload the rules configuration.  This function
  * makes use of the logfile and flog() to print the new rules.
- *     @param signum The signal that we caught (always SIGUSR2)
+ *     @param signum The signal that we caught (always SIGUSR2)
  */
 void cgre_flash_rules(int signum);
 
 /**
  * Catch the SIGUSR1 signal and reload the rules configuration.  This function
  * makes use of the logfile and flog() to print the new rules.
- *     @param signum The signal that we caught (always SIGUSR1)
+ *     @param signum The signal that we caught (always SIGUSR1)
  */
 void cgre_flash_templates(int signum);
 
 /**
  * Catch the SIGTERM and SIGINT signal so that we can exit gracefully.  Before
  * exiting, this function makes use of the logfile and flog().
- *     @param signum The signal that we caught (SIGTERM, SIGINT)
+ *     @param signum The signal that we caught (SIGTERM, SIGINT)
  */
 void cgre_catch_term(int signum);