2017-07-25 16:03:11 +02:00
|
|
|
/*
|
|
|
|
* virresctrl.h:
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIR_RESCTRL_H__
|
|
|
|
# define __VIR_RESCTRL_H__
|
|
|
|
|
|
|
|
# include "internal.h"
|
|
|
|
|
|
|
|
# include "virbitmap.h"
|
|
|
|
# include "virutil.h"
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
VIR_CACHE_TYPE_BOTH,
|
|
|
|
VIR_CACHE_TYPE_CODE,
|
|
|
|
VIR_CACHE_TYPE_DATA,
|
|
|
|
|
|
|
|
VIR_CACHE_TYPE_LAST
|
|
|
|
} virCacheType;
|
|
|
|
|
|
|
|
VIR_ENUM_DECL(virCache);
|
2018-02-08 15:55:09 +01:00
|
|
|
VIR_ENUM_DECL(virCacheKernel);
|
2017-07-25 16:03:11 +02:00
|
|
|
|
|
|
|
|
2017-11-20 10:23:04 +01:00
|
|
|
typedef struct _virResctrlInfoPerCache virResctrlInfoPerCache;
|
|
|
|
typedef virResctrlInfoPerCache *virResctrlInfoPerCachePtr;
|
|
|
|
struct _virResctrlInfoPerCache {
|
2017-07-25 16:03:11 +02:00
|
|
|
/* Smallest possible increase of the allocation size in bytes */
|
|
|
|
unsigned long long granularity;
|
|
|
|
/* Minimal allocatable size in bytes (if different from granularity) */
|
|
|
|
unsigned long long min;
|
|
|
|
/* Type of the allocation */
|
|
|
|
virCacheType scope;
|
|
|
|
/* Maximum number of simultaneous allocations */
|
|
|
|
unsigned int max_allocation;
|
|
|
|
};
|
|
|
|
|
2017-11-20 11:12:06 +01:00
|
|
|
typedef struct _virResctrlInfo virResctrlInfo;
|
|
|
|
typedef virResctrlInfo *virResctrlInfoPtr;
|
2017-07-25 16:03:11 +02:00
|
|
|
|
2017-11-20 11:12:06 +01:00
|
|
|
virResctrlInfoPtr
|
|
|
|
virResctrlInfoNew(void);
|
|
|
|
|
|
|
|
int
|
|
|
|
virResctrlInfoGetCache(virResctrlInfoPtr resctrl,
|
|
|
|
unsigned int level,
|
|
|
|
unsigned long long size,
|
|
|
|
size_t *ncontrols,
|
|
|
|
virResctrlInfoPerCachePtr **controls);
|
|
|
|
|
2017-10-16 17:17:32 +02:00
|
|
|
/* Alloc-related things */
|
|
|
|
typedef struct _virResctrlAlloc virResctrlAlloc;
|
|
|
|
typedef virResctrlAlloc *virResctrlAllocPtr;
|
|
|
|
|
|
|
|
typedef int virResctrlAllocForeachSizeCallback(unsigned int level,
|
|
|
|
virCacheType type,
|
|
|
|
unsigned int cache,
|
|
|
|
unsigned long long size,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
virResctrlAllocPtr
|
|
|
|
virResctrlAllocNew(void);
|
|
|
|
|
|
|
|
bool
|
2018-02-01 14:57:40 +01:00
|
|
|
virResctrlAllocIsEmpty(virResctrlAllocPtr alloc);
|
2017-10-16 17:17:32 +02:00
|
|
|
|
|
|
|
int
|
2018-02-01 14:57:40 +01:00
|
|
|
virResctrlAllocSetSize(virResctrlAllocPtr alloc,
|
2017-10-16 17:17:32 +02:00
|
|
|
unsigned int level,
|
|
|
|
virCacheType type,
|
|
|
|
unsigned int cache,
|
|
|
|
unsigned long long size);
|
|
|
|
|
|
|
|
int
|
2018-02-01 14:57:40 +01:00
|
|
|
virResctrlAllocForeachSize(virResctrlAllocPtr alloc,
|
2017-10-16 17:17:32 +02:00
|
|
|
virResctrlAllocForeachSizeCallback cb,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
int
|
|
|
|
virResctrlAllocSetID(virResctrlAllocPtr alloc,
|
|
|
|
const char *id);
|
|
|
|
const char *
|
|
|
|
virResctrlAllocGetID(virResctrlAllocPtr alloc);
|
|
|
|
|
|
|
|
char *
|
|
|
|
virResctrlAllocFormat(virResctrlAllocPtr alloc);
|
|
|
|
|
2018-01-30 23:57:42 +01:00
|
|
|
int
|
|
|
|
virResctrlAllocDeterminePath(virResctrlAllocPtr alloc,
|
|
|
|
const char *machinename);
|
|
|
|
|
2017-10-16 17:17:32 +02:00
|
|
|
int
|
|
|
|
virResctrlAllocCreate(virResctrlInfoPtr r_info,
|
|
|
|
virResctrlAllocPtr alloc,
|
|
|
|
const char *machinename);
|
|
|
|
|
|
|
|
int
|
|
|
|
virResctrlAllocAddPID(virResctrlAllocPtr alloc,
|
|
|
|
pid_t pid);
|
|
|
|
|
|
|
|
int
|
|
|
|
virResctrlAllocRemove(virResctrlAllocPtr alloc);
|
|
|
|
|
2017-07-25 16:03:11 +02:00
|
|
|
#endif /* __VIR_RESCTRL_H__ */
|