All other types exported from install.h should be namespaces like this,
hence namespace InstallInfo the same way.
Also, remove external forward definition of UnitFileScope type.
#include "formats-util.h"
static int specifier_prefix_and_instance(char specifier, void *data, void *userdata, char **ret) {
#include "formats-util.h"
static int specifier_prefix_and_instance(char specifier, void *data, void *userdata, char **ret) {
- InstallInfo *i = userdata;
+ UnitFileInstallInfo *i = userdata;
}
static int specifier_prefix(char specifier, void *data, void *userdata, char **ret) {
}
static int specifier_prefix(char specifier, void *data, void *userdata, char **ret) {
- InstallInfo *i = userdata;
+ UnitFileInstallInfo *i = userdata;
}
static int specifier_instance(char specifier, void *data, void *userdata, char **ret) {
}
static int specifier_instance(char specifier, void *data, void *userdata, char **ret) {
- InstallInfo *i = userdata;
+ UnitFileInstallInfo *i = userdata;
}
static int specifier_user_name(char specifier, void *data, void *userdata, char **ret) {
}
static int specifier_user_name(char specifier, void *data, void *userdata, char **ret) {
- InstallInfo *i = userdata;
+ UnitFileInstallInfo *i = userdata;
const char *username;
_cleanup_free_ char *tmp = NULL;
char *printed = NULL;
const char *username;
_cleanup_free_ char *tmp = NULL;
char *printed = NULL;
-int install_full_printf(InstallInfo *i, const char *format, char **ret) {
+int install_full_printf(UnitFileInstallInfo *i, const char *format, char **ret) {
/* This is similar to unit_full_printf() but does not support
* anything path-related.
/* This is similar to unit_full_printf() but does not support
* anything path-related.
#pragma once
#include "install.h"
#pragma once
#include "install.h"
-int install_full_printf(InstallInfo *i, const char *format, char **ret);
+
+int install_full_printf(UnitFileInstallInfo *i, const char *format, char **ret);
-static void install_info_free(InstallInfo *i) {
+static void install_info_free(UnitFileInstallInfo *i) {
assert(i);
free(i->name);
assert(i);
free(i->name);
}
static void install_info_hashmap_free(OrderedHashmap *m) {
}
static void install_info_hashmap_free(OrderedHashmap *m) {
+ UnitFileInstallInfo *i;
InstallContext *c,
const char *name,
const char *path) {
InstallContext *c,
const char *name,
const char *path) {
+ UnitFileInstallInfo *i = NULL;
- i = new0(InstallInfo, 1);
+ i = new0(UnitFileInstallInfo, 1);
size_t l;
const char *word, *state;
InstallContext *c = data;
size_t l;
const char *word, *state;
InstallContext *c = data;
- InstallInfo *i = userdata;
+ UnitFileInstallInfo *i = userdata;
assert(filename);
assert(lvalue);
assert(filename);
assert(lvalue);
void *data,
void *userdata) {
void *data,
void *userdata) {
+ UnitFileInstallInfo *i = data;
void *data,
void *userdata) {
void *data,
void *userdata) {
+ UnitFileInstallInfo *i = data;
static int unit_file_load(
InstallContext *c,
static int unit_file_load(
InstallContext *c,
+ UnitFileInstallInfo *info,
const char *path,
const char *root_dir,
bool allow_symlink,
const char *path,
const char *root_dir,
bool allow_symlink,
static int unit_file_search(
InstallContext *c,
static int unit_file_search(
InstallContext *c,
+ UnitFileInstallInfo *info,
const LookupPaths *paths,
const char *root_dir,
bool allow_symlink,
const LookupPaths *paths,
const char *root_dir,
bool allow_symlink,
bool *also) {
_cleanup_(install_context_done) InstallContext c = {};
bool *also) {
_cleanup_(install_context_done) InstallContext c = {};
+ UnitFileInstallInfo *i;
}
static int install_info_symlink_alias(
}
static int install_info_symlink_alias(
+ UnitFileInstallInfo *i,
const char *config_path,
bool force,
UnitFileChange **changes,
const char *config_path,
bool force,
UnitFileChange **changes,
}
static int install_info_symlink_wants(
}
static int install_info_symlink_wants(
+ UnitFileInstallInfo *i,
const char *config_path,
char **list,
const char *suffix,
const char *config_path,
char **list,
const char *suffix,
}
static int install_info_symlink_link(
}
static int install_info_symlink_link(
+ UnitFileInstallInfo *i,
const LookupPaths *paths,
const char *config_path,
const char *root_dir,
const LookupPaths *paths,
const char *config_path,
const char *root_dir,
}
static int install_info_apply(
}
static int install_info_apply(
+ UnitFileInstallInfo *i,
const LookupPaths *paths,
const char *config_path,
const char *root_dir,
const LookupPaths *paths,
const char *config_path,
const char *root_dir,
UnitFileChange **changes,
unsigned *n_changes) {
UnitFileChange **changes,
unsigned *n_changes) {
+ UnitFileInstallInfo *i;
const char *config_path,
const char *root_dir) {
const char *config_path,
const char *root_dir) {
+ UnitFileInstallInfo *i;
_cleanup_free_ char *config_path = NULL;
char **i;
int r;
_cleanup_free_ char *config_path = NULL;
char **i;
int r;
+ UnitFileInstallInfo *info;
assert(scope >= 0);
assert(scope < _UNIT_FILE_SCOPE_MAX);
assert(scope >= 0);
assert(scope < _UNIT_FILE_SCOPE_MAX);
_cleanup_free_ char *config_path = NULL;
char *path;
int r;
_cleanup_free_ char *config_path = NULL;
char *path;
int r;
+ UnitFileInstallInfo *i = NULL;
assert(scope >= 0);
assert(scope < _UNIT_FILE_SCOPE_MAX);
assert(scope >= 0);
assert(scope < _UNIT_FILE_SCOPE_MAX);
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+typedef enum UnitFileScope UnitFileScope;
+typedef enum UnitFileState UnitFileState;
+typedef enum UnitFilePresetMode UnitFilePresetMode;
+typedef enum UnitFileChangeType UnitFileChangeType;
+typedef struct UnitFileChange UnitFileChange;
+typedef struct UnitFileList UnitFileList;
+typedef struct UnitFileInstallInfo UnitFileInstallInfo;
+
#include "hashmap.h"
#include "unit-name.h"
#include "path-lookup.h"
#include "hashmap.h"
#include "unit-name.h"
#include "path-lookup.h"
-typedef enum UnitFileScope {
UNIT_FILE_SYSTEM,
UNIT_FILE_GLOBAL,
UNIT_FILE_USER,
_UNIT_FILE_SCOPE_MAX,
_UNIT_FILE_SCOPE_INVALID = -1
UNIT_FILE_SYSTEM,
UNIT_FILE_GLOBAL,
UNIT_FILE_USER,
_UNIT_FILE_SCOPE_MAX,
_UNIT_FILE_SCOPE_INVALID = -1
-typedef enum UnitFileState {
UNIT_FILE_ENABLED,
UNIT_FILE_ENABLED_RUNTIME,
UNIT_FILE_LINKED,
UNIT_FILE_ENABLED,
UNIT_FILE_ENABLED_RUNTIME,
UNIT_FILE_LINKED,
UNIT_FILE_INVALID,
_UNIT_FILE_STATE_MAX,
_UNIT_FILE_STATE_INVALID = -1
UNIT_FILE_INVALID,
_UNIT_FILE_STATE_MAX,
_UNIT_FILE_STATE_INVALID = -1
-typedef enum UnitFilePresetMode {
+enum UnitFilePresetMode {
UNIT_FILE_PRESET_FULL,
UNIT_FILE_PRESET_ENABLE_ONLY,
UNIT_FILE_PRESET_DISABLE_ONLY,
_UNIT_FILE_PRESET_MAX,
_UNIT_FILE_PRESET_INVALID = -1
UNIT_FILE_PRESET_FULL,
UNIT_FILE_PRESET_ENABLE_ONLY,
UNIT_FILE_PRESET_DISABLE_ONLY,
_UNIT_FILE_PRESET_MAX,
_UNIT_FILE_PRESET_INVALID = -1
-typedef enum UnitFileChangeType {
+enum UnitFileChangeType {
UNIT_FILE_SYMLINK,
UNIT_FILE_UNLINK,
_UNIT_FILE_CHANGE_TYPE_MAX,
_UNIT_FILE_CHANGE_TYPE_INVALID = -1
UNIT_FILE_SYMLINK,
UNIT_FILE_UNLINK,
_UNIT_FILE_CHANGE_TYPE_MAX,
_UNIT_FILE_CHANGE_TYPE_INVALID = -1
-typedef struct UnitFileChange {
UnitFileChangeType type;
char *path;
char *source;
UnitFileChangeType type;
char *path;
char *source;
-typedef struct UnitFileList {
char *path;
UnitFileState state;
char *path;
UnitFileState state;
+struct UnitFileInstallInfo {
char *name;
char *path;
char *user;
char *name;
char *path;
char *user;
char **also;
char *default_instance;
char **also;
char *default_instance;
int unit_file_enable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
int unit_file_disable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
int unit_file_enable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
int unit_file_disable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
-typedef enum UnitFileScope UnitFileScope;
-
typedef struct LookupPaths {
char **unit_path;
#ifdef HAVE_SYSV_COMPAT
typedef struct LookupPaths {
char **unit_path;
#ifdef HAVE_SYSV_COMPAT
const char *generator,
const char *generator_early,
const char *generator_late);
const char *generator,
const char *generator_early,
const char *generator_late);
-void lookup_paths_free(LookupPaths *p);
+
+#include "install.h"
+
int lookup_paths_init_from_scope(LookupPaths *paths,
UnitFileScope scope,
const char *root_dir);
int lookup_paths_init_from_scope(LookupPaths *paths,
UnitFileScope scope,
const char *root_dir);
+void lookup_paths_free(LookupPaths *p);
#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)