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

📄 xc.c

📁 xen虚拟机源代码安装包
💻 C
📖 第 1 页 / 共 5 页
字号:
      " 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" },    { "get_device_group",      (PyCFunction)pyxc_get_device_group,      METH_VARARGS, "\n"      "get sibling devices infomation.\n"      " dom     [int]:      Domain to assign device to.\n"      " seg     [int]:      PCI segment.\n"      " bus     [int]:      PCI bus.\n"      " dev     [int]:      PCI dev.\n"      " func    [int]:      PCI func.\n"      "Returns: [string]:   Sibling devices \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" },     { "assign_device",       (PyCFunction)pyxc_assign_device,       METH_VARARGS | METH_KEYWORDS, "\n"       "Assign device to IOMMU domain.\n"       " dom     [int]:      Domain to assign device to.\n"       " pci_str [str]:      PCI devices.\n"       "Returns: [int] 0 on success, or device bdf that can't be assigned.\n" },     { "deassign_device",       (PyCFunction)pyxc_deassign_device,       METH_VARARGS | METH_KEYWORDS, "\n"       "Deassign device from IOMMU domain.\n"       " dom     [int]:      Domain to deassign device from.\n"       " pci_str [str]:      PCI devices.\n"       "Returns: [int] 0 on success, or device bdf that can't be deassigned.\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_map_pirq",      (PyCFunction)pyxc_physdev_map_pirq,      METH_VARARGS | METH_KEYWORDS, "\n"      "map physical irq to guest pirq.\n"      " dom     [int]:      Identifier of domain to map for.\n"      " index   [int]:      physical irq.\n"      " pirq    [int]:      guest pirq.\n"      "Returns: [long] value of the param.\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" },#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" },#if defined(__i386__) || defined(__x86_64__)    { "domain_check_cpuid",       (PyCFunction)pyxc_dom_check_cpuid,       METH_VARARGS, "\n"      "Apply checks to host CPUID.\n"      " input [long]: Input for cpuid instruction (eax)\n"      " sub_input [long]: Second input (optional, may be None) for cpuid "      "                     instruction (ecx)\n"      " config [dict]: Dictionary of register\n"      " config [dict]: Dictionary of register, use for checking\n\n"      "Returns: [int] 0 on success; exception on error.\n" },        { "domain_set_cpuid",       (PyCFunction)pyxc_dom_set_cpuid,       METH_VARARGS, "\n"      "Set cpuid response for an input and a domain.\n"      " dom [int]: Identifier of domain.\n"      " input [long]: Input for cpuid instruction (eax)\n"      " sub_input [long]: Second input (optional, may be None) for cpuid "      "                     instruction (ecx)\n"      " config [dict]: Dictionary of register\n\n"      "Returns: [int] 0 on success; exception on error.\n" },    { "domain_set_policy_cpuid",       (PyCFunction)pyxc_dom_set_policy_cpuid,       METH_VARARGS, "\n"      "Set the default cpuid policy for a domain.\n"      " dom [int]: Identifier of domain.\n\n"      "Returns: [int] 0 on success; exception on error.\n" },    { "domain_set_machine_address_size",      (PyCFunction)pyxc_dom_set_machine_address_size,      METH_VARARGS, "\n"      "Set maximum machine address size for this domain.\n"      " dom [int]: Identifier of domain.\n"      " width [int]: Maximum machine address width.\n" },#endif    { 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 + -