Thread (38 messages) 38 messages, 9 authors, 2007-09-16

Re: [PATCH/RFC] Add node states sysfs class attributeS - V3

From: Lee Schermerhorn <hidden>
Date: 2007-08-30 13:34:00

On Wed, 2007-08-29 at 15:14 -0700, Christoph Lameter wrote:
On Wed, 29 Aug 2007, Lee Schermerhorn wrote:
quoted
root@gwydyr(root):cat /sys/devices/system/node/possible
possible:       0-255
The file is already called "possible". Repeating it in the output will
make it difficult to parse.
Yeah.  I noticed, after I posted, how stupid that looked.  Clear a case
of "premature patch-ulation".  I'm fixing it now.  
quoted
+static ssize_t
+print_nodes_possible(struct sysdev_class *class, char *buf)
+{
+	return print_nodes_state(N_POSSIBLE, buf);
+}
+
+static ssize_t
+print_nodes_online(struct sysdev_class *class, char *buf)
+{
+	return print_nodes_state(N_ONLINE, buf);
+}
+
+static ssize_t
+print_nodes_has_normal_memory(struct sysdev_class *class, char *buf)
+{
+	return print_nodes_state(N_NORMAL_MEMORY, buf);
+}
+
+static ssize_t
+print_nodes_has_cpu(struct sysdev_class *class, char *buf)
+{
+	return print_nodes_state(N_CPU, buf);
+}
Is there a way to avoid having to add another one of these if we add
a new node state?
I haven't figure out a way from the info I'm given in the show/print
routine [just the node class and the buffer address] to figure out which
attribute file was read, or I'd have avoided the function per attribute
nonsense.
Also there is a CR after the type.
Took me a minute to figure out what you meant.  Again, old habits...
I've always put my function names against the left margin for easy
searching.  But I have read where this is discouraged.

I will say that the patch passed checkpatch just fine.  I'll fix it in
the respin.

Lee

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help