Re: Formatting time in kernel



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
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Gcov-kernel patch update for 2.6.0-test3
    ... Here's another resync of the kernel patch (originally by Hubertus Franke ... and Rajan Ravindran) to allow the gcov coverage analysis tool to be used ... * The .ctors-section contains a list of pointers to constructor ... static struct memchunk *freechunks; ...
    (Linux-Kernel)
  • [PATCH 2 of 18] ipath - core driver header files
    ... ipath_debug.h contains mask values used for controlling driver debugging. ... * to communicate between kernel and user code. ... * This struct must have explict pad fields where type sizes ... * We could have a single register get/put routine, that takes a group type, ...
    (Linux-Kernel)
  • Re: [HP ProLiant WatchDog driver] hpwdt HP WatchDog Patch
    ... specific HW Timer located in the HP ProLiant iLO 2 ASIC. ... development kernel. ... `struct SMBIOS_entry_point' would be more typical. ... +hpwdt_ioctl(struct file *file, unsigned int cmd, ...
    (Linux-Kernel)
  • Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions
    ... Existing FXSAVE kernels will have set it to zero. ... There might be fields the existing FXSAVE format which can be equally abused, ... struct state_foo *foo; ... This is not merely extensible, but it's easy for userspace to massage it into whatever format -- longer or shorter -- that it happens to know about, and it gives a natural way for the kernel to communicate "none of this state" by feeding a NULL pointer. ...
    (Linux-Kernel)
  • [PATCH] Add seq_file howto to Documentation/
    ... +traversing a list of kernel items and iterating on that list. ... +function only needs to call seq_openwith a pointer to a struct ... +(0 for the first entry). ... +write static headings or variable data into the seq_file output buffer. ...
    (Linux-Kernel)