mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
libxl: clean up trailing whitespaces in code.
Commit exactly the results of running find \! -iname '*.txt' -type f -print0 | xargs -0 perl -p -i.bak -E 's/\s+\n/\n/' Signed-off-by: Wei Liu <liuw@liuw.name> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
1 parent
b2c448b55c
commit
1b86994afe
26 files changed
+169
-169
No files matched your search
@@ -9,7 +9,7 @@ _xl()
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
xl=xl
|
||||
|
||||
|
||||
if [[ $COMP_CWORD == 1 ]] ; then
|
||||
opts=`${xl} help 2>/dev/null | sed '1,4d' | awk '{print $1}' | sed 's/$/ ,/g'` && COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
return 0
|
||||
|
||||
@@ -21,10 +21,10 @@ if __name__ == '__main__':
|
||||
sys.exit(1)
|
||||
|
||||
random.seed()
|
||||
|
||||
|
||||
idl = sys.argv[1]
|
||||
(_,types) = libxltypes.parse(idl)
|
||||
|
||||
|
||||
impl = sys.argv[2]
|
||||
f = open(impl, "w")
|
||||
f.write("""
|
||||
@@ -39,7 +39,7 @@ int main(int argc, char **argv)
|
||||
f.write(" %s %s_val;\n" % (ty.typename, ty.typename))
|
||||
f.write(" int rc;\n")
|
||||
f.write("\n")
|
||||
|
||||
|
||||
for ty in [t for t in types if isinstance(t,libxltypes.Enumeration)]:
|
||||
f.write(" printf(\"%s -- to string:\\n\");\n" % (ty.typename))
|
||||
for v in ty.values:
|
||||
@@ -53,7 +53,7 @@ int main(int argc, char **argv)
|
||||
f.write(" %s_val = -1;\n" % (ty.typename))
|
||||
f.write(" rc = %s_from_string(\"%s\", &%s_val);\n" %\
|
||||
(ty.typename, n, ty.typename))
|
||||
|
||||
|
||||
f.write(" printf(\"\\t%s = \\\"%%s\\\" = %%d (rc %%d)\\n\", \"%s\", %s_val, rc);\n" %\
|
||||
(v, n, ty.typename))
|
||||
f.write("\n")
|
||||
|
||||
+15
-15
@@ -17,7 +17,7 @@ def format_comment(level, comment):
|
||||
s += "%s */" % indent
|
||||
s += "\n"
|
||||
return s
|
||||
|
||||
|
||||
def libxl_C_instance_of(ty, instancename):
|
||||
if isinstance(ty, libxltypes.Aggregate) and ty.typename is None:
|
||||
if instancename is None:
|
||||
@@ -33,7 +33,7 @@ def libxl_C_type_define(ty, indent = ""):
|
||||
if isinstance(ty, libxltypes.Enumeration):
|
||||
if ty.comment is not None:
|
||||
s += format_comment(0, ty.comment)
|
||||
|
||||
|
||||
if ty.typename is None:
|
||||
s += "enum {\n"
|
||||
else:
|
||||
@@ -76,12 +76,12 @@ def libxl_C_type_define(ty, indent = ""):
|
||||
return s.replace("\n", "\n%s" % indent)
|
||||
|
||||
def libxl_C_type_destroy(ty, v, indent = " ", parent = None):
|
||||
|
||||
|
||||
s = ""
|
||||
if isinstance(ty, libxltypes.KeyedUnion):
|
||||
if parent is None:
|
||||
raise Exception("KeyedUnion type must have a parent")
|
||||
s += "switch (%s) {\n" % (parent + ty.keyvar_name)
|
||||
s += "switch (%s) {\n" % (parent + ty.keyvar_name)
|
||||
for f in ty.fields:
|
||||
(nparent,fexpr) = ty.member(v, f, parent is None)
|
||||
s += "case %s:\n" % f.enumname
|
||||
@@ -95,7 +95,7 @@ def libxl_C_type_destroy(ty, v, indent = " ", parent = None):
|
||||
else:
|
||||
if ty.destructor_fn is not None:
|
||||
s += "%s(%s);\n" % (ty.destructor_fn, ty.pass_arg(v, parent is None))
|
||||
|
||||
|
||||
if s != "":
|
||||
s = indent + s
|
||||
return s.replace("\n", "\n%s" % indent).rstrip(indent)
|
||||
@@ -122,7 +122,7 @@ def libxl_C_enum_strings(ty, indent=""):
|
||||
s += " { NULL, -1 },\n"
|
||||
s += "};\n"
|
||||
s += "\n"
|
||||
|
||||
|
||||
if s != "":
|
||||
s = indent + s
|
||||
return s.replace("\n", "\n%s" % indent).rstrip(indent)
|
||||
@@ -131,11 +131,11 @@ def libxl_C_enum_from_string(ty, str, e, indent = " "):
|
||||
s = ""
|
||||
s += "return libxl__enum_from_string(%s_string_table,\n" % ty.typename
|
||||
s += " %s, (int *)%s);\n" % (str, e)
|
||||
|
||||
|
||||
if s != "":
|
||||
s = indent + s
|
||||
return s.replace("\n", "\n%s" % indent).rstrip(indent)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 4:
|
||||
@@ -145,11 +145,11 @@ if __name__ == '__main__':
|
||||
(_, idl, header, impl) = sys.argv
|
||||
|
||||
(_,types) = libxltypes.parse(idl)
|
||||
|
||||
|
||||
print "outputting libxl type definitions to %s" % header
|
||||
|
||||
f = open(header, "w")
|
||||
|
||||
|
||||
f.write("""#ifndef __LIBXL_TYPES_H
|
||||
#define __LIBXL_TYPES_H
|
||||
|
||||
@@ -159,9 +159,9 @@ if __name__ == '__main__':
|
||||
* This file is autogenerated by
|
||||
* "%s"
|
||||
*/
|
||||
|
||||
|
||||
""" % " ".join(sys.argv))
|
||||
|
||||
|
||||
for ty in types:
|
||||
f.write(libxl_C_type_define(ty) + ";\n")
|
||||
if ty.destructor_fn is not None:
|
||||
@@ -174,7 +174,7 @@ if __name__ == '__main__':
|
||||
|
||||
f.write("""#endif /* __LIBXL_TYPES_H */\n""")
|
||||
f.close()
|
||||
|
||||
|
||||
print "outputting libxl type implementations to %s" % impl
|
||||
|
||||
f = open(impl, "w")
|
||||
@@ -213,11 +213,11 @@ if __name__ == '__main__':
|
||||
f.write("}\n")
|
||||
f.write("\n")
|
||||
|
||||
f.write(libxl_C_enum_strings(ty))
|
||||
f.write(libxl_C_enum_strings(ty))
|
||||
|
||||
f.write("int %s_from_string(const char *s, %s *e)\n" % (ty.typename, ty.typename))
|
||||
f.write("{\n")
|
||||
f.write(libxl_C_enum_from_string(ty, "s", "e"))
|
||||
f.write(libxl_C_enum_from_string(ty, "s", "e"))
|
||||
f.write("}\n")
|
||||
f.write("\n")
|
||||
|
||||
|
||||
+11
-11
@@ -64,7 +64,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version, xentoollog_logger * lg)
|
||||
|
||||
ctx->xch = xc_interface_open(lg,lg,0);
|
||||
if (!ctx->xch) {
|
||||
LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno,
|
||||
LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno,
|
||||
"cannot open libxc handle");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version, xentoollog_logger * lg)
|
||||
if (!ctx->xsh)
|
||||
ctx->xsh = xs_domain_open();
|
||||
if (!ctx->xsh) {
|
||||
LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno,
|
||||
LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, errno,
|
||||
"cannot connect to xenstore");
|
||||
xc_interface_close(ctx->xch);
|
||||
return ERROR_FAIL;
|
||||
@@ -88,7 +88,7 @@ int libxl_ctx_free(libxl_ctx *ctx)
|
||||
if (!ctx) return 0;
|
||||
if (ctx->xch) xc_interface_close(ctx->xch);
|
||||
libxl_version_info_destroy(&ctx->version_info);
|
||||
if (ctx->xsh) xs_daemon_close(ctx->xsh);
|
||||
if (ctx->xsh) xs_daemon_close(ctx->xsh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -247,15 +247,15 @@ int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid)
|
||||
goto out;
|
||||
}
|
||||
if (xc_domain_resume(ctx->xch, domid, 0)) {
|
||||
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
|
||||
"xc_domain_resume failed for domain %u",
|
||||
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
|
||||
"xc_domain_resume failed for domain %u",
|
||||
domid);
|
||||
rc = ERROR_FAIL;
|
||||
goto out;
|
||||
}
|
||||
if (!xs_resume_domain(ctx->xsh, domid)) {
|
||||
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
|
||||
"xs_resume_domain failed for domain %u",
|
||||
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
|
||||
"xs_resume_domain failed for domain %u",
|
||||
domid);
|
||||
rc = ERROR_FAIL;
|
||||
}
|
||||
@@ -701,7 +701,7 @@ int libxl_event_get_disk_eject_info(libxl_ctx *ctx, uint32_t domid, libxl_event
|
||||
disk->backend = LIBXL_DISK_BACKEND_QDISK;
|
||||
} else {
|
||||
disk->backend = LIBXL_DISK_BACKEND_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
disk->pdev_path = strdup("");
|
||||
disk->format = LIBXL_DISK_FORMAT_EMPTY;
|
||||
@@ -897,7 +897,7 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass)
|
||||
if ( lseek(autopass_fd, SEEK_SET, 0) ) {
|
||||
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
|
||||
"rewind %s (autopass) failed", tmpname);
|
||||
goto x_fail;
|
||||
goto x_fail;
|
||||
}
|
||||
|
||||
args[2] = "-autopass";
|
||||
@@ -1527,8 +1527,8 @@ static unsigned int libxl__append_disk_list_of_type(libxl__gc *gc,
|
||||
} else {
|
||||
pdisk->pdev_path = physpath_tmp;
|
||||
}
|
||||
libxl_string_to_backend(ctx, libxl__xs_read(gc, XBT_NULL,
|
||||
libxl__sprintf(gc, "%s/%s/type", be_path, *dir)),
|
||||
libxl_string_to_backend(ctx, libxl__xs_read(gc, XBT_NULL,
|
||||
libxl__sprintf(gc, "%s/%s/type", be_path, *dir)),
|
||||
&(pdisk->backend));
|
||||
pdisk->vdev = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(gc, "%s/%s/dev", be_path, *dir), &len);
|
||||
removable = libxl__xs_read(gc, XBT_NULL, libxl__sprintf
|
||||
|
||||
+2
-2
@@ -370,7 +370,7 @@ int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_conso
|
||||
* if the guest is using stubdoms).
|
||||
* This function can be called after creating the device model, in
|
||||
* case of HVM guests, and before libxl_run_bootloader in case of PV
|
||||
* guests using pygrub. */
|
||||
* guests using pygrub. */
|
||||
int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm);
|
||||
|
||||
int libxl_domain_info(libxl_ctx*, libxl_dominfo *info_r,
|
||||
@@ -520,7 +520,7 @@ static inline int libxl_domid_valid_guest(uint32_t domid)
|
||||
|
||||
int libxl_flask_context_to_sid(libxl_ctx *ctx, char *buf, size_t len,
|
||||
uint32_t *ssidref);
|
||||
int libxl_flask_sid_to_context(libxl_ctx *ctx, uint32_t ssidref, char **buf,
|
||||
int libxl_flask_sid_to_context(libxl_ctx *ctx, uint32_t ssidref, char **buf,
|
||||
size_t *len);
|
||||
int libxl_flask_getenforce(libxl_ctx *ctx);
|
||||
int libxl_flask_setenforce(libxl_ctx *ctx, int mode);
|
||||
|
||||
@@ -95,8 +95,8 @@ libxl_dominfo = Struct("dominfo",[
|
||||
("paused", bool),
|
||||
("shutdown", bool),
|
||||
("dying", bool),
|
||||
|
||||
("shutdown_reason", uint8, False,
|
||||
|
||||
("shutdown_reason", uint8, False,
|
||||
"""Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
|
||||
|
||||
Otherwise set to a value guaranteed not to clash with any valid
|
||||
@@ -134,7 +134,7 @@ libxl_version_info = Struct("version_info", [
|
||||
("pagesize", integer),
|
||||
("commandline", string),
|
||||
])
|
||||
|
||||
|
||||
libxl_domain_create_info = Struct("domain_create_info",[
|
||||
("type", libxl_domain_type),
|
||||
("hap", bool),
|
||||
@@ -212,19 +212,19 @@ libxl_device_model_info = Struct("device_model_info",[
|
||||
("opengl", bool, False, "opengl enabled or disabled (if enabled requires sdl enabled)"),
|
||||
("spice", bool, False,
|
||||
"spice enabled or disabled"),
|
||||
("spiceport", integer, False,
|
||||
("spiceport", integer, False,
|
||||
"the port that should be listened on for the spice server"),
|
||||
("spicetls_port", integer, False, """the tls port
|
||||
that should be listened on for the spice server,
|
||||
that should be listened on for the spice server,
|
||||
at least one of the port or tls port must be given"""),
|
||||
("spicehost", string, False, """the interface
|
||||
that should be listened on if given otherwise any interface"""),
|
||||
("spicedisable_ticketing", bool, False,
|
||||
("spicedisable_ticketing", bool, False,
|
||||
"enable client connection with no password"),
|
||||
("spicepasswd", string, False, """set ticket password
|
||||
witch must be used by a client for connection.
|
||||
The password never expires"""),
|
||||
("spiceagent_mouse", bool, False,
|
||||
("spiceagent_mouse", bool, False,
|
||||
"Whether spice agent is used for client mouse mode(default is on)"),
|
||||
("nographic", bool, False, "no graphics, use serial port"),
|
||||
("gfx_passthru", bool, False, "graphics passthrough enabled or disabled"),
|
||||
|
||||
@@ -166,7 +166,7 @@ static int disk_try_backend(disk_try_backend_args *a,
|
||||
LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Disk vdev=%s, backend "
|
||||
" %d unknown", a->disk->vdev, backend);
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
abort(); /* notreached */
|
||||
|
||||
@@ -177,7 +177,7 @@ static int disk_try_backend(disk_try_backend_args *a,
|
||||
libxl_disk_backend_to_string(backend),
|
||||
libxl_disk_format_to_string(a->disk->format));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int libxl__device_disk_set_backend(libxl__gc *gc, libxl_device_disk *disk) {
|
||||
libxl_ctx *ctx = libxl__gc_owner(gc);
|
||||
@@ -240,11 +240,11 @@ char *libxl__device_disk_string_of_format(libxl_disk_format format)
|
||||
{
|
||||
switch (format) {
|
||||
case LIBXL_DISK_FORMAT_QCOW: return "qcow";
|
||||
case LIBXL_DISK_FORMAT_QCOW2: return "qcow2";
|
||||
case LIBXL_DISK_FORMAT_VHD: return "vhd";
|
||||
case LIBXL_DISK_FORMAT_QCOW2: return "qcow2";
|
||||
case LIBXL_DISK_FORMAT_VHD: return "vhd";
|
||||
case LIBXL_DISK_FORMAT_RAW:
|
||||
case LIBXL_DISK_FORMAT_EMPTY: return "aio";
|
||||
default: return NULL;
|
||||
case LIBXL_DISK_FORMAT_EMPTY: return "aio";
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force)
|
||||
if (!force) {
|
||||
/* Linux-ism. Most implementations leave the timeout
|
||||
* untouched after select. Linux, however, will chip
|
||||
* away the elapsed time from it, which is what we
|
||||
* away the elapsed time from it, which is what we
|
||||
* need to enforce a single time span waiting for
|
||||
* device destruction. */
|
||||
struct timeval tv;
|
||||
|
||||
@@ -120,7 +120,7 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc,
|
||||
vncarg = libxl__sprintf(gc, "%s,password", vncarg);
|
||||
flexarray_append(dm_args, "-vnc");
|
||||
flexarray_append(dm_args, vncarg);
|
||||
|
||||
|
||||
if (info->vncunused) {
|
||||
flexarray_append(dm_args, "-vncunused");
|
||||
}
|
||||
@@ -274,11 +274,11 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
|
||||
}
|
||||
|
||||
if (strchr(listen, ':') != NULL)
|
||||
flexarray_append(dm_args,
|
||||
flexarray_append(dm_args,
|
||||
libxl__sprintf(gc, "%s%s", listen,
|
||||
info->vncunused ? ",to=99" : ""));
|
||||
else
|
||||
flexarray_append(dm_args,
|
||||
flexarray_append(dm_args,
|
||||
libxl__sprintf(gc, "%s:%d%s", listen, display,
|
||||
info->vncunused ? ",to=99" : ""));
|
||||
}
|
||||
|
||||
@@ -22,23 +22,23 @@ int libxl_flask_context_to_sid(libxl_ctx *ctx, char *buf, size_t len,
|
||||
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,
|
||||
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);
|
||||
*buf = strdup(tmp);
|
||||
}
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ int libxl_flask_getenforce(libxl_ctx *ctx)
|
||||
|
||||
rc = xc_flask_getenforce(ctx->xch);
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int libxl_flask_setenforce(libxl_ctx *ctx, int mode)
|
||||
|
||||
@@ -535,7 +535,7 @@ int libxl_device_pci_list_assignable(libxl_ctx *ctx, libxl_device_pci **list, in
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* This function checks that all functions of a device are bound to pciback
|
||||
* driver. It also initialises a bit-mask of which function numbers are present
|
||||
* on that device.
|
||||
@@ -598,7 +598,7 @@ static int pci_ins_check(libxl__gc *gc, uint32_t domid, const char *state, void
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int do_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int starting)
|
||||
{
|
||||
libxl_ctx *ctx = libxl__gc_owner(gc);
|
||||
@@ -870,7 +870,7 @@ static int do_pci_remove(libxl__gc *gc, uint32_t domid,
|
||||
NULL, NULL, NULL) < 0) {
|
||||
LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model didn't respond in time");
|
||||
/* This depends on guest operating system acknowledging the
|
||||
* SCI, if it doesn't respond in time then we may wish to
|
||||
* SCI, if it doesn't respond in time then we may wish to
|
||||
* force the removal.
|
||||
*/
|
||||
return ERROR_FAIL;
|
||||
|
||||
@@ -313,7 +313,7 @@ int libxl_read_file_contents(libxl_ctx *ctx, const char *filename,
|
||||
int e;
|
||||
struct stat stab;
|
||||
ssize_t rs;
|
||||
|
||||
|
||||
f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
if (errno == ENOENT) return ENOENT;
|
||||
|
||||
@@ -48,7 +48,7 @@ int libxl_write_exactly(libxl_ctx *ctx, int fd, const void *data,
|
||||
* EPROTO and you have no way to tell how much was read. Errors are
|
||||
* logged using filename (which is only used for logging) and what
|
||||
* (which may be 0). */
|
||||
|
||||
|
||||
pid_t libxl_fork(libxl_ctx *ctx);
|
||||
int libxl_pipe(libxl_ctx *ctx, int pipes[2]);
|
||||
/* Just like fork(2), pipe(2), but log errors. */
|
||||
|
||||
@@ -44,12 +44,12 @@ class Type(object):
|
||||
|
||||
def make_arg(self, n, passby=None):
|
||||
if passby is None: passby = self.passby
|
||||
|
||||
|
||||
if passby == PASS_BY_REFERENCE:
|
||||
return "%s *%s" % (self.typename, n)
|
||||
else:
|
||||
return "%s %s" % (self.typename, n)
|
||||
|
||||
|
||||
def pass_arg(self, n, isref=None, passby=None):
|
||||
if passby is None: passby = self.passby
|
||||
if isref is None: isref = self.passby == PASS_BY_REFERENCE
|
||||
@@ -97,7 +97,7 @@ class EnumerationValue(object):
|
||||
self.name = str.upper(enum.namespace) + self.rawname
|
||||
self.value = value
|
||||
self.comment = kwargs.setdefault("comment", None)
|
||||
|
||||
|
||||
class Enumeration(Type):
|
||||
def __init__(self, typename, values, **kwargs):
|
||||
kwargs.setdefault('destructor_fn', None)
|
||||
@@ -121,7 +121,7 @@ class Enumeration(Type):
|
||||
if v.valuename == str.upper(name):
|
||||
return v
|
||||
return ValueError
|
||||
|
||||
|
||||
class Field(object):
|
||||
"""An element of an Aggregate type"""
|
||||
def __init__(self, type, name, **kwargs):
|
||||
@@ -164,7 +164,7 @@ class Aggregate(Type):
|
||||
deref = v + "->"
|
||||
else:
|
||||
deref = v + "."
|
||||
|
||||
|
||||
if f.name is None: # Anonymous
|
||||
return (deref, deref)
|
||||
else:
|
||||
@@ -191,7 +191,7 @@ class KeyedUnion(Aggregate):
|
||||
|
||||
if not isinstance(keyvar_type, Enumeration):
|
||||
raise ValueError
|
||||
|
||||
|
||||
self.keyvar_name = keyvar_name
|
||||
self.keyvar_type = keyvar_type
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ static int ctx_prep(CfgParseContext *ctx, XLU_Config *cfg) {
|
||||
ctx->lexerrlineno= -1;
|
||||
ctx->likely_python= 0;
|
||||
ctx->scanner= 0;
|
||||
|
||||
|
||||
e= xlu__cfg_yylex_init_extra(ctx, &ctx->scanner);
|
||||
if (e) {
|
||||
fprintf(cfg->report,"%s: unable to create scanner: %s\n",
|
||||
@@ -191,7 +191,7 @@ int xlu_cfg_get_string(const XLU_Config *cfg, const char *n,
|
||||
*value_r= set->values[0];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int xlu_cfg_replace_string(const XLU_Config *cfg, const char *n,
|
||||
char **value_r) {
|
||||
XLU_ConfigSetting *set;
|
||||
@@ -231,7 +231,7 @@ int xlu_cfg_get_long(const XLU_Config *cfg, const char *n,
|
||||
*value_r= l;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int xlu_cfg_get_list(const XLU_Config *cfg, const char *n,
|
||||
XLU_ConfigList **list_r, int *entries_r, int dont_warn) {
|
||||
@@ -269,7 +269,7 @@ XLU_ConfigSetting *xlu__cfg_set_mk(CfgParseContext *ctx,
|
||||
|
||||
set->name= 0; /* tbd */
|
||||
set->avalues= alloc;
|
||||
|
||||
|
||||
if (!alloc) {
|
||||
set->nvalues= 0;
|
||||
set->values= 0;
|
||||
@@ -295,11 +295,11 @@ void xlu__cfg_set_add(CfgParseContext *ctx, XLU_ConfigSetting *set,
|
||||
if (ctx->err) return;
|
||||
|
||||
assert(atom);
|
||||
|
||||
|
||||
if (set->nvalues >= set->avalues) {
|
||||
int new_avalues;
|
||||
char **new_values;
|
||||
|
||||
|
||||
if (set->avalues > INT_MAX / 100) { ctx->err= ERANGE; return; }
|
||||
new_avalues= set->avalues * 4;
|
||||
new_values= realloc(set->values,
|
||||
@@ -324,7 +324,7 @@ void xlu__cfg_set_store(CfgParseContext *ctx, char *name,
|
||||
|
||||
char *xlu__cfgl_strdup(CfgParseContext *ctx, const char *src) {
|
||||
char *result;
|
||||
|
||||
|
||||
if (ctx->err) return 0;
|
||||
result= strdup(src);
|
||||
if (!result) ctx->err= errno;
|
||||
@@ -380,7 +380,7 @@ char *xlu__cfgl_dequote(CfgParseContext *ctx, const char *src) {
|
||||
goto x; \
|
||||
} \
|
||||
p += (ep - numbuf); \
|
||||
}while(0)
|
||||
}while(0)
|
||||
|
||||
p++;
|
||||
NUMERIC_CHAR(2,2,16,"hex");
|
||||
|
||||
+35
-35
@@ -34,7 +34,7 @@
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
@@ -51,7 +51,7 @@ typedef uint32_t flex_uint32_t;
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
|
||||
@@ -185,7 +185,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
|
||||
/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
|
||||
* access to the local variable yy_act. Since yyless() is a macro, it would break
|
||||
* existing scanners that call yyless() from OUTSIDE xlu__cfg_yylex.
|
||||
* existing scanners that call yyless() from OUTSIDE xlu__cfg_yylex.
|
||||
* One obvious solution it to make yy_act a global. I tried that, and saw
|
||||
* a 5% performance hit in a non-yylineno scanner, because yy_act is
|
||||
* normally declared as a register variable-- so it is not worth it.
|
||||
@@ -197,7 +197,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
if ( yytext[yyl] == '\n' )\
|
||||
--yylineno;\
|
||||
}while(0)
|
||||
|
||||
|
||||
/* Return all but the first "n" matched characters back to the input stream. */
|
||||
#define yyless(n) \
|
||||
do \
|
||||
@@ -259,7 +259,7 @@ struct yy_buffer_state
|
||||
|
||||
int yy_bs_lineno; /**< The line count. */
|
||||
int yy_bs_column; /**< The column count. */
|
||||
|
||||
|
||||
/* Whether to try to fill the input buffer when we reach the
|
||||
* end of it.
|
||||
*/
|
||||
@@ -574,9 +574,9 @@ static int yy_init_globals (yyscan_t yyscanner );
|
||||
/* This must go here because YYSTYPE and YYLTYPE are included
|
||||
* from bison output in section 1.*/
|
||||
# define yylval yyg->yylval_r
|
||||
|
||||
|
||||
# define yylloc yyg->yylloc_r
|
||||
|
||||
|
||||
int xlu__cfg_yylex_init (yyscan_t* scanner);
|
||||
|
||||
int xlu__cfg_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
|
||||
@@ -615,9 +615,9 @@ YYSTYPE * xlu__cfg_yyget_lval (yyscan_t yyscanner );
|
||||
void xlu__cfg_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
|
||||
|
||||
YYLTYPE *xlu__cfg_yyget_lloc (yyscan_t yyscanner );
|
||||
|
||||
|
||||
void xlu__cfg_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
|
||||
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
*/
|
||||
@@ -845,7 +845,7 @@ yy_find_action:
|
||||
int yyl;
|
||||
for ( yyl = yyg->yy_more_len; yyl < yyleng; ++yyl )
|
||||
if ( yytext[yyl] == '\n' )
|
||||
|
||||
|
||||
do{ yylineno++;
|
||||
yycolumn=0;
|
||||
}while(0)
|
||||
@@ -1377,7 +1377,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||
yyg->yy_hold_char = *++yyg->yy_c_buf_p;
|
||||
|
||||
if ( c == '\n' )
|
||||
|
||||
|
||||
do{ yylineno++;
|
||||
yycolumn=0;
|
||||
}while(0)
|
||||
@@ -1460,7 +1460,7 @@ static void xlu__cfg_yy_load_buffer_state (yyscan_t yyscanner)
|
||||
YY_BUFFER_STATE xlu__cfg_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
|
||||
b = (YY_BUFFER_STATE) xlu__cfg_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
|
||||
if ( ! b )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yy_create_buffer()" );
|
||||
@@ -1504,7 +1504,7 @@ static void xlu__cfg_yy_load_buffer_state (yyscan_t yyscanner)
|
||||
#ifndef __cplusplus
|
||||
extern int isatty (int );
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* Initializes or reinitializes a buffer.
|
||||
* This function is sometimes called more than once on the same buffer,
|
||||
* such as during a xlu__cfg_yyrestart() or at EOF.
|
||||
@@ -1530,7 +1530,7 @@ extern int isatty (int );
|
||||
}
|
||||
|
||||
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
|
||||
|
||||
|
||||
errno = oerrno;
|
||||
}
|
||||
|
||||
@@ -1636,9 +1636,9 @@ static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner)
|
||||
, yyscanner);
|
||||
if ( ! yyg->yy_buffer_stack )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in xlu__cfg_yyensure_buffer_stack()" );
|
||||
|
||||
|
||||
memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
|
||||
|
||||
|
||||
yyg->yy_buffer_stack_max = num_to_alloc;
|
||||
yyg->yy_buffer_stack_top = 0;
|
||||
return;
|
||||
@@ -1667,12 +1667,12 @@ static void xlu__cfg_yyensure_buffer_stack (yyscan_t yyscanner)
|
||||
* @param base the character buffer
|
||||
* @param size the size in bytes of the character buffer
|
||||
* @param yyscanner The scanner object.
|
||||
* @return the newly allocated buffer state object.
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
YY_BUFFER_STATE xlu__cfg_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
|
||||
if ( size < 2 ||
|
||||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
|
||||
base[size-1] != YY_END_OF_BUFFER_CHAR )
|
||||
@@ -1708,7 +1708,7 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_buffer (char * base, yy_size_t size , yyscan_
|
||||
*/
|
||||
YY_BUFFER_STATE xlu__cfg_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
|
||||
{
|
||||
|
||||
|
||||
return xlu__cfg_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
|
||||
}
|
||||
|
||||
@@ -1725,7 +1725,7 @@ YY_BUFFER_STATE xlu__cfg_yy_scan_bytes (yyconst char * yybytes, int _yybytes_l
|
||||
char *buf;
|
||||
yy_size_t n;
|
||||
int i;
|
||||
|
||||
|
||||
/* Get memory for full buffer, including space for trailing EOB's. */
|
||||
n = _yybytes_len + 2;
|
||||
buf = (char *) xlu__cfg_yyalloc(n ,yyscanner );
|
||||
@@ -1793,10 +1793,10 @@ YY_EXTRA_TYPE xlu__cfg_yyget_extra (yyscan_t yyscanner)
|
||||
int xlu__cfg_yyget_lineno (yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
|
||||
if (! YY_CURRENT_BUFFER)
|
||||
return 0;
|
||||
|
||||
|
||||
return yylineno;
|
||||
}
|
||||
|
||||
@@ -1806,10 +1806,10 @@ int xlu__cfg_yyget_lineno (yyscan_t yyscanner)
|
||||
int xlu__cfg_yyget_column (yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
|
||||
if (! YY_CURRENT_BUFFER)
|
||||
return 0;
|
||||
|
||||
|
||||
return yycolumn;
|
||||
}
|
||||
|
||||
@@ -1870,8 +1870,8 @@ void xlu__cfg_yyset_lineno (int line_number , yyscan_t yyscanner)
|
||||
|
||||
/* lineno is only valid if an input buffer exists. */
|
||||
if (! YY_CURRENT_BUFFER )
|
||||
yy_fatal_error( "xlu__cfg_yyset_lineno called with no buffer" , yyscanner);
|
||||
|
||||
yy_fatal_error( "xlu__cfg_yyset_lineno called with no buffer" , yyscanner);
|
||||
|
||||
yylineno = line_number;
|
||||
}
|
||||
|
||||
@@ -1885,8 +1885,8 @@ void xlu__cfg_yyset_column (int column_no , yyscan_t yyscanner)
|
||||
|
||||
/* column is only valid if an input buffer exists. */
|
||||
if (! YY_CURRENT_BUFFER )
|
||||
yy_fatal_error( "xlu__cfg_yyset_column called with no buffer" , yyscanner);
|
||||
|
||||
yy_fatal_error( "xlu__cfg_yyset_column called with no buffer" , yyscanner);
|
||||
|
||||
yycolumn = column_no;
|
||||
}
|
||||
|
||||
@@ -1939,13 +1939,13 @@ YYLTYPE *xlu__cfg_yyget_lloc (yyscan_t yyscanner)
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
return yylloc;
|
||||
}
|
||||
|
||||
|
||||
void xlu__cfg_yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
yylloc = yylloc_param;
|
||||
}
|
||||
|
||||
|
||||
/* User-visible API */
|
||||
|
||||
/* xlu__cfg_yylex_init is special because it creates the scanner itself, so it is
|
||||
@@ -1993,20 +1993,20 @@ int xlu__cfg_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_glo
|
||||
errno = EINVAL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
*ptr_yy_globals = (yyscan_t) xlu__cfg_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
|
||||
|
||||
|
||||
if (*ptr_yy_globals == NULL){
|
||||
errno = ENOMEM;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* By setting to 0xAA, we expose bugs in
|
||||
yy_init_globals. Leave at 0x00 for releases. */
|
||||
memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
|
||||
|
||||
|
||||
xlu__cfg_yyset_extra (yy_user_defined, *ptr_yy_globals);
|
||||
|
||||
|
||||
return yy_init_globals ( *ptr_yy_globals );
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
@@ -55,7 +55,7 @@ typedef uint32_t flex_uint32_t;
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
|
||||
@@ -193,7 +193,7 @@ struct yy_buffer_state
|
||||
|
||||
int yy_bs_lineno; /**< The line count. */
|
||||
int yy_bs_column; /**< The column count. */
|
||||
|
||||
|
||||
/* Whether to try to fill the input buffer when we reach the
|
||||
* end of it.
|
||||
*/
|
||||
@@ -281,9 +281,9 @@ YYSTYPE * xlu__cfg_yyget_lval (yyscan_t yyscanner );
|
||||
void xlu__cfg_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
|
||||
|
||||
YYLTYPE *xlu__cfg_yyget_lloc (yyscan_t yyscanner );
|
||||
|
||||
|
||||
void xlu__cfg_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
|
||||
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
*/
|
||||
|
||||
@@ -819,7 +819,7 @@ int yydebug;
|
||||
# define YYMAXDEPTH 10000
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if YYERROR_VERBOSE
|
||||
|
||||
@@ -1030,7 +1030,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
|
||||
}
|
||||
}
|
||||
#endif /* YYERROR_VERBOSE */
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------.
|
||||
| Release the memory associated to this symbol. |
|
||||
@@ -1101,7 +1101,7 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, ctx)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Prevent warnings from -Wmissing-prototypes. */
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
%%
|
||||
|
||||
file: /* empty */
|
||||
| file setting
|
||||
| file setting
|
||||
|
||||
setting: IDENT '=' value { xlu__cfg_set_store(ctx,$1,$3,@3.first_line); }
|
||||
endstmt
|
||||
|
||||
@@ -19,7 +19,7 @@ static int dpc_prep(DiskParseContext *dpc, const char *spec) {
|
||||
int e;
|
||||
|
||||
dpc->spec = spec;
|
||||
|
||||
|
||||
e = xlu__disk_yylex_init_extra(dpc, &dpc->scanner);
|
||||
if (e) goto fail;
|
||||
|
||||
|
||||
+28
-28
@@ -34,7 +34,7 @@
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
@@ -51,7 +51,7 @@ typedef uint32_t flex_uint32_t;
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
|
||||
@@ -184,7 +184,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#define EOB_ACT_LAST_MATCH 2
|
||||
|
||||
#define YY_LESS_LINENO(n)
|
||||
|
||||
|
||||
/* Return all but the first "n" matched characters back to the input stream. */
|
||||
#define yyless(n) \
|
||||
do \
|
||||
@@ -246,7 +246,7 @@ struct yy_buffer_state
|
||||
|
||||
int yy_bs_lineno; /**< The line count. */
|
||||
int yy_bs_column; /**< The column count. */
|
||||
|
||||
|
||||
/* Whether to try to fill the input buffer when we reach the
|
||||
* end of it.
|
||||
*/
|
||||
@@ -846,7 +846,7 @@ static void setformat(DiskParseContext *dpc, const char *str) {
|
||||
else if (!strcmp(str,"vhd")) DSET(dpc,format,FORMAT,str,VHD);
|
||||
else xlu__disk_err(dpc,str,"unknown value for format");
|
||||
}
|
||||
|
||||
|
||||
/* Sets ->backend from the string. IDL should provide something for this. */
|
||||
static void setbackendtype(DiskParseContext *dpc, const char *str) {
|
||||
if ( !strcmp(str,"phy")) DSET(dpc,backend,BACKEND,str,PHY);
|
||||
@@ -854,7 +854,7 @@ static void setbackendtype(DiskParseContext *dpc, const char *str) {
|
||||
else if (!strcmp(str,"qdisk")) DSET(dpc,backend,BACKEND,str,QDISK);
|
||||
else xlu__disk_err(dpc,str,"unknown value for backendtype");
|
||||
}
|
||||
|
||||
|
||||
#define DEPRECATE(usewhatinstead) /* not currently reported */
|
||||
|
||||
|
||||
@@ -1869,7 +1869,7 @@ static void xlu__disk_yy_load_buffer_state (yyscan_t yyscanner)
|
||||
YY_BUFFER_STATE xlu__disk_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
|
||||
b = (YY_BUFFER_STATE) xlu__disk_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
|
||||
if ( ! b )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in xlu__disk_yy_create_buffer()" );
|
||||
@@ -1913,7 +1913,7 @@ static void xlu__disk_yy_load_buffer_state (yyscan_t yyscanner)
|
||||
#ifndef __cplusplus
|
||||
extern int isatty (int );
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* Initializes or reinitializes a buffer.
|
||||
* This function is sometimes called more than once on the same buffer,
|
||||
* such as during a xlu__disk_yyrestart() or at EOF.
|
||||
@@ -1939,7 +1939,7 @@ extern int isatty (int );
|
||||
}
|
||||
|
||||
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
|
||||
|
||||
|
||||
errno = oerrno;
|
||||
}
|
||||
|
||||
@@ -2045,9 +2045,9 @@ static void xlu__disk_yyensure_buffer_stack (yyscan_t yyscanner)
|
||||
, yyscanner);
|
||||
if ( ! yyg->yy_buffer_stack )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in xlu__disk_yyensure_buffer_stack()" );
|
||||
|
||||
|
||||
memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
|
||||
|
||||
|
||||
yyg->yy_buffer_stack_max = num_to_alloc;
|
||||
yyg->yy_buffer_stack_top = 0;
|
||||
return;
|
||||
@@ -2076,12 +2076,12 @@ static void xlu__disk_yyensure_buffer_stack (yyscan_t yyscanner)
|
||||
* @param base the character buffer
|
||||
* @param size the size in bytes of the character buffer
|
||||
* @param yyscanner The scanner object.
|
||||
* @return the newly allocated buffer state object.
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
YY_BUFFER_STATE xlu__disk_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
|
||||
if ( size < 2 ||
|
||||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
|
||||
base[size-1] != YY_END_OF_BUFFER_CHAR )
|
||||
@@ -2117,7 +2117,7 @@ YY_BUFFER_STATE xlu__disk_yy_scan_buffer (char * base, yy_size_t size , yyscan
|
||||
*/
|
||||
YY_BUFFER_STATE xlu__disk_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
|
||||
{
|
||||
|
||||
|
||||
return xlu__disk_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
|
||||
}
|
||||
|
||||
@@ -2134,7 +2134,7 @@ YY_BUFFER_STATE xlu__disk_yy_scan_bytes (yyconst char * yybytes, int _yybytes_
|
||||
char *buf;
|
||||
yy_size_t n;
|
||||
int i;
|
||||
|
||||
|
||||
/* Get memory for full buffer, including space for trailing EOB's. */
|
||||
n = _yybytes_len + 2;
|
||||
buf = (char *) xlu__disk_yyalloc(n ,yyscanner );
|
||||
@@ -2202,10 +2202,10 @@ YY_EXTRA_TYPE xlu__disk_yyget_extra (yyscan_t yyscanner)
|
||||
int xlu__disk_yyget_lineno (yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
|
||||
if (! YY_CURRENT_BUFFER)
|
||||
return 0;
|
||||
|
||||
|
||||
return yylineno;
|
||||
}
|
||||
|
||||
@@ -2215,10 +2215,10 @@ int xlu__disk_yyget_lineno (yyscan_t yyscanner)
|
||||
int xlu__disk_yyget_column (yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
|
||||
if (! YY_CURRENT_BUFFER)
|
||||
return 0;
|
||||
|
||||
|
||||
return yycolumn;
|
||||
}
|
||||
|
||||
@@ -2279,8 +2279,8 @@ void xlu__disk_yyset_lineno (int line_number , yyscan_t yyscanner)
|
||||
|
||||
/* lineno is only valid if an input buffer exists. */
|
||||
if (! YY_CURRENT_BUFFER )
|
||||
yy_fatal_error( "xlu__disk_yyset_lineno called with no buffer" , yyscanner);
|
||||
|
||||
yy_fatal_error( "xlu__disk_yyset_lineno called with no buffer" , yyscanner);
|
||||
|
||||
yylineno = line_number;
|
||||
}
|
||||
|
||||
@@ -2294,8 +2294,8 @@ void xlu__disk_yyset_column (int column_no , yyscan_t yyscanner)
|
||||
|
||||
/* column is only valid if an input buffer exists. */
|
||||
if (! YY_CURRENT_BUFFER )
|
||||
yy_fatal_error( "xlu__disk_yyset_column called with no buffer" , yyscanner);
|
||||
|
||||
yy_fatal_error( "xlu__disk_yyset_column called with no buffer" , yyscanner);
|
||||
|
||||
yycolumn = column_no;
|
||||
}
|
||||
|
||||
@@ -2378,20 +2378,20 @@ int xlu__disk_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_gl
|
||||
errno = EINVAL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
*ptr_yy_globals = (yyscan_t) xlu__disk_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
|
||||
|
||||
|
||||
if (*ptr_yy_globals == NULL){
|
||||
errno = ENOMEM;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* By setting to 0xAA, we expose bugs in
|
||||
yy_init_globals. Leave at 0x00 for releases. */
|
||||
memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
|
||||
|
||||
|
||||
xlu__disk_yyset_extra (yy_user_defined, *ptr_yy_globals);
|
||||
|
||||
|
||||
return yy_init_globals ( *ptr_yy_globals );
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
@@ -55,7 +55,7 @@ typedef uint32_t flex_uint32_t;
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
|
||||
@@ -193,7 +193,7 @@ struct yy_buffer_state
|
||||
|
||||
int yy_bs_lineno; /**< The line count. */
|
||||
int yy_bs_column; /**< The column count. */
|
||||
|
||||
|
||||
/* Whether to try to fill the input buffer when we reach the
|
||||
* end of it.
|
||||
*/
|
||||
|
||||
@@ -99,7 +99,7 @@ static void setformat(DiskParseContext *dpc, const char *str) {
|
||||
else if (!strcmp(str,"vhd")) DSET(dpc,format,FORMAT,str,VHD);
|
||||
else xlu__disk_err(dpc,str,"unknown value for format");
|
||||
}
|
||||
|
||||
|
||||
/* Sets ->backend from the string. IDL should provide something for this. */
|
||||
static void setbackendtype(DiskParseContext *dpc, const char *str) {
|
||||
if ( !strcmp(str,"phy")) DSET(dpc,backend,BACKEND,str,PHY);
|
||||
@@ -107,7 +107,7 @@ static void setbackendtype(DiskParseContext *dpc, const char *str) {
|
||||
else if (!strcmp(str,"qdisk")) DSET(dpc,backend,BACKEND,str,QDISK);
|
||||
else xlu__disk_err(dpc,str,"unknown value for backendtype");
|
||||
}
|
||||
|
||||
|
||||
#define DEPRECATE(usewhatinstead) /* not currently reported */
|
||||
|
||||
%}
|
||||
|
||||
@@ -33,7 +33,7 @@ int xlu_cfg_readfile(XLU_Config*, const char *real_filename);
|
||||
int xlu_cfg_readdata(XLU_Config*, const char *data, int length);
|
||||
/* If these fail, then it is undefined behaviour to call xlu_cfg_get_...
|
||||
* functions. You have to just xlu_cfg_destroy. */
|
||||
|
||||
|
||||
void xlu_cfg_destroy(XLU_Config*);
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ static void parse_global_config(const char *configfile,
|
||||
|
||||
xlu_cfg_destroy(config);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int opt = 0;
|
||||
|
||||
+12
-12
@@ -586,7 +586,7 @@ static void parse_config_data(const char *configfile_filename_report,
|
||||
}else{
|
||||
libxl_uuid_generate(&c_info->uuid);
|
||||
}
|
||||
|
||||
|
||||
if (!xlu_cfg_get_long(config, "oos", &l))
|
||||
c_info->oos = l;
|
||||
|
||||
@@ -1472,7 +1472,7 @@ static int create_domain(struct domain_create *dom_info)
|
||||
/* when we receive a domain we get its name from the config
|
||||
* file; and we receive it to a temporary name */
|
||||
assert(!common_domname);
|
||||
|
||||
|
||||
common_domname = d_config.c_info.name;
|
||||
d_config.c_info.name = 0; /* steals allocation from config */
|
||||
|
||||
@@ -1655,7 +1655,7 @@ start:
|
||||
|
||||
/* Some settings only make sense on first boot. */
|
||||
paused = 0;
|
||||
if (common_domname
|
||||
if (common_domname
|
||||
&& strcmp(d_config.c_info.name, common_domname)) {
|
||||
d_config.c_info.name = strdup(common_domname);
|
||||
}
|
||||
@@ -2267,8 +2267,8 @@ static void list_domains(int verbose, int context, const libxl_dominfo *info, in
|
||||
int rc;
|
||||
size_t size;
|
||||
char *buf;
|
||||
rc = libxl_flask_sid_to_context(ctx, info[i].ssidref, &buf,
|
||||
&size);
|
||||
rc = libxl_flask_sid_to_context(ctx, info[i].ssidref, &buf,
|
||||
&size);
|
||||
if (rc < 0)
|
||||
printf(" -");
|
||||
else {
|
||||
@@ -3657,7 +3657,7 @@ static int sched_credit_domain_get(
|
||||
rc = libxl_sched_credit_domain_get(ctx, domid, scinfo);
|
||||
if (rc)
|
||||
fprintf(stderr, "libxl_sched_credit_domain_get failed.\n");
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -5254,7 +5254,7 @@ int main_getenforce(int argc, char **argv)
|
||||
else if (ret == 0)
|
||||
printf("Permissive\n");
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main_setenforce(int argc, char **argv)
|
||||
@@ -5281,14 +5281,14 @@ int main_setenforce(int argc, char **argv)
|
||||
help("setenforce");
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
ret = libxl_flask_setenforce(ctx, mode);
|
||||
|
||||
if (ret) {
|
||||
if (errno == ENOSYS) {
|
||||
fprintf(stderr, "Flask XSM disabled\n");
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "error occured while setting enforcing mode (%i)\n", ret);
|
||||
}
|
||||
|
||||
@@ -5316,7 +5316,7 @@ int main_loadpolicy(int argc, char **argv)
|
||||
ret = -1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
ret = stat(polFName, &info);
|
||||
if ( ret < 0 ) {
|
||||
fprintf(stderr, "Error occurred retrieving information about"
|
||||
@@ -5325,7 +5325,7 @@ int main_loadpolicy(int argc, char **argv)
|
||||
}
|
||||
|
||||
polMemCp = malloc(info.st_size);
|
||||
|
||||
|
||||
ret = read(polFd, polMemCp, info.st_size);
|
||||
if ( ret < 0 ) {
|
||||
fprintf(stderr, "Unable to read new Flask policy file: %s\n",
|
||||
|
||||
@@ -54,7 +54,7 @@ struct cmd_spec cmd_table[] = {
|
||||
&main_reboot, 0,
|
||||
"Issue a reboot signal to a domain",
|
||||
"<Domain>",
|
||||
},
|
||||
},
|
||||
{ "pci-attach",
|
||||
&main_pciattach, 0,
|
||||
"Insert a new pass-through pci device",
|
||||
@@ -393,7 +393,7 @@ struct cmd_spec *cmdtable_lookup(const char *s)
|
||||
size_t len;
|
||||
int i, count = 0;
|
||||
|
||||
if (!s)
|
||||
if (!s)
|
||||
return NULL;
|
||||
len = strlen(s);
|
||||
for (i = 0; i < cmdtable_len; i++) {
|
||||
|
||||