lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200613155738.2249399-24-jim.cromie@gmail.com>
Date:   Sat, 13 Jun 2020 09:57:37 -0600
From:   Jim Cromie <jim.cromie@...il.com>
To:     jbaron@...mai.com, linux-kernel@...r.kernel.org,
        akpm@...uxfoundation.org, gregkh@...uxfoundation.org
Cc:     linux@...musvillemoes.dk, Jim Cromie <jim.cromie@...il.com>
Subject: [PATCH v2 23/24] kset-example: add pr_debug()s for easy visibility of its operation

put pr_debug()s into most functions, to easily see code operate when
module is loaded and used.

  #> dmesg -w &
  #> modprobe kset-example dyndbg=+pfml
  #> cat /sys/kernel/kset-example/*/*
---
 samples/kobject/kset-example.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c
index c8010f126808..27c9b1beec28 100644
--- a/samples/kobject/kset-example.c
+++ b/samples/kobject/kset-example.c
@@ -56,6 +56,7 @@ static ssize_t foo_attr_show(struct kobject *kobj,
 	struct foo_attribute *attribute;
 	struct foo_obj *foo;
 
+	pr_debug("called");
 	attribute = to_foo_attr(attr);
 	foo = to_foo_obj(kobj);
 
@@ -76,6 +77,7 @@ static ssize_t foo_attr_store(struct kobject *kobj,
 	struct foo_attribute *attribute;
 	struct foo_obj *foo;
 
+	pr_debug("called");
 	attribute = to_foo_attr(attr);
 	foo = to_foo_obj(kobj);
 
@@ -102,6 +104,7 @@ static void foo_release(struct kobject *kobj)
 {
 	struct foo_obj *foo;
 
+	pr_debug("called");
 	foo = to_foo_obj(kobj);
 	kfree(foo);
 }
@@ -112,6 +115,7 @@ static void foo_release(struct kobject *kobj)
 static ssize_t foo_show(struct foo_obj *foo_obj, struct foo_attribute *attr,
 			char *buf)
 {
+	pr_debug("called");
 	return sprintf(buf, "%d\n", foo_obj->foo);
 }
 
@@ -120,6 +124,7 @@ static ssize_t foo_store(struct foo_obj *foo_obj, struct foo_attribute *attr,
 {
 	int ret;
 
+	pr_debug("called");
 	ret = kstrtoint(buf, 10, &foo_obj->foo);
 	if (ret < 0)
 		return ret;
@@ -140,6 +145,7 @@ static ssize_t b_show(struct foo_obj *foo_obj, struct foo_attribute *attr,
 {
 	int var;
 
+	pr_debug("called");
 	if (strcmp(attr->attr.name, "baz") == 0)
 		var = foo_obj->baz;
 	else
@@ -152,6 +158,7 @@ static ssize_t b_store(struct foo_obj *foo_obj, struct foo_attribute *attr,
 {
 	int var, ret;
 
+	pr_debug("called");
 	ret = kstrtoint(buf, 10, &var);
 	if (ret < 0)
 		return ret;
@@ -201,6 +208,7 @@ static struct foo_obj *create_foo_obj(const char *name)
 	struct foo_obj *foo;
 	int retval;
 
+	pr_debug("called");
 	/* allocate the memory for the whole object */
 	foo = kzalloc(sizeof(*foo), GFP_KERNEL);
 	if (!foo)
@@ -235,11 +243,13 @@ static struct foo_obj *create_foo_obj(const char *name)
 
 static void destroy_foo_obj(struct foo_obj *foo)
 {
+	pr_debug("called");
 	kobject_put(&foo->kobj);
 }
 
 static int __init example_init(void)
 {
+	pr_debug("called");
 	/*
 	 * Create a kset with the name of "kset_example",
 	 * located under /sys/kernel/
@@ -276,6 +286,7 @@ static int __init example_init(void)
 
 static void __exit example_exit(void)
 {
+	pr_debug("called");
 	destroy_foo_obj(baz_obj);
 	destroy_foo_obj(bar_obj);
 	destroy_foo_obj(foo_obj);
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