Lines Matching defs:debug_log
40 static char *batadv_log_char_addr(struct batadv_priv_debug_log *debug_log,
43 return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK];
46 static void batadv_emit_log_char(struct batadv_priv_debug_log *debug_log,
51 char_addr = batadv_log_char_addr(debug_log, debug_log->log_end);
53 debug_log->log_end++;
55 if (debug_log->log_end - debug_log->log_start > batadv_log_buff_len)
56 debug_log->log_start = debug_log->log_end - batadv_log_buff_len;
60 static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log,
67 if (!debug_log)
70 spin_lock_bh(&debug_log->lock);
76 batadv_emit_log_char(debug_log, *p);
78 spin_unlock_bh(&debug_log->lock);
80 wake_up(&debug_log->queue_wait);
104 static bool batadv_log_empty(struct batadv_priv_debug_log *debug_log)
106 return !(debug_log->log_start - debug_log->log_end);
113 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log;
118 if ((file->f_flags & O_NONBLOCK) && batadv_log_empty(debug_log))
130 error = wait_event_interruptible(debug_log->queue_wait,
131 (!batadv_log_empty(debug_log)));
136 spin_lock_bh(&debug_log->lock);
139 (debug_log->log_start != debug_log->log_end)) {
140 char_addr = batadv_log_char_addr(debug_log,
141 debug_log->log_start);
144 debug_log->log_start++;
146 spin_unlock_bh(&debug_log->lock);
150 spin_lock_bh(&debug_log->lock);
156 spin_unlock_bh(&debug_log->lock);
167 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log;
169 poll_wait(file, &debug_log->queue_wait, wait);
171 if (!batadv_log_empty(debug_log))
194 bat_priv->debug_log = kzalloc(sizeof(*bat_priv->debug_log), GFP_ATOMIC);
195 if (!bat_priv->debug_log)
198 spin_lock_init(&bat_priv->debug_log->lock);
199 init_waitqueue_head(&bat_priv->debug_log->queue_wait);
212 kfree(bat_priv->debug_log);
213 bat_priv->debug_log = NULL;
236 batadv_fdebug_log(bat_priv->debug_log, "[%10u] %pV",