1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

move some info() to dbg()

This commit is contained in:
Kay Sievers 2008-11-01 20:16:24 +01:00
parent 5755d586e1
commit 86b5778857
9 changed files with 64 additions and 62 deletions

View File

@ -250,7 +250,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl)
goto err;
}
info(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type);
dbg(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type);
return uctrl_msg;
err:
udev_ctrl_msg_unref(uctrl_msg);
@ -272,7 +272,7 @@ void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg)
ctrl_msg->refcount--;
if (ctrl_msg->refcount > 0)
return;
info(ctrl_msg->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg);
dbg(ctrl_msg->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg);
free(ctrl_msg);
}

View File

@ -87,7 +87,7 @@ int udev_device_read_db(struct udev_device *udev_device)
devpath_to_db_path(udev_device->udev, udev_device->devpath, filename, sizeof(filename));
if (lstat(filename, &stats) != 0) {
info(udev_device->udev, "no db file to read %s: %m\n", filename);
dbg(udev_device->udev, "no db file to read %s: %m\n", filename);
return -1;
}
if ((stats.st_mode & S_IFMT) == S_IFLNK) {
@ -100,7 +100,7 @@ int udev_device_read_db(struct udev_device *udev_device)
if (target_len > 0)
target[target_len] = '\0';
else {
info(udev_device->udev, "error reading db link %s: %m\n", filename);
dbg(udev_device->udev, "error reading db link %s: %m\n", filename);
return -1;
}
@ -134,7 +134,7 @@ int udev_device_read_db(struct udev_device *udev_device)
f = fopen(filename, "r");
if (f == NULL) {
info(udev_device->udev, "error reading db file %s: %m\n", filename);
dbg(udev_device->udev, "error reading db file %s: %m\n", filename);
return -1;
}
while (fgets(line, sizeof(line), f)) {
@ -252,7 +252,7 @@ struct udev_device *device_new(struct udev *udev)
udev_device_add_property(udev_device,
udev_list_entry_get_name(list_entry),
udev_list_entry_get_value(list_entry));
info(udev_device->udev, "udev_device: %p created\n", udev_device);
dbg(udev_device->udev, "udev_device: %p created\n", udev_device);
return udev_device;
}
@ -295,7 +295,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *
subdir = &syspath[len+1];
pos = strrchr(subdir, '/');
if (pos == NULL || pos < &subdir[2]) {
info(udev, "not a subdir :%s\n", syspath);
dbg(udev, "not a subdir :%s\n", syspath);
return NULL;
}
@ -330,13 +330,13 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *
util_strlcpy(file, path, sizeof(file));
util_strlcat(file, "/uevent", sizeof(file));
if (stat(file, &statbuf) != 0) {
info(udev, "not a device: %s\n", syspath);
dbg(udev, "not a device: %s\n", syspath);
return NULL;
}
} else {
/* everything else just needs to be a directory */
if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) {
info(udev, "directory not found: %s\n", syspath);
dbg(udev, "directory not found: %s\n", syspath);
return NULL;
}
}
@ -531,7 +531,7 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device)
udev_device->parent_device = device_new_from_parent(udev_device);
}
if (udev_device->parent_device != NULL)
info(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device);
dbg(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device);
return udev_device->parent_device;
}
@ -612,7 +612,7 @@ void udev_device_unref(struct udev_device *udev_device)
udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list);
free(udev_device->envp);
free(udev_device->monitor_buf);
info(udev_device->udev, "udev_device: %p released\n", udev_device);
dbg(udev_device->udev, "udev_device: %p released\n", udev_device);
free(udev_device);
}
@ -840,8 +840,8 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const
/* look for possibly already cached result */
udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->sysattr_list)) {
if (strcmp(udev_list_entry_get_name(list_entry), sysattr) == 0) {
info(udev_device->udev, "got '%s' (%s) from cache\n",
sysattr, udev_list_entry_get_value(list_entry));
dbg(udev_device->udev, "got '%s' (%s) from cache\n",
sysattr, udev_list_entry_get_value(list_entry));
return udev_list_entry_get_value(list_entry);
}
}
@ -851,7 +851,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const
util_strlcat(path, sysattr, sizeof(path));
if (lstat(path, &statbuf) != 0) {
info(udev_device->udev, "no attribute '%s', keep negative entry\n", path);
dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path);
udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, NULL, 0, 0);
goto out;
}
@ -868,7 +868,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const
pos = strrchr(target, '/');
if (pos != NULL) {
pos = &pos[1];
info(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos);
dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos);
list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, pos, 0, 0);
val = udev_list_entry_get_value(list_entry);
}
@ -887,7 +887,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const
/* read attribute value */
fd = open(path, O_RDONLY);
if (fd < 0) {
info(udev_device->udev, "attribute '%s' can not be opened\n", path);
dbg(udev_device->udev, "attribute '%s' can not be opened\n", path);
goto out;
}
size = read(fd, value, sizeof(value));
@ -900,7 +900,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const
/* got a valid value, store it in cache and return it */
value[size] = '\0';
util_remove_trailing_chars(value, '\n');
info(udev_device->udev, "'%s' has attribute value '%s'\n", path, value);
dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value);
list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, value, 0, 0);
val = udev_list_entry_get_value(list_entry);
out:
@ -1072,7 +1072,7 @@ static int update_envp_monitor_buf(struct udev_device *udev_device)
udev_device->envp[i] = NULL;
udev_device->monitor_buf_len = bufpos;
udev_device->envp_uptodate = 1;
info(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", i, bufpos);
dbg(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", i, bufpos);
return 0;
}

View File

@ -310,7 +310,7 @@ static int devices_delay(struct udev *udev, const char *syspath)
len = strlen(udev_get_sys_path(udev));
for (i = 0; delay_device_list[i] != NULL; i++) {
if (strstr(&syspath[len], delay_device_list[i]) != NULL) {
info(udev, "delaying: %s\n", syspath);
dbg(udev, "delaying: %s\n", syspath);
return 1;
}
}
@ -368,23 +368,23 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate)
util_strlcat(base, "/subsystem", sizeof(base));
if (stat(base, &statbuf) == 0) {
/* we have /subsystem/, forget all the old stuff */
info(udev, "searching '/subsystem/*/devices/*' dir\n");
dbg(udev, "searching '/subsystem/*/devices/*' dir\n");
scan_dir(udev_enumerate, "subsystem", "devices", NULL);
} else {
info(udev, "searching '/bus/*/devices/*' dir\n");
dbg(udev, "searching '/bus/*/devices/*' dir\n");
scan_dir(udev_enumerate, "bus", "devices", NULL);
info(udev, "searching '/class/*' dir\n");
dbg(udev, "searching '/class/*' dir\n");
scan_dir(udev_enumerate, "class", NULL, NULL);
/* if block isn't a class, scan /block/ */
util_strlcpy(base, udev_get_sys_path(udev), sizeof(base));
util_strlcat(base, "/class/block", sizeof(base));
if (stat(base, &statbuf) != 0) {
if (match_subsystem(udev_enumerate, "block")) {
info(udev, "searching '/block/*' dir\n");
dbg(udev, "searching '/block/*' dir\n");
/* scan disks */
scan_dir_and_add_devices(udev_enumerate, "block", NULL, NULL);
/* scan partitions */
info(udev, "searching '/block/*/*' dir\n");
dbg(udev, "searching '/block/*/*' dir\n");
scan_dir(udev_enumerate, "block", NULL, "block");
}
}
@ -419,11 +419,11 @@ int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate)
else
subsysdir = "bus";
if (match_subsystem(udev_enumerate, "subsystem")) {
info(udev, "searching '%s/*' dir\n", subsysdir);
dbg(udev, "searching '%s/*' dir\n", subsysdir);
scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL);
}
if (match_subsystem(udev_enumerate, "drivers")) {
info(udev, "searching '%s/*/drivers/*' dir\n", subsysdir);
dbg(udev, "searching '%s/*/drivers/*' dir\n", subsysdir);
scan_dir(udev_enumerate, subsysdir, "drivers", "drivers");
}
return 0;

View File

@ -110,17 +110,17 @@ struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_
if (unique)
udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) {
if (strcmp(entry_loop->name, name) == 0) {
info(udev, "'%s' is already in the list\n", name);
dbg(udev, "'%s' is already in the list\n", name);
free(entry_loop->value);
if (value == NULL) {
entry_loop->value = NULL;
info(udev, "'%s' value unset\n", name);
dbg(udev, "'%s' value unset\n", name);
return entry_loop;
}
entry_loop->value = strdup(value);
if (entry_loop->value == NULL)
return NULL;
info(udev, "'%s' value replaced with '%s'\n", name, value);
dbg(udev, "'%s' value replaced with '%s'\n", name, value);
return entry_loop;
}
}

View File

@ -94,7 +94,7 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char
free(udev_monitor);
return NULL;
}
info(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path);
dbg(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path);
return udev_monitor;
}
@ -121,7 +121,7 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev)
udev_monitor->snl.nl_pid = getpid();
udev_monitor->snl.nl_groups = 1;
info(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT\n", udev_monitor);
dbg(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT\n", udev_monitor);
return udev_monitor;
}
@ -136,7 +136,7 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor)
err(udev_monitor->udev, "bind failed: %m\n");
return err;
}
info(udev_monitor->udev, "monitor %p listening on netlink\n", udev_monitor);
dbg(udev_monitor->udev, "monitor %p listening on netlink\n", udev_monitor);
} else if (udev_monitor->sun.sun_family != 0) {
err = bind(udev_monitor->sock, (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen);
if (err < 0) {
@ -145,7 +145,7 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor)
}
/* enable receiving of the sender credentials */
setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));
info(udev_monitor->udev, "monitor %p listening on socket\n", udev_monitor);
dbg(udev_monitor->udev, "monitor %p listening on socket\n", udev_monitor);
}
return 0;
}
@ -191,7 +191,7 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor)
return;
if (udev_monitor->sock >= 0)
close(udev_monitor->sock);
info(udev_monitor->udev, "monitor %p released\n", udev_monitor);
dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor);
free(udev_monitor);
}

