[lkml]   [2001]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: /proc format (was Device Registry (DevReg) Patch 0.2.0)
    ---------  Received message begins Here  ---------

    > On Wednesday 25 April 2001 19:10, you wrote:
    > > The command
    > > more foo/* foo/*/*
    > > will display the values in the foo subtree nicely, I think.
    > Unfortunately it displays only the values. Dumping numbers and strings
    > without knowing their meaning (and probably not even the order) is not very
    > useful.
    > > Better to factor the XML part out to a userspace library...
    > But the one-value per file approach is MORE work. It would be less work to
    > create XML and factor out the directory structure in user-space :)
    > Devreg collects its data from the drivers, each driver should contribute the
    > information that it can provide about the device.
    > Printing a few values in XML format using the functions from xmlprocfs is as
    > easy as writing
    > proc_printf(fragment, "<usb:topology port=\"%d\" portnum=\"%d\"/>\n",
    > get_portnum(usbdev), usbdev->maxchild);
    > Extending the devreg output with driver-specific data means registering a
    > callback function that prints the driver's data. The driver should use its
    > own XML namespace, so whatever the driver adds will not break any
    > (well-written) user-space applications. The data is created on-demand, so the
    > values can be dynamic and do not waste any space when devreg is not used.
    > The code is easy to read and not larger than a solution that creates static
    > /proc entries, and holding the data completely static would take much more
    > memory. And it takes less code than a solution that would create the values
    > in /proc dynamically because this would mean one callback per file or a
    > complicated way to specify several values with a single callback.

    Personally, I think

    proc_printf(fragment, "%d %d",get_portnum(usbdev), usbdev->maxchild);

    (or the string "dddd ddd" with d representing a digit)

    is shorter (and faster) to parse with

    fscanf(input,"%d %d",&usbdev,&maxchild);

    Than it would be to try parsing

    <usb:topology port="ddddd" portnum="dddd">

    with an XML parser.

    Sorry - XML is good for some things. It is not designed to be a
    interface language between a kernel and user space.

    I am NOT in favor of "one file per value", but structured data needs
    to be written in a reasonable, concise manner. XML is intended for
    communication between disparate systems in an exreemly precise manner
    to allow some self documentation to be included when the communication

    Even Lisp S expressions are easier :-)

    Jesse I Pollard, II

    Any opinions expressed are solely my own.
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 12:52    [W:0.022 / U:7.232 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site