⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xc.c

📁 xen 3.2.2 源码
💻 C
📖 第 1 页 / 共 4 页
字号:
      " cpumap [list, []]: list of usable CPUs.\n\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "domain_setcpuweight",       (PyCFunction)pyxc_domain_setcpuweight,       METH_VARARGS | METH_KEYWORDS, "\n"      "Set cpuweight scheduler parameter for domain.\n"      " dom [int]:            Identifier of domain to be changed.\n"      " cpuweight [float, 1]: VCPU being pinned.\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "domain_sethandle",       (PyCFunction)pyxc_domain_sethandle,      METH_VARARGS, "\n"      "Set domain's opaque handle.\n"      " dom [int]:            Identifier of domain.\n"      " handle [list of 16 ints]: New opaque handle.\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "domain_getinfo",       (PyCFunction)pyxc_domain_getinfo,       METH_VARARGS | METH_KEYWORDS, "\n"      "Get information regarding a set of domains, in increasing id order.\n"      " first_dom [int, 0]:    First domain to retrieve info about.\n"      " max_doms  [int, 1024]: Maximum number of domains to retrieve info"      " about.\n\n"      "Returns: [list of dicts] if list length is less than 'max_doms'\n"      "         parameter then there was an error, or the end of the\n"      "         domain-id space was reached.\n"      " dom      [int]: Identifier of domain to which this info pertains\n"      " cpu      [int]:  CPU to which this domain is bound\n"      " vcpus    [int]:  Number of Virtual CPUS in this domain\n"      " dying    [int]:  Bool - is the domain dying?\n"      " crashed  [int]:  Bool - has the domain crashed?\n"      " shutdown [int]:  Bool - has the domain shut itself down?\n"      " paused   [int]:  Bool - is the domain paused by control software?\n"      " blocked  [int]:  Bool - is the domain blocked waiting for an event?\n"      " running  [int]:  Bool - is the domain currently running?\n"      " 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"      " shutdown_reason [int]: Numeric code from guest OS, explaining "      "reason why it shut itself down.\n" },    { "vcpu_getinfo",       (PyCFunction)pyxc_vcpu_getinfo,       METH_VARARGS | METH_KEYWORDS, "\n"      "Get information regarding a VCPU.\n"      " dom  [int]:    Domain to retrieve info about.\n"      " vcpu [int, 0]: VCPU to retrieve info about.\n\n"      "Returns: [dict]\n"      " online   [int]:  Bool - Is this VCPU currently online?\n"      " blocked  [int]:  Bool - Is this VCPU blocked waiting for an event?\n"      " running  [int]:  Bool - Is this VCPU currently running on a CPU?\n"      " cpu_time [long]: CPU time consumed, in nanoseconds\n"      " cpumap   [int]:  Bitmap of CPUs this VCPU can run on\n"      " cpu      [int]:  CPU that this VCPU is currently bound to\n" },    { "linux_build",       (PyCFunction)pyxc_linux_build,       METH_VARARGS | METH_KEYWORDS, "\n"      "Build a new Linux guest OS.\n"      " dom     [int]:      Identifier of domain to build into.\n"      " image   [str]:      Name of kernel image file. May be gzipped.\n"      " ramdisk [str, n/a]: Name of ramdisk file, if any.\n"      " cmdline [str, n/a]: Kernel parameters, if any.\n\n"      " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "hvm_build",       (PyCFunction)pyxc_hvm_build,       METH_VARARGS | METH_KEYWORDS, "\n"      "Build a new HVM guest OS.\n"      " dom     [int]:      Identifier of domain to build into.\n"      " image   [str]:      Name of HVM loader image file.\n"      " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "hvm_get_param",       (PyCFunction)pyxc_get_hvm_param,       METH_VARARGS | METH_KEYWORDS, "\n"      "get a parameter of HVM guest OS.\n"      " dom     [int]:      Identifier of domain to build into.\n"      " param   [int]:      No. of HVM param.\n"      "Returns: [long] value of the param.\n" },    { "hvm_set_param",       (PyCFunction)pyxc_set_hvm_param,       METH_VARARGS | METH_KEYWORDS, "\n"      "set a parameter of HVM guest OS.\n"      " dom     [int]:      Identifier of domain to build into.\n"      " param   [int]:      No. of HVM param.\n"      " value   [long]:     Value of param.\n"      "Returns: [int] 0 on success.\n" },     { "test_assign_device",       (PyCFunction)pyxc_test_assign_device,       METH_VARARGS | METH_KEYWORDS, "\n"       "test device assignment with VT-d.\n"       " dom     [int]:      Identifier of domain to build into.\n"       " pci_str [str]:      PCI devices.\n"       "Returns: [int] 0 on success, or device bdf that can't be assigned.\n" },      { "sched_id_get",      (PyCFunction)pyxc_sched_id_get,      METH_NOARGS, "\n"      "Get the current scheduler type in use.\n"      "Returns: [int] sched_id.\n" },        { "sedf_domain_set",      (PyCFunction)pyxc_sedf_domain_set,      METH_KEYWORDS, "\n"      "Set the scheduling parameters for a domain when running with Atropos.\n"      " dom       [int]:  domain to set\n"      " period    [long]: domain's scheduling period\n"      " slice     [long]: domain's slice per period\n"      " latency   [long]: domain's wakeup latency hint\n"      " extratime [int]:  domain aware of extratime?\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "sedf_domain_get",      (PyCFunction)pyxc_sedf_domain_get,      METH_VARARGS, "\n"      "Get the current scheduling parameters for a domain when running with\n"      "the Atropos scheduler."      " dom       [int]: domain to query\n"      "Returns:   [dict]\n"      " domain    [int]: domain ID\n"      " period    [long]: scheduler period\n"      " slice     [long]: CPU reservation per period\n"      " latency   [long]: domain's wakeup latency hint\n"      " extratime [int]:  domain aware of extratime?\n"},        { "sched_credit_domain_set",      (PyCFunction)pyxc_sched_credit_domain_set,      METH_KEYWORDS, "\n"      "Set the scheduling parameters for a domain when running with the\n"      "SMP credit scheduler.\n"      " domid     [int]:   domain id to set\n"      " weight    [short]: domain's scheduling weight\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "sched_credit_domain_get",      (PyCFunction)pyxc_sched_credit_domain_get,      METH_VARARGS, "\n"      "Get the scheduling parameters for a domain when running with the\n"      "SMP credit scheduler.\n"      " domid     [int]:   domain id to get\n"      "Returns:   [dict]\n"      " weight    [short]: domain's scheduling weight\n"},    { "evtchn_alloc_unbound",       (PyCFunction)pyxc_evtchn_alloc_unbound,      METH_VARARGS | METH_KEYWORDS, "\n"      "Allocate an unbound port that will await a remote connection.\n"      " dom        [int]: Domain whose port space to allocate from.\n"      " remote_dom [int]: Remote domain to accept connections from.\n\n"      "Returns: [int] Unbound event-channel port.\n" },    { "evtchn_reset",       (PyCFunction)pyxc_evtchn_reset,      METH_VARARGS | METH_KEYWORDS, "\n"      "Reset all connections.\n"      " dom [int]: Domain to reset.\n" },    { "physdev_pci_access_modify",      (PyCFunction)pyxc_physdev_pci_access_modify,      METH_VARARGS | METH_KEYWORDS, "\n"      "Allow a domain access to a PCI device\n"      " dom    [int]: Identifier of domain to be allowed access.\n"      " bus    [int]: PCI bus\n"      " dev    [int]: PCI slot\n"      " func   [int]: PCI function\n"      " enable [int]: Non-zero means enable access; else disable access\n\n"      "Returns: [int] 0 on success; -1 on error.\n" },     { "readconsolering",       (PyCFunction)pyxc_readconsolering,       METH_VARARGS | METH_KEYWORDS, "\n"      "Read Xen's console ring.\n"      " clear [int, 0]: Bool - clear the ring after reading from it?\n\n"      "Returns: [str] string is empty on failure.\n" },    { "physinfo",      (PyCFunction)pyxc_physinfo,      METH_NOARGS, "\n"      "Get information about the physical host machine\n"      "Returns [dict]: information about the hardware"      "        [None]: on failure.\n" },    { "xeninfo",      (PyCFunction)pyxc_xeninfo,      METH_NOARGS, "\n"      "Get information about the Xen host\n"      "Returns [dict]: information about Xen"      "        [None]: on failure.\n" },    { "shadow_control",       (PyCFunction)pyxc_shadow_control,       METH_VARARGS | METH_KEYWORDS, "\n"      "Set parameter for shadow pagetable interface\n"      " dom [int]:   Identifier of domain.\n"      " op [int, 0]: operation\n\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "shadow_mem_control",       (PyCFunction)pyxc_shadow_mem_control,       METH_VARARGS | METH_KEYWORDS, "\n"      "Set or read shadow pagetable memory use\n"      " dom [int]:   Identifier of domain.\n"      " mb [int, -1]: MB of shadow memory this domain should have.\n\n"      "Returns: [int] MB of shadow memory in use by this domain.\n" },    { "domain_setmaxmem",       (PyCFunction)pyxc_domain_setmaxmem,       METH_VARARGS, "\n"      "Set a domain's memory limit\n"      " dom [int]: Identifier of domain.\n"      " maxmem_kb [int]: .\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "domain_set_memmap_limit",       (PyCFunction)pyxc_domain_set_memmap_limit,       METH_VARARGS, "\n"      "Set a domain's physical memory mappping limit\n"      " dom [int]: Identifier of domain.\n"      " map_limitkb [int]: .\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "domain_memory_increase_reservation",       (PyCFunction)pyxc_domain_memory_increase_reservation,       METH_VARARGS | METH_KEYWORDS, "\n"      "Increase a domain's memory reservation\n"      " dom [int]: Identifier of domain.\n"      " mem_kb [long]: .\n"      "Returns: [int] 0 on success; -1 on error.\n" },#ifdef __ia64__    { "nvram_init",      (PyCFunction)pyxc_nvram_init,      METH_VARARGS, "\n"      "Init nvram in IA64 platform\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "set_os_type",      (PyCFunction)pyxc_set_os_type,      METH_VARARGS, "\n"      "Set guest OS type on IA64 platform\n"      "Returns: [int] 0 on success; -1 on error.\n" },#endif /* __ia64__ */    { "domain_ioport_permission",      (PyCFunction)pyxc_domain_ioport_permission,      METH_VARARGS | METH_KEYWORDS, "\n"      "Allow a domain access to a range of IO ports\n"      " dom          [int]: Identifier of domain to be allowed access.\n"      " first_port   [int]: First IO port\n"      " nr_ports     [int]: Number of IO ports\n"      " allow_access [int]: Non-zero means enable access; else disable access\n\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "domain_irq_permission",      (PyCFunction)pyxc_domain_irq_permission,      METH_VARARGS | METH_KEYWORDS, "\n"      "Allow a domain access to a physical IRQ\n"      " dom          [int]: Identifier of domain to be allowed access.\n"      " pirq         [int]: The Physical IRQ\n"      " allow_access [int]: Non-zero means enable access; else disable access\n\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "domain_iomem_permission",      (PyCFunction)pyxc_domain_iomem_permission,      METH_VARARGS | METH_KEYWORDS, "\n"      "Allow a domain access to a range of IO memory pages\n"      " dom          [int]: Identifier of domain to be allowed access.\n"      " first_pfn   [long]: First page of I/O Memory\n"      " nr_pfns     [long]: Number of pages of I/O Memory (>0)\n"      " allow_access [int]: Non-zero means enable access; else disable access\n\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "pages_to_kib",      (PyCFunction)pyxc_pages_to_kib,      METH_VARARGS, "\n"      "Returns: [int]: The size in KiB of memory spanning the given number "      "of pages.\n" },    { "domain_set_time_offset",      (PyCFunction)pyxc_domain_set_time_offset,      METH_VARARGS, "\n"      "Set a domain's time offset to Dom0's localtime\n"      " dom        [int]: Domain whose time offset is being set.\n"      " offset     [int]: Time offset from UTC in seconds.\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "domain_send_trigger",      (PyCFunction)pyxc_domain_send_trigger,      METH_VARARGS | METH_KEYWORDS, "\n"      "Send trigger to a domain.\n"      " dom     [int]: Identifier of domain to be sent trigger.\n"      " trigger [int]: Trigger type number.\n"      " vcpu    [int]: VCPU to be sent trigger.\n"      "Returns: [int] 0 on success; -1 on error.\n" },    { "send_debug_keys",      (PyCFunction)pyxc_send_debug_keys,      METH_VARARGS | METH_KEYWORDS, "\n"      "Inject debug keys into Xen.\n"      " keys    [str]: String of keys to inject.\n" },#ifdef __powerpc__    { "arch_alloc_real_mode_area",       (PyCFunction)pyxc_alloc_real_mode_area,       METH_VARARGS | METH_KEYWORDS, "\n"      "Allocate a domain's real mode area.\n"      " dom [int]: Identifier of domain.\n"      " log [int]: Specifies the area's size.\n"      "Returns: [int] 0 on success; -1 on error.\n" },#endif /* __powerpc */    { NULL, NULL, 0, NULL }};static PyObject *PyXc_getattr(PyObject *obj, char *name){    return Py_FindMethod(pyxc_methods, obj, name);}static PyObject *PyXc_new(PyTypeObject *type, PyObject *args, PyObject *kwds){    XcObject *self = (XcObject *)type->tp_alloc(type, 0);    if (self == NULL)        return NULL;    self->xc_handle = -1;    return (PyObject *)self;}static intPyXc_init(XcObject *self, PyObject *args, PyObject *kwds){    if ((self->xc_handle = xc_interface_open()) == -1) {        pyxc_error_to_exception();        return -1;    }    return 0;}static void PyXc_dealloc(XcObject *self){    if (self->xc_handle != -1) {        xc_interface_close(self->xc_handle);        self->xc_handle = -1;    }    self->ob_type->tp_free((PyObject *)self);}static PyTypeObject PyXcType = {    PyObject_HEAD_INIT(NULL)    0,    PKG "." CLS,    sizeof(XcObject),    0,    (destructor)PyXc_dealloc,     /* tp_dealloc        */    NULL,                         /* tp_print          */    PyXc_getattr,                 /* tp_getattr        */    NULL,                         /* tp_setattr        */    NULL,                         /* tp_compare        */    NULL,                         /* tp_repr           */    NULL,                         /* tp_as_number      */    NULL,                         /* tp_as_sequence    */    NULL,                         /* tp_as_mapping     */    NULL,                         /* tp_hash           */    NULL,                         /* tp_call           */    NULL,                         /* tp_str            */    NULL,                         /* tp_getattro       */    NULL,                         /* tp_setattro       */    NULL,                         /* tp_as_buffer      */    Py_TPFLAGS_DEFAULT,           /* tp_flags          */    "Xen client connections",     /* tp_doc            */    NULL,                         /* tp_traverse       */    NULL,                         /* tp_clear          */    NULL,                         /* tp_richcompare    */    0,                            /* tp_weaklistoffset */    NULL,                         /* tp_iter           */    NULL,                         /* tp_iternext       */    pyxc_methods,                 /* tp_methods        */    NULL,                         /* tp_members        */    NULL,                         /* tp_getset         */    NULL,                         /* tp_base           */    NULL,                         /* tp_dict           */    NULL,                         /* tp_descr_get      */    NULL,                         /* tp_descr_set      */    0,                            /* tp_dictoffset     */    (initproc)PyXc_init,          /* tp_init           */    NULL,                         /* tp_alloc          */    PyXc_new,                     /* tp_new            */};static PyMethodDef xc_methods[] = { { NULL } };PyMODINIT_FUNC initxc(void){    PyObject *m;    if (PyType_Ready(&PyXcType) < 0)        return;    m = Py_InitModule(PKG, xc_methods);    if (m == NULL)      return;    xc_error_obj = PyErr_NewException(PKG ".Error", PyExc_RuntimeError, NULL);    zero = PyInt_FromLong(0);    /* KAF: This ensures that we get debug output in a timely manner. */    setbuf(stdout, NULL);    setbuf(stderr, NULL);    Py_INCREF(&PyXcType);    PyModule_AddObject(m, CLS, (PyObject *)&PyXcType);    Py_INCREF(xc_error_obj);    PyModule_AddObject(m, "Error", xc_error_obj);    /* Expose some libxc constants to Python */    PyModule_AddIntConstant(m, "XEN_SCHEDULER_SEDF", XEN_SCHEDULER_SEDF);    PyModule_AddIntConstant(m, "XEN_SCHEDULER_CREDIT", XEN_SCHEDULER_CREDIT);}/* * Local variables: *  c-indent-level: 4 *  c-basic-offset: 4 * End: */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -