]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
abstraction: Add passthrough function
authorTom Hromatka <tom.hromatka@oracle.com>
Wed, 15 Dec 2021 21:12:09 +0000 (21:12 +0000)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 3 Feb 2022 21:42:31 +0000 (14:42 -0700)
Add a passthrough function for settings/values that require
no conversion.

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

index 734f303e02a8c10be8f8b2e0c3b7f3c6ab00b784..a93bf3223e99470bd74ef2a24f1ec411df36aaab 100644 (file)
@@ -124,6 +124,14 @@ int cgroup_convert_name_only(struct cgroup_controller * const dst_cgc,
        return cgroup_add_value_string(dst_cgc, out_setting, in_value);
 }
 
+int cgroup_convert_passthrough(struct cgroup_controller * const dst_cgc,
+                              const char * const in_value,
+                              const char * const out_setting,
+                              void *in_dflt, void *out_dflt)
+{
+       return cgroup_add_value_string(dst_cgc, out_setting, in_value);
+}
+
 static int convert_setting(struct cgroup_controller * const out_cgc,
                           const struct control_value * const in_ctrl_val)
 {
index f7118e9defaae5a377336331c3b5bdc5ab8a0dbe..73eccba6fbf75e1633b7ca73632b11b112a3a810 100644 (file)
@@ -72,6 +72,20 @@ int cgroup_convert_name_only(struct cgroup_controller * const dst_cgc,
                             const char * const out_setting,
                             void *in_dflt, void *out_dflt);
 
+/**
+ * No conversion necessary.  The name and the contents are the same
+ *
+ * @param dst_cgc Destination cgroup controller
+ * @param in_value Contents of the input setting
+ * @param out_setting Destination cgroup setting
+ * @param in_dflt Default value of the input setting (unused)
+ * @param out_dflt Default value of the output setting (unused)
+ */
+int cgroup_convert_passthrough(struct cgroup_controller * const dst_cgc,
+                              const char * const in_value,
+                              const char * const out_setting,
+                              void *in_dflt, void *out_dflt);
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif