path_kill_slashes(cleaned);
- done = set_new(&string_hash_ops);
+ done = set_new(&path_hash_ops);
if (!done)
return -ENOMEM;
char *x;
unsigned long orig_flags;
- todo = set_new(&string_hash_ops);
+ todo = set_new(&path_hash_ops);
if (!todo)
return -ENOMEM;
} else
log_debug("Cgroup path: %s", root);
- a = hashmap_new(&string_hash_ops);
- b = hashmap_new(&string_hash_ops);
+ a = hashmap_new(&path_hash_ops);
+ b = hashmap_new(&path_hash_ops);
if (!a || !b) {
r = log_oom();
goto finish;
if (streq_ptr(d->sysfs, sysfs))
return 0;
- r = hashmap_ensure_allocated(&UNIT(d)->manager->devices_by_sysfs, &string_hash_ops);
+ r = hashmap_ensure_allocated(&UNIT(d)->manager->devices_by_sysfs, &path_hash_ops);
if (r < 0)
return r;
if (r < 0)
goto fail;
- r = hashmap_ensure_allocated(&m->cgroup_unit, &string_hash_ops);
+ r = hashmap_ensure_allocated(&m->cgroup_unit, &path_hash_ops);
if (r < 0)
goto fail;
set_free_free(m->unit_path_cache);
- m->unit_path_cache = set_new(&string_hash_ops);
+ m->unit_path_cache = set_new(&path_hash_ops);
if (!m->unit_path_cache) {
r = -ENOMEM;
goto fail;
mount->parameters_proc_self_mountinfo.what) {
/* Remember that this device might just have disappeared */
- if (set_ensure_allocated(&gone, &string_hash_ops) < 0 ||
+ if (set_ensure_allocated(&gone, &path_hash_ops) < 0 ||
set_put(gone, mount->parameters_proc_self_mountinfo.what) < 0)
log_oom(); /* we don't care too much about OOM here... */
}
mount->from_proc_self_mountinfo &&
mount->parameters_proc_self_mountinfo.what) {
- if (set_ensure_allocated(&around, &string_hash_ops) < 0 ||
+ if (set_ensure_allocated(&around, &path_hash_ops) < 0 ||
set_put(around, mount->parameters_proc_self_mountinfo.what) < 0)
log_oom();
}
assert(s);
- r = hashmap_ensure_allocated(&UNIT(s)->manager->swaps_by_devnode, &string_hash_ops);
+ r = hashmap_ensure_allocated(&UNIT(s)->manager->swaps_by_devnode, &path_hash_ops);
if (r < 0)
return r;
if (!path_is_absolute(path))
return -EINVAL;
- r = hashmap_ensure_allocated(&u->requires_mounts_for, &string_hash_ops);
+ r = hashmap_ensure_allocated(&u->requires_mounts_for, &path_hash_ops);
if (r < 0)
return r;
if (!x) {
char *q;
- r = hashmap_ensure_allocated(&u->manager->units_requiring_mounts_for, &string_hash_ops);
+ r = hashmap_ensure_allocated(&u->manager->units_requiring_mounts_for, &path_hash_ops);
if (r < 0)
return r;
j->path = t;
}
- j->files = ordered_hashmap_new(&string_hash_ops);
+ j->files = ordered_hashmap_new(&path_hash_ops);
if (!j->files)
goto fail;
j->files_cache = ordered_hashmap_iterated_cache_new(j->files);
- j->directories_by_path = hashmap_new(&string_hash_ops);
+ j->directories_by_path = hashmap_new(&path_hash_ops);
j->mmap = mmap_cache_new();
if (!j->files_cache || !j->directories_by_path || !j->mmap)
goto fail;
assert(udev);
- nodes = set_new(&string_hash_ops);
+ nodes = set_new(&path_hash_ops);
if (!nodes)
return -ENOMEM;
if (r < 0)
return r;
- cgroups = hashmap_new(&string_hash_ops);
+ cgroups = hashmap_new(&path_hash_ops);
if (!cgroups)
return -ENOMEM;
assert(p);
- r = set_ensure_allocated(remove_symlinks_to, &string_hash_ops);
+ r = set_ensure_allocated(remove_symlinks_to, &path_hash_ops);
if (r < 0)
return r;
_cleanup_free_ char *l = NULL;
void *v;
int k;
+
k = read_line(f, LONG_LINE_MAX, &l);
if (k == 0)
break;
-
if (k < 0)
return log_error_errno(k, "Failed to read file '%s', ignoring: %m", path);
c++;
p = strstrip(l);
- if (!*p)
- continue;
+ if (isempty(p))
+ continue;
if (strchr(COMMENTS "\n", *p))
continue;
umask(0022);
- sysctl_options = ordered_hashmap_new(&string_hash_ops);
+ sysctl_options = ordered_hashmap_new(&path_hash_ops);
if (!sysctl_options) {
r = log_oom();
goto finish;
/* We maintain a cache of the sockets we found in /proc/net/unix to speed things up a little. */
- unix_sockets = set_new(&string_hash_ops);
- if (!unix_sockets)
+ unix_sockets = set_new(&path_hash_ops);
+ if (!unix_sockets) {
+ log_oom();
return;
+ }
f = fopen("/proc/net/unix", "re");
if (!f) {