summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-08-22 23:37:02 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-08-22 23:45:56 +0200
commit4ad44249c3bc1df9dff86ae3461c02cd1c9ed6ee (patch)
tree90340ecd5939f2f26ac995e697ae1fb6f99dd4df
parente54db171eeddf100121e18ea62c7ee22df6fbb4d (diff)
libctrl: Use DCTRL as logging destination in libctrl
-rw-r--r--openbsc/src/libctrl/control_cmd.c32
-rw-r--r--openbsc/src/libctrl/control_if.c24
2 files changed, 28 insertions, 28 deletions
diff --git a/openbsc/src/libctrl/control_cmd.c b/openbsc/src/libctrl/control_cmd.c
index 132003088..818c0d570 100644
--- a/openbsc/src/libctrl/control_cmd.c
+++ b/openbsc/src/libctrl/control_cmd.c
@@ -141,7 +141,7 @@ int ctrl_cmd_exec(vector vline, struct ctrl_cmd *command, vector node, void *dat
goto out;
}
} else if (cmd_el->param) {
- LOGP(DLINP, LOGL_NOTICE, "Parameter verification unimplemented, continuing without\n");
+ LOGP(DCTRL, LOGL_NOTICE, "Parameter verification unimplemented, continuing without\n");
}
ret = cmd_el->set(command, data);
goto out;
@@ -190,7 +190,7 @@ static void create_cmd_struct(struct ctrl_cmd_struct *cmd, const char *name)
for (cur = name, word = NULL; cur[0] != '\0'; ++cur) {
/* warn about optionals */
if (cur[0] == '(' || cur[0] == ')' || cur[0] == '|') {
- LOGP(DLINP, LOGL_ERROR,
+ LOGP(DCTRL, LOGL_ERROR,
"Optionals are not supported in '%s'\n", name);
goto failure;
}
@@ -225,7 +225,7 @@ int ctrl_cmd_install(enum ctrl_node_type node, struct ctrl_cmd_element *cmd)
if (!cmds_vec) {
cmds_vec = vector_init(5);
if (!cmds_vec) {
- LOGP(DLINP, LOGL_ERROR, "vector_init failed.\n");
+ LOGP(DCTRL, LOGL_ERROR, "vector_init failed.\n");
return -ENOMEM;
}
vector_set_index(ctrl_node_vec, node, cmds_vec);
@@ -281,7 +281,7 @@ struct ctrl_cmd *ctrl_cmd_parse(void *ctx, struct msgb *msg)
cmd = talloc_zero(ctx, struct ctrl_cmd);
if (!cmd) {
- LOGP(DLINP, LOGL_ERROR, "Failed to allocate.\n");
+ LOGP(DCTRL, LOGL_ERROR, "Failed to allocate.\n");
return NULL;
}
@@ -323,11 +323,11 @@ struct ctrl_cmd *ctrl_cmd_parse(void *ctx, struct msgb *msg)
if (!var) {
cmd->type = CTRL_TYPE_ERROR;
cmd->reply = "GET incomplete";
- LOGP(DLINP, LOGL_NOTICE, "GET Command incomplete\n");
+ LOGP(DCTRL, LOGL_NOTICE, "GET Command incomplete\n");
goto err;
}
cmd->variable = talloc_strdup(cmd, var);
- LOGP(DLINP, LOGL_DEBUG, "Command: GET %s\n", cmd->variable);
+ LOGP(DCTRL, LOGL_DEBUG, "Command: GET %s\n", cmd->variable);
break;
case CTRL_TYPE_SET:
var = strtok_r(NULL, " ", &saveptr);
@@ -335,14 +335,14 @@ struct ctrl_cmd *ctrl_cmd_parse(void *ctx, struct msgb *msg)
if (!var || !val) {
cmd->type = CTRL_TYPE_ERROR;
cmd->reply = "SET incomplete";
- LOGP(DLINP, LOGL_NOTICE, "SET Command incomplete\n");
+ LOGP(DCTRL, LOGL_NOTICE, "SET Command incomplete\n");
goto err;
}
cmd->variable = talloc_strdup(cmd, var);
cmd->value = talloc_strdup(cmd, val);
if (!cmd->variable || !cmd->value)
goto oom;
- LOGP(DLINP, LOGL_DEBUG, "Command: SET %s = %s\n", cmd->variable, cmd->value);
+ LOGP(DCTRL, LOGL_DEBUG, "Command: SET %s = %s\n", cmd->variable, cmd->value);
break;
case CTRL_TYPE_GET_REPLY:
case CTRL_TYPE_SET_REPLY:
@@ -352,14 +352,14 @@ struct ctrl_cmd *ctrl_cmd_parse(void *ctx, struct msgb *msg)
if (!var || !val) {
cmd->type = CTRL_TYPE_ERROR;
cmd->reply = "Trap/Reply incomplete";
- LOGP(DLINP, LOGL_NOTICE, "Trap/Reply incomplete\n");
+ LOGP(DCTRL, LOGL_NOTICE, "Trap/Reply incomplete\n");
goto err;
}
cmd->variable = talloc_strdup(cmd, var);
cmd->reply = talloc_strdup(cmd, val);
if (!cmd->variable || !cmd->reply)
goto oom;
- LOGP(DLINP, LOGL_DEBUG, "Command: TRAP/REPLY %s: %s\n", cmd->variable, cmd->reply);
+ LOGP(DCTRL, LOGL_DEBUG, "Command: TRAP/REPLY %s: %s\n", cmd->variable, cmd->reply);
break;
case CTRL_TYPE_ERROR:
var = strtok_r(NULL, "\0", &saveptr);
@@ -370,7 +370,7 @@ struct ctrl_cmd *ctrl_cmd_parse(void *ctx, struct msgb *msg)
cmd->reply = talloc_strdup(cmd, var);
if (!cmd->reply)
goto oom;
- LOGP(DLINP, LOGL_DEBUG, "Command: ERROR %s\n", cmd->reply);
+ LOGP(DCTRL, LOGL_DEBUG, "Command: ERROR %s\n", cmd->reply);
break;
case CTRL_TYPE_UNKNOWN:
default:
@@ -410,7 +410,7 @@ struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd)
tmp = talloc_asprintf(cmd, "%s %s %s", type, cmd->id, cmd->variable);
if (!tmp) {
- LOGP(DLINP, LOGL_ERROR, "Failed to allocate cmd.\n");
+ LOGP(DCTRL, LOGL_ERROR, "Failed to allocate cmd.\n");
goto err;
}
@@ -425,7 +425,7 @@ struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd)
tmp = talloc_asprintf(cmd, "%s %s %s %s", type, cmd->id, cmd->variable,
cmd->value);
if (!tmp) {
- LOGP(DLINP, LOGL_ERROR, "Failed to allocate cmd.\n");
+ LOGP(DCTRL, LOGL_ERROR, "Failed to allocate cmd.\n");
goto err;
}
@@ -442,7 +442,7 @@ struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd)
tmp = talloc_asprintf(cmd, "%s %s %s %s", type, cmd->id, cmd->variable,
cmd->reply);
if (!tmp) {
- LOGP(DLINP, LOGL_ERROR, "Failed to allocate cmd.\n");
+ LOGP(DCTRL, LOGL_ERROR, "Failed to allocate cmd.\n");
goto err;
}
@@ -457,7 +457,7 @@ struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd)
tmp = talloc_asprintf(cmd, "%s %s %s", type, cmd->id,
cmd->reply);
if (!tmp) {
- LOGP(DLINP, LOGL_ERROR, "Failed to allocate cmd.\n");
+ LOGP(DCTRL, LOGL_ERROR, "Failed to allocate cmd.\n");
goto err;
}
@@ -466,7 +466,7 @@ struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd)
talloc_free(tmp);
break;
default:
- LOGP(DLINP, LOGL_NOTICE, "Unknown command type %i\n", cmd->type);
+ LOGP(DCTRL, LOGL_NOTICE, "Unknown command type %i\n", cmd->type);
goto err;
break;
}
diff --git a/openbsc/src/libctrl/control_if.c b/openbsc/src/libctrl/control_if.c
index d1a3c1c76..299b00d17 100644
--- a/openbsc/src/libctrl/control_if.c
+++ b/openbsc/src/libctrl/control_if.c
@@ -76,7 +76,7 @@ int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd)
msg = ctrl_cmd_make(cmd);
if (!msg) {
- LOGP(DLINP, LOGL_ERROR, "Could not generate msg\n");
+ LOGP(DCTRL, LOGL_ERROR, "Could not generate msg\n");
return -1;
}
@@ -85,7 +85,7 @@ int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd)
ret = osmo_wqueue_enqueue(queue, msg);
if (ret != 0) {
- LOGP(DLINP, LOGL_ERROR, "Failed to enqueue the command.\n");
+ LOGP(DCTRL, LOGL_ERROR, "Failed to enqueue the command.\n");
msgb_free(msg);
}
return ret;
@@ -218,27 +218,27 @@ static int handle_control_read(struct osmo_fd * bfd)
ret = ipa_msg_recv(bfd->fd, &msg);
if (ret <= 0) {
if (ret == 0)
- LOGP(DLINP, LOGL_INFO, "The control connection was closed\n");
+ LOGP(DCTRL, LOGL_INFO, "The control connection was closed\n");
else
- LOGP(DLINP, LOGL_ERROR, "Failed to parse ip access message: %d\n", ret);
+ LOGP(DCTRL, LOGL_ERROR, "Failed to parse ip access message: %d\n", ret);
goto err;
}
if (msg->len < sizeof(*iph) + sizeof(*iph_ext)) {
- LOGP(DLINP, LOGL_ERROR, "The message is too short.\n");
+ LOGP(DCTRL, LOGL_ERROR, "The message is too short.\n");
goto err;
}
iph = (struct ipaccess_head *) msg->data;
if (iph->proto != IPAC_PROTO_OSMO) {
- LOGP(DLINP, LOGL_ERROR, "Protocol mismatch. We got 0x%x\n", iph->proto);
+ LOGP(DCTRL, LOGL_ERROR, "Protocol mismatch. We got 0x%x\n", iph->proto);
goto err;
}
iph_ext = (struct ipaccess_head_ext *) iph->data;
if (iph_ext->proto != IPAC_PROTO_EXT_CTRL) {
- LOGP(DLINP, LOGL_ERROR, "Extended protocol mismatch. We got 0x%x\n", iph_ext->proto);
+ LOGP(DCTRL, LOGL_ERROR, "Extended protocol mismatch. We got 0x%x\n", iph_ext->proto);
goto err;
}
@@ -256,7 +256,7 @@ static int handle_control_read(struct osmo_fd * bfd)
cmd = talloc_zero(ccon, struct ctrl_cmd);
if (!cmd)
goto err;
- LOGP(DLINP, LOGL_ERROR, "Command parser error.\n");
+ LOGP(DCTRL, LOGL_ERROR, "Command parser error.\n");
cmd->type = CTRL_TYPE_ERROR;
cmd->id = "err";
cmd->reply = "Command parser error.";
@@ -279,7 +279,7 @@ static int control_write_cb(struct osmo_fd *bfd, struct msgb *msg)
rc = write(bfd->fd, msg->data, msg->len);
if (rc != msg->len)
- LOGP(DLINP, LOGL_ERROR, "Failed to write message to the control connection.\n");
+ LOGP(DCTRL, LOGL_ERROR, "Failed to write message to the control connection.\n");
return rc;
}
@@ -313,7 +313,7 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
perror("accept");
return fd;
}
- LOGP(DLINP, LOGL_INFO, "accept()ed new control connection from %s\n",
+ LOGP(DCTRL, LOGL_INFO, "accept()ed new control connection from %s\n",
inet_ntoa(sa.sin_addr));
on = 1;
@@ -325,7 +325,7 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
}
ccon = ctrl_connection_alloc(listen_bfd->data);
if (!ccon) {
- LOGP(DLINP, LOGL_ERROR, "Failed to allocate.\n");
+ LOGP(DCTRL, LOGL_ERROR, "Failed to allocate.\n");
close(fd);
return -1;
}
@@ -338,7 +338,7 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
ret = osmo_fd_register(&ccon->write_queue.bfd);
if (ret < 0) {
- LOGP(DLINP, LOGL_ERROR, "Could not register FD.\n");
+ LOGP(DCTRL, LOGL_ERROR, "Could not register FD.\n");
close(ccon->write_queue.bfd.fd);
talloc_free(ccon);
}