Formatting time in kernel
lulf at stud.ntnu.no
Wed May 31 02:24:02 PDT 2006
On Tue, May 30, 2006 at 07:17:45PM -0500, Rick C. Petty wrote:
> On Fri, May 26, 2006 at 10:59:18PM +0200, Ulf Lilleengen wrote:
> > I've been looking through the kernel code the past few days, but I have not found
> > what I'm looking for, which is a way to format "struct timeval" for output
> > in the same matter as the ctime(3) in the standard libc. I keep thinking how this part of the code
> > should not be in kernel because of this, but things will be vastly more
> > complicated if not because of the whole gvinum structure. (This is for use in
> > the gvinum dumpconfig option I'm working on, and I'm not sure if it's really that important
> > showing the creation time, but that's a different discussion).
> Why can't you just pass the struct timeval up to the userland tool and have
> gvinum call ctime? Or at the very least pass up a time_t. Maybe go the
> other route and pass up the whole gv_label (I'm assuming this is the
> structure you're talking about).. /sbin/gvinum already has to include
> vinum/geom_vinum_var.h so it's not like it's very kernel-specific (e.g.
> #ifdef KERNEL). I personally feel that stuff like this belongs in userland
> not kernel, parsing or converting times, etc.
I agree, but currently the output list, printconfig and those are heavily
formatted in the kernel, so I was just looking for the easy way out as a
temporate solution. However, I intend to pass the whole configuration to userland, not just the
label, and let the tools format it there, as I see to this point see no reason
for it to be in the kernel.
Mvh Ulf Lilleengen
More information about the freebsd-hackers