From: Marek Szyprowski Date: Tue, 20 Sep 2022 10:33:47 +0000 (+0200) Subject: zlogger: remove all, legacy crappy /sys interface X-Git-Tag: accepted/tizen/unified/20221102.172737~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F82%2F281682%2F4;p=platform%2Fkernel%2Flinux-tizen-modules-source.git zlogger: remove all, legacy crappy /sys interface /sys based interface is no longer used, so remove it completely. Change-Id: I4565169ad4b7e04f7aca9c73e13a928c85a69f1e Signed-off-by: Marek Szyprowski --- diff --git a/kernel/zlogger/zlogger.c b/kernel/zlogger/zlogger.c index 5064449..02a4fd2 100644 --- a/kernel/zlogger/zlogger.c +++ b/kernel/zlogger/zlogger.c @@ -111,13 +111,10 @@ static struct mutex g_task_mutex; static struct queue g_free_q; -static int g_max_thread_id; - static uint64_t g_start_time; static uint64_t g_hwc_offset; static int g_task_on; -static uint32_t g_free_count; static uint32_t g_err_count; @@ -254,7 +251,6 @@ static int zlog_task(void *user_data) ptr->blk = 0; // TODO: The userspace might very well be using this block right now. mutex_unlock(&g_block_mutex); - g_free_count++; } } @@ -299,9 +295,6 @@ static long alloc_block_for_thread(bool is_stdout) uint16_t blk; struct zlogger_block *block; - if (g_max_thread_id < tid) - g_max_thread_id = tid; - mutex_lock(&g_block_mutex); blk = get_thread_table(tid, is_stdout); if (blk) @@ -699,112 +692,6 @@ static const struct file_operations zlogger_fops = { .owner = THIS_MODULE, }; -static ssize_t status_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - int thread_count = 0; - int i; - int is_stdout; - - for (i = 0; i < g_max_thread_id; i++) { - for (is_stdout = 0; is_stdout <= 1; ++is_stdout) { - if (get_thread_table(i, is_stdout) > 0) - thread_count++; - } - } - - return snprintf(buf, PAGE_SIZE, - "free(%d%%):%d/%d task_on:%d gc_free:%u error:%u tid_max:%d\n", - BLOCK_RATIO(g_free_q.count), g_free_q.count, (g_free_q.count + thread_count), - g_task_on, g_free_count, g_err_count, g_max_thread_id); -} - -static DEVICE_ATTR_RO(status); - -static ssize_t time_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - return snprintf(buf, PAGE_SIZE, - "%llu %llu %llu\n", g_start_time, ktime_get_ns(), g_hwc_offset); -} - -static DEVICE_ATTR_RO(time); - -static uint16_t g_block = 1; - -static ssize_t block_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - unsigned long value; - - if (kstrtoul(buf, 10, &value) < 0) { - pr_err("Failed to get value"); - return -EINVAL; - } - - if (value < 1 || value > ZLOGGER_BLOCK_COUNT) - return -EINVAL; - - g_block = value; - - return count; -} - -static ssize_t block_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct zlogger_block *block = get_block((uint16_t)g_block); - - if (!block) - return snprintf(buf, PAGE_SIZE, "[%d] Invalid block\n", g_block); - - return snprintf(buf, PAGE_SIZE, "[%d] pid:%u tid:%u offset:%u %llu %llu\n", - g_block, block->head.pid, block->head.tid, block->head.offset, - ((struct zlogger_entry *)(block->data))->time, block->head.ts); -} - -static DEVICE_ATTR_RW(block); - -static uint16_t g_thread = 1; -static ssize_t thread_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - long value; - - if (kstrtol(buf, 10, &value) < 0) { - pr_err("Failed to get value"); - return -EINVAL; - } - - if (value < 1 || value > g_max_thread_id) - return -EINVAL; - - g_thread = value; - - return count; -} - -static ssize_t thread_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - return snprintf(buf, PAGE_SIZE, "[%d] block: %u, stdout block: %u\n", - g_thread, get_thread_table(g_thread, false), get_thread_table(g_thread, true)); -} - -static DEVICE_ATTR_RW(thread); - -static struct attribute *zlogger_attributes[] = { - &dev_attr_status.attr, - &dev_attr_time.attr, - &dev_attr_block.attr, - &dev_attr_thread.attr, - NULL, -}; - -static const struct attribute_group zlogger_attr_group = { - .attrs = zlogger_attributes, -}; - static int zlogger_init(void) { int i = 0; @@ -856,12 +743,6 @@ static int zlogger_init(void) goto out_free_zlog_task; } - r = sysfs_create_group(&zlogger_device.this_device->kobj, &zlogger_attr_group); - if (unlikely(r)) { - dev_err(zlogger_device.this_device, "failed to create sysfs nodes with (%d)\n", r); - goto out_free_zlogger_device; - } - g_init = 1; pr_info("Init success\n"); @@ -894,7 +775,6 @@ static void zlogger_exit(void) struct hlist_node *tmp_iter = NULL; int tmp_bkt; - sysfs_remove_group(&zlogger_device.this_device->kobj, &zlogger_attr_group); misc_deregister(&zlogger_device); // TODO: What about the task that is running in the background?