Commit d7fe03ca authored by Sebastien Gougeaud's avatar Sebastien Gougeaud Committed by Thomas Leibovici
Browse files

admin: refactor _admin_notify() to receive a pho_id

Replacing the family and name by an ID data structure.

Change-Id: I4b851e61aedd0220beaf94f7045a4d42298ca6b8
Signed-off-by: default avatarSebastien Gougeaud <>

Reviewed-by: Linter
Tested-by: default avatarJenkins s8open_nr <>
Reviewed-by: default avatarQuentin Bouget <>
Reviewed-by: default avatarThomas Leibovici <>
parent a3794938
......@@ -139,8 +139,8 @@ out:
return rc;
static int _admin_notify(struct admin_handle *adm, enum rsc_family family,
const char *name, enum notify_op op)
static int _admin_notify(struct admin_handle *adm, struct pho_id *id,
enum notify_op op)
pho_resp_t *resp;
pho_req_t req;
......@@ -156,8 +156,8 @@ static int _admin_notify(struct admin_handle *adm, enum rsc_family family, = rid;
req.notify->op = op;
req.notify->rsrc_id->family = family;
req.notify->rsrc_id->name = strdup(name);
req.notify->rsrc_id->family = id->family;
req.notify->rsrc_id->name = strdup(id->name);
rc = _send_and_receive(adm, &req, &resp);
if (rc)
......@@ -165,8 +165,8 @@ static int _admin_notify(struct admin_handle *adm, enum rsc_family family,
if (pho_response_is_notify(resp)) {
if (resp->req_id == rid &&
(int) family == (int) resp->notify->rsrc_id->family &&
!strcmp(resp->notify->rsrc_id->name, name)) {
(int) id->family == (int) resp->notify->rsrc_id->family &&
!strcmp(resp->notify->rsrc_id->name, id->name)) {
pho_debug("Notify request succeeded");
goto out;
......@@ -194,12 +194,16 @@ out:
int phobos_admin_device_add(struct admin_handle *adm, enum rsc_family family,
const char *name)
struct pho_id dev_id;
int rc;
if (!adm->daemon_is_online)
return 0;
rc = _admin_notify(adm, family, name, PHO_NTFY_OP_ADD_DEVICE);
pho_id_name_set(&dev_id, name); = family;
rc = _admin_notify(adm, &dev_id, PHO_NTFY_OP_ADD_DEVICE);
if (rc)
LOG_RETURN(rc, "Communication with LRS failed");
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment