numa_conf.h 3.9 KB
Newer Older
1
/*
2
 * numa_conf.h
3
 *
4
 * Copyright (C) 2014-2015 Red Hat, Inc.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *
 * 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
 * License along with this library.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 * Author: Martin Kletzander <mkletzan@redhat.com>
 */

23 24
#ifndef __NUMA_CONF_H__
# define __NUMA_CONF_H__
25

26 27
# include <libxml/xpath.h>

28 29 30
# include "internal.h"
# include "virutil.h"
# include "virbitmap.h"
31
# include "virbuffer.h"
32
# include "cpu_conf.h"
33 34 35 36


typedef struct _virDomainNumatune virDomainNumatune;
typedef virDomainNumatune *virDomainNumatunePtr;
37 38

typedef enum {
39 40 41
    VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT = 0,
    VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC,
    VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO,
42

43 44
    VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST
} virDomainNumatunePlacement;
45

46
VIR_ENUM_DECL(virDomainNumatunePlacement)
47 48
VIR_ENUM_DECL(virDomainNumatuneMemMode)

49 50 51 52 53 54

void virDomainNumatuneFree(virDomainNumatunePtr numatune);

/*
 * XML Parse/Format functions
 */
55 56 57 58 59
int virDomainNumatuneParseXML(virDomainNumatunePtr *numatunePtr,
                              bool placement_static,
                              size_t ncells,
                              xmlXPathContextPtr ctxt)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
60 61 62 63 64 65 66

int virDomainNumatuneFormatXML(virBufferPtr buf, virDomainNumatunePtr numatune)
    ATTRIBUTE_NONNULL(1);

/*
 * Getters
 */
67 68
virDomainNumatuneMemMode virDomainNumatuneGetMode(virDomainNumatunePtr numatune,
                                                  int cellid);
69 70

virBitmapPtr virDomainNumatuneGetNodeset(virDomainNumatunePtr numatune,
71 72
                                         virBitmapPtr auto_nodeset,
                                         int cellid);
73

74 75 76 77 78
int virDomainNumatuneMaybeGetNodeset(virDomainNumatunePtr numatune,
                                     virBitmapPtr auto_nodeset,
                                     virBitmapPtr *retNodeset,
                                     int cellid);

79 80 81 82
/*
 * Formatters
 */
char *virDomainNumatuneFormatNodeset(virDomainNumatunePtr numatune,
83 84
                                     virBitmapPtr auto_nodeset,
                                     int cellid);
85 86 87

int virDomainNumatuneMaybeFormatNodeset(virDomainNumatunePtr numatune,
                                        virBitmapPtr auto_nodeset,
88 89
                                        char **mask,
                                        int cellid);
90 91 92 93

/*
 * Setters
 */
94 95 96 97 98
int virDomainNumatuneSet(virDomainNumatunePtr *numatunePtr,
                         bool placement_static,
                         int placement,
                         int mode,
                         virBitmapPtr nodeset)
99 100 101 102 103 104 105 106 107
    ATTRIBUTE_NONNULL(1);

/*
 * Other accessors
 */
bool virDomainNumatuneEquals(virDomainNumatunePtr n1,
                             virDomainNumatunePtr n2);

bool virDomainNumatuneHasPlacementAuto(virDomainNumatunePtr numatune);
108

109 110
bool virDomainNumatuneHasPerNodeBinding(virDomainNumatunePtr numatune);

111
int virDomainNumatuneSpecifiedMaxNode(virDomainNumatunePtr numatune);
112 113 114

bool virDomainNumatuneNodesetIsAvailable(virDomainNumatunePtr numatune,
                                         virBitmapPtr auto_nodeset);
115 116 117

bool virDomainNumatuneNodeSpecified(virDomainNumatunePtr numatune,
                                    int cellid);
118 119

int virDomainNumaDefCPUParseXML(virCPUDefPtr def, xmlXPathContextPtr ctxt);
120
int virDomainNumaDefCPUFormat(virBufferPtr buf, virCPUDefPtr def);
121

122
#endif /* __NUMA_CONF_H__ */