mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
tools: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c35d8a7d5e
commit
a325763ff1
@ -23,17 +23,16 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_NSS_H
|
||||
# define LIBVIRT_NSS_H
|
||||
#pragma once
|
||||
|
||||
# include <nss.h>
|
||||
# include <netdb.h>
|
||||
#include <nss.h>
|
||||
#include <netdb.h>
|
||||
|
||||
# if !defined(LIBVIRT_NSS_GUEST)
|
||||
# define NSS_NAME(s) _nss_libvirt_##s##_r
|
||||
# else
|
||||
# define NSS_NAME(s) _nss_libvirt_guest_##s##_r
|
||||
# endif
|
||||
#if !defined(LIBVIRT_NSS_GUEST)
|
||||
# define NSS_NAME(s) _nss_libvirt_##s##_r
|
||||
#else
|
||||
# define NSS_NAME(s) _nss_libvirt_guest_##s##_r
|
||||
#endif
|
||||
|
||||
enum nss_status
|
||||
NSS_NAME(gethostbyname)(const char *name, struct hostent *result,
|
||||
@ -48,17 +47,15 @@ enum nss_status
|
||||
NSS_NAME(gethostbyname3)(const char *name, int af, struct hostent *result,
|
||||
char *buffer, size_t buflen, int *errnop,
|
||||
int *herrnop, int32_t *ttlp, char **canonp);
|
||||
# ifdef HAVE_STRUCT_GAIH_ADDRTUPLE
|
||||
#ifdef HAVE_STRUCT_GAIH_ADDRTUPLE
|
||||
enum nss_status
|
||||
NSS_NAME(gethostbyname4)(const char *name, struct gaih_addrtuple **pat,
|
||||
char *buffer, size_t buflen, int *errnop,
|
||||
int *herrnop, int32_t *ttlp);
|
||||
# endif /* HAVE_STRUCT_GAIH_ADDRTUPLE */
|
||||
#endif /* HAVE_STRUCT_GAIH_ADDRTUPLE */
|
||||
|
||||
# if defined(HAVE_BSD_NSS)
|
||||
#if defined(HAVE_BSD_NSS)
|
||||
ns_mtab*
|
||||
nss_module_register(const char *name, unsigned int *size,
|
||||
nss_module_unregister_fn *unregister);
|
||||
# endif /* HAVE_BSD_NSS */
|
||||
|
||||
#endif /* LIBVIRT_NSS_H */
|
||||
#endif /* HAVE_BSD_NSS */
|
||||
|
@ -18,10 +18,9 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_COMPLETER_H
|
||||
# define LIBVIRT_VIRSH_COMPLETER_H
|
||||
#pragma once
|
||||
|
||||
# include "vsh.h"
|
||||
#include "vsh.h"
|
||||
|
||||
char ** virshDomainNameCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
@ -118,4 +117,3 @@ char ** virshCellnoCompleter(vshControl *ctl,
|
||||
char ** virshDomainShutdownModeCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
#endif /* LIBVIRT_VIRSH_COMPLETER_H */
|
||||
|
@ -18,18 +18,15 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_CONSOLE_H
|
||||
# define LIBVIRT_VIRSH_CONSOLE_H
|
||||
#pragma once
|
||||
|
||||
# ifndef WIN32
|
||||
#ifndef WIN32
|
||||
|
||||
# include <virsh.h>
|
||||
# include <virsh.h>
|
||||
|
||||
int virshRunConsole(vshControl *ctl,
|
||||
virDomainPtr dom,
|
||||
const char *dev_name,
|
||||
unsigned int flags);
|
||||
|
||||
# endif /* !WIN32 */
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_CONSOLE_H */
|
||||
#endif /* !WIN32 */
|
||||
|
@ -18,15 +18,12 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_DOMAIN_MONITOR_H
|
||||
# define LIBVIRT_VIRSH_DOMAIN_MONITOR_H
|
||||
#pragma once
|
||||
|
||||
# include "virsh.h"
|
||||
#include "virsh.h"
|
||||
|
||||
char *virshGetDomainDescription(vshControl *ctl, virDomainPtr dom,
|
||||
bool title, unsigned int flags)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
|
||||
|
||||
extern const vshCmdDef domMonitoringCmds[];
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_DOMAIN_MONITOR_H */
|
||||
|
@ -18,10 +18,9 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_DOMAIN_H
|
||||
# define LIBVIRT_VIRSH_DOMAIN_H
|
||||
#pragma once
|
||||
|
||||
# include "virsh.h"
|
||||
#include "virsh.h"
|
||||
|
||||
struct virshDomainEventCallback {
|
||||
const char *name;
|
||||
@ -32,5 +31,3 @@ typedef struct virshDomainEventCallback virshDomainEventCallback;
|
||||
extern virshDomainEventCallback virshDomainEventCallbacks[];
|
||||
|
||||
extern const vshCmdDef domManagementCmds[];
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_DOMAIN_H */
|
||||
|
@ -18,11 +18,8 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_HOST_H
|
||||
# define LIBVIRT_VIRSH_HOST_H
|
||||
#pragma once
|
||||
|
||||
# include "virsh.h"
|
||||
#include "virsh.h"
|
||||
|
||||
extern const vshCmdDef hostAndHypervisorCmds[];
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_HOST_H */
|
||||
|
@ -18,20 +18,17 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_INTERFACE_H
|
||||
# define LIBVIRT_VIRSH_INTERFACE_H
|
||||
#pragma once
|
||||
|
||||
# include "virsh.h"
|
||||
#include "virsh.h"
|
||||
|
||||
virInterfacePtr virshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd,
|
||||
const char *optname,
|
||||
const char **name, unsigned int flags);
|
||||
|
||||
/* default is lookup by Name and MAC */
|
||||
# define virshCommandOptInterface(_ctl, _cmd, _name) \
|
||||
#define virshCommandOptInterface(_ctl, _cmd, _name) \
|
||||
virshCommandOptInterfaceBy(_ctl, _cmd, NULL, _name, \
|
||||
VIRSH_BYMAC | VIRSH_BYNAME)
|
||||
|
||||
extern const vshCmdDef ifaceCmds[];
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_INTERFACE_H */
|
||||
|
@ -18,10 +18,9 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_NETWORK_H
|
||||
# define LIBVIRT_VIRSH_NETWORK_H
|
||||
#pragma once
|
||||
|
||||
# include "virsh.h"
|
||||
#include "virsh.h"
|
||||
|
||||
virNetworkPtr
|
||||
virshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
|
||||
@ -33,7 +32,7 @@ virshCommandOptNetworkPort(vshControl *ctl, const vshCmd *cmd,
|
||||
const char **name);
|
||||
|
||||
/* default is lookup by Name and UUID */
|
||||
# define virshCommandOptNetwork(_ctl, _cmd, _name) \
|
||||
#define virshCommandOptNetwork(_ctl, _cmd, _name) \
|
||||
virshCommandOptNetworkBy(_ctl, _cmd, _name, \
|
||||
VIRSH_BYUUID | VIRSH_BYNAME)
|
||||
|
||||
@ -46,5 +45,3 @@ typedef struct virshNetworkEventCallback virshNetworkEventCallback;
|
||||
extern virshNetworkEventCallback virshNetworkEventCallbacks[];
|
||||
|
||||
extern const vshCmdDef networkCmds[];
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_NETWORK_H */
|
||||
|
@ -18,10 +18,9 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_NODEDEV_H
|
||||
# define LIBVIRT_VIRSH_NODEDEV_H
|
||||
#pragma once
|
||||
|
||||
# include "virsh.h"
|
||||
#include "virsh.h"
|
||||
|
||||
struct virshNodedevEventCallback {
|
||||
const char *name;
|
||||
@ -32,5 +31,3 @@ typedef struct virshNodedevEventCallback virshNodedevEventCallback;
|
||||
extern virshNodedevEventCallback virshNodedevEventCallbacks[];
|
||||
|
||||
extern const vshCmdDef nodedevCmds[];
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_NODEDEV_H */
|
||||
|
@ -18,10 +18,9 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_NWFILTER_H
|
||||
# define LIBVIRT_VIRSH_NWFILTER_H
|
||||
#pragma once
|
||||
|
||||
# include "virsh.h"
|
||||
#include "virsh.h"
|
||||
|
||||
virNWFilterPtr
|
||||
virshCommandOptNWFilterBy(vshControl *ctl, const vshCmd *cmd,
|
||||
@ -32,14 +31,12 @@ virshCommandOptNWFilterBindingBy(vshControl *ctl, const vshCmd *cmd,
|
||||
const char **name, unsigned int flags);
|
||||
|
||||
/* default is lookup by Name and UUID */
|
||||
# define virshCommandOptNWFilter(_ctl, _cmd, _name) \
|
||||
#define virshCommandOptNWFilter(_ctl, _cmd, _name) \
|
||||
virshCommandOptNWFilterBy(_ctl, _cmd, _name, \
|
||||
VIRSH_BYUUID | VIRSH_BYNAME)
|
||||
|
||||
/* default is lookup by port dev */
|
||||
# define virshCommandOptNWFilterBinding(_ctl, _cmd, _name) \
|
||||
#define virshCommandOptNWFilterBinding(_ctl, _cmd, _name) \
|
||||
virshCommandOptNWFilterBindingBy(_ctl, _cmd, _name, 0)
|
||||
|
||||
extern const vshCmdDef nwfilterCmds[];
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_NWFILTER_H */
|
||||
|
@ -18,17 +18,16 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_POOL_H
|
||||
# define LIBVIRT_VIRSH_POOL_H
|
||||
#pragma once
|
||||
|
||||
# include "virsh.h"
|
||||
#include "virsh.h"
|
||||
|
||||
virStoragePoolPtr
|
||||
virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
|
||||
const char **name, unsigned int flags);
|
||||
|
||||
/* default is lookup by Name and UUID */
|
||||
# define virshCommandOptPool(_ctl, _cmd, _optname, _name) \
|
||||
#define virshCommandOptPool(_ctl, _cmd, _optname, _name) \
|
||||
virshCommandOptPoolBy(_ctl, _cmd, _optname, _name, \
|
||||
VIRSH_BYUUID | VIRSH_BYNAME)
|
||||
|
||||
@ -41,5 +40,3 @@ typedef struct virshPoolEventCallback virshPoolEventCallback;
|
||||
extern virshPoolEventCallback virshPoolEventCallbacks[];
|
||||
|
||||
extern const vshCmdDef storagePoolCmds[];
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_POOL_H */
|
||||
|
@ -18,10 +18,9 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_SECRET_H
|
||||
# define LIBVIRT_VIRSH_SECRET_H
|
||||
#pragma once
|
||||
|
||||
# include "virsh.h"
|
||||
#include "virsh.h"
|
||||
|
||||
struct virshSecretEventCallback {
|
||||
const char *name;
|
||||
@ -32,5 +31,3 @@ typedef struct virshSecretEventCallback virshSecretEventCallback;
|
||||
extern virshSecretEventCallback virshSecretEventCallbacks[];
|
||||
|
||||
extern const vshCmdDef secretCmds[];
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_SECRET_H */
|
||||
|
@ -18,11 +18,8 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_SNAPSHOT_H
|
||||
# define LIBVIRT_VIRSH_SNAPSHOT_H
|
||||
#pragma once
|
||||
|
||||
# include "virsh.h"
|
||||
#include "virsh.h"
|
||||
|
||||
extern const vshCmdDef snapshotCmds[];
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_SNAPSHOT_H */
|
||||
|
@ -16,13 +16,12 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_UTIL_H
|
||||
# define LIBVIRT_VIRSH_UTIL_H
|
||||
#pragma once
|
||||
|
||||
# include "virsh.h"
|
||||
#include "virsh.h"
|
||||
|
||||
# include <libxml/parser.h>
|
||||
# include <libxml/xpath.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xpath.h>
|
||||
|
||||
virDomainPtr
|
||||
virshLookupDomainBy(vshControl *ctl,
|
||||
@ -103,5 +102,3 @@ virshDomainGetXML(vshControl *ctl,
|
||||
xmlXPathContextPtr *ctxt)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4)
|
||||
ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_UTIL_H */
|
||||
|
@ -18,10 +18,9 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_VOLUME_H
|
||||
# define LIBVIRT_VIRSH_VOLUME_H
|
||||
#pragma once
|
||||
|
||||
# include "virsh.h"
|
||||
#include "virsh.h"
|
||||
|
||||
virStorageVolPtr virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
|
||||
const char *optname,
|
||||
@ -29,10 +28,8 @@ virStorageVolPtr virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
|
||||
const char **name, unsigned int flags);
|
||||
|
||||
/* default is lookup by Name and UUID */
|
||||
# define virshCommandOptVol(_ctl, _cmd, _optname, _pooloptname, _name) \
|
||||
#define virshCommandOptVol(_ctl, _cmd, _optname, _pooloptname, _name) \
|
||||
virshCommandOptVolBy(_ctl, _cmd, _optname, _pooloptname, _name, \
|
||||
VIRSH_BYUUID | VIRSH_BYNAME)
|
||||
|
||||
extern const vshCmdDef storageVolCmds[];
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_VOLUME_H */
|
||||
|
@ -18,46 +18,45 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRSH_H
|
||||
# define LIBVIRT_VIRSH_H
|
||||
#pragma once
|
||||
|
||||
# include <stdarg.h>
|
||||
# include <unistd.h>
|
||||
# include <sys/stat.h>
|
||||
# include <termios.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <termios.h>
|
||||
|
||||
# include "internal.h"
|
||||
# include "virerror.h"
|
||||
# include "virthread.h"
|
||||
# include "virpolkit.h"
|
||||
# include "vsh.h"
|
||||
# include "virsh-completer.h"
|
||||
#include "internal.h"
|
||||
#include "virerror.h"
|
||||
#include "virthread.h"
|
||||
#include "virpolkit.h"
|
||||
#include "vsh.h"
|
||||
#include "virsh-completer.h"
|
||||
|
||||
# define VIRSH_PROMPT_RW "virsh # "
|
||||
# define VIRSH_PROMPT_RO "virsh > "
|
||||
#define VIRSH_PROMPT_RW "virsh # "
|
||||
#define VIRSH_PROMPT_RO "virsh > "
|
||||
|
||||
# define VIR_FROM_THIS VIR_FROM_NONE
|
||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
||||
|
||||
/*
|
||||
* Command group types
|
||||
*/
|
||||
# define VIRSH_CMD_GRP_DOM_MANAGEMENT "Domain Management"
|
||||
# define VIRSH_CMD_GRP_DOM_MONITORING "Domain Monitoring"
|
||||
# define VIRSH_CMD_GRP_STORAGE_POOL "Storage Pool"
|
||||
# define VIRSH_CMD_GRP_STORAGE_VOL "Storage Volume"
|
||||
# define VIRSH_CMD_GRP_NETWORK "Networking"
|
||||
# define VIRSH_CMD_GRP_NODEDEV "Node Device"
|
||||
# define VIRSH_CMD_GRP_IFACE "Interface"
|
||||
# define VIRSH_CMD_GRP_NWFILTER "Network Filter"
|
||||
# define VIRSH_CMD_GRP_SECRET "Secret"
|
||||
# define VIRSH_CMD_GRP_SNAPSHOT "Snapshot"
|
||||
# define VIRSH_CMD_GRP_HOST_AND_HV "Host and Hypervisor"
|
||||
# define VIRSH_CMD_GRP_VIRSH "Virsh itself"
|
||||
#define VIRSH_CMD_GRP_DOM_MANAGEMENT "Domain Management"
|
||||
#define VIRSH_CMD_GRP_DOM_MONITORING "Domain Monitoring"
|
||||
#define VIRSH_CMD_GRP_STORAGE_POOL "Storage Pool"
|
||||
#define VIRSH_CMD_GRP_STORAGE_VOL "Storage Volume"
|
||||
#define VIRSH_CMD_GRP_NETWORK "Networking"
|
||||
#define VIRSH_CMD_GRP_NODEDEV "Node Device"
|
||||
#define VIRSH_CMD_GRP_IFACE "Interface"
|
||||
#define VIRSH_CMD_GRP_NWFILTER "Network Filter"
|
||||
#define VIRSH_CMD_GRP_SECRET "Secret"
|
||||
#define VIRSH_CMD_GRP_SNAPSHOT "Snapshot"
|
||||
#define VIRSH_CMD_GRP_HOST_AND_HV "Host and Hypervisor"
|
||||
#define VIRSH_CMD_GRP_VIRSH "Virsh itself"
|
||||
|
||||
/*
|
||||
* Common command options
|
||||
*/
|
||||
# define VIRSH_COMMON_OPT_POOL(_helpstr, cflags) \
|
||||
#define VIRSH_COMMON_OPT_POOL(_helpstr, cflags) \
|
||||
{.name = "pool", \
|
||||
.type = VSH_OT_DATA, \
|
||||
.flags = VSH_OFLAG_REQ, \
|
||||
@ -66,7 +65,7 @@
|
||||
.completer_flags = cflags, \
|
||||
}
|
||||
|
||||
# define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \
|
||||
#define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \
|
||||
{.name = "domain", \
|
||||
.type = VSH_OT_DATA, \
|
||||
.flags = VSH_OFLAG_REQ, \
|
||||
@ -75,35 +74,35 @@
|
||||
.completer_flags = cflags, \
|
||||
}
|
||||
|
||||
# define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
|
||||
#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
|
||||
VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)
|
||||
|
||||
# define VIRSH_COMMON_OPT_CONFIG(_helpstr) \
|
||||
#define VIRSH_COMMON_OPT_CONFIG(_helpstr) \
|
||||
{.name = "config", \
|
||||
.type = VSH_OT_BOOL, \
|
||||
.help = _helpstr \
|
||||
}
|
||||
|
||||
# define VIRSH_COMMON_OPT_LIVE(_helpstr) \
|
||||
#define VIRSH_COMMON_OPT_LIVE(_helpstr) \
|
||||
{.name = "live", \
|
||||
.type = VSH_OT_BOOL, \
|
||||
.help = _helpstr \
|
||||
}
|
||||
|
||||
# define VIRSH_COMMON_OPT_CURRENT(_helpstr) \
|
||||
#define VIRSH_COMMON_OPT_CURRENT(_helpstr) \
|
||||
{.name = "current", \
|
||||
.type = VSH_OT_BOOL, \
|
||||
.help = _helpstr \
|
||||
}
|
||||
|
||||
# define VIRSH_COMMON_OPT_FILE(_helpstr) \
|
||||
#define VIRSH_COMMON_OPT_FILE(_helpstr) \
|
||||
{.name = "file", \
|
||||
.type = VSH_OT_DATA, \
|
||||
.flags = VSH_OFLAG_REQ, \
|
||||
.help = _helpstr \
|
||||
}
|
||||
|
||||
# define VIRSH_COMMON_OPT_DOMAIN_OT_STRING(_helpstr, oflags, cflags) \
|
||||
#define VIRSH_COMMON_OPT_DOMAIN_OT_STRING(_helpstr, oflags, cflags) \
|
||||
{.name = "domain", \
|
||||
.type = VSH_OT_STRING, \
|
||||
.flags = oflags, \
|
||||
@ -112,11 +111,11 @@
|
||||
.completer_flags = cflags, \
|
||||
}
|
||||
|
||||
# define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(oflags, cflags) \
|
||||
#define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(oflags, cflags) \
|
||||
VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), \
|
||||
oflags, cflags)
|
||||
|
||||
# define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(_helpstr, cflags) \
|
||||
#define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(_helpstr, cflags) \
|
||||
{.name = "domain", \
|
||||
.type = VSH_OT_ARGV, \
|
||||
.flags = VSH_OFLAG_NONE, \
|
||||
@ -125,7 +124,7 @@
|
||||
.completer_flags = cflags, \
|
||||
}
|
||||
|
||||
# define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV_FULL(cflags) \
|
||||
#define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV_FULL(cflags) \
|
||||
VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(N_("domain name, id or uuid"), cflags)
|
||||
|
||||
typedef struct _virshControl virshControl;
|
||||
@ -171,5 +170,3 @@ typedef enum {
|
||||
} virshLookupByFlags;
|
||||
|
||||
virConnectPtr virshConnect(vshControl *ctl, const char *uri, bool readonly);
|
||||
|
||||
#endif /* LIBVIRT_VIRSH_H */
|
||||
|
@ -18,13 +18,11 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRT_ADMIN_COMPLETER_H
|
||||
# define LIBVIRT_VIRT_ADMIN_COMPLETER_H
|
||||
#pragma once
|
||||
|
||||
# include "vsh.h"
|
||||
#include "vsh.h"
|
||||
|
||||
char **
|
||||
vshAdmServerCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
#endif /* LIBVIRT_VIRT_ADMIN_COMPLETER_H */
|
||||
|
@ -18,13 +18,12 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRT_ADMIN_H
|
||||
# define LIBVIRT_VIRT_ADMIN_H
|
||||
#pragma once
|
||||
|
||||
# include "internal.h"
|
||||
# include "vsh.h"
|
||||
#include "internal.h"
|
||||
#include "vsh.h"
|
||||
|
||||
# define VIR_FROM_THIS VIR_FROM_NONE
|
||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
||||
|
||||
/*
|
||||
* Command group types
|
||||
@ -40,5 +39,3 @@ struct _vshAdmControl {
|
||||
virAdmConnectPtr conn; /* connection to a daemon's admin server */
|
||||
bool wantReconnect;
|
||||
};
|
||||
|
||||
#endif /* LIBVIRT_VIRT_ADMIN_H */
|
||||
|
@ -19,9 +19,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRT_HOST_VALIDATE_BHYVE_H
|
||||
# define LIBVIRT_VIRT_HOST_VALIDATE_BHYVE_H
|
||||
#pragma once
|
||||
|
||||
int virHostValidateBhyve(void);
|
||||
|
||||
#endif /* LIBVIRT_VIRT_HOST_VALIDATE_BHYVE_H */
|
||||
|
@ -19,13 +19,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRT_HOST_VALIDATE_COMMON_H
|
||||
# define LIBVIRT_VIRT_HOST_VALIDATE_COMMON_H
|
||||
#pragma once
|
||||
|
||||
# include "internal.h"
|
||||
# include "virutil.h"
|
||||
# include "virbitmap.h"
|
||||
# include "virenum.h"
|
||||
#include "internal.h"
|
||||
#include "virutil.h"
|
||||
#include "virbitmap.h"
|
||||
#include "virenum.h"
|
||||
|
||||
typedef enum {
|
||||
VIR_HOST_VALIDATE_FAIL,
|
||||
@ -84,5 +83,3 @@ int virHostValidateCGroupControllers(const char *hvname,
|
||||
|
||||
int virHostValidateIOMMU(const char *hvname,
|
||||
virHostValidateLevel level);
|
||||
|
||||
#endif /* LIBVIRT_VIRT_HOST_VALIDATE_COMMON_H */
|
||||
|
@ -19,9 +19,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRT_HOST_VALIDATE_LXC_H
|
||||
# define LIBVIRT_VIRT_HOST_VALIDATE_LXC_H
|
||||
#pragma once
|
||||
|
||||
int virHostValidateLXC(void);
|
||||
|
||||
#endif /* LIBVIRT_VIRT_HOST_VALIDATE_LXC_H */
|
||||
|
@ -19,9 +19,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VIRT_HOST_VALIDATE_QEMU_H
|
||||
# define LIBVIRT_VIRT_HOST_VALIDATE_QEMU_H
|
||||
#pragma once
|
||||
|
||||
int virHostValidateQEMU(void);
|
||||
|
||||
#endif /* LIBVIRT_VIRT_HOST_VALIDATE_QEMU_H */
|
||||
|
@ -18,10 +18,9 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VSH_TABLE_H
|
||||
# define LIBVIRT_VSH_TABLE_H
|
||||
#pragma once
|
||||
|
||||
# include "vsh.h"
|
||||
#include "vsh.h"
|
||||
|
||||
typedef struct _vshTable vshTable;
|
||||
typedef struct _vshTableRow vshTableRow;
|
||||
@ -33,5 +32,3 @@ vshTablePtr vshTableNew(const char *format, ...);
|
||||
int vshTableRowAppend(vshTablePtr table, const char *arg, ...);
|
||||
void vshTablePrintToStdout(vshTablePtr table, vshControl *ctl);
|
||||
char *vshTablePrintToString(vshTablePtr table, bool header);
|
||||
|
||||
#endif /* LIBVIRT_VSH_TABLE_H */
|
||||
|
87
tools/vsh.h
87
tools/vsh.h
@ -18,36 +18,35 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_VSH_H
|
||||
# define LIBVIRT_VSH_H
|
||||
#pragma once
|
||||
|
||||
# include <stdarg.h>
|
||||
# include <unistd.h>
|
||||
# include <sys/stat.h>
|
||||
# include <termios.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <termios.h>
|
||||
|
||||
# include "internal.h"
|
||||
# include "virerror.h"
|
||||
# include "virthread.h"
|
||||
#include "internal.h"
|
||||
#include "virerror.h"
|
||||
#include "virthread.h"
|
||||
|
||||
# define VIR_FROM_THIS VIR_FROM_NONE
|
||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
||||
|
||||
# define GETTIMEOFDAY(T) gettimeofday(T, NULL)
|
||||
# define VSH_MAX_XML_FILE (10*1024*1024)
|
||||
# define VSH_MATCH(FLAG) (flags & (FLAG))
|
||||
#define GETTIMEOFDAY(T) gettimeofday(T, NULL)
|
||||
#define VSH_MAX_XML_FILE (10*1024*1024)
|
||||
#define VSH_MATCH(FLAG) (flags & (FLAG))
|
||||
|
||||
/**
|
||||
* The log configuration
|
||||
*/
|
||||
# define MSG_BUFFER 4096
|
||||
# define DIR_MODE (S_IWUSR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* 0755 */
|
||||
# define FILE_MODE (S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH) /* 0644 */
|
||||
# define LOCK_MODE (S_IWUSR | S_IRUSR) /* 0600 */
|
||||
# define LVL_DEBUG "DEBUG"
|
||||
# define LVL_INFO "INFO"
|
||||
# define LVL_NOTICE "NOTICE"
|
||||
# define LVL_WARNING "WARNING"
|
||||
# define LVL_ERROR "ERROR"
|
||||
#define MSG_BUFFER 4096
|
||||
#define DIR_MODE (S_IWUSR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* 0755 */
|
||||
#define FILE_MODE (S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH) /* 0644 */
|
||||
#define LOCK_MODE (S_IWUSR | S_IRUSR) /* 0600 */
|
||||
#define LVL_DEBUG "DEBUG"
|
||||
#define LVL_INFO "INFO"
|
||||
#define LVL_NOTICE "NOTICE"
|
||||
#define LVL_WARNING "WARNING"
|
||||
#define LVL_ERROR "ERROR"
|
||||
|
||||
/**
|
||||
* vshErrorLevel:
|
||||
@ -62,7 +61,7 @@ typedef enum {
|
||||
VSH_ERR_ERROR
|
||||
} vshErrorLevel;
|
||||
|
||||
# define VSH_DEBUG_DEFAULT VSH_ERR_ERROR
|
||||
#define VSH_DEBUG_DEFAULT VSH_ERR_ERROR
|
||||
|
||||
/*
|
||||
* virsh command line grammar:
|
||||
@ -218,9 +217,9 @@ struct _vshControl {
|
||||
int keepalive_interval; /* Client keepalive interval */
|
||||
int keepalive_count; /* Client keepalive count */
|
||||
|
||||
# ifndef WIN32
|
||||
#ifndef WIN32
|
||||
struct termios termattr; /* settings of the tty terminal */
|
||||
# endif
|
||||
#endif
|
||||
bool istty; /* is the terminal a tty */
|
||||
|
||||
const vshClientHooks *hooks;/* mandatory client specific hooks */
|
||||
@ -313,7 +312,7 @@ void vshDebug(vshControl *ctl, int level, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(3, 4);
|
||||
|
||||
/* User visible sort, so we want locale-specific case comparison. */
|
||||
# define vshStrcasecmp(S1, S2) strcasecmp(S1, S2)
|
||||
#define vshStrcasecmp(S1, S2) strcasecmp(S1, S2)
|
||||
int vshNameSorter(const void *a, const void *b);
|
||||
|
||||
virTypedParameterPtr vshFindTypedParamByName(const char *name,
|
||||
@ -386,7 +385,7 @@ bool cmdQuit(vshControl *ctl, const vshCmd *cmd);
|
||||
bool cmdSelfTest(vshControl *ctl, const vshCmd *cmd);
|
||||
bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
|
||||
|
||||
# define VSH_CMD_CD \
|
||||
#define VSH_CMD_CD \
|
||||
{ \
|
||||
.name = "cd", \
|
||||
.handler = cmdCd, \
|
||||
@ -395,7 +394,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
|
||||
.flags = VSH_CMD_FLAG_NOCONNECT \
|
||||
}
|
||||
|
||||
# define VSH_CMD_ECHO \
|
||||
#define VSH_CMD_ECHO \
|
||||
{ \
|
||||
.name = "echo", \
|
||||
.handler = cmdEcho, \
|
||||
@ -404,7 +403,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
|
||||
.flags = VSH_CMD_FLAG_NOCONNECT \
|
||||
}
|
||||
|
||||
# define VSH_CMD_EXIT \
|
||||
#define VSH_CMD_EXIT \
|
||||
{ \
|
||||
.name = "exit", \
|
||||
.handler = cmdQuit, \
|
||||
@ -413,7 +412,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
|
||||
.flags = VSH_CMD_FLAG_NOCONNECT \
|
||||
}
|
||||
|
||||
# define VSH_CMD_HELP \
|
||||
#define VSH_CMD_HELP \
|
||||
{ \
|
||||
.name = "help", \
|
||||
.handler = cmdHelp, \
|
||||
@ -422,7 +421,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
|
||||
.flags = VSH_CMD_FLAG_NOCONNECT \
|
||||
}
|
||||
|
||||
# define VSH_CMD_PWD \
|
||||
#define VSH_CMD_PWD \
|
||||
{ \
|
||||
.name = "pwd", \
|
||||
.handler = cmdPwd, \
|
||||
@ -431,7 +430,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
|
||||
.flags = VSH_CMD_FLAG_NOCONNECT \
|
||||
}
|
||||
|
||||
# define VSH_CMD_QUIT \
|
||||
#define VSH_CMD_QUIT \
|
||||
{ \
|
||||
.name = "quit", \
|
||||
.handler = cmdQuit, \
|
||||
@ -440,7 +439,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
|
||||
.flags = VSH_CMD_FLAG_NOCONNECT \
|
||||
}
|
||||
|
||||
# define VSH_CMD_SELF_TEST \
|
||||
#define VSH_CMD_SELF_TEST \
|
||||
{ \
|
||||
.name = "self-test", \
|
||||
.handler = cmdSelfTest, \
|
||||
@ -450,7 +449,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
|
||||
.alias = "self-test" \
|
||||
}
|
||||
|
||||
# define VSH_CMD_COMPLETE \
|
||||
#define VSH_CMD_COMPLETE \
|
||||
{ \
|
||||
.name = "complete", \
|
||||
.handler = cmdComplete, \
|
||||
@ -467,16 +466,16 @@ char * vshReadline(vshControl *ctl, const char *prompt);
|
||||
|
||||
/* allocation wrappers */
|
||||
void *_vshMalloc(vshControl *ctl, size_t sz, const char *filename, int line);
|
||||
# define vshMalloc(_ctl, _sz) _vshMalloc(_ctl, _sz, __FILE__, __LINE__)
|
||||
#define vshMalloc(_ctl, _sz) _vshMalloc(_ctl, _sz, __FILE__, __LINE__)
|
||||
|
||||
void *_vshCalloc(vshControl *ctl, size_t nmemb, size_t sz,
|
||||
const char *filename, int line);
|
||||
# define vshCalloc(_ctl, _nmemb, _sz) \
|
||||
#define vshCalloc(_ctl, _nmemb, _sz) \
|
||||
_vshCalloc(_ctl, _nmemb, _sz, __FILE__, __LINE__)
|
||||
|
||||
char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
|
||||
int line);
|
||||
# define vshStrdup(_ctl, _s) _vshStrdup(_ctl, _s, __FILE__, __LINE__)
|
||||
#define vshStrdup(_ctl, _s) _vshStrdup(_ctl, _s, __FILE__, __LINE__)
|
||||
|
||||
/* Macros to help dealing with mutually exclusive options. */
|
||||
|
||||
@ -493,7 +492,7 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
|
||||
* This helper does an early return and therefore it has to be called
|
||||
* before anything that would require cleanup.
|
||||
*/
|
||||
# define VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, EXPR1, NAME2, EXPR2) \
|
||||
#define VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, EXPR1, NAME2, EXPR2) \
|
||||
if ((EXPR1) && (EXPR2)) { \
|
||||
vshError(ctl, _("Options --%s and --%s are mutually exclusive"), \
|
||||
NAME1, NAME2); \
|
||||
@ -511,7 +510,7 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
|
||||
* This helper does an early return and therefore it has to be called
|
||||
* before anything that would require cleanup.
|
||||
*/
|
||||
# define VSH_EXCLUSIVE_OPTIONS(NAME1, NAME2) \
|
||||
#define VSH_EXCLUSIVE_OPTIONS(NAME1, NAME2) \
|
||||
VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, vshCommandOptBool(cmd, NAME1), \
|
||||
NAME2, vshCommandOptBool(cmd, NAME2))
|
||||
|
||||
@ -526,7 +525,7 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
|
||||
* This helper does an early return and therefore it has to be called
|
||||
* before anything that would require cleanup.
|
||||
*/
|
||||
# define VSH_EXCLUSIVE_OPTIONS_VAR(VARNAME1, VARNAME2) \
|
||||
#define VSH_EXCLUSIVE_OPTIONS_VAR(VARNAME1, VARNAME2) \
|
||||
VSH_EXCLUSIVE_OPTIONS_EXPR(#VARNAME1, VARNAME1, #VARNAME2, VARNAME2)
|
||||
|
||||
/* Macros to help dealing with required options. */
|
||||
@ -544,7 +543,7 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
|
||||
* This helper does an early return and therefore it has to be called
|
||||
* before anything that would require cleanup.
|
||||
*/
|
||||
# define VSH_REQUIRE_OPTION_EXPR(NAME1, EXPR1, NAME2, EXPR2) \
|
||||
#define VSH_REQUIRE_OPTION_EXPR(NAME1, EXPR1, NAME2, EXPR2) \
|
||||
do { \
|
||||
if ((EXPR1) && !(EXPR2)) { \
|
||||
vshError(ctl, _("Option --%s is required by option --%s"), \
|
||||
@ -564,7 +563,7 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
|
||||
* This helper does an early return and therefore it has to be called
|
||||
* before anything that would require cleanup.
|
||||
*/
|
||||
# define VSH_REQUIRE_OPTION(NAME1, NAME2) \
|
||||
#define VSH_REQUIRE_OPTION(NAME1, NAME2) \
|
||||
VSH_REQUIRE_OPTION_EXPR(NAME1, vshCommandOptBool(cmd, NAME1), \
|
||||
NAME2, vshCommandOptBool(cmd, NAME2))
|
||||
|
||||
@ -580,7 +579,5 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
|
||||
* This helper does an early return and therefore it has to be called
|
||||
* before anything that would require cleanup.
|
||||
*/
|
||||
# define VSH_REQUIRE_OPTION_VAR(VARNAME1, VARNAME2) \
|
||||
#define VSH_REQUIRE_OPTION_VAR(VARNAME1, VARNAME2) \
|
||||
VSH_REQUIRE_OPTION_EXPR(#VARNAME1, VARNAME1, #VARNAME2, VARNAME2)
|
||||
|
||||
#endif /* LIBVIRT_VSH_H */
|
||||
|
@ -17,10 +17,7 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBVIRT_PACKET_LIBVIRT_H
|
||||
# define LIBVIRT_PACKET_LIBVIRT_H
|
||||
#pragma once
|
||||
|
||||
void proto_register_libvirt(void);
|
||||
void proto_reg_handoff_libvirt(void);
|
||||
|
||||
#endif /* LIBVIRT_PACKET_LIBVIRT_H */
|
||||
|
Loading…
Reference in New Issue
Block a user