提交 7b033e1f 编写于 作者: J Jeff Dike 提交者: Linus Torvalds

[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: NJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 44700a44
...@@ -122,12 +122,12 @@ int mconsole_get_request(int fd, struct mc_request *req) ...@@ -122,12 +122,12 @@ int mconsole_get_request(int fd, struct mc_request *req)
return(1); return(1);
} }
int mconsole_reply(struct mc_request *req, char *str, int err, int more) int mconsole_reply_len(struct mc_request *req, const char *str, int total,
int err, int more)
{ {
struct mconsole_reply reply; struct mconsole_reply reply;
int total, len, n; int len, n;
total = strlen(str);
do { do {
reply.err = err; reply.err = err;
...@@ -155,6 +155,12 @@ int mconsole_reply(struct mc_request *req, char *str, int err, int more) ...@@ -155,6 +155,12 @@ int mconsole_reply(struct mc_request *req, char *str, int err, int more)
return(0); return(0);
} }
int mconsole_reply(struct mc_request *req, const char *str, int err, int more)
{
return mconsole_reply_len(req, str, strlen(str), err, more);
}
int mconsole_unlink_socket(void) int mconsole_unlink_socket(void)
{ {
unlink(mconsole_socket_name); unlink(mconsole_socket_name);
......
...@@ -66,7 +66,9 @@ struct mc_request ...@@ -66,7 +66,9 @@ struct mc_request
extern char mconsole_socket_name[]; extern char mconsole_socket_name[];
extern int mconsole_unlink_socket(void); extern int mconsole_unlink_socket(void);
extern int mconsole_reply(struct mc_request *req, char *reply, int err, extern int mconsole_reply_len(struct mc_request *req, const char *reply,
int len, int err, int more);
extern int mconsole_reply(struct mc_request *req, const char *str, int err,
int more); int more);
extern void mconsole_version(struct mc_request *req); extern void mconsole_version(struct mc_request *req);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册