#define ZLOGGER_MSG_MAX (140)
#define ZLOGGER_IOCTL_COMMAND_ALLOC (20745321)
+#define ZLOGGER_IOCTL_COMMAND_CLEAR (20745322)
#define ZLOGGER_IOCTL_COMMAND_SET_DEFAULT_PRIORITY _IOW('a', 'a', uint32_t)
#define ZLOGGER_IOCTL_COMMAND_SET_DEFAULT_TAG _IOW('a', 'b', char* )
return 0;
}
+static long zlogger_clear(void)
+{
+ int i;
+ struct thread_table_field *ptr = NULL;
+
+ mutex_lock(&g_block_mutex);
+
+ for (i = 1; i <= ZLOGGER_BLOCK_COUNT; i++) {
+ struct zlogger_block *block = get_block(i);
+
+ memset(&block->head, 0, sizeof(block->head));
+ }
+
+ hash_for_each(g_thread_table->data, i, ptr, next) {
+ if (ptr->blk != 0) {
+ queue_push(&g_free_q, ptr->blk);
+ ptr->blk = 0;
+ }
+ }
+
+ mutex_unlock(&g_block_mutex);
+ return 0;
+}
+
static long zlogger_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
switch (cmd) {
return alloc_block_for_thread(false);
break;
+ case ZLOGGER_IOCTL_COMMAND_CLEAR:
+ return zlogger_clear();
+ break;
+
case ZLOGGER_IOCTL_COMMAND_SET_DEFAULT_PRIORITY:
return zlogger_update_prio(filp, arg);
break;