Date: Thu, 27 Apr 2000 10:54:04 -0700 (PDT) From: Archie Cobbs <archie@whistle.com> To: freebsd-arch@freebsd.org Subject: ASCII <--> binary conversion in the kernel Message-ID: <200004271754.KAA66171@bubba.whistle.com>
next in thread | raw e-mail | index | archive | help
Hi, In developing netgraph we came up with a way to easily convert an arbitrary C structure, even one with variable length array fields, into a human readable ASCII string and back, all farily efficiently from within the kernel. The code that does this is completely indepedent from the rest of netgraph and lives in these files: /usr/src/sys/netgraph/ng_parse.h /usr/src/sys/netgraph/ng_parse.c It occurred to me that this capability might be useful in other parts of the kernel, e.g., "device hints" structures, KLD module initialization files, sysctl, etc. It's not even limited to C structures; it can convert any structured binary data to ASCII and back. Just wanted to give people a heads-up in case anyone is looking for such a thing. We've found it pretty handy. For details, see: http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netgraph/ng_parse.h?rev=1.3 -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004271754.KAA66171>