Thread (43 messages) 43 messages, 5 authors, 2007-03-05

Re: [PATCH RFC 1/31] net: Add net_namespace_type.h to allow for per network namespace variables.

From: Eric W. Biederman <hidden>
Date: 2007-01-25 20:53:54

Stephen Hemminger [off-list ref] writes:
Can all this be a nop if a CONFIG option is not selected?
That is exactly what this infrastructure supports.
What you see is the version that comes into effect when
the CONFIG option is not selected.
From using an empty structure to replace a pointer to make
that a NOP to most of the rest below.

quoted
diff --git a/include/linux/net_namespace_type.h
b/include/linux/net_namespace_type.h
quoted
new file mode 100644
index 0000000..8173f59
--- /dev/null
+++ b/include/linux/net_namespace_type.h
@@ -0,0 +1,52 @@
+/* 
+ * Definition of the network namespace reference type
+ * And operations upon it.
+ */
+#ifndef __LINUX_NET_NAMESPACE_TYPE_H
+#define __LINUX_NET_NAMESPACE_TYPE_H
+
+#define __pernetname(name) per_net__##name
Code obfuscation, please don't do that
Single point of making the naming rules, better maintenance.
The basic point is that variables that come through this path
you should not access directly.  Tweaking the name enforces that
even in the compiled out state.
quoted
+typedef struct {} net_t;
No typedef for this please.
Why.  That is conventially how we do opaque types in linux
when someone is doing something sophisticated.


You probably want to look down to patch 21 to see what the compiled
in version of these look like.

Eric
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help