Add more printf() related functions to the LinuxKPI.

Obtained from:	kmacy @
MFC after:	1 week
Sponsored by:	Mellanox Technologies
This commit is contained in:
hselasky 2016-05-23 12:35:07 +00:00
parent 8f6176cfd2
commit bbffa168e8

View File

@ -52,6 +52,8 @@
#include <linux/log2.h>
#include <asm/byteorder.h>
#include <machine/stdarg.h>
#define KERN_CONT ""
#define KERN_EMERG "<0>"
#define KERN_ALERT "<1>"
@ -124,7 +126,37 @@
#define DIV_ROUND_UP_ULL(x, n) DIV_ROUND_UP((unsigned long long)(x), (n))
#define FIELD_SIZEOF(t, f) sizeof(((t *)0)->f)
#define printk(X...) printf(X)
#define printk(...) printf(__VA_ARGS__)
#define vprintk(f, a) vprintf(f, a)
struct va_format {
const char *fmt;
va_list *va;
};
static inline int
vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
{
ssize_t ssize = size;
int i;
i = vsnprintf(buf, size, fmt, args);
return ((i >= ssize) ? (ssize - 1) : i);
}
static inline int
scnprintf(char *buf, size_t size, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i = vscnprintf(buf, size, fmt, args);
va_end(args);
return (i);
}
/*
* The "pr_debug()" and "pr_devel()" macros should produce zero code