numatune_conf.h 3.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 * numatune_conf.h
 *
 * Copyright (C) 2014 Red Hat, Inc.
 *
 * 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>
 */

#ifndef __NUMATUNE_CONF_H__
# define __NUMATUNE_CONF_H__

26 27
# include <libxml/xpath.h>

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


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

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

42 43
    VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST
} virDomainNumatunePlacement;
44

45
VIR_ENUM_DECL(virDomainNumatunePlacement)
46 47
VIR_ENUM_DECL(virDomainNumatuneMemMode)

48 49 50 51 52 53

void virDomainNumatuneFree(virDomainNumatunePtr numatune);

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

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

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

virBitmapPtr virDomainNumatuneGetNodeset(virDomainNumatunePtr numatune,
70 71
                                         virBitmapPtr auto_nodeset,
                                         int cellid);
72 73 74 75 76

/*
 * Formatters
 */
char *virDomainNumatuneFormatNodeset(virDomainNumatunePtr numatune,
77 78
                                     virBitmapPtr auto_nodeset,
                                     int cellid);
79 80 81

int virDomainNumatuneMaybeFormatNodeset(virDomainNumatunePtr numatune,
                                        virBitmapPtr auto_nodeset,
82 83
                                        char **mask,
                                        int cellid);
84 85 86 87

/*
 * Setters
 */
88 89 90 91 92
int virDomainNumatuneSet(virDomainNumatunePtr *numatunePtr,
                         bool placement_static,
                         int placement,
                         int mode,
                         virBitmapPtr nodeset)
93 94 95 96 97 98 99 100 101
    ATTRIBUTE_NONNULL(1);

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

bool virDomainNumatuneHasPlacementAuto(virDomainNumatunePtr numatune);
102

103 104
bool virDomainNumatuneHasPerNodeBinding(virDomainNumatunePtr numatune);

105
int virDomainNumatuneSpecifiedMaxNode(virDomainNumatunePtr numatune);
106 107 108

bool virDomainNumatuneNodesetIsAvailable(virDomainNumatunePtr numatune,
                                         virBitmapPtr auto_nodeset);
109
#endif /* __NUMATUNE_CONF_H__ */