Commit 7b033e1fdeef3d8bacac3cd5cfa53c9d670d1f3d

Authored by Jeff Dike
Committed by Linus Torvalds
1 parent 44700a4469

[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>

Showing 2 changed files with 14 additions and 6 deletions Side-by-side Diff

arch/um/drivers/mconsole_user.c
... ... @@ -122,12 +122,12 @@
122 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 128 struct mconsole_reply reply;
128   - int total, len, n;
  129 + int len, n;
129 130  
130   - total = strlen(str);
131 131 do {
132 132 reply.err = err;
133 133  
... ... @@ -154,6 +154,12 @@
154 154 } while(total > 0);
155 155 return(0);
156 156 }
  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 +
157 163  
158 164 int mconsole_unlink_socket(void)
159 165 {
arch/um/include/mconsole.h
... ... @@ -32,7 +32,7 @@
32 32  
33 33 struct mconsole_notify {
34 34 u32 magic;
35   - u32 version;
  35 + u32 version;
36 36 enum { MCONSOLE_SOCKET, MCONSOLE_PANIC, MCONSOLE_HANG,
37 37 MCONSOLE_USER_NOTIFY } type;
38 38 u32 len;
... ... @@ -66,7 +66,9 @@
66 66 extern char mconsole_socket_name[];
67 67  
68 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 72 int more);
71 73  
72 74 extern void mconsole_version(struct mc_request *req);
... ... @@ -84,7 +86,7 @@
84 86 extern void mconsole_stack(struct mc_request *req);
85 87  
86 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 90 int len);
89 91 extern char *mconsole_notify_socket(void);
90 92 extern void lock_notify(void);