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:
parent
f96cf55d36
commit
14e012871f
@ -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 };
|
||||
|
@ -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;
|
||||
|
@ -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 *)) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user