hi,
I have the code below, a version of which used to (just before xen3
release) work fine for giving my domain access to a block device. I
have tried to adjust this based on the python source, but my block
device no longer registers in domU :-(
For domU I am using the linux-2.6.12 from xen-unstable (about one week
old) and for dom0 linux-2.6-xen.hg of about the same age.
void setup_vbd(int domid, int uuid, char* vdev, char* pdev)
{
struct xs_transaction_handle* t;
struct xs_permissions xsperms[2];
xsperms[0].id = domid;
xsperms[0].perms = XS_PERM_READ | XS_PERM_WRITE;
char s[256];
char s2[256];
char* home = xs_get_domain_path(xs,domid);
char* dom0_home = xs_get_domain_path(xs,0);
printf("dom0_home is %s\n",dom0_home);
char backend[256];
char frontend[256];
sprintf(backend,"%s/backend/vbd/%d/%d",dom0_home,uuid,domid);
sprintf(frontend, "%s/device/vbd/%d",home,uuid);
xs_begin();
sprintf(s,"%s/domain",backend);
sprintf(s2,"%d",domid);
xs_w(s, s2);
sprintf(s,"%s/frontend",backend);
xs_w(s, frontend );
sprintf(s,"%s/frontend-id",backend);
sprintf(s2,"%d",domid);
xs_w(s, s2 );
sprintf(s, "%s/state", backend);
xs_w(s, "1");
xs_end();
xs_begin();
xs_mkdir(xs,t,backend);
int result = xs_set_permissions(xs, t, backend, xsperms, 1);
sprintf(s,"%s/backend",frontend);
xs_w(s, backend );
sprintf(s, "%s/backend-id", frontend);
xs_w(s, "0");
sprintf(s, "%s/state", frontend);
xs_w(s, "1");
sprintf(s, "%s/virtual-device", frontend);
xs_w(s, vdev );
xs_end();
}
I hope someone can point out the obvious mistake in the code above.
Thanks in advance,
Jacob
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|