mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-06 15:43:02 +02:00
confd: Rename srx_set_item -> lydx_new_path
Since this function wraps lyd_new_path. This allows us to write a wrapper for sr_set_item, using the expected name.
This commit is contained in:
committed by
Joachim Wiberg
parent
69d6bc6942
commit
2259e108e4
@@ -284,13 +284,13 @@ static int ifoper(sr_session_ctx_t *session, uint32_t sub_id, const char *module
|
||||
TAILQ_FOREACH(iface, &iface_list, link) {
|
||||
snprintf(xpath, sizeof(xpath), INTERFACE_XPATH, iface->ifname);
|
||||
|
||||
if ((rc = srx_set_item(ctx, parent, &first, xpath, "if-index", "%d", iface->ifindex)))
|
||||
if ((rc = lydx_new_path(ctx, parent, &first, xpath, "if-index", "%d", iface->ifindex)))
|
||||
goto fail;
|
||||
|
||||
if ((rc = srx_set_item(ctx, parent, &first, xpath, "admin-status", "up")))
|
||||
if ((rc = lydx_new_path(ctx, parent, &first, xpath, "admin-status", "up")))
|
||||
goto fail;
|
||||
|
||||
if ((rc = srx_set_item(ctx, parent, &first, xpath, "oper-status", "up")))
|
||||
if ((rc = lydx_new_path(ctx, parent, &first, xpath, "oper-status", "up")))
|
||||
goto fail;
|
||||
|
||||
if (rc) {
|
||||
|
||||
@@ -116,9 +116,9 @@ static int clock_cb(sr_session_ctx_t *session, uint32_t sub_id, const char *modu
|
||||
}
|
||||
fmtime(now, curtime, sizeof(curtime));
|
||||
|
||||
if ((rc = srx_set_item(ctx, parent, &first, CLOCK_PATH_, "boot-datetime", boottime)))
|
||||
if ((rc = lydx_new_path(ctx, parent, &first, CLOCK_PATH_, "boot-datetime", boottime)))
|
||||
goto fail;
|
||||
if ((rc = srx_set_item(ctx, parent, &first, CLOCK_PATH_, "current-datetime", curtime)))
|
||||
if ((rc = lydx_new_path(ctx, parent, &first, CLOCK_PATH_, "current-datetime", curtime)))
|
||||
goto fail;
|
||||
|
||||
if (rc) {
|
||||
@@ -141,13 +141,13 @@ static int platform_cb(sr_session_ctx_t *session, uint32_t sub_id, const char *m
|
||||
|
||||
ctx = sr_acquire_context(sr_session_get_connection(session));
|
||||
|
||||
if ((rc = srx_set_item(ctx, parent, &first, PLATFORM_PATH_, "os-name", os)))
|
||||
if ((rc = lydx_new_path(ctx, parent, &first, PLATFORM_PATH_, "os-name", os)))
|
||||
goto fail;
|
||||
if ((rc = srx_set_item(ctx, parent, &first, PLATFORM_PATH_, "os-release", rel)))
|
||||
if ((rc = lydx_new_path(ctx, parent, &first, PLATFORM_PATH_, "os-release", rel)))
|
||||
goto fail;
|
||||
if ((rc = srx_set_item(ctx, parent, &first, PLATFORM_PATH_, "os-version", ver)))
|
||||
if ((rc = lydx_new_path(ctx, parent, &first, PLATFORM_PATH_, "os-version", ver)))
|
||||
goto fail;
|
||||
if ((rc = srx_set_item(ctx, parent, &first, PLATFORM_PATH_, "machine", sys)))
|
||||
if ((rc = lydx_new_path(ctx, parent, &first, PLATFORM_PATH_, "machine", sys)))
|
||||
goto fail;
|
||||
|
||||
if (rc) {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#include <stdarg.h>
|
||||
#include "core.h"
|
||||
|
||||
int srx_set_item(const struct ly_ctx *ctx, struct lyd_node **parent, int *first,
|
||||
char *xpath_base, char *node, const char *fmt, ...)
|
||||
int lydx_new_path(const struct ly_ctx *ctx, struct lyd_node **parent, int *first,
|
||||
char *xpath_base, char *node, const char *fmt, ...)
|
||||
{
|
||||
char xpath[strlen(xpath_base) + strlen(node) + 2];
|
||||
va_list ap;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#define SRX_GET_UINT8(s,v,fmt,...) srx_get_int(s, &v, SR_UINT8_T, fmt, ##__VA_ARGS__)
|
||||
#define SRX_GET_UINT32(s,v,fmt,...) srx_get_int(s, &v, SR_UINT32_T, fmt, ##__VA_ARGS__)
|
||||
|
||||
int srx_set_item(const struct ly_ctx *ctx, struct lyd_node **parent, int *first, char *xpath_base,
|
||||
char *node, const char *fmt, ...);
|
||||
int lydx_new_path(const struct ly_ctx *ctx, struct lyd_node **parent, int *first, char *xpath_base,
|
||||
char *node, const char *fmt, ...);
|
||||
|
||||
char *srx_get_str (sr_session_ctx_t *session, const char *fmt, ...);
|
||||
int srx_get_int (sr_session_ctx_t *session, int *result, sr_val_type_t type, const char *fmt, ...);
|
||||
|
||||
Reference in New Issue
Block a user