View File

@ -103,7 +103,7 @@ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queu
return 0;
buf[len-1] = '\0';
seqnum = strtoull(buf, NULL, 10);
info(udev_queue->udev, "seqnum=%llu\n", seqnum);
dbg(udev_queue->udev, "seqnum=%llu\n", seqnum);
return seqnum;
}
@ -128,7 +128,7 @@ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue)
return 0;
buf[len-1] = '\0';
seqnum = strtoull(buf, NULL, 10);
info(udev_queue->udev, "seqnum=%llu\n", seqnum);
dbg(udev_queue->udev, "seqnum=%llu\n", seqnum);
udev_queue->last_seen_udev_seqnum = seqnum;
return seqnum;
}
@ -144,20 +144,20 @@ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue)
util_strlcpy(queuename, udev_get_dev_path(udev_queue->udev), sizeof(queuename));
util_strlcat(queuename, "/.udev/queue", sizeof(queuename));
if (stat(queuename, &statbuf) == 0) {
info(udev_queue->udev, "queue is not empty\n");
dbg(udev_queue->udev, "queue is not empty\n");
return 0;
}
seqnum_kernel = udev_queue_get_kernel_seqnum(udev_queue);
if (seqnum_kernel <= udev_queue->last_seen_udev_seqnum) {
info(udev_queue->udev, "queue is empty\n");
dbg(udev_queue->udev, "queue is empty\n");
return 1;
}
udev_queue_get_udev_seqnum(udev_queue);
if (seqnum_kernel <= udev_queue->last_seen_udev_seqnum) {
info(udev_queue->udev, "queue is empty\n");
dbg(udev_queue->udev, "queue is empty\n");
return 1;
}
info(udev_queue->udev, "queue is empty, but kernel events still pending [%llu]<->[%llu]\n",
dbg(udev_queue->udev, "queue is empty, but kernel events still pending [%llu]<->[%llu]\n",
seqnum_kernel, udev_queue->last_seen_udev_seqnum);
return 0;
}
@ -179,7 +179,7 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo
udev_get_dev_path(udev_queue->udev), seqnum);
if (stat(filename, &statbuf) == 0)
return 0;
info(udev_queue->udev, "seqnum: %llu finished\n", seqnum);
dbg(udev_queue->udev, "seqnum: %llu finished\n", seqnum);
return 1;
}
@ -214,7 +214,7 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev
if (len < 0 || len >= (ssize_t)(sizeof(syspath)-syslen))
continue;
syspath[syslen + len] = '\0';
info(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name);
dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name);
udev_list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, dent->d_name, 0, 0);
}
closedir(dir);
@ -253,7 +253,7 @@ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev
if (len < 0 || len >= (ssize_t)(sizeof(syspath)-syslen))
continue;
syspath[syslen + len] = '\0';
info(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name);
dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name);
util_strlcpy(filename, syspath, sizeof(filename));
util_strlcat(filename, "/uevent", sizeof(filename));
if (stat(filename, &statbuf) != 0)

View File

@ -48,7 +48,7 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *sy
if (pos == NULL)
return -1;
pos = &pos[1];
info(udev, "resolved link to: '%s'\n", pos);
dbg(udev, "resolved link to: '%s'\n", pos);
return util_strlcpy(value, pos, size);
}

View File

