Lines Matching refs:debug_log
62 static char *batadv_log_char_addr(struct batadv_priv_debug_log *debug_log, in batadv_log_char_addr() argument
65 return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK]; in batadv_log_char_addr()
68 static void batadv_emit_log_char(struct batadv_priv_debug_log *debug_log, in batadv_emit_log_char() argument
73 char_addr = batadv_log_char_addr(debug_log, debug_log->log_end); in batadv_emit_log_char()
75 debug_log->log_end++; in batadv_emit_log_char()
77 if (debug_log->log_end - debug_log->log_start > batadv_log_buff_len) in batadv_emit_log_char()
78 debug_log->log_start = debug_log->log_end - batadv_log_buff_len; in batadv_emit_log_char()
82 static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log, in batadv_fdebug_log() argument
89 if (!debug_log) in batadv_fdebug_log()
92 spin_lock_bh(&debug_log->lock); in batadv_fdebug_log()
98 batadv_emit_log_char(debug_log, *p); in batadv_fdebug_log()
100 spin_unlock_bh(&debug_log->lock); in batadv_fdebug_log()
102 wake_up(&debug_log->queue_wait); in batadv_fdebug_log()
114 batadv_fdebug_log(bat_priv->debug_log, "[%10u] %s", in batadv_debug_log()
137 static int batadv_log_empty(struct batadv_priv_debug_log *debug_log) in batadv_log_empty() argument
139 return !(debug_log->log_start - debug_log->log_end); in batadv_log_empty()
146 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; in batadv_log_read() local
151 if ((file->f_flags & O_NONBLOCK) && batadv_log_empty(debug_log)) in batadv_log_read()
163 error = wait_event_interruptible(debug_log->queue_wait, in batadv_log_read()
164 (!batadv_log_empty(debug_log))); in batadv_log_read()
169 spin_lock_bh(&debug_log->lock); in batadv_log_read()
172 (debug_log->log_start != debug_log->log_end)) { in batadv_log_read()
173 char_addr = batadv_log_char_addr(debug_log, in batadv_log_read()
174 debug_log->log_start); in batadv_log_read()
177 debug_log->log_start++; in batadv_log_read()
179 spin_unlock_bh(&debug_log->lock); in batadv_log_read()
183 spin_lock_bh(&debug_log->lock); in batadv_log_read()
189 spin_unlock_bh(&debug_log->lock); in batadv_log_read()
200 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log; in batadv_log_poll() local
202 poll_wait(file, &debug_log->queue_wait, wait); in batadv_log_poll()
204 if (!batadv_log_empty(debug_log)) in batadv_log_poll()
225 bat_priv->debug_log = kzalloc(sizeof(*bat_priv->debug_log), GFP_ATOMIC); in batadv_debug_log_setup()
226 if (!bat_priv->debug_log) in batadv_debug_log_setup()
229 spin_lock_init(&bat_priv->debug_log->lock); in batadv_debug_log_setup()
230 init_waitqueue_head(&bat_priv->debug_log->queue_wait); in batadv_debug_log_setup()
246 kfree(bat_priv->debug_log); in batadv_debug_log_cleanup()
247 bat_priv->debug_log = NULL; in batadv_debug_log_cleanup()