SOLVED.
For Xenstore the null terminated caracter is MANDATORY, when
calculating the size of the string to pass it to xenbus_send the
function strlen does not count the \0 at the end, so when memcpy is
executed the null does not go to the buffer. Hence the function
onearg() in xenstored_core will return null when extracting the path.
Sorry my bad....
Daniel
On Tue, Aug 2, 2011 at 9:32 PM, Daniel Castro <evil.dani@xxxxxxxxx> wrote:
> On Mon, Aug 1, 2011 at 9:42 PM, Daniel Castro <evil.dani@xxxxxxxxx> wrote:
>> Hello All,
>>
>> I am having some trouble with xenstore, so any ideas to solve this
>> "small" problem will be greatly appreciated.
>>
>> Right now the rings for xenbus connections is created but whenever I
>> send anything to xenstore (XS_READ, XS_WRITE, XS_GET_PERMS or
>> XS_DIRECTORY) the response is 22 if I do a XS_DEBUG I get a 13. On the
>> xenstore trace log I get for example:
>> IN 0x1f53050 20110801 21:15:25 GET_PERMS (/local/domain/0)
>> OUT 0x1f53050 20110801 21:15:25 ERROR (EINVAL )
>> IN 0x1f53050 20110801 21:15:25 DEBUG (/local/domain/0)
>> OUT 0x1f53050 20110801 21:15:25 ERROR (EACCES )
>> The address for the rings is correct and the response code corresponds
>> to the error number.
>>
>> The connection works the same way as in hvmloader xenbus.c
>>
>> The relevant code is like this:
>> char *test = "/local/domain/0"; //path to query
>> char * replay_data = malloc_high(1024); //buffer for response
>> memset(replay_data,0,1024);
>> replay_data[1023] = '\0'; //sanity check
>> int replay_len = 0; //no response yet
>> ret = xenbus_send(XS_DIRECTORY,strlen(test),test,&replay_len,&replay_data);
>>
>> After the xenbus_send the replay_data buffer is empty.
>>
>> Any ideas?
>>
>
> Since nobody had any ideas I went by myself and modified the code of
> xenstored_core and xenstored_domain in order to get to the bottom of
> this.
>
> I am adding lines like:
> trace("error on method XX in file YY where return should be THIS: %d, error);
> To the methods I am calling so far with this results:
>
> IN 0x13c5590 20110802 21:19:39 READ (/local/domain/1/device/pci/0/state )
> Got message READ len 35 from 0x13c5590
> Writing msg READ (1) out to 0x13c5590 domid 16843009
> OUT 0x13c5590 20110802 21:19:39 READ (1)
> IN 0x13b51f0 20110802 21:19:40 GET_PERMS (/local/domain/0)
> Got message GET_PERMS len 15 from 0x13b51f0
> debug: get_node in core; error name or is not valid node_name: (null)
> Error node does not exist
> Writing msg ERROR (EINVAL) out to 0x13b51f0 domid 16843009
> OUT 0x13b51f0 20110802 21:19:40 ERROR (EINVAL )
> IN 0x13b51f0 20110802 21:19:40 DEBUG (/local/domain/0)
> Got message DEBUG len 15 from 0x13b51f0
>
> Two things catch my attention:
> * The domid for the operation in xenstore is incorrect. Maybe I need
> to do something about that. Since this code is being run when
> hvmloader is deploying the BIOS on main memory maybe I have to do
> something to introduce the domain to xenstore?
> * The node string for GET_PERMS is getting to be null, so either it
> does not exist or is being lost in the process. Again I am trying to
> get /local/domain/0 according to xenstore-ls it does exist.
>
>
> In order to make this work I have to add to the init script of
> xenstored the --verbose option, and the following in
> /etc/defaults/xencommons:
> XENCONSOLED_TRACE=all
> XENSTORED_TRACE=yes
> XENBACKENDD_DEBUG=yes
>
>
> I will keep digging on the matter.
>
> Daniel
>
--
+-=====---------------------------+
| +---------------------------------+ | This space intentionally blank
for notetaking.
| | | Daniel Castro, |
| | | Consultant/Programmer.|
| | | U Andes |
+-------------------------------------+
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|