Skip to contentSkip to conversation

9p: Clean up get_protocol_version to use strcmp

PATCH New Prem Karat 1 participant 1 message May 6, 2011

Subsystems (3)
lore
Share & tools
lore

Prem Karat

author
#0 lore raw

PATCH 1/1 9p: Clean up get_protocol_version to use strcmp

9p: Clean-up get_protocol_version() to use strcmp

---
 include/net/9p/client.h    |    6 ++--
 include/net/9p/transport.h |    2 +-
 net/9p/client.c            |   47 ++++++++++++++++++++++++++++++-------------
 net/9p/mod.c               |    4 +-
 4 files changed, 39 insertions(+), 20 deletions(-)
include/net/9p/client.h +3 -3
index 051a99f..0415ba1 100644
@@ -36,9 +36,9 @@
  */
 
 enum p9_proto_versions{
-	p9_proto_legacy = 0,
-	p9_proto_2000u = 1,
-	p9_proto_2000L = 2,
+	p9_proto_legacy,
+	p9_proto_2000u,
+	p9_proto_2000L,
 };
 
 
include/net/9p/transport.h +1 -1
index 8f08c73..d32b472 100644
@@ -66,7 +66,7 @@ struct p9_trans_module {
 
 void v9fs_register_trans(struct p9_trans_module *m);
 void v9fs_unregister_trans(struct p9_trans_module *m);
-struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name);
+struct p9_trans_module *v9fs_get_trans_by_name(char *s);
 struct p9_trans_module *v9fs_get_default_trans(void);
 void v9fs_put_trans(struct p9_trans_module *m);
 #endif /* NET_9P_TRANSPORT_H */
net/9p/client.c +33 -14

84 lines not on this page · raw message

net/9p/mod.c +2 -2
index cf8a412..40b06ac 100644
@@ -80,14 +80,14 @@ EXPORT_SYMBOL(v9fs_unregister_trans);
  * @name: string identifying transport
  *
  */
-struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name)
+struct p9_trans_module *v9fs_get_trans_by_name(char *s)
 {
 	struct p9_trans_module *t, *found = NULL;
 
 	spin_lock(&v9fs_trans_lock);
 
 	list_for_each_entry(t, &v9fs_trans_list, list)
-		if (strncmp(t->name, name->from, name->to-name->from) == 0 &&
+		if (strcmp(t->name, s) == 0 &&
 		    try_module_get(t->owner)) {
 			found = t;
 			break;
Signature · 7 lines
1.7.4

-- 
Cheers,
Prem
Linux Technology Center,
IBM Systems & Technology Labs