ret = server_id_db_set_exclusive(names_db, "notify-daemon");
if (ret != 0) {
- DEBUG(10, ("%s: server_id_db_add failed: %s\n",
- __func__, strerror(ret)));
+ DBG_DEBUG("server_id_db_add failed: %s\n",
+ strerror(ret));
tevent_req_error(req, ret);
goto deregister_get_db;
}
size_t *num_instances)
{
if ((buflen % sizeof(struct notifyd_instance)) != 0) {
- DEBUG(1, ("%s: invalid buffer size: %u\n",
- __func__, (unsigned)buflen));
+ DBG_WARNING("invalid buffer size: %zu\n", buflen);
return false;
}
bool ok = false;
if (pathlen == 0) {
- DEBUG(1, ("%s: pathlen==0\n", __func__));
+ DBG_WARNING("pathlen==0\n");
return false;
}
if (path[pathlen-1] != '\0') {
- DEBUG(1, ("%s: path not 0-terminated\n", __func__));
+ DBG_WARNING("path not 0-terminated\n");
return false;
}
- DEBUG(10, ("%s: path=%s, filter=%u, subdir_filter=%u, "
- "private_data=%p\n", __func__, path,
- (unsigned)chg->filter, (unsigned)chg->subdir_filter,
- chg->private_data));
+ DBG_DEBUG("path=%s, filter=%"PRIu32", subdir_filter=%"PRIu32", "
+ "private_data=%p\n",
+ path,
+ chg->filter,
+ chg->subdir_filter,
+ chg->private_data);
rec = dbwrap_fetch_locked(
entries, entries,
make_tdb_data((const uint8_t *)path, pathlen-1));
if (rec == NULL) {
- DEBUG(1, ("%s: dbwrap_fetch_locked failed\n", __func__));
+ DBG_WARNING("dbwrap_fetch_locked failed\n");
goto fail;
}
instances = talloc_array(rec, struct notifyd_instance,
num_instances + 1);
if (instances == NULL) {
- DEBUG(1, ("%s: talloc failed\n", __func__));
+ DBG_WARNING("talloc failed\n");
goto fail;
}
num_instances -= 1;
}
- DEBUG(10, ("%s: %s has %u instances\n", __func__,
- path, (unsigned)num_instances));
+ DBG_DEBUG("%s has %zu instances\n", path, num_instances);
if (num_instances == 0) {
status = dbwrap_record_delete(rec);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1, ("%s: dbwrap_record_delete returned %s\n",
- __func__, nt_errstr(status)));
+ DBG_WARNING("dbwrap_record_delete returned %s\n",
+ nt_errstr(status));
goto fail;
}
} else {
status = dbwrap_record_store(rec, value, 0);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1, ("%s: dbwrap_record_store returned %s\n",
- __func__, nt_errstr(status)));
+ DBG_WARNING("dbwrap_record_store returned %s\n",
+ nt_errstr(status));
goto fail;
}
}
struct notify_rec_change_msg *msg;
if (bufsize < offsetof(struct notify_rec_change_msg, path) + 1) {
- DEBUG(1, ("%s: message too short, ignoring: %u\n", __func__,
- (unsigned)bufsize));
+ DBG_WARNING("message too short, ignoring: %zu\n", bufsize);
return false;
}
*pmsg = msg = (struct notify_rec_change_msg *)buf;
*pathlen = bufsize - offsetof(struct notify_rec_change_msg, path);
- DEBUG(10, ("%s: Got rec_change_msg filter=%u, subdir_filter=%u, "
- "private_data=%p, path=%.*s\n",
- __func__, (unsigned)msg->instance.filter,
- (unsigned)msg->instance.subdir_filter,
- msg->instance.private_data, (int)(*pathlen), msg->path));
+ DBG_DEBUG("Got rec_change_msg filter=%"PRIu32", "
+ "subdir_filter=%"PRIu32", private_data=%p, path=%.*s\n",
+ msg->instance.filter,
+ msg->instance.subdir_filter,
+ msg->instance.private_data,
+ (int)(*pathlen),
+ msg->path);
return true;
}
state->entries, state->sys_notify_watch, state->sys_notify_ctx,
state->msg_ctx);
if (!ok) {
- DEBUG(1, ("%s: notifyd_apply_rec_change failed, ignoring\n",
- __func__));
+ DBG_DEBUG("notifyd_apply_rec_change failed, ignoring\n");
return;
}
tmp = talloc_realloc(log, log->recs, struct messaging_rec *,
log->num_recs+1);
if (tmp == NULL) {
- DEBUG(1, ("%s: talloc_realloc failed, ignoring\n", __func__));
+ DBG_WARNING("talloc_realloc failed, ignoring\n");
return;
}
log->recs = tmp;
return;
}
if (data->data[data->length-1] != 0) {
- DEBUG(1, ("%s: path not 0-terminated, ignoring\n", __func__));
+ DBG_WARNING("path not 0-terminated, ignoring\n");;
return;
}
tstate.msg = (struct notify_trigger_msg *)data->data;
path = tstate.msg->path;
- DEBUG(10, ("%s: Got trigger_msg action=%u, filter=%u, path=%s\n",
- __func__, (unsigned)tstate.msg->action,
- (unsigned)tstate.msg->filter, path));
+ DBG_DEBUG("Got trigger_msg action=%"PRIu32", filter=%"PRIu32", "
+ "path=%s\n",
+ tstate.msg->action,
+ tstate.msg->filter,
+ path);
if (path[0] != '/') {
- DEBUG(1, ("%s: path %s does not start with /, ignoring\n",
- __func__, path));
+ DBG_WARNING("path %s does not start with /, ignoring\n",
+ path);
return;
}
next_p = strchr(p+1, '/');
tstate.recursive = (next_p != NULL);
- DEBUG(10, ("%s: Trying path %.*s\n", __func__,
- (int)path_len, path));
+ DBG_DEBUG("Trying path %.*s\n", (int)path_len, path);
key = (TDB_DATA) { .dptr = discard_const_p(uint8_t, path),
.dsize = path_len };
if (!notifyd_parse_entry(data.dptr, data.dsize, &instances,
&num_instances)) {
- DEBUG(1, ("%s: Could not parse notifyd_entry\n", __func__));
+ DBG_DEBUG("Could not parse notifyd_entry\n");
return;
}
- DEBUG(10, ("%s: Found %u instances for %.*s\n", __func__,
- (unsigned)num_instances, (int)key.dsize,
- (char *)key.dptr));
+ DBG_DEBUG("Found %zu instances for %.*s\n",
+ num_instances,
+ (int)key.dsize,
+ (char *)key.dptr);
iov[0].iov_base = &msg;
iov[0].iov_len = offsetof(struct notify_event_msg, path);
tstate->msg_ctx, instance->client,
MSG_PVFS_NOTIFY, iov, ARRAY_SIZE(iov), NULL, 0);
- DEBUG(10, ("%s: messaging_send_iov to %s returned %s\n",
- __func__,
- server_id_str_buf(instance->client, &idbuf),
- nt_errstr(status)));
+ DBG_DEBUG("messaging_send_iov to %s returned %s\n",
+ server_id_str_buf(instance->client, &idbuf),
+ nt_errstr(status));
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND) &&
procid_is_local(&instance->client)) {
}
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1, ("%s: messaging_send_iov returned %s\n",
- __func__, nt_errstr(status)));
+ DBG_WARNING("messaging_send_iov returned %s\n",
+ nt_errstr(status));
}
}
}
MSG_SMB_NOTIFY_REC_CHANGE, iov, ARRAY_SIZE(iov), NULL, 0);
if (ret != 0) {
- DEBUG(10, ("%s: messaging_send_iov_from returned %s\n",
- __func__, strerror(ret)));
+ DBG_WARNING("messaging_send_iov_from returned %s\n",
+ strerror(ret));
}
}
buf = talloc_array(talloc_tos(), uint8_t, dbsize);
if (buf == NULL) {
- DEBUG(1, ("%s: talloc_array(%ju) failed\n",
- __func__, (uintmax_t)dbsize));
+ DBG_WARNING("talloc_array(%zu) failed\n", dbsize);
return;
}
dbsize = dbwrap_marshall(state->entries, buf, dbsize);
if (dbsize != talloc_get_size(buf)) {
- DEBUG(1, ("%s: dbsize changed: %ju->%ju\n", __func__,
- (uintmax_t)talloc_get_size(buf),
- (uintmax_t)dbsize));
+ DBG_DEBUG("dbsize changed: %zu->%zu\n",
+ talloc_get_size(buf),
+ dbsize);
TALLOC_FREE(buf);
return;
}
iov[1] = (struct iovec) { .iov_base = buf,
.iov_len = dbsize };
- DEBUG(10, ("%s: Sending %ju bytes to %s->%s\n", __func__,
- (uintmax_t)iov_buflen(iov, ARRAY_SIZE(iov)),
- server_id_str_buf(messaging_server_id(msg_ctx), &id1),
- server_id_str_buf(src, &id2)));
+ DBG_DEBUG("Sending %zu bytes to %s->%s\n",
+ iov_buflen(iov, ARRAY_SIZE(iov)),
+ server_id_str_buf(messaging_server_id(msg_ctx), &id1),
+ server_id_str_buf(src, &id2));
status = messaging_send_iov(msg_ctx, src, MSG_SMB_NOTIFY_DB,
iov, ARRAY_SIZE(iov), NULL, 0);
TALLOC_FREE(buf);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1, ("%s: messaging_send_iov failed: %s\n",
- __func__, nt_errstr(status)));
+ DBG_WARNING("messaging_send_iov failed: %s\n",
+ nt_errstr(status));
}
}
p->db = db_open_rbt(p);
if (p->db == NULL) {
- DEBUG(10, ("%s: db_open_rbt failed\n", __func__));
+ DBG_DEBUG("db_open_rbt failed\n");
TALLOC_FREE(p);
return;
}
status = dbwrap_unmarshall(p->db, data->data + 8,
data->length - 8);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(10, ("%s: dbwrap_unmarshall returned %s for db %s\n",
- __func__, nt_errstr(status),
- server_id_str_buf(src, &idbuf)));
+ DBG_DEBUG("dbwrap_unmarshall returned %s for db %s\n",
+ nt_errstr(status),
+ server_id_str_buf(src, &idbuf));
TALLOC_FREE(p);
return;
}
dbwrap_traverse_read(p->db, notifyd_add_proxy_syswatches, state,
&count);
- DEBUG(10, ("%s: Database from %s contained %d records\n", __func__,
- server_id_str_buf(src, &idbuf), count));
+ DBG_DEBUG("Database from %s contained %d records\n",
+ server_id_str_buf(src, &idbuf),
+ count);
}
static void notifyd_broadcast_reclog(struct ctdbd_connection *ctdbd_conn,
return;
}
- DEBUG(10, ("%s: rec_index=%ju, num_recs=%u\n", __func__,
- (uintmax_t)log->rec_index, (unsigned)log->num_recs));
+ DBG_DEBUG("rec_index=%zu, num_recs=%"PRIu32"\n",
+ log->rec_index,
+ log->num_recs);
message_hdr_put(msghdr, MSG_SMB_NOTIFY_REC_CHANGES, src,
(struct server_id) {0 });
&blob, log, log,
(ndr_push_flags_fn_t)ndr_push_messaging_reclog);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- DEBUG(1, ("%s: ndr_push_messaging_recs failed: %s\n",
- __func__, ndr_errstr(ndr_err)));
+ DBG_WARNING("ndr_push_messaging_recs failed: %s\n",
+ ndr_errstr(ndr_err));
goto done;
}
iov[1] = (struct iovec) { .iov_base = blob.data,
CTDB_SRVID_SAMBA_NOTIFY_PROXY, iov, ARRAY_SIZE(iov));
TALLOC_FREE(blob.data);
if (ret != 0) {
- DEBUG(1, ("%s: ctdbd_messaging_send failed: %s\n",
- __func__, strerror(ret)));
+ DBG_WARNING("ctdbd_messaging_send failed: %s\n",
+ strerror(ret));
goto done;
}
* peer dead
*/
- DEBUG(10, ("%s: peer %s died\n", __func__,
- server_id_str_buf(p->pid, &idbuf)));
+ DBG_DEBUG("peer %s died\n",
+ server_id_str_buf(p->pid, &idbuf));
/*
* This implicitly decrements notifyd->num_peers
*/
ok = notifyd_parse_entry(value.dptr, value.dsize, &instances,
&num_instances);
if (!ok) {
- DEBUG(1, ("%s: Could not parse notifyd entry for %s\n",
- __func__, path));
+ DBG_WARNING("Could not parse notifyd entry for %s\n", path);
return 0;
}
notifyd_sys_callback, state->msg_ctx,
&instance->sys_watch);
if (ret != 0) {
- DEBUG(1, ("%s: inotify_watch returned %s\n",
- __func__, strerror(errno)));
+ DBG_WARNING("inotify_watch returned %s\n",
+ strerror(errno));
}
}
ok = notifyd_parse_entry(value.dptr, value.dsize, &instances,
&num_instances);
if (!ok) {
- DEBUG(1, ("%s: Could not parse notifyd entry for %.*s\n",
- __func__, (int)key.dsize, (char *)key.dptr));
+ DBG_WARNING("Could not parse notifyd entry for %.*s\n",
+ (int)key.dsize, (char *)key.dptr);
return 0;
}
for (i=0; i<num_instances; i++) {
log = talloc(peer, struct messaging_reclog);
if (log == NULL) {
- DEBUG(10, ("%s: talloc failed\n", __func__));
+ DBG_DEBUG("talloc failed\n");
return;
}
&blob, log, log,
(ndr_pull_flags_fn_t)ndr_pull_messaging_reclog);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- DEBUG(10, ("%s: ndr_pull_messaging_reclog failed: %s\n",
- __func__, ndr_errstr(ndr_err)));
+ DBG_DEBUG("ndr_pull_messaging_reclog failed: %s\n",
+ ndr_errstr(ndr_err));
goto fail;
}
- DEBUG(10, ("%s: Got %u recs index %ju from %s\n", __func__,
- (unsigned)log->num_recs, (uintmax_t)log->rec_index,
- server_id_str_buf(peer->pid, &idbuf)));
+ DBG_DEBUG("Got %"PRIu32" recs index %"PRIu64" from %s\n",
+ log->num_recs,
+ log->rec_index,
+ server_id_str_buf(peer->pid, &idbuf));
if (log->rec_index != peer->rec_index) {
- DEBUG(3, ("%s: Got rec index %ju from %s, expected %ju\n",
- __func__, (uintmax_t)log->rec_index,
- server_id_str_buf(peer->pid, &idbuf),
- (uintmax_t)peer->rec_index));
+ DBG_INFO("Got rec index %"PRIu64" from %s, "
+ "expected %"PRIu64"\n",
+ log->rec_index,
+ server_id_str_buf(peer->pid, &idbuf),
+ peer->rec_index);
goto fail;
}
ok = notifyd_parse_rec_change(r->buf.data, r->buf.length,
&chg, &pathlen);
if (!ok) {
- DEBUG(3, ("%s: notifyd_parse_rec_change failed\n",
- __func__));
+ DBG_INFO("notifyd_parse_rec_change failed\n");
goto fail;
}
state->sys_notify_ctx,
state->msg_ctx);
if (!ok) {
- DEBUG(3, ("%s: notifyd_apply_rec_change failed\n",
- __func__));
+ DBG_INFO("notifyd_apply_rec_change failed\n");
goto fail;
}
}
return;
fail:
- DEBUG(10, ("%s: Dropping peer %s\n", __func__,
- server_id_str_buf(peer->pid, &idbuf)));
+ DBG_DEBUG("Dropping peer %s\n",
+ server_id_str_buf(peer->pid, &idbuf));
TALLOC_FREE(peer);
}
NTSTATUS status;
if (msglen < MESSAGE_HDR_LENGTH) {
- DEBUG(10, ("%s: Got short broadcast\n", __func__));
+ DBG_DEBUG("Got short broadcast\n");
return 0;
}
message_hdr_get(&msg_type, &src, &dst, msg);
if (msg_type != MSG_SMB_NOTIFY_REC_CHANGES) {
- DEBUG(10, ("%s Got message %u, ignoring\n", __func__,
- (unsigned)msg_type));
+ DBG_DEBUG("Got message %"PRIu32", ignoring\n", msg_type);
return 0;
}
if (server_id_equal(&src, &my_id)) {
- DEBUG(10, ("%s: Ignoring my own broadcast\n", __func__));
+ DBG_DEBUG("Ignoring my own broadcast\n");
return 0;
}
- DEBUG(10, ("%s: Got MSG_SMB_NOTIFY_REC_CHANGES from %s\n",
- __func__, server_id_str_buf(src, &idbuf)));
+ DBG_DEBUG("Got MSG_SMB_NOTIFY_REC_CHANGES from %s\n",
+ server_id_str_buf(src, &idbuf));
for (i=0; i<state->num_peers; i++) {
if (server_id_equal(&state->peers[i]->pid, &src)) {
- DEBUG(10, ("%s: Applying changes to peer %u\n",
- __func__, (unsigned)i));
+ DBG_DEBUG("Applying changes to peer %"PRIu32"\n", i);
notifyd_apply_reclog(state->peers[i],
msg + MESSAGE_HDR_LENGTH,
}
}
- DEBUG(10, ("%s: Creating new peer for %s\n", __func__,
- server_id_str_buf(src, &idbuf)));
+ DBG_DEBUG("Creating new peer for %s\n",
+ server_id_str_buf(src, &idbuf));
p = notifyd_peer_new(state, src);
if (p == NULL) {
- DEBUG(10, ("%s: notifyd_peer_new failed\n", __func__));
+ DBG_DEBUG("notifyd_peer_new failed\n");
return 0;
}
status = messaging_send_buf(state->msg_ctx, src, MSG_SMB_NOTIFY_GET_DB,
NULL, 0);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(10, ("%s: messaging_send_buf failed: %s\n",
- __func__, nt_errstr(status)));
+ DBG_DEBUG("messaging_send_buf failed: %s\n",
+ nt_errstr(status));
TALLOC_FREE(p);
return 0;
}
ok = notifyd_parse_entry(value.dptr, value.dsize, &instances,
&num_instances);
if (!ok) {
- DEBUG(10, ("%s: Could not parse entry for path %s\n",
- __func__, path));
+ DBG_DEBUG("Could not parse entry for path %s\n", path);
return true;
}