Commit 04c13411 authored by Andrey Ignatov's avatar Andrey Ignatov Committed by Daniel Borkmann

selftests/bpf: Fix const'ness in cgroup_helpers

Lack of const in cgroup helpers signatures forces to write ugly client
code. Fix it.
Signed-off-by: default avatarAndrey Ignatov <rdna@fb.com>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 060a7fcc
...@@ -118,7 +118,7 @@ static int join_cgroup_from_top(char *cgroup_path) ...@@ -118,7 +118,7 @@ static int join_cgroup_from_top(char *cgroup_path)
* *
* On success, it returns 0, otherwise on failure it returns 1. * On success, it returns 0, otherwise on failure it returns 1.
*/ */
int join_cgroup(char *path) int join_cgroup(const char *path)
{ {
char cgroup_path[PATH_MAX + 1]; char cgroup_path[PATH_MAX + 1];
...@@ -158,7 +158,7 @@ void cleanup_cgroup_environment(void) ...@@ -158,7 +158,7 @@ void cleanup_cgroup_environment(void)
* On success, it returns the file descriptor. On failure it returns 0. * On success, it returns the file descriptor. On failure it returns 0.
* If there is a failure, it prints the error to stderr. * If there is a failure, it prints the error to stderr.
*/ */
int create_and_get_cgroup(char *path) int create_and_get_cgroup(const char *path)
{ {
char cgroup_path[PATH_MAX + 1]; char cgroup_path[PATH_MAX + 1];
int fd; int fd;
...@@ -186,7 +186,7 @@ int create_and_get_cgroup(char *path) ...@@ -186,7 +186,7 @@ int create_and_get_cgroup(char *path)
* which is an invalid cgroup id. * which is an invalid cgroup id.
* If there is a failure, it prints the error to stderr. * If there is a failure, it prints the error to stderr.
*/ */
unsigned long long get_cgroup_id(char *path) unsigned long long get_cgroup_id(const char *path)
{ {
int dirfd, err, flags, mount_id, fhsize; int dirfd, err, flags, mount_id, fhsize;
union { union {
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
__FILE__, __LINE__, clean_errno(), ##__VA_ARGS__) __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__)
int create_and_get_cgroup(char *path); int create_and_get_cgroup(const char *path);
int join_cgroup(char *path); int join_cgroup(const char *path);
int setup_cgroup_environment(void); int setup_cgroup_environment(void);
void cleanup_cgroup_environment(void); void cleanup_cgroup_environment(void);
unsigned long long get_cgroup_id(char *path); unsigned long long get_cgroup_id(const char *path);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment