Lines Matching refs:debug_log
41 static char *batadv_log_char_addr(struct batadv_priv_debug_log *debug_log,
44 return &debug_log->log_buff[idx & BATADV_LOG_BUFF_MASK];
47 static void batadv_emit_log_char(struct batadv_priv_debug_log *debug_log,
52 char_addr = batadv_log_char_addr(debug_log, debug_log->log_end);
54 debug_log->log_end++;
56 if (debug_log->log_end - debug_log->log_start > batadv_log_buff_len)
57 debug_log->log_start = debug_log->log_end - batadv_log_buff_len;
61 static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log,
68 if (!debug_log)
71 spin_lock_bh(&debug_log->lock);
77 batadv_emit_log_char(debug_log, *p);
79 spin_unlock_bh(&debug_log->lock);
81 wake_up(&debug_log->queue_wait);
93 batadv_fdebug_log(bat_priv->debug_log, "[%10u] %s",
116 static int batadv_log_empty(struct batadv_priv_debug_log *debug_log)
118 return !(debug_log->log_start - debug_log->log_end);
125 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log;
130 if ((file->f_flags & O_NONBLOCK) && batadv_log_empty(debug_log))
142 error = wait_event_interruptible(debug_log->queue_wait,
143 (!batadv_log_empty(debug_log)));
148 spin_lock_bh(&debug_log->lock);
151 (debug_log->log_start != debug_log->log_end)) {
152 char_addr = batadv_log_char_addr(debug_log,
153 debug_log->log_start);
156 debug_log->log_start++;
158 spin_unlock_bh(&debug_log->lock);
162 spin_lock_bh(&debug_log->lock);
168 spin_unlock_bh(&debug_log->lock);
179 struct batadv_priv_debug_log *debug_log = bat_priv->debug_log;
181 poll_wait(file, &debug_log->queue_wait, wait);
183 if (!batadv_log_empty(debug_log))
204 bat_priv->debug_log = kzalloc(sizeof(*bat_priv->debug_log), GFP_ATOMIC);
205 if (!bat_priv->debug_log)
208 spin_lock_init(&bat_priv->debug_log->lock);
209 init_waitqueue_head(&bat_priv->debug_log->queue_wait);
225 kfree(bat_priv->debug_log);
226 bat_priv->debug_log = NULL;