/[vps]/baselayout-vserver/trunk/src/core/depend.h
Gentoo

Diff of /baselayout-vserver/trunk/src/core/depend.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 126 Revision 127
1/*
2 * depend.h
3 *
4 * Dependancy engine for Gentoo style rc-scripts.
5 *
6 * Copyright (C) 2004,2005 Martin Schlemmer <azarah@nosferatu.za.org>
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * $Header$
23 */
24
25#ifndef _DEPEND_H
26#define _DEPEND_H
27
28#include <sys/types.h>
29#include "list.h"
30
31/* Dependency types supported or still to be implemented */
32typedef enum {
33 NEED, /* All dependencies needed by specified service */
34 NEED_ME, /* All dependencies that need specified service */
35 USE, /* All dependencies used by specified service */
36 USE_ME, /* All dependencies that use specified service */
37 BEFORE, /* All services started before specified service */
38 AFTER, /* All services started after specified service */
39 BROKEN, /* All dependencies of type NEED missing for
40 specified service */
41 PROVIDE, /* All virtual services provided by specified service */
42 ALL_SERVICE_TYPE_T
43} service_type_t;
44
45/* Names for above service types (service_type_t).
46 * Note that this should sync with above service_type_t */
47extern char *service_type_names[];
48
49typedef struct {
50 struct list_head node;
51
52 char *name; /* Name of service */
53 char **depend_info[ALL_SERVICE_TYPE_T]; /* String lists for each service
54 type */
55 char *provide; /* Name of virtual service it
56 provides. This is only valid
57 after we resolving - thus after
58 service_resolve_dependencies() */
59 time_t mtime; /* Modification time of script */
60} service_info_t;
61
62struct list_head service_info_list;
63
64service_info_t *service_get_info(char *servicename);
65int service_add(char *servicename);
66int service_is_dependency(char *servicename, char *dependency, service_type_t type);
67int service_add_dependency(char *servicename, char *dependency, service_type_t type);
68int service_del_dependency(char *servicename, char *dependency, service_type_t type);
69service_info_t *service_get_virtual(char *virtual);
70int service_add_virtual(char *servicename, char* virtual);
71int service_set_mtime(char *servicename, time_t mtime);
72int service_resolve_dependencies(void);
73
74#endif /* _DEPEND_H */
75

Legend:
Removed from v.126  
changed lines
  Added in v.127

  ViewVC Help
Powered by ViewVC 1.1.20