Пример #1
0
static void print_reply(daemon_reply reply)
{
	const char *a = daemon_reply_str(reply, "response", NULL);
	const char *b = daemon_reply_str(reply, "status", NULL);
	const char *c = daemon_reply_str(reply, "reason", NULL);

	printf("response \"%s\" status \"%s\" reason \"%s\"\n",
	       a ? a : "", b ? b : "", c ? c : "");
}
static int _lvmlockd_result(daemon_reply reply, int *result)
{
	int reply_result;

	if (reply.error) {
		log_error("lvmlockd_result reply error %d", reply.error);
		return 0;
	}

	if (strcmp(daemon_reply_str(reply, "response", ""), "OK")) {
		log_error("lvmlockd_result bad response");
		return 0;
	}

	reply_result = daemon_reply_int(reply, "op_result", NO_LOCKD_RESULT);
	if (reply_result == -1000) {
		log_error("lvmlockd_result no op_result");
		return 0;
	}

	*result = reply_result;

	return 1;
}