lxc_conf.h 2.5 KB
Newer Older
D
Daniel Veillard 已提交
1
/*
2
 * Copyright (C) 2010 Red Hat, Inc.
D
Daniel Veillard 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 * Copyright IBM Corp. 2008
 *
 * lxc_conf.h: header file for linux container config functions
 *
 * Authors:
 *  David L. Leskovec <dlesko at linux.vnet.ibm.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
21
 * License along with this library.  If not, see
O
Osier Yang 已提交
22
 * <http://www.gnu.org/licenses/>.
D
Daniel Veillard 已提交
23 24 25
 */

#ifndef LXC_CONF_H
26
# define LXC_CONF_H
D
Daniel Veillard 已提交
27

28
# include <config.h>
D
Daniel Veillard 已提交
29

30 31 32 33 34
# include "internal.h"
# include "domain_conf.h"
# include "domain_event.h"
# include "capabilities.h"
# include "threads.h"
35
# include "vircgroup.h"
36
# include "security/security_manager.h"
37
# include "configmake.h"
38
# include "hostusb.h"
D
Daniel Veillard 已提交
39

40 41
# define LXC_DRIVER_NAME "LXC"

42 43 44
# define LXC_CONFIG_DIR SYSCONFDIR "/libvirt/lxc"
# define LXC_STATE_DIR LOCALSTATEDIR "/run/libvirt/lxc"
# define LXC_LOG_DIR LOCALSTATEDIR "/log/libvirt/lxc"
45
# define LXC_AUTOSTART_DIR LXC_CONFIG_DIR "/autostart"
46

47 48 49 50
typedef struct _virLXCDriver virLXCDriver;
typedef virLXCDriver *virLXCDriverPtr;

struct _virLXCDriver {
51
    virMutex lock;
52

53 54
    virCapsPtr caps;

55
    virCgroupPtr cgroup;
56 57 58 59 60

    size_t nactive;
    virStateInhibitCallback inhibitCallback;
    void *inhibitOpaque;

61
    virDomainObjList domains;
62
    char *configDir;
63
    char *autostartDir;
64 65
    char *stateDir;
    char *logDir;
A
Amy Griffis 已提交
66
    int log_libvirtd;
67
    int have_netns;
68

69 70
    usbDeviceList *activeUsbHostdevs;

71
    virDomainEventStatePtr domainEventState;
72

73 74 75 76 77
    char *securityDriverName;
    bool securityDefaultConfined;
    bool securityRequireConfined;
    virSecurityManagerPtr securityManager;

78 79 80 81
    /* Mapping of 'char *uuidstr' -> virConnectPtr
     * of guests which will be automatically killed
     * when the virConnectPtr is closed*/
    virHashTablePtr autodestroy;
D
Daniel Veillard 已提交
82 83
};

84 85
int lxcLoadDriverConfig(virLXCDriverPtr driver);
virCapsPtr lxcCapsInit(virLXCDriverPtr driver);
D
Daniel Veillard 已提交
86

87
static inline void lxcDriverLock(virLXCDriverPtr driver)
88 89 90
{
    virMutexLock(&driver->lock);
}
91
static inline void lxcDriverUnlock(virLXCDriverPtr driver)
92 93 94 95
{
    virMutexUnlock(&driver->lock);
}

D
Daniel Veillard 已提交
96
#endif /* LXC_CONF_H */