1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Differentiate the request and response format, in daemon/common.

This commit is contained in:
Petr Rockai 2011-06-29 22:20:14 +00:00
parent f96cf55d36
commit 14e012871f
4 changed files with 5 additions and 5 deletions

View File

@ -60,7 +60,7 @@ daemon_reply daemon_send_simple(daemon_handle h, char *id, ...)
{
va_list ap;
va_start(ap, id);
daemon_request rq = { .buffer = format_buffer(id, ap) };
daemon_request rq = { .buffer = format_buffer("request", id, ap) };
if (!rq.buffer) {
daemon_reply err = { .error = ENOMEM, .buffer = NULL, .cft = NULL };

View File

@ -205,7 +205,7 @@ response daemon_reply_simple(char *id, ...)
{
va_list ap;
va_start(ap, id);
response res = { .buffer = format_buffer(id, ap), .cft = NULL };
response res = { .buffer = format_buffer("response", id, ap), .cft = NULL };
if (!res.buffer)
res.error = ENOMEM;

View File

@ -70,13 +70,13 @@ int write_buffer(int fd, char *buffer, int length) {
return 0;
}
char *format_buffer(char *id, va_list ap)
char *format_buffer(const char *what, const char *id, va_list ap)
{
char *buffer, *old;
char *next;
char *format;
dm_asprintf(&buffer, "request = \"%s\"\n", id);
dm_asprintf(&buffer, "%s = \"%s\"\n", what, id);
if (!buffer) goto fail;
while (next = va_arg(ap, char *)) {

View File

@ -3,4 +3,4 @@
int read_buffer(int fd, char **buffer);
int write_buffer(int fd, char *buffer, int length);
char *format_buffer(char *id, va_list ap);
char *format_buffer(const char *what, const char *id, va_list ap);