WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: xl: Add subcommand 'xl dmesg'

Ian Jackson writes ("[Xen-devel] Re: xl: Add subcommand 'xl dmesg'"):
> Are we sure that calling the logging function for every line in the
> ring is really what we want ?  If nothing else this will repeat
> messages.

Having thought about this some more (and had a chat with Stefano) I
think the right libxl interface is an iterator, something like this:

 struct libxl_xen_console_reader*
 libxl_xen_console_read_start(struct libxl_ctx*);

 int
 libxl_xen_console_read_line(struct libxl_ctx*,
                             struct libxl_xen_console_reader*,
                             char **line_r);
   /* return values:                                          *line_r
    *   1          success, whole line obtained from buffer    non-0
    *   0          no more lines available right now           0
    *   negative   error code ERROR_*                          0
    * On success *line_r is updated to point to a nul-terminated
    * string which is valid until the next call on the same console
    * reader.  The libxl caller may overwrite parts of the string
    * if it wishes. */

 void
 libxl_xen_console_read_finish(struct libxl_ctx*,
                               struct libxl_xen_console_reader*);

"xl dmesg" then calls _start, loops calling line, and then calls
_finish.  Other libxl callers can plumb it into logging or poll for
more output of whatever they like.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel