*
******************************************************************************/
+#include <scsc/scsc_mx.h>
#include "scsc_logring_main.h"
#include "scsc_logring_debugfs.h"
return newpos;
}
+static int samsg_open(struct inode *ino, struct file *filp)
+{
+ int ret;
+
+ ret = debugfile_open(ino, filp);
+#ifdef CONFIG_SCSC_MXLOGGER
+ if (!ret)
+ scsc_service_register_observer(NULL, "LOGRING");
+#endif
+ return ret;
+}
+
+static int samsg_release(struct inode *ino, struct file *filp)
+{
+#ifdef CONFIG_SCSC_MXLOGGER
+ scsc_service_unregister_observer(NULL, "LOGRING");
+#endif
+
+ return debugfile_release(ino, filp);
+}
+
const struct file_operations samsg_fops = {
.owner = THIS_MODULE,
- .open = debugfile_open,
+ .open = samsg_open,
.read = samsg_read,
- .release = debugfile_release,
+ .release = samsg_release,
};
/**
* Copyright (c) 2016 - 2018 Samsung Electronics Co., Ltd. All rights reserved.
*
********************************************************************************/
-
#include "scsc_logring_main.h"
#include "scsc_logring_ring.h"
#include "scsc_logring_debugfs.h"
+#ifdef CONFIG_SCSC_LOG_COLLECTION
+#include <scsc/scsc_log_collector.h>
+#endif
/* Global module parameters */
static int enable = DEFAULT_ENABLE_LOGRING;
struct scsc_ring_buffer *the_ringbuf;
+#ifdef CONFIG_SCSC_LOG_COLLECTION
+static int logring_collect(struct scsc_log_collector_client *collect_client, size_t size);
+
+struct scsc_log_collector_client logring_collect_client = {
+ .name = "Logring",
+ .type = SCSC_LOG_CHUNK_LOGRING,
+ .collect_init = NULL,
+ .collect = logring_collect,
+ .collect_end = NULL,
+ .prv = NULL,
+};
+#endif
+
/* Module init and ring buffer allocation */
int __init samlog_init(void)
{
rb->bsz);
scsc_printk_tag(NO_ECHO_PRK, NO_TAG,
"Using THROWAWAY DYNAMIC per-reader buffer.\n");
+
+#ifdef CONFIG_SCSC_LOG_COLLECTION
+ scsc_log_collector_register_client(&logring_collect_client);
+#endif
return 0;
tfail:
initialized = false;
free_ring_buffer(the_ringbuf);
the_ringbuf = NULL;
+#ifdef CONFIG_SCSC_LOG_COLLECTION
+ scsc_log_collector_unregister_client(&logring_collect_client);
+#endif
pr_info("Samlog Unloaded\n");
}
&scsc_droplevel_test_me,
};
+#ifdef CONFIG_SCSC_LOG_COLLECTION
+static int logring_collect(struct scsc_log_collector_client *collect_client, size_t size)
+{
+ int ret = 0, saved_droplevel;
+
+ if (!the_ringbuf)
+ return 0;
+
+ /**
+ * Inhibit logring during collection overriding with scsc_droplevel_all
+ */
+ saved_droplevel = scsc_droplevel_all;
+ scsc_droplevel_all = DEFAULT_DROP_ALL;
+
+ /* Write buffer */
+ ret = scsc_log_collector_write(the_ringbuf->buf, the_ringbuf->bsz, 1);
+
+ scsc_droplevel_all = saved_droplevel;
+
+ return ret;
+}
+#endif
+
static int scsc_reset_all_droplevels_to_set_param_cb(const char *val,
const struct kernel_param *kp)
{