log.c (07fa3fa2572f2dee85beb8137f90ccf33d7206af) | log.c (0dacc7fab623be97bda7aefe0d1d8d68cebb4218) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* Copyright (C) 2010-2018 B.A.T.M.A.N. contributors: 3 * 4 * Marek Lindner 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of version 2 of the GNU General Public 8 * License as published by the Free Software Foundation. --- 29 unchanged lines hidden (view full) --- 38#include <linux/types.h> 39#include <linux/uaccess.h> 40#include <linux/wait.h> 41#include <stdarg.h> 42 43#include "debugfs.h" 44#include "trace.h" 45 | 1// SPDX-License-Identifier: GPL-2.0 2/* Copyright (C) 2010-2018 B.A.T.M.A.N. contributors: 3 * 4 * Marek Lindner 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of version 2 of the GNU General Public 8 * License as published by the Free Software Foundation. --- 29 unchanged lines hidden (view full) --- 38#include <linux/types.h> 39#include <linux/uaccess.h> 40#include <linux/wait.h> 41#include <stdarg.h> 42 43#include "debugfs.h" 44#include "trace.h" 45 |
46#ifdef CONFIG_BATMAN_ADV_DEBUGFS 47 |
|
46#define BATADV_LOG_BUFF_MASK (batadv_log_buff_len - 1) 47 48static const int batadv_log_buff_len = BATADV_LOG_BUF_LEN; 49 50static char *batadv_log_char_addr(struct batadv_priv_debug_log *debug_log, 51 size_t idx) 52{ 53 return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK]; --- 33 unchanged lines hidden (view full) --- 87 88 spin_unlock_bh(&debug_log->lock); 89 90 wake_up(&debug_log->queue_wait); 91 92 return 0; 93} 94 | 48#define BATADV_LOG_BUFF_MASK (batadv_log_buff_len - 1) 49 50static const int batadv_log_buff_len = BATADV_LOG_BUF_LEN; 51 52static char *batadv_log_char_addr(struct batadv_priv_debug_log *debug_log, 53 size_t idx) 54{ 55 return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK]; --- 33 unchanged lines hidden (view full) --- 89 90 spin_unlock_bh(&debug_log->lock); 91 92 wake_up(&debug_log->queue_wait); 93 94 return 0; 95} 96 |
95/** 96 * batadv_debug_log() - Add debug log entry 97 * @bat_priv: the bat priv with all the soft interface information 98 * @fmt: format string 99 * 100 * Return: 0 on success or negative error number in case of failure 101 */ 102int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) 103{ 104 struct va_format vaf; 105 va_list args; 106 107 va_start(args, fmt); 108 109 vaf.fmt = fmt; 110 vaf.va = &args; 111 112 batadv_fdebug_log(bat_priv->debug_log, "[%10u] %pV", 113 jiffies_to_msecs(jiffies), &vaf); 114 115 trace_batadv_dbg(bat_priv, &vaf); 116 117 va_end(args); 118 119 return 0; 120} 121 | |
122static int batadv_log_open(struct inode *inode, struct file *file) 123{ 124 if (!try_module_get(THIS_MODULE)) 125 return -EBUSY; 126 127 batadv_debugfs_deprecated(file, 128 "Use tracepoint batadv:batadv_dbg instead\n"); 129 --- 124 unchanged lines hidden (view full) --- 254 * batadv_debug_log_cleanup() - Destroy debug log 255 * @bat_priv: the bat priv with all the soft interface information 256 */ 257void batadv_debug_log_cleanup(struct batadv_priv *bat_priv) 258{ 259 kfree(bat_priv->debug_log); 260 bat_priv->debug_log = NULL; 261} | 97static int batadv_log_open(struct inode *inode, struct file *file) 98{ 99 if (!try_module_get(THIS_MODULE)) 100 return -EBUSY; 101 102 batadv_debugfs_deprecated(file, 103 "Use tracepoint batadv:batadv_dbg instead\n"); 104 --- 124 unchanged lines hidden (view full) --- 229 * batadv_debug_log_cleanup() - Destroy debug log 230 * @bat_priv: the bat priv with all the soft interface information 231 */ 232void batadv_debug_log_cleanup(struct batadv_priv *bat_priv) 233{ 234 kfree(bat_priv->debug_log); 235 bat_priv->debug_log = NULL; 236} |
237 238#endif /* CONFIG_BATMAN_ADV_DEBUGFS */ 239 240/** 241 * batadv_debug_log() - Add debug log entry 242 * @bat_priv: the bat priv with all the soft interface information 243 * @fmt: format string 244 * 245 * Return: 0 on success or negative error number in case of failure 246 */ 247int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) 248{ 249 struct va_format vaf; 250 va_list args; 251 252 va_start(args, fmt); 253 254 vaf.fmt = fmt; 255 vaf.va = &args; 256 257#ifdef CONFIG_BATMAN_ADV_DEBUGFS 258 batadv_fdebug_log(bat_priv->debug_log, "[%10u] %pV", 259 jiffies_to_msecs(jiffies), &vaf); 260#endif 261 262 trace_batadv_dbg(bat_priv, &vaf); 263 264 va_end(args); 265 266 return 0; 267} |
|