[Devel] [PATCH vz8] ve: fixes for !CONFIG_VE case

Nikita Yushchenko nikita.yushchenko at virtuozzo.com
Tue Oct 19 17:43:39 MSK 2021


Avoid several compile errors if CONFIG_VE is not defined.

Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 include/linux/sched.h    | 2 +-
 include/linux/ve.h       | 7 ++++---
 include/linux/ve_proto.h | 1 +
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 67b28133d88f..51b0c562d983 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2078,8 +2078,8 @@ int sched_trace_rq_nr_running(struct rq *rq);
 
 const struct cpumask *sched_trace_rd_span(struct root_domain *rd);
 
-#ifdef CONFIG_VE
 struct cgroup_subsys_state;
+#ifdef CONFIG_VE
 extern void link_ve_root_cpu_cgroup(struct cgroup_subsys_state *css);
 void unlink_ve_root_cpu_cgroup(struct cgroup_subsys_state *css);
 #else /* CONFIG_VE */
diff --git a/include/linux/ve.h b/include/linux/ve.h
index 3028ce3455cf..df0a5a0a945c 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -224,8 +224,9 @@ extern int vz_security_protocol_check(struct net *net, int protocol);
 int ve_net_hide_sysctl(struct net *net);
 
 #else	/* CONFIG_VE */
-#define get_ve(ve)	(NULL)
-#define put_ve(ve)	do { } while (0)
+#include <linux/init_task.h>
+#define get_ve(ve)	((void)(ve), NULL)
+#define put_ve(ve)	do { (void)(ve); } while (0)
 
 static inline void ve_stop_ns(struct pid_namespace *ns) { }
 static inline void ve_exit_ns(struct pid_namespace *ns) { }
@@ -254,7 +255,7 @@ static inline int vz_security_protocol_check(struct net *net, int protocol) { re
 static inline void monotonic_abs_to_ve(clockid_t which_clock,
 				       struct timespec64 *tp) { }
 static inline void monotonic_ve_to_abs(clockid_t which_clock,
-				       struct timepsec64 *tp) { }
+				       struct timespec64 *tp) { }
 
 #endif	/* CONFIG_VE */
 
diff --git a/include/linux/ve_proto.h b/include/linux/ve_proto.h
index 7ec73cfe3dd7..d7b613f7d26d 100644
--- a/include/linux/ve_proto.h
+++ b/include/linux/ve_proto.h
@@ -78,6 +78,7 @@ extern void ve_hook_register(int chain, struct ve_hook *vh);
 extern void ve_hook_unregister(struct ve_hook *vh);
 extern int nr_threads_ve(struct ve_struct *ve);
 #else /* CONFIG_VE */
+#include <linux/sched/stat.h>
 #define ve_hook_register(ch, vh)	do { } while (0)
 #define ve_hook_unregister(ve)		do { } while (0)
 
-- 
2.30.2



More information about the Devel mailing list