mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +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_list ap;
|
||||||
va_start(ap, id);
|
va_start(ap, id);
|
||||||
daemon_request rq = { .buffer = format_buffer(id, ap) };
|
daemon_request rq = { .buffer = format_buffer("request", id, ap) };
|
||||||
|
|
||||||
if (!rq.buffer) {
|
if (!rq.buffer) {
|
||||||
daemon_reply err = { .error = ENOMEM, .buffer = NULL, .cft = NULL };
|
daemon_reply err = { .error = ENOMEM, .buffer = NULL, .cft = NULL };
|
||||||
|
@ -205,7 +205,7 @@ response daemon_reply_simple(char *id, ...)
|
|||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, id);
|
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)
|
if (!res.buffer)
|
||||||
res.error = ENOMEM;
|
res.error = ENOMEM;
|
||||||
|
@ -70,13 +70,13 @@ int write_buffer(int fd, char *buffer, int length) {
|
|||||||
return 0;
|
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 *buffer, *old;
|
||||||
char *next;
|
char *next;
|
||||||
char *format;
|
char *format;
|
||||||
|
|
||||||
dm_asprintf(&buffer, "request = \"%s\"\n", id);
|
dm_asprintf(&buffer, "%s = \"%s\"\n", what, id);
|
||||||
if (!buffer) goto fail;
|
if (!buffer) goto fail;
|
||||||
|
|
||||||
while (next = va_arg(ap, char *)) {
|
while (next = va_arg(ap, char *)) {
|
||||||
|
@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
int read_buffer(int fd, char **buffer);
|
int read_buffer(int fd, char **buffer);
|
||||||
int write_buffer(int fd, char *buffer, int length);
|
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…
x
Reference in New Issue
Block a user