4562c35527
We allocated the names set for each unit, but in the majority of cases, we'd put only one name in the set: $ systemctl show --value -p Names '*'|grep .|grep -v ' '|wc -l 564 $ systemctl show --value -p Names '*'|grep .|grep ' '|wc -l 16 So let's add a separate .id field, and only store aliases in the set, and only create the set if there's at least one alias. This requires a bit of gymnastics in the code, but I think this optimization is worth the trouble, because we save one object for many loaded units. In particular set_complete_move() wasn't very useful because the target unit would always have at least one name defined, i.e. the optimization to move the whole set over would never fire.
27 lines
882 B
C
27 lines
882 B
C
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
#pragma once
|
|
|
|
#include "hashmap.h"
|
|
#include "macro.h"
|
|
#include "set.h"
|
|
#include "unit-name.h"
|
|
|
|
int drop_in_file(const char *dir, const char *unit, unsigned level,
|
|
const char *name, char **_p, char **_q);
|
|
|
|
int write_drop_in(const char *dir, const char *unit, unsigned level,
|
|
const char *name, const char *data);
|
|
|
|
int write_drop_in_format(const char *dir, const char *unit, unsigned level,
|
|
const char *name, const char *format, ...) _printf_(5, 6);
|
|
|
|
int unit_file_find_dropin_paths(
|
|
const char *original_root,
|
|
char **lookup_path,
|
|
Set *unit_path_cache,
|
|
const char *dir_suffix,
|
|
const char *file_suffix,
|
|
const char *name,
|
|
const Set *aliases,
|
|
char ***paths);
|