diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-01-06 03:19:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:47 -0500 |
commit | 7b033e1fdeef3d8bacac3cd5cfa53c9d670d1f3d (patch) | |
tree | 632948968ea0d61bc323f419866d3d037a99f0a5 /arch/um | |
parent | 44700a4469b6bb89e6f1edd32b8a4a915dd967c6 (diff) |
[PATCH] uml: add mconsole_reply variant with length param
This is needed for the console output patch, since we have a possibly
non-NULL-terminated string there. So, the new interface takes a string and a
length, and the old interface calls strlen on its string and calls the new
interface with the length.
There's also a bit of whitespace cleanup.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/drivers/mconsole_user.c | 12 | ||||
-rw-r--r-- | arch/um/include/mconsole.h | 8 |
2 files changed, 14 insertions, 6 deletions
diff --git a/arch/um/drivers/mconsole_user.c b/arch/um/drivers/mconsole_user.c index 310c1f823f26..4b109fe7fff8 100644 --- a/arch/um/drivers/mconsole_user.c +++ b/arch/um/drivers/mconsole_user.c | |||
@@ -122,12 +122,12 @@ int mconsole_get_request(int fd, struct mc_request *req) | |||
122 | return(1); | 122 | return(1); |
123 | } | 123 | } |
124 | 124 | ||
125 | int mconsole_reply(struct mc_request *req, char *str, int err, int more) | 125 | int mconsole_reply_len(struct mc_request *req, const char *str, int total, |
126 | int err, int more) | ||
126 | { | 127 | { |
127 | struct mconsole_reply reply; | 128 | struct mconsole_reply reply; |
128 | int total, len, n; | 129 | int len, n; |
129 | 130 | ||
130 | total = strlen(str); | ||
131 | do { | 131 | do { |
132 | reply.err = err; | 132 | reply.err = err; |
133 | 133 | ||
@@ -155,6 +155,12 @@ int mconsole_reply(struct mc_request *req, char *str, int err, int more) | |||
155 | return(0); | 155 | return(0); |
156 | } | 156 | } |
157 | 157 | ||
158 | int mconsole_reply(struct mc_request *req, const char *str, int err, int more) | ||
159 | { | ||
160 | return mconsole_reply_len(req, str, strlen(str), err, more); | ||
161 | } | ||
162 | |||
163 | |||
158 | int mconsole_unlink_socket(void) | 164 | int mconsole_unlink_socket(void) |
159 | { | 165 | { |
160 | unlink(mconsole_socket_name); | 166 | unlink(mconsole_socket_name); |
diff --git a/arch/um/include/mconsole.h b/arch/um/include/mconsole.h index b1b512f47035..58f67d391105 100644 --- a/arch/um/include/mconsole.h +++ b/arch/um/include/mconsole.h | |||
@@ -32,7 +32,7 @@ struct mconsole_reply { | |||
32 | 32 | ||
33 | struct mconsole_notify { | 33 | struct mconsole_notify { |
34 | u32 magic; | 34 | u32 magic; |
35 | u32 version; | 35 | u32 version; |
36 | enum { MCONSOLE_SOCKET, MCONSOLE_PANIC, MCONSOLE_HANG, | 36 | enum { MCONSOLE_SOCKET, MCONSOLE_PANIC, MCONSOLE_HANG, |
37 | MCONSOLE_USER_NOTIFY } type; | 37 | MCONSOLE_USER_NOTIFY } type; |
38 | u32 len; | 38 | u32 len; |
@@ -66,7 +66,9 @@ struct mc_request | |||
66 | extern char mconsole_socket_name[]; | 66 | extern char mconsole_socket_name[]; |
67 | 67 | ||
68 | extern int mconsole_unlink_socket(void); | 68 | extern int mconsole_unlink_socket(void); |
69 | extern int mconsole_reply(struct mc_request *req, char *reply, int err, | 69 | extern int mconsole_reply_len(struct mc_request *req, const char *reply, |
70 | int len, int err, int more); | ||
71 | extern int mconsole_reply(struct mc_request *req, const char *str, int err, | ||
70 | int more); | 72 | int more); |
71 | 73 | ||
72 | extern void mconsole_version(struct mc_request *req); | 74 | extern void mconsole_version(struct mc_request *req); |
@@ -84,7 +86,7 @@ extern void mconsole_proc(struct mc_request *req); | |||
84 | extern void mconsole_stack(struct mc_request *req); | 86 | extern void mconsole_stack(struct mc_request *req); |
85 | 87 | ||
86 | extern int mconsole_get_request(int fd, struct mc_request *req); | 88 | extern int mconsole_get_request(int fd, struct mc_request *req); |
87 | extern int mconsole_notify(char *sock_name, int type, const void *data, | 89 | extern int mconsole_notify(char *sock_name, int type, const void *data, |
88 | int len); | 90 | int len); |
89 | extern char *mconsole_notify_socket(void); | 91 | extern char *mconsole_notify_socket(void); |
90 | extern void lock_notify(void); | 92 | extern void lock_notify(void); |