@ -230,13 +230,13 @@ struct udev *udev_new(void)
if (udev->dev_path == NULL || udev->sys_path == NULL)
goto err;
info(udev, "context %p created\n", udev);
info(udev, "log_priority=%d\n", udev->log_priority);
info(udev, "config_file='%s'\n", config_file);
info(udev, "dev_path='%s'\n", udev->dev_path);
info(udev, "sys_path='%s'\n", udev->sys_path);
dbg(udev, "context %p created\n", udev);
dbg(udev, "log_priority=%d\n", udev->log_priority);
dbg(udev, "config_file='%s'\n", config_file);
dbg(udev, "dev_path='%s'\n", udev->dev_path);
dbg(udev, "sys_path='%s'\n", udev->sys_path);
if (udev->rules_path != NULL)
info(udev, "rules_path='%s'\n", udev->rules_path);
dbg(udev, "rules_path='%s'\n", udev->rules_path);
free(config_file);
return udev;
err:
@ -281,7 +281,7 @@ void udev_unref(struct udev *udev)
free(udev->dev_path);
free(udev->sys_path);
free(udev->rules_path);
info(udev, "context %p released\n", udev);
dbg(udev, "context %p released\n", udev);
free(udev);
}

View File

@ -283,7 +283,7 @@ static int add_string(struct udev_rules *rules, const char *str)
buf = realloc(rules->buf, rules->buf_max + add);
if (buf == NULL)
return -1;
info(rules->udev, "extend buffer from %zu to %zu\n", rules->buf_max, rules->buf_max + add);
dbg(rules->udev, "extend buffer from %zu to %zu\n", rules->buf_max, rules->buf_max + add);
rules->buf = buf;
rules->buf_max += add;
}
@ -310,7 +310,7 @@ static int add_token(struct udev_rules *rules, struct token *token)
tokens = realloc(rules->tokens, (rules->token_max + add ) * sizeof(struct token));
if (tokens == NULL)
return -1;
info(rules->udev, "extend tokens from %u to %u\n", rules->token_max, rules->token_max + add);
dbg(rules->udev, "extend tokens from %u to %u\n", rules->token_max, rules->token_max + add);
rules->tokens = tokens;
rules->token_max += add;
}
@ -349,7 +349,7 @@ static uid_t add_uid(struct udev_rules *rules, const char *owner)
uids = realloc(rules->uids, (rules->uids_max + add ) * sizeof(struct uid_gid));
if (uids == NULL)
return uid;
info(rules->udev, "extend uids from %u to %u\n", rules->uids_max, rules->uids_max + add);
dbg(rules->udev, "extend uids from %u to %u\n", rules->uids_max, rules->uids_max + add);
rules->uids = uids;
rules->uids_max += add;
}
@ -392,7 +392,7 @@ static gid_t add_gid(struct udev_rules *rules, const char *group)
gids = realloc(rules->gids, (rules->gids_max + add ) * sizeof(struct uid_gid));
if (gids == NULL)
return gid;
info(rules->udev, "extend gids from %u to %u\n", rules->gids_max, rules->gids_max + add);
dbg(rules->udev, "extend gids from %u to %u\n", rules->gids_max, rules->gids_max + add);
rules->gids = gids;
rules->gids_max += add;
}
@ -461,7 +461,7 @@ static int import_property_from_string(struct udev_device *dev, char *line)
val++;
}
info(udev, "adding '%s'='%s'\n", key, val);
dbg(udev, "adding '%s'='%s'\n", key, val);
/* handle device, renamed by external tool, returning new path */
if (strcmp(key, "DEVPATH") == 0) {
@ -1595,8 +1595,8 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
/* offset 0 is always '\0' */
rules->buf[0] = '\0';
rules->buf_cur = 1;
info(udev, "prealloc %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n",
rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max);
dbg(udev, "prealloc %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n",
rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max);
if (udev_get_rules_path(udev) != NULL) {
/* custom rules location for testing */
@ -2041,11 +2041,11 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
attr_subst_subdir(filename, sizeof(filename));
match = (stat(filename, &statbuf) == 0);
info(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n");
dbg(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n");
if (match && cur->key.mode > 0) {
match = ((statbuf.st_mode & cur->key.mode) > 0);
info(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode,
match ? "matches" : "does not match", cur->key.mode);
dbg(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode,
match ? "matches" : "does not match", cur->key.mode);
}
if (match && cur->key.op == OP_NOMATCH)
goto nomatch;
@ -2360,7 +2360,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
util_strlcpy(value, &rules->buf[cur->key.value_off], sizeof(value));
udev_event_apply_format(event, value, sizeof(value));
info(event->udev, "writing '%s' to sysfs file '%s'\n", value, attr);
info(event->udev, "ATTR '%s' writing '%s' %s:%u\n", attr, value,
&rules->buf[rule->rule.filename_off],
rule->rule.filename_line);
f = fopen(attr, "w");
if (f != NULL) {
if (!event->test)