https://virtuozzo.atlassian.net/browse/VSTOR-119876

Signed-off-by: Aleksei Oladko <[email protected]>
---
 include/linux/printk.h |  8 ++++++++
 kernel/printk/printk.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/include/linux/printk.h b/include/linux/printk.h
index d74ad6f38987..8bbf98d43b93 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -169,6 +169,9 @@ int _printk(const char *fmt, ...);
 asmlinkage __printf(2, 3) __cold
 int ve_printk(int dst, const char *fmt, ...);
 
+asmlinkage __printf(2, 3) __cold
+int ve_printk_deferred(int dst, const char *fmt, ...);
+
 struct ve_struct;
 int ve_log_init(struct ve_struct *ve);
 void ve_log_destroy(struct ve_struct *ve);
@@ -237,6 +240,11 @@ int ve_printk(int dst, const char *s, ...)
 {
        return 0;
 }
+static inline __printf(2, 3) __cold
+int ve_printk_deferred(int dst, const char *s, ...)
+{
+       return 0;
+}
 static inline
 int ve_log_init(struct ve_struct *ve)
 {
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index f8e32b5fad0d..719ebe73ae9c 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2558,6 +2558,34 @@ asmlinkage int ve_printk(int dst, const char *fmt, ...)
 }
 EXPORT_SYMBOL(ve_printk);
 
+static asmlinkage int ve_vprintk_deferred(int dst, const char *fmt, va_list 
args)
+{
+       va_list args2;
+       int r = 0;
+
+       va_copy(args2, args);
+       if ((dst & VE0_LOG) || ve_is_super(get_exec_env()))
+               r = vprintk_emit(0, LOGLEVEL_SCHED, NULL, fmt, args);
+       if (!ve_is_super(get_exec_env()) && (dst & VE_LOG))
+               r = ve_vprintk_emit(0, LOGLEVEL_SCHED, NULL, fmt, args2);
+       va_end(args2);
+
+       return r;
+}
+
+asmlinkage int ve_printk_deferred(int dst, const char *fmt, ...)
+{
+       va_list args;
+       int r;
+
+       va_start(args, fmt);
+       r = ve_vprintk_deferred(dst, fmt, args);
+       va_end(args);
+
+       return r;
+}
+EXPORT_SYMBOL(ve_printk_deferred);
+
 static asmlinkage int ve_log_vprintk(struct ve_struct *ve, const char *fmt, 
va_list args)
 {
        int r = 0;
-- 
2.43.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to