[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Problem with Xen headerfiles
On Tue, Jul 02, 2013 at 06:06:43PM +0430, Mina Jafari wrote: > I tryied to implement it in xen but this time I had problems with xc_*** > functions which are in libxc library and can't be used there! > where I really should implement this program? > So "implement it in Xen" means you're trying to add functionality to Xen. I don't know what you're trying to do, but apparently you're mixing Xen internal things with user space tool libraries. If you need to modify Xen, don't include *any* user space headers, and don't link against user space libraries. On the other hand, to develop a user space program, you might be better off using your distro's pre-packaged Xen and its development package / header files. Wei. > > On Tue, Jul 2, 2013 at 12:39 PM, Wei Liu <wei.liu2@xxxxxxxxxx> wrote: > > > As you're writing a user space program you should only include public > > headers installed in your system. Including internal header files of Xen > > will not work. > > > > > > Wei. > > > > On Tue, Jul 02, 2013 at 12:09:41PM +0430, Mina Jafari wrote: > > > Hi all, > > > I'm trying to compile this program to map domu's page. But it returns > > > errors that can't find headerfiles! > > > > > > *gcc -c map_page.c -I/***/xen/xen-4.1.2/xen/include -lxenctrl -o > > > map_page.o* > > > *In file included from > > > /home/ossl5/xen/xen-4.1.2original/xen/include/asm/smp.h:16:0, > > > from > > > /home/ossl5/xen/xen-4.1.2original/xen/include/xen/smp.h:5, > > > from > > > /home/ossl5/xen/xen-4.1.2original/xen/include/xen/sched.h:8, > > > from /usr/include/xenctrl.h:43, > > > from map_page.c:2: > > > /home/ossl5/xen/xen-4.1.2original/xen/include/asm-x86/mpspec.h:6:25: > > fatal > > > error: mach_mpspec.h: No such file or directory > > > compilation terminated. > > > * > > > > > > And as I see this file isn't really located in this directory. I modified > > > the path included, and compile it again. This time returned error about > > not > > > finding another headerfile and "previous declaration"! > > > > > > *gcc -I/***/xen/xen-4.1.2original/xen/include -lxenctrl map_page.c -o > > > map_page.o > > > In file included from > > > /***/xen/xen-4.1.2original/xen/include/xen/sched.h:9:0, > > > from /usr/include/xenctrl.h:43, > > > from map_page.c:2: > > > /***/xen/xen-4.1.2original/xen/include/xen/shared.h:13:3: error: > > > conflicting types for âshared_info_tâ > > > In file included from /usr/include/xenctrl.h:37:0, > > > from map_page.c:2: > > > /usr/include/xen/xen.h:537:28: note: previous declaration of > > > âshared_info_tâ was here > > > In file included from > > > /***/xen/xen-4.1.2original/xen/include/xen/sched.h:9:0, > > > from /usr/include/xenctrl.h:43, > > > from map_page.c:2: > > > /***/xen/xen-4.1.2original/xen/include/xen/shared.h:28:3: error: > > > conflicting types for âvcpu_info_tâ > > > In file included from /usr/include/xenctrl.h:37:0, > > > from map_page.c:2: > > > /usr/include/xen/xen.h:477:26: note: previous declaration of > > âvcpu_info_tâ > > > was here > > > In file included from > > > /***/xen/xen-4.1.2original/xen/include/xen/hvm/irq.h:28:0, > > > from > > > /***/xen/xen-4.1.2original/xen/include/asm/hvm/irq.h:25, > > > from > > > /***/xen/xen-4.1.2original/xen/include/asm/hvm/vpt.h:32, > > > from > > > /***/xen/xen-4.1.2original/xen/include/asm/hvm/vlapic.h:27, > > > from > > > /***/xen/xen-4.1.2original/xen/include/asm/hvm/vcpu.h:25, > > > from > > /***/xen/xen-4.1.2original/xen/include/asm/domain.h:6, > > > from > > /***/xen/xen-4.1.2original/xen/include/xen/domain.h:6, > > > from > > /***/xen/xen-4.1.2original/xen/include/xen/sched.h:19, > > > from /usr/include/xenctrl.h:43, > > > from map_page.c:2: > > > /***/xen/xen-4.1.2original/xen/include/asm/irq.h:10:25: fatal error: > > > irq_vectors.h: No such file or directory > > > compilation terminated.* > > > > > > Am I compiling it in a wrong way that it couldn't find headerfiles? > > > > > > Here is my program "map_page.c" located in xen directory. > > > * > > > #include <stdio.h> > > > #include <xenctrl.h> > > > #include <xs_api.h> > > > #include <asm-x86/current.h> > > > #include <xen/sched.h> > > > > > > > > > typedef unsigned long long guest_word_t; > > > > > > int main() > > > { > > > > > > vcpu_guest_context_any_t *vcpu_ctx_any; > > > int vcpu = 0; > > > int ret = 0 ; > > > xc_interface *xch = 0; > > > char *domid = 0; > > > char *buffer; > > > guest_word_t virt; > > > > > > > > > > > > > > > struct xs_handle *h = xs_daemon_open(); > > > xch = xc_interface_open(0,0,0); > > > if (xc_handle < 0) { > > > printf ("error : xc_interface_open"); > > > exit (-1); > > > } > > > > > > domid = get_dom_domid (h); > > > //typedef struct vcpu *current_vcpu = get_cpu_info()->current_vcpu; > > > //vcpu = current_vcpu.vcpu_id; > > > vcpu_setcontext (vcpu); > > > buffer = (char)map_page(vcpu_ctx_any,vcpu,virt); > > > > > > > > > xc_interface_close(xch); > > > return(0); > > > } > > > > > > > > > > > > static void *map_page(vcpu_guest_context_any_t *ctx, int vcpu, > > guest_word_t > > > virt) > > > { > > > static unsigned long previous_mfn = 0; > > > static void *mapped = NULL; > > > > > > unsigned long mfn = xc_translate_foreign_address(xc_handle, domid, > > > vcpu, virt); > > > unsigned long offset = virt & ~XC_PAGE_MASK; > > > > > > if (mapped && mfn == previous_mfn) > > > goto out; > > > > > > if (mapped) > > > munmap(mapped, XC_PAGE_SIZE); > > > > > > previous_mfn = mfn; > > > > > > mapped = xc_map_foreign_range(xc_handle, domid, XC_PAGE_SIZE, 0, > > mfn); > > > > > > if (mapped == NULL) { > > > fprintf(stderr, "failed to map page.\n"); > > > exit(-1); > > > } > > > > > > out: > > > return (void *)(mapped + offset); > > > } > > > * > > > > > _______________________________________________ > > > Xen-devel mailing list > > > Xen-devel@xxxxxxxxxxxxx > > > http://lists.xen.org/xen-devel > > > > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |