From: Kamalesh Babulal Date: Wed, 16 Mar 2022 16:16:22 +0000 (+0530) Subject: include/iterators.h: fix checkpatch.pl warnings X-Git-Tag: v3.0~139 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9efc43b4781bbe3de979c53f1237d1f80b00f4c;p=thirdparty%2Flibcgroup.git include/iterators.h: fix checkpatch.pl warnings This patch introduces coding style changes such as reverse xmas tree local variable declarations, header file reordering, and many other minor tweaks such as line spacing, removing trailing white spaces. In summary, this patch fixes the following checkpatch.pl recommendations: total: 0 errors, 25 warnings, 432 lines checked Signed-off-by: Kamalesh Babulal Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/include/libcgroup/iterators.h b/include/libcgroup/iterators.h index 584b3e33..0256e090 100644 --- a/include/libcgroup/iterators.h +++ b/include/libcgroup/iterators.h @@ -53,11 +53,11 @@ extern "C" { * int ret; * ret = iterator_name_begin(&handle, &item); * while (ret == 0) { - * // process the item here + * // process the item here * ret = iterator_name_begin(&handle, &item); * } * if (ret != ECGEOF) { - * // process the error here + * // process the error here * } * iterator_name_end(&handle); * @endcode @@ -143,27 +143,28 @@ struct cgroup_file_info { * full hierarchy. * @param depth The maximum depth to which the function should walk, 0 * implies all the way down. - * @param handle Handle to be used during iteration. - * @param info Info filled and returned about directory information. + * @param handle The handle to be used during iteration. + * @param info The info filled and returned about directory information. * @param base_level Opaque integer which you must pass to subsequent - * cgroup_walk_tree_next. + * cgroup_walk_tree_next. * @todo why base_level is not hidden in **handle? * @return #ECGEOF when there is no node. */ int cgroup_walk_tree_begin(const char *controller, const char *base_path, int depth, - void **handle, struct cgroup_file_info *info, - int *base_level); + void **handle, struct cgroup_file_info *info, + int *base_level); + /** * Get the next directory in the walk. * @param depth The maximum depth to which the function should walk, 0 * implies all the way down. - * @param handle Handle to be used during iteration. - * @param info Info filled and returned about the next directory. + * @param handle The handle to be used during iteration. + * @param info The info filled and returned about the next directory. * @param base_level Value of base_level returned by cgroup_walk_tree_begin(). * @return #ECGEOF when we are done walking through the nodes. */ int cgroup_walk_tree_next(int depth, void **handle, - struct cgroup_file_info *info, int base_level); + struct cgroup_file_info *info, int base_level); /** * Release the iterator. @@ -173,7 +174,7 @@ int cgroup_walk_tree_end(void **handle); /** * Set the flags for walk_tree. Currently available flags are in * #cgroup_walk_type enum. - * @param handle Handle of the iterator. + * @param handle The handle of the iterator. * @param flags */ int cgroup_walk_tree_set_flags(void **handle, int flags); @@ -184,31 +185,32 @@ int cgroup_walk_tree_set_flags(void **handle, int flags); * The value is read up to newline character or at most max-1 characters, * whichever comes first (i.e. similar to fgets()). * @param controller Name of the controller for which stats are requested. - * @param path Path to control group, relative to hierarchy root. + * @param path The path to control group, relative to hierarchy root. * @param name is variable name. - * @param handle Handle to be used during iteration. - * @param buffer Buffer to read the value into. + * @param handle The handle to be used during iteration. + * @param buffer The buffer to read the value into. * The buffer is always zero-terminated. * @param max Maximal lenght of the buffer * @return #ECGEOF when the stats file is empty. */ int cgroup_read_value_begin(const char * const controller, const char *path, - const char * const name, void **handle, char *buffer, int max); - -/** - * Read the next string from the given variable handle - * which is generated by cgroup_read_stats_begin() function. - * the value is read up to newline character or at most max-1 characters, - * whichever comes first (i.e. similar to fgets()) per - * cgroup_read_stats_next() call - * @param handle Handle to be used during iteration. - * @param data returned the string. - * @param buffer Buffer to read the value into. - * The buffer is always zero-terminated. - * @param max Maximal lenght of the buffer - * @return #ECGEOF when the iterator finishes getting the list of stats. - */ + const char * const name, void **handle, + char *buffer, int max); + +/** + * Read the next string from the given variable handle + * which is generated by cgroup_read_stats_begin() function. + * the value is read up to newline character or at most max-1 characters, + * whichever comes first (i.e. similar to fgets()) per + * cgroup_read_stats_next() call + * @param handle The handle to be used during iteration. + * @param data returned the string. + * @param buffer The buffer to read the value into. + * The buffer is always zero-terminated. + * @param max Maximal lenght of the buffer + * @return #ECGEOF when the iterator finishes getting the list of stats. + */ int cgroup_read_value_next(void **handle, char *buffer, int max); /** @@ -242,17 +244,17 @@ struct cgroup_stat { * controller and control group. One line is returned per * cgroup_read_stats_begin() and cgroup_read_stats_next() call. * @param controller Name of the controller for which stats are requested. - * @param path Path to control group, relative to hierarchy root. - * @param handle Handle to be used during iteration. + * @param path The path to control group, relative to hierarchy root. + * @param handle The handle to be used during iteration. * @param stat Returned first item in the stats file. * @return #ECGEOF when the stats file is empty. */ int cgroup_read_stats_begin(const char *controller, const char *path, void **handle, - struct cgroup_stat *stat); + struct cgroup_stat *stat); /** * Read the next stat value. - * @param handle Handle to be used during iteration. + * @param handle The handle to be used during iteration. * @param stat Returned next item in the stats file. * @return #ECGEOF when the iterator finishes getting the list of stats. */ @@ -275,12 +277,12 @@ int cgroup_read_stats_end(void **handle); * Read the tasks file to get the list of tasks in a cgroup. * @param cgroup Name of the cgroup. * @param controller Name of the cgroup subsystem. - * @param handle Handle to be used in the iteration. + * @param handle The handle to be used in the iteration. * @param pid The pid read from the tasks file. * @return #ECGEOF when the group does not contain any tasks. */ int cgroup_get_task_begin(const char *cgroup, const char *controller, void **handle, - pid_t *pid); + pid_t *pid); /** * Read the next task value. @@ -320,7 +322,7 @@ struct cgroup_mount_point { /** * Read the mount table to give a list where each controller is * mounted. - * @param handle Handle to be used for iteration. + * @param handle The handle to be used for iteration. * @param info The variable where the path to the controller is stored. * @return #ECGEOF when no controllers are mounted. */ @@ -331,7 +333,7 @@ int cgroup_get_controller_begin(void **handle, struct cgroup_mount_point *info); * While walking through the mount table, the controllers are * returned in order of their mount points, i.e. controllers mounted together * in one hierarchy are returned next to each other. - * @param handle Handle to be used for iteration. + * @param handle The handle to be used for iteration. * @param info The variable where the path to the controller is stored. * @return #ECGEOF when all controllers were already returned. */ @@ -371,14 +373,14 @@ struct controller_data { /** * Read the first of controllers from /proc/cgroups. - * @param handle Handle to be used for iteration. + * @param handle The handle to be used for iteration. * @param info The structure which will be filled with controller data. */ int cgroup_get_all_controller_begin(void **handle, struct controller_data *info); /** * Read next controllers from /proc/cgroups. - * @param handle Handle to be used for iteration. + * @param handle The handle to be used for iteration. * @param info The structure which will be filled with controller data. */ int cgroup_get_all_controller_next(void **handle, struct controller_data *info); @@ -400,21 +402,21 @@ int cgroup_get_all_controller_end(void **handle); * Read the first mount point of the hierarchy with given controller. * The first is the same as the mount point returned by * cgroup_get_subsys_mount_point(). - * @param handle Handle to be used for iteration. - * @param controller Controller name. + * @param handle The handle to be used for iteration. + * @param controller The controller name. * @param path Buffer to fill the path into. The buffer must be at least * FILENAME_MAX characters long. */ int cgroup_get_subsys_mount_point_begin(const char *controller, void **handle, - char *path); + char *path); + /** * Read next mount point of the hierarchy with given controller. - * @param handle Handle to be used for iteration. + * @param handle The handle to be used for iteration. * @param path Buffer to fill the path into. The buffer must be at least * FILENAME_MAX characters long. */ -int cgroup_get_subsys_mount_point_next(void **handle, - char *path); +int cgroup_get_subsys_mount_point_next(void **handle, char *path); /** * Release the iterator.