mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
Move a lot of #include <stdfoo.h> from individual files into libxl_internal.h. This helps avoid portability mistakes where necessary system headers are omitted from individual files, and is also of course a convenience when developing. Also add #include "libxl_osdeps.h" /* must come before any other headers */ to the top of most libxl*.c files, so that anyone who adds any headers before libxl_internal.h will put the in the right place. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
75 lines
1.4 KiB
C
75 lines
1.4 KiB
C
/*
|
|
*
|
|
* Author: Machon Gregory, <mbgrego@tycho.ncsc.mil>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2,
|
|
* as published by the Free Software Foundation.
|
|
*/
|
|
|
|
#include "libxl_osdeps.h" /* must come before any other headers */
|
|
|
|
#include "libxl_internal.h"
|
|
|
|
int libxl_flask_context_to_sid(libxl_ctx *ctx, char *buf, size_t len,
|
|
uint32_t *ssidref)
|
|
{
|
|
int rc;
|
|
|
|
rc = xc_flask_context_to_sid(ctx->xch, buf, len, ssidref);
|
|
|
|
return rc;
|
|
}
|
|
|
|
int libxl_flask_sid_to_context(libxl_ctx *ctx, uint32_t ssidref,
|
|
char **buf, size_t *len)
|
|
{
|
|
int rc;
|
|
char tmp[XC_PAGE_SIZE];
|
|
|
|
rc = xc_flask_sid_to_context(ctx->xch, ssidref, tmp, sizeof(tmp));
|
|
|
|
if (!rc) {
|
|
*len = strlen(tmp);
|
|
*buf = strdup(tmp);
|
|
}
|
|
|
|
return rc;
|
|
}
|
|
|
|
int libxl_flask_getenforce(libxl_ctx *ctx)
|
|
{
|
|
int rc;
|
|
|
|
rc = xc_flask_getenforce(ctx->xch);
|
|
|
|
return rc;
|
|
}
|
|
|
|
int libxl_flask_setenforce(libxl_ctx *ctx, int mode)
|
|
{
|
|
int rc;
|
|
|
|
rc = xc_flask_setenforce(ctx->xch, mode);
|
|
|
|
return rc;
|
|
}
|
|
|
|
int libxl_flask_loadpolicy(libxl_ctx *ctx, void *policy, uint32_t size)
|
|
{
|
|
|
|
int rc;
|
|
|
|
rc = xc_flask_load(ctx->xch, policy, size);
|
|
|
|
return rc;
|
|
}
|
|
|
|
/*
|
|
* Local variables:
|
|
* mode: C
|
|
* c-basic-offset: 4
|
|
* indent-tabs-mode: nil
|
|
* End:
|
|
*/
|