diff mbox series

[RFC,1/7] net: Add a /sys/net directory to sysfs

Message ID 20210111214143.553479-2-Anna.Schumaker@Netapp.com (mailing list archive)
State New
Headers show
Series SUNRPC: Create sysfs files for changing IP | expand

Commit Message

Anna Schumaker Jan. 11, 2021, 9:41 p.m. UTC
From: Anna Schumaker <Anna.Schumaker@Netapp.com>

Sunrpc will want to place its files under this directory

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 include/net/sock.h | 4 ++++
 net/socket.c       | 8 ++++++++
 2 files changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/include/net/sock.h b/include/net/sock.h
index bdc4323ce53c..cd986c6fbc6f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1765,6 +1765,10 @@  void sk_common_release(struct sock *sk);
 /* Initialise core socket variables */
 void sock_init_data(struct socket *sock, struct sock *sk);
 
+
+/* /sys/net */
+extern struct kobject *net_kobj;
+
 /*
  * Socket reference counting postulates.
  *
diff --git a/net/socket.c b/net/socket.c
index 33e8b6c4e1d3..43986419d673 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -141,6 +141,10 @@  static void sock_show_fdinfo(struct seq_file *m, struct file *f)
 #define sock_show_fdinfo NULL
 #endif
 
+/* /sys/net */
+struct kobject *net_kobj;
+EXPORT_SYMBOL_GPL(net_kobj);
+
 /*
  *	Socket files have a set of 'special' operations as well as the generic file ones. These don't appear
  *	in the operation structures but are done directly via the socketcall() multiplexor.
@@ -3060,6 +3064,10 @@  static int __init sock_init(void)
 		goto out_mount;
 	}
 
+	net_kobj = kobject_create_and_add("net", NULL);
+	if (!net_kobj)
+		printk(KERN_WARNING "%s: kobj create error\n", __func__);
+
 	/* The real protocol initialization is performed in later initcalls.
 	 */