]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/unit-name.h
unit: get rid of UnitVTable.suffix, which is now unused
[thirdparty/systemd.git] / src / shared / unit-name.h
CommitLineData
03467c88 1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
9e2f7c11
LP
2
3#ifndef foounitnamehfoo
4#define foounitnamehfoo
5
6/***
7 This file is part of systemd.
8
9 Copyright 2010 Lennart Poettering
10
11 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
9e2f7c11
LP
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 19 Lesser General Public License for more details.
9e2f7c11 20
5430f7f2 21 You should have received a copy of the GNU Lesser General Public License
9e2f7c11
LP
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23***/
24
71fad675 25#include <stdbool.h>
9e2f7c11 26
71fad675 27#define UNIT_NAME_MAX 256
9e2f7c11 28
0a9f8ed0
ZJS
29typedef enum UnitType UnitType;
30
31enum UnitType {
32 UNIT_SERVICE = 0,
33 UNIT_SOCKET,
34 UNIT_TARGET,
35 UNIT_DEVICE,
36 UNIT_MOUNT,
37 UNIT_AUTOMOUNT,
38 UNIT_SNAPSHOT,
39 UNIT_TIMER,
40 UNIT_SWAP,
41 UNIT_PATH,
42 _UNIT_TYPE_MAX,
43 _UNIT_TYPE_INVALID = -1
44};
45
46const char *unit_type_to_string(UnitType i);
47UnitType unit_type_from_string(const char *s);
48
9e2f7c11
LP
49int unit_name_to_instance(const char *n, char **instance);
50char* unit_name_to_prefix(const char *n);
51char* unit_name_to_prefix_and_instance(const char *n);
52
5f739699 53bool unit_name_is_valid(const char *n, bool template_ok);
9e2f7c11
LP
54bool unit_prefix_is_valid(const char *p);
55bool unit_instance_is_valid(const char *i);
56
5f739699
LP
57UnitType unit_name_to_type(const char *n);
58
9e2f7c11
LP
59char *unit_name_change_suffix(const char *n, const char *suffix);
60
61char *unit_name_build(const char *prefix, const char *instance, const char *suffix);
9e2f7c11
LP
62
63char *unit_name_escape(const char *f);
64char *unit_name_unescape(const char *f);
35eb6b12 65char *unit_name_path_escape(const char *f);
9fc50704
LP
66char *unit_name_path_unescape(const char *f);
67
9e2f7c11
LP
68bool unit_name_is_template(const char *n);
69
70char *unit_name_replace_instance(const char *f, const char *i);
71
72char *unit_name_template(const char *f);
73
a16e1123 74char *unit_name_from_path(const char *path, const char *suffix);
9fff8a1f 75char *unit_name_from_path_instance(const char *prefix, const char *path, const char *suffix);
a16e1123
LP
76char *unit_name_to_path(const char *name);
77
48899192
MS
78char *unit_dbus_path_from_name(const char *name);
79
b0193f1c
LP
80char *unit_name_mangle(const char *name);
81
9e2f7c11 82#endif