static u32 console_idx;
static enum printk_log_flags console_prev;
-#define PREFIX_MAX 32
-#define LOG_LINE_MAX 1024 - PREFIX_MAX
-
/* cpu currently holding printk_logbuf_lock */
static volatile unsigned int logbuf_cpu = UINT_MAX;
size_t len = iov_length(iv, count);
ssize_t ret = len;
- if (len > LOG_LINE_MAX)
+ if (len > PRINTK_LOG_LINE_MAX)
return -EINVAL;
buf = kmalloc(len+1, GFP_KERNEL);
if (buf == NULL)
struct printk_log *msg;
int len = 0;
- text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL);
+ text = kmalloc(PRINTK_LOG_LINE_MAX + PRINTK_PREFIX_MAX, GFP_KERNEL);
if (!text)
return -ENOMEM;
skip = syslog_partial;
msg = printk_log_from_idx(syslog_idx);
n = msg_print_text(msg, syslog_prev, true, text,
- LOG_LINE_MAX + PREFIX_MAX);
+ PRINTK_LOG_LINE_MAX + PRINTK_PREFIX_MAX);
if (n - syslog_partial <= size) {
/* message fits into buffer, move forward */
syslog_idx = printk_log_next(syslog_idx);
char *text;
int len = 0;
- text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL);
+ text = kmalloc(PRINTK_LOG_LINE_MAX + PRINTK_PREFIX_MAX, GFP_KERNEL);
if (!text)
return -ENOMEM;
int textlen;
textlen = msg_print_text(msg, prev, true, text,
- LOG_LINE_MAX + PREFIX_MAX);
+ PRINTK_LOG_LINE_MAX + PRINTK_PREFIX_MAX);
if (textlen < 0) {
len = textlen;
break;
* reached the console in case of a kernel crash.
*/
static struct cont {
- char buf[LOG_LINE_MAX];
+ char buf[PRINTK_LOG_LINE_MAX];
size_t len; /* length == 0 means unused buffer */
size_t cons; /* bytes written to console */
struct task_struct *owner; /* task of first print*/
const char *fmt, va_list args)
{
static int recursion_bug;
- static char textbuf[LOG_LINE_MAX];
+ static char textbuf[PRINTK_LOG_LINE_MAX];
char *text = textbuf;
size_t text_len;
enum printk_log_flags lflags = 0;
#else /* CONFIG_PRINTK */
-#define LOG_LINE_MAX 0
-#define PREFIX_MAX 0
-#define LOG_LINE_MAX 0
+#define PRINTK_LOG_LINE_MAX 0
+#define PRINTK_PREFIX_MAX 0
static u64 syslog_seq;
static u32 syslog_idx;
static u64 console_seq;
*/
void console_unlock(void)
{
- static char text[LOG_LINE_MAX + PREFIX_MAX];
+ static char text[PRINTK_LOG_LINE_MAX + PRINTK_PREFIX_MAX];
static u64 seen_seq;
unsigned long flags;
bool wake_klogd = false;