install.h revision 5430f7f2bc7330f3088b894166bf3524a067e3d8
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering#ifndef fooinstallhfoo
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering#define fooinstallhfoo
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering/***
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering This file is part of systemd.
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering Copyright 2011 Lennart Poettering
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering systemd is free software; you can redistribute it and/or modify it
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering under the terms of the GNU Lesser General Public License as published by
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering (at your option) any later version.
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering systemd is distributed in the hope that it will be useful, but
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering Lesser General Public License for more details.
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering You should have received a copy of the GNU Lesser General Public License
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
24882e06c135584f16f31ba8a00fecde8b7f6fadLennart Poettering***/
24882e06c135584f16f31ba8a00fecde8b7f6fadLennart Poettering
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering#include "hashmap.h"
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poetteringtypedef enum UnitFileScope {
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UNIT_FILE_SYSTEM,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UNIT_FILE_GLOBAL,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UNIT_FILE_USER,
82659fd7571bda0f3dce9755b89a23c411d53ddaLennart Poettering _UNIT_FILE_SCOPE_MAX,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering _UNIT_FILE_SCOPE_INVALID = -1
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering} UnitFileScope;
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poetteringtypedef enum UnitFileState {
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UNIT_FILE_ENABLED,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UNIT_FILE_ENABLED_RUNTIME,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UNIT_FILE_LINKED,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UNIT_FILE_LINKED_RUNTIME,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UNIT_FILE_MASKED,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UNIT_FILE_MASKED_RUNTIME,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UNIT_FILE_STATIC,
82659fd7571bda0f3dce9755b89a23c411d53ddaLennart Poettering UNIT_FILE_DISABLED,
82659fd7571bda0f3dce9755b89a23c411d53ddaLennart Poettering _UNIT_FILE_STATE_MAX,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering _UNIT_FILE_STATE_INVALID = -1
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering} UnitFileState;
82659fd7571bda0f3dce9755b89a23c411d53ddaLennart Poettering
82659fd7571bda0f3dce9755b89a23c411d53ddaLennart Poetteringtypedef enum UnitFileChangeType {
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UNIT_FILE_SYMLINK,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UNIT_FILE_UNLINK,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering _UNIT_FILE_CHANGE_TYPE_MAX,
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering _UNIT_FILE_CHANGE_TYPE_INVALID = -1
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering} UnitFileChangeType;
58ea275a68cd242ad60161bcb7582614d1d89f13Lennart Poettering
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poetteringtypedef struct UnitFileChange {
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering UnitFileChangeType type;
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering char *path;
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering char *source;
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering} UnitFileChange;
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poetteringtypedef struct UnitFileList {
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering char *path;
ac5e3a505e49c80b56c971a8fc13bacac961640dJan Synacek UnitFileState state;
ac5e3a505e49c80b56c971a8fc13bacac961640dJan Synacek} UnitFileList;
ac5e3a505e49c80b56c971a8fc13bacac961640dJan Synacek
ac5e3a505e49c80b56c971a8fc13bacac961640dJan Synacekint unit_file_enable(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poetteringint unit_file_disable(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], UnitFileChange **changes, unsigned *n_changes);
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poetteringint unit_file_reenable(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poetteringint unit_file_link(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
int unit_file_preset(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
int unit_file_mask(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
int unit_file_unmask(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], UnitFileChange **changes, unsigned *n_changes);
UnitFileState unit_file_get_state(UnitFileScope scope, const char *root_dir, const char *filename);
int unit_file_get_list(UnitFileScope scope, const char *root_dir, Hashmap *h);
void unit_file_list_free(Hashmap *h);
void unit_file_changes_free(UnitFileChange *changes, unsigned n_changes);
int unit_file_query_preset(UnitFileScope scope, const char *name);
const char *unit_file_state_to_string(UnitFileState s);
UnitFileState unit_file_state_from_string(const char *s);
const char *unit_file_change_type_to_string(UnitFileChangeType s);
UnitFileChangeType unit_file_change_type_from_string(const char *s);
#endif