lkml.org 
[lkml]   [2006]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How to document dimension units for virtual files?
Hi!

> > > 2. Encode dimension unit into filename (e.g. onlinetime_ms or
> memory_kb)
> >
> > This is the recommended one.
> > - simple to implement and understand on both sides
> >
> > - if you change units, you notice breaking userspace immediately
> > and can even notice it being used in closed source tools
> > with a simple strace
> >
> > - no parsing involved, as the author of the user space tool
> > usually assumes the unit implicitly (like "programming by contract",
> where
> > the "contract" is the filename, which is quite easy to check for.
> >
> > - you can keep a legacy interface with neglible effort and code wastage
> >
> > - many advantages I forgot :-)
> >
>
> I also think that this is the best solution. It would be nice to have
> that documented somewhere. Maybe in the Documentation directory
> something like:
>
> Howto export data in virtual files
> ==================================
>
> If you want to export data to userspace via virtual filesystems
> like procfs, sysfs, debugfs etc., the following rules are recommended:

...yes please... such patch would be nice.

> - Export only one value in one virtual file.
> - Data format should be as simple as possible.
> - Use ASCII formated strings, no binary data if possible.
> - If data has dimension units, encode that in the filename.
> Please use the following suffixes:
> * kb: Kilobytes
> * mb: Megabytes

just use B for bytes....

--
Thanks for all the (sleeping) penguins.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-10-28 20:43    [W:0.050 / U:1.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site