From 57e067d108197f59dc97c8298ec7ce5fae71487b Mon Sep 17 00:00:00 2001 From: "kaf24@freefall.cl.cam.ac.uk" Date: Thu, 21 Oct 2004 15:10:27 +0000 Subject: [PATCH] bitkeeper revision 1.1159.124.2 (4177d163xinza3-p0e7_VEpiJ-okNA) Remove domain names from Xen. These are now stored only within xend. --- tools/libxc/xc.h | 7 ---- tools/libxc/xc_domain.c | 16 --------- tools/libxc/xc_linux_restore.c | 44 +++---------------------- tools/libxc/xc_linux_save.c | 5 --- tools/python/xen/lowlevel/xc/xc.c | 44 +++---------------------- tools/python/xen/xend/XendDomain.py | 9 ----- tools/python/xen/xend/XendDomainInfo.py | 6 ++-- xen/common/dom0_ops.c | 28 +++------------- xen/common/domain.c | 7 ---- xen/include/hypervisor-ifs/dom0_ops.h | 36 +++++++------------- xen/include/xen/sched.h | 4 +-- 11 files changed, 27 insertions(+), 179 deletions(-) diff --git a/tools/libxc/xc.h b/tools/libxc/xc.h index e022feb7eb..ddee505e5f 100644 --- a/tools/libxc/xc.h +++ b/tools/libxc/xc.h @@ -31,8 +31,6 @@ typedef struct { unsigned long nr_pages; unsigned long shared_info_frame; u64 cpu_time; -#define XC_DOMINFO_MAXNAME 16 - char name[XC_DOMINFO_MAXNAME]; unsigned long max_memkb; } xc_dominfo_t; @@ -46,7 +44,6 @@ typedef struct xc_shadow_control_stats_st int xc_domain_create(int xc_handle, unsigned int mem_kb, - const char *name, int cpu, float cpu_weight, u32 *pdomid); @@ -193,10 +190,6 @@ int xc_physinfo(int xc_handle, int xc_sched_id(int xc_handle, int *sched_id); -int xc_domain_setname(int xc_handle, - u32 domid, - char *name); - int xc_domain_setinitialmem(int xc_handle, u32 domid, unsigned int initial_memkb); diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index 601f338c42..958d85a69e 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -10,7 +10,6 @@ int xc_domain_create(int xc_handle, unsigned int mem_kb, - const char *name, int cpu, float cpu_weight, u32 *pdomid) @@ -21,8 +20,6 @@ int xc_domain_create(int xc_handle, op.cmd = DOM0_CREATEDOMAIN; op.u.createdomain.domain = (domid_t)*pdomid; op.u.createdomain.memory_kb = mem_kb; - strncpy(op.u.createdomain.name, name, MAX_DOMAIN_NAME); - op.u.createdomain.name[MAX_DOMAIN_NAME-1] = '\0'; op.u.createdomain.cpu = cpu; if ( (err = do_dom0_op(xc_handle, &op)) == 0 ) @@ -113,8 +110,6 @@ int xc_domain_getinfo(int xc_handle, info->max_memkb = op.u.getdomaininfo.max_pages<<(PAGE_SHIFT); info->shared_info_frame = op.u.getdomaininfo.shared_info_frame; info->cpu_time = op.u.getdomaininfo.cpu_time; - strncpy(info->name, op.u.getdomaininfo.name, XC_DOMINFO_MAXNAME); - info->name[XC_DOMINFO_MAXNAME-1] = '\0'; next_domid = (u16)op.u.getdomaininfo.domain + 1; info++; @@ -165,17 +160,6 @@ int xc_shadow_control(int xc_handle, return (rc == 0) ? op.u.shadow_control.pages : rc; } -int xc_domain_setname(int xc_handle, - u32 domid, - char *name) -{ - dom0_op_t op; - op.cmd = DOM0_SETDOMAINNAME; - op.u.setdomainname.domain = (domid_t)domid; - strncpy(op.u.setdomainname.name, name, MAX_DOMAIN_NAME); - return do_dom0_op(xc_handle, &op); -} - int xc_domain_setcpuweight(int xc_handle, u32 domid, float weight) diff --git a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c index 93b78c4c87..247e972fd6 100644 --- a/tools/libxc/xc_linux_restore.c +++ b/tools/libxc/xc_linux_restore.c @@ -102,9 +102,6 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt) /* First 16 bytes of the state file must contain 'LinuxGuestRecord'. */ char signature[16]; - /* A copy of the domain's name. */ - char name[MAX_DOMAIN_NAME]; - /* A table containg the type of each PFN (/not/ MFN!). */ unsigned long *pfn_type = NULL; @@ -149,8 +146,7 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt) goto out; } - if ( xcio_read(ioctxt, name, sizeof(name)) || - xcio_read(ioctxt, &nr_pfns, sizeof(unsigned long)) || + if ( xcio_read(ioctxt, &nr_pfns, sizeof(unsigned long)) || xcio_read(ioctxt, pfn_to_mfn_frame_list, PAGE_SIZE) ) { xcio_error(ioctxt, "Error reading header"); @@ -163,17 +159,6 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt) goto out; } - for ( i = 0; i < MAX_DOMAIN_NAME; i++ ) - { - if ( name[i] == '\0' ) break; - if ( name[i] & 0x80 ) - { - xcio_error(ioctxt, "Random characters in domain name"); - goto out; - } - } - name[MAX_DOMAIN_NAME-1] = '\0'; - if ( nr_pfns > 1024*1024 ) { xcio_error(ioctxt, "Invalid state file -- pfn count out of range"); @@ -199,30 +184,9 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt) goto out; } -#if 0 - /* Set the domain's name to that from the restore file */ - if ( xc_domain_setname( xc_handle, dom, name ) ) - { - xcio_error(ioctxt, "Could not set domain name"); - goto out; - } - - /* Set the domain's initial memory allocation - to that from the restore file */ - - if ( xc_domain_setinitialmem(xc_handle, dom, - nr_pfns * (PAGE_SIZE / 1024)) ) - { - xcio_error(ioctxt, "Could not set domain %d initial memory. pfns=%d, %dKB", - dom, nr_pfns,nr_pfns * (PAGE_SIZE / 1024)); - goto out; - } -#endif - - - /* XXX create domain on CPU=-1 so that in future it auto load ballances by default */ - if ( xc_domain_create( xc_handle, nr_pfns * (PAGE_SIZE / 1024), - "", -1, 1, &dom ) ) + /* Create domain on CPU -1 so that it may auto load-balance in future. */ + if ( xc_domain_create(xc_handle, nr_pfns * (PAGE_SIZE / 1024), + -1, 1, &dom) ) { xcio_error(ioctxt, "Could not create domain. pfns=%d, %dKB", nr_pfns,nr_pfns * (PAGE_SIZE / 1024)); diff --git a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c index 86dd872054..504a1223e2 100644 --- a/tools/libxc/xc_linux_save.c +++ b/tools/libxc/xc_linux_save.c @@ -303,9 +303,6 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) /* A copy of the CPU context of the guest. */ full_execution_context_t ctxt; - /* A copy of the domain's name. */ - char name[MAX_DOMAIN_NAME]; - /* A table containg the type of each PFN (/not/ MFN!). */ unsigned long *pfn_type = NULL; unsigned long *pfn_batch = NULL; @@ -359,7 +356,6 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) xcio_error(ioctxt, "Could not get full domain info"); goto out; } - memcpy(name, op.u.getdomaininfo.name, sizeof(name)); shared_info_frame = op.u.getdomaininfo.shared_info_frame; /* A cheesy test to see whether the domain contains valid state. */ @@ -539,7 +535,6 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt) /* Start writing out the saved-domain record. */ if ( xcio_write(ioctxt, "LinuxGuestRecord", 16) || - xcio_write(ioctxt, name, sizeof(name)) || xcio_write(ioctxt, &nr_pfns, sizeof(unsigned long)) || xcio_write(ioctxt, pfn_to_mfn_frame_list, PAGE_SIZE) ){ xcio_error(ioctxt, "Error writing header"); diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 1e4c9af930..61287b2c38 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -42,21 +42,19 @@ static PyObject *pyxc_domain_create(PyObject *self, XcObject *xc = (XcObject *)self; unsigned int mem_kb = 0; - char *name = "(anon)"; int cpu = -1; float cpu_weight = 1; u32 dom = 0; int ret; - static char *kwd_list[] = { "dom", "mem_kb", "name", - "cpu", "cpu_weight", NULL }; + static char *kwd_list[] = { "dom", "mem_kb", "cpu", "cpu_weight", NULL }; - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iisif", kwd_list, - &dom, &mem_kb, &name, &cpu, &cpu_weight)) + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiif", kwd_list, + &dom, &mem_kb, &cpu, &cpu_weight)) return NULL; if ( (ret = xc_domain_create( - xc->xc_handle, mem_kb, name, cpu, cpu_weight, &dom)) < 0 ) + xc->xc_handle, mem_kb, cpu, cpu_weight, &dom)) < 0 ) return PyErr_SetFromErrno(xc_error); return PyInt_FromLong(dom); @@ -172,7 +170,7 @@ static PyObject *pyxc_domain_getinfo(PyObject *self, PyList_SetItem( list, i, Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i" - ",s:l,s:L,s:s,s:l,s:i}", + ",s:l,s:L,s:l,s:i}", "dom", info[i].domid, "cpu", info[i].cpu, "dying", info[i].dying, @@ -183,7 +181,6 @@ static PyObject *pyxc_domain_getinfo(PyObject *self, "running", info[i].running, "mem_kb", info[i].nr_pages*4, "cpu_time", info[i].cpu_time, - "name", info[i].name, "maxmem_kb", info[i].max_memkb, "shutdown_reason", info[i].shutdown_reason )); @@ -779,27 +776,6 @@ static PyObject *pyxc_rrobin_global_get(PyObject *self, return Py_BuildValue("{s:L}", "slice", slice); } -static PyObject *pyxc_domain_setname(PyObject *self, - PyObject *args, - PyObject *kwds) -{ - XcObject *xc = (XcObject *)self; - u32 dom; - char *name; - - static char *kwd_list[] = { "dom", "name", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list, - &dom, &name) ) - return NULL; - - if ( xc_domain_setname(xc->xc_handle, dom, name) != 0 ) - return PyErr_SetFromErrno(xc_error); - - Py_INCREF(zero); - return zero; -} - static PyObject *pyxc_domain_setmaxmem(PyObject *self, PyObject *args, PyObject *kwds) @@ -830,7 +806,6 @@ static PyMethodDef pyxc_methods[] = { "Create a new domain.\n" " dom [int, 0]: Domain identifier to use (allocated if zero).\n" " mem_kb [int, 0]: Memory allocation, in kilobytes.\n" - " name [str, '(anon)']: Informative textual name.\n\n" "Returns: [int] new domain identifier; -1 on error.\n" }, { "domain_pause", @@ -883,7 +858,6 @@ static PyMethodDef pyxc_methods[] = { " mem_kb [int]: Memory reservation, in kilobytes\n" " maxmem_kb [int]: Maximum memory limit, in kilobytes\n" " cpu_time [long]: CPU time consumed, in nanoseconds\n" - " name [str]: Identifying name\n" " shutdown_reason [int]: Numeric code from guest OS, explaining " "reason why it shut itself down.\n" }, @@ -1071,14 +1045,6 @@ static PyMethodDef pyxc_methods[] = { " op [int, 0]: operation\n\n" "Returns: [int] 0 on success; -1 on error.\n" }, - { "domain_setname", - (PyCFunction)pyxc_domain_setname, - METH_VARARGS | METH_KEYWORDS, "\n" - "Set domain informative textual name\n" - " dom [int]: Identifier of domain.\n" - " name [str]: Text string.\n\n" - "Returns: [int] 0 on success; -1 on error.\n" }, - { "domain_setmaxmem", (PyCFunction)pyxc_domain_setmaxmem, METH_VARARGS | METH_KEYWORDS, "\n" diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index 72e004edb2..8c616be689 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -355,15 +355,6 @@ class XendDomain: deferred.addCallback(cbok) return deferred - def domain_setname(self, dom, name): - """Set the name of a domain. - For internal use only. - - @param dom: domain id - @param name: domain name - """ - return xc.domain_setname(dom=dom, name=name) - def domain_restart(self, dominfo): """Restart a domain. diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index b8aba6bb99..5e7764da9e 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -236,7 +236,7 @@ def vm_recreate(savedinfo, info): if config: d = vm.construct(config) else: - vm.name = info['name'] + vm.name = sxp.child_value(savedinfo, 'name') d = defer.succeed(vm) vm.recreate = 0 return d @@ -434,8 +434,6 @@ class XendDomainInfo: self.cpu_weight = float(sxp.child_value(config, 'cpu_weight', '1')) except: raise VmError('invalid cpu weight') - if self.restore and self.dom: - xc.domain_setname(self.dom, self.name) self.memory = int(sxp.child_value(config, 'memory')) if self.memory is None: raise VmError('missing memory size') @@ -690,7 +688,7 @@ class XendDomainInfo: raise VmError('invalid cpu') cpu_weight = self.cpu_weight dom = xc.domain_create(dom= dom, mem_kb= memory * 1024, - name= name, cpu= cpu, cpu_weight= cpu_weight) + cpu= cpu, cpu_weight= cpu_weight) if dom <= 0: raise VmError('Creating domain failed: name=%s memory=%d' % (name, memory)) diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c index 09b9d5d2d5..12762d1af9 100644 --- a/xen/common/dom0_ops.c +++ b/xen/common/dom0_ops.c @@ -42,9 +42,10 @@ static inline int is_free_domid(domid_t dom) return 0; } -/** Allocate a free domain id. We try to reuse domain ids in a fairly low range, - * only expanding the range when there are no free domain ids. This is to - * keep domain ids in a range depending on the number that exist simultaneously, +/* + * Allocate a free domain id. We try to reuse domain ids in a fairly low range, + * only expanding the range when there are no free domain ids. This is to keep + * domain ids in a range depending on the number that exist simultaneously, * rather than incrementing domain ids in the full 32-bit range. */ static int allocate_domid(domid_t *pdom) @@ -208,12 +209,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op) if ( (d = do_createdomain(dom, pro)) == NULL ) break; - if ( op->u.createdomain.name[0] ) - { - strncpy(d->name, op->u.createdomain.name, MAX_DOMAIN_NAME); - d->name[MAX_DOMAIN_NAME - 1] = '\0'; - } - ret = alloc_new_dom_mem(d, op->u.createdomain.memory_kb); if ( ret != 0 ) { @@ -359,7 +354,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op) read_unlock_irqrestore(&tasklist_lock, flags); op->u.getdomaininfo.domain = d->domain; - strcpy(op->u.getdomaininfo.name, d->name); op->u.getdomaininfo.flags = (test_bit(DF_DYING, &d->flags) ? DOMFLAGS_DYING : 0) | @@ -543,20 +537,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op) } break; - case DOM0_SETDOMAINNAME: - { - struct domain *d; - ret = -ESRCH; - d = find_domain_by_id( op->u.setdomainname.domain ); - if ( d != NULL ) - { - strncpy(d->name, op->u.setdomainname.name, MAX_DOMAIN_NAME); - put_domain(d); - ret = 0; - } - } - break; - case DOM0_SETDOMAININITIALMEM: { struct domain *d; diff --git a/xen/common/domain.c b/xen/common/domain.c index d7509bc976..99039c10df 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -24,7 +24,6 @@ struct domain *task_list; struct domain *do_createdomain(domid_t dom_id, unsigned int cpu) { - char buf[100]; struct domain *d, **pd; unsigned long flags; @@ -59,11 +58,6 @@ struct domain *do_createdomain(domid_t dom_id, unsigned int cpu) return NULL; } - /* We use a large intermediate to avoid overflow in sprintf. */ - sprintf(buf, "Domain-%u", dom_id); - strncpy(d->name, buf, MAX_DOMAIN_NAME); - d->name[MAX_DOMAIN_NAME-1] = '\0'; - arch_do_createdomain(d); sched_add_domain(d); @@ -81,7 +75,6 @@ struct domain *do_createdomain(domid_t dom_id, unsigned int cpu) } else { - sprintf(d->name, "Idle-%d", cpu); sched_add_domain(d); } diff --git a/xen/include/hypervisor-ifs/dom0_ops.h b/xen/include/hypervisor-ifs/dom0_ops.h index 11bec43e95..05eaa4ad20 100644 --- a/xen/include/hypervisor-ifs/dom0_ops.h +++ b/xen/include/hypervisor-ifs/dom0_ops.h @@ -19,9 +19,7 @@ * This makes sure that old versions of dom0 tools will stop working in a * well-defined way (rather than crashing the machine, for instance). */ -#define DOM0_INTERFACE_VERSION 0xAAAA0017 - -#define MAX_DOMAIN_NAME 16 +#define DOM0_INTERFACE_VERSION 0xAAAA0019 /************************************************************************/ @@ -53,15 +51,14 @@ typedef struct { /* IN parameters. */ memory_t memory_kb; /* 0 */ MEMORY_PADDING; - u8 name[MAX_DOMAIN_NAME]; /* 8 */ - u32 cpu; /* 24 */ - u32 __pad0; /* 28 */ + u32 cpu; /* 8 */ + u32 __pad0; /* 12 */ /* IN/OUT parameters. */ /* If 0, domain is allocated. If non-zero use it unless in use. */ - domid_t domain; /* 32 */ + domid_t domain; /* 16 */ u16 __pad1; /* OUT parameters. */ -} PACKED dom0_createdomain_t; /* 36 bytes */ +} PACKED dom0_createdomain_t; /* 20 bytes */ #define DOM0_DESTROYDOMAIN 9 typedef struct { @@ -101,17 +98,16 @@ typedef struct { #define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */ #define DOMFLAGS_SHUTDOWNSHIFT 16 u32 flags; /* 4 */ - u8 name[MAX_DOMAIN_NAME]; /* 8 */ - full_execution_context_t *ctxt; /* 24 */ /* NB. IN/OUT variable. */ + full_execution_context_t *ctxt; /* 8 */ /* NB. IN/OUT variable. */ MEMORY_PADDING; - memory_t tot_pages; /* 32 */ + memory_t tot_pages; /* 16 */ MEMORY_PADDING; - memory_t max_pages; /* 40 */ + memory_t max_pages; /* 24 */ MEMORY_PADDING; - memory_t shared_info_frame; /* 48: MFN of shared_info struct */ + memory_t shared_info_frame; /* 32: MFN of shared_info struct */ MEMORY_PADDING; - u64 cpu_time; /* 56 */ -} PACKED dom0_getdomaininfo_t; /* 64 bytes */ + u64 cpu_time; /* 40 */ +} PACKED dom0_getdomaininfo_t; /* 48 bytes */ #define DOM0_BUILDDOMAIN 13 typedef struct { @@ -298,15 +294,6 @@ typedef struct { dom0_shadow_control_stats_t stats; } PACKED dom0_shadow_control_t; - -#define DOM0_SETDOMAINNAME 26 -typedef struct { - /* IN variables. */ - domid_t domain; /* 0 */ - u16 __pad; - u8 name[MAX_DOMAIN_NAME]; /* 4 */ -} PACKED dom0_setdomainname_t; /* 20 bytes */ - #define DOM0_SETDOMAININITIALMEM 27 typedef struct { /* IN variables. */ @@ -375,7 +362,6 @@ typedef struct { dom0_pcidev_access_t pcidev_access; dom0_sched_id_t sched_id; dom0_shadow_control_t shadow_control; - dom0_setdomainname_t setdomainname; dom0_setdomaininitialmem_t setdomaininitialmem; dom0_setdomainmaxmem_t setdomainmaxmem; dom0_getpageframeinfo2_t getpageframeinfo2; diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 10fb93bac0..a5647c56ce 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -2,7 +2,6 @@ #define __SCHED_H__ #define STACK_SIZE (2*PAGE_SIZE) -#define MAX_DOMAIN_NAME 16 #include #include @@ -85,7 +84,6 @@ struct domain */ domid_t domain; - char name[MAX_DOMAIN_NAME]; s_time_t create_time; spinlock_t page_alloc_lock; /* protects all the following fields */ @@ -135,7 +133,7 @@ struct domain * "interesting" (i.e. have clear bits) */ /* Handy macro - number of bytes of the IO bitmap, per selector bit. */ -#define IOBMP_SELBIT_LWORDS ( IO_BITMAP_SIZE / 64 ) +#define IOBMP_SELBIT_LWORDS (IO_BITMAP_SIZE / 64) unsigned long *io_bitmap; /* Pointer to task's IO bitmap or NULL */ unsigned long flags; -- 2.39.5