[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] modules and hypercall



Hello,

I'm trying to write a module to play with hypercall. So I wrote the following
module:

-------------------------xvifgetinfo.c----------------
/*
 * xvifgetinfo.c
 * 
 * The routines in this file are used to get information about virtual
 * network interface provide by Xen. 
 * 
 */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>

#include <hypervisor-ifs/hypervisor-if.h>
#include <hypervisor-ifs/network.h>

/**
 * init_xvifgetinfo() - this function is called when module is loaded
 * 
 * Description: We try to get information concerning the vif #1 
 *              in domain #0
 */
static int __init init_xvifgetinfo(void)
{
        network_op_t netop;
        long res;

        printk(KERN_INFO "init_xvifgetinfo: Loaded\n");

        netop.cmd = NETWORK_OP_VIFGETINFO;
        netop.u.vif_getinfo.domain = 0;
        netop.u.vif_getinfo.vif = 1;

        res = HYPERVISOR_network_op(&netop);
        if (res < 0) {
                printk(KERN_INFO "init_xvifgetinfo: HYPERVISOR_network_op error
%ld\n", res)
;
                return res;
        }

        return 0;
}

/**
 * cleanup_xvifgetinfo() - this function is called when the module 
 *                    is unloading. 
 */
static void __exit cleanup_xvifgetinfo(void)
{
        /* Nothing to do */
        printk(KERN_INFO "init_xvifgetinfo: Unloaded\n");
}

module_init(init_xvifgetinfo);
module_exit(cleanup_xvifgetinfo);

-------------------------xvifgetinfo.c----------------

I compiled with the following command:
cc -D__KERNEL__  \
   -DMODULE -I/home/guill/dcl/xeno/xeno-unstable.bk/linux-2.4.22/include \
   -I/home/guill/dcl/xeno/xeno-unstable.bk/xen/include \
   -Wall   -c -o xvifgetinfo.o xvifgetinfo.c

The following error is raised when I load the module from domain0:

init_xvifgetinfo: Loaded
init_xvifgetinfo: HYPERVISOR_network_op error -38

Error 38 means that function is not implemented. However, it seems that
the function is implemented. Is it possible to use a module that uses 
hypercall? 

Thanks 
Guillaume




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.