On 12/21/2011 05:20 PM, NeilBrown wrote: > It is certainly nice and simple. It really looks more like a filesystem than > a char device though... though they aren't really files so much as lossy > pipes. I don't think that's a problem though, lots of things in filesystems > don't behave exactly like files. > > If you created a 'logbuf' filesystem that used libfs to provide a single > directory in which privileged processes could create files then you wouldn't > need the kernel to "know" the allowed logs: radio, events, main, system. > The size could be set by ftruncate() (by privileged used again) rather than > being hardcoded. > > You would defined 'read' and 'write' much like you currently do to create a list of > datagrams in a circular buffer and replace the ioctls by more standard > interfaces: > > LOGGER_GET_LOG_BUG_SIZE would use 'stat' and the st_blocks field > LOGGER_GET_LOG_LEN would use 'stat' and the st_size field > LOGGER_GET_NEXT_ENTRY_LEN could use the FIONREAD ioctl > LOGGER_FLUSH_LOG could use ftruncate > > The result would be much the same amount of code, but an interface which has > fewer details hard-coded and is generally more versatile and accessible. This is a very interesting suggestion. I think it would be good to create a prototype of this and see how it affects the user-space code as well as what the kernel-side issues would be (and to check whether this would change any of the current logger semantics). It would also have the side effect of allowing runtime modification of the buffer size, though I'm not sure whether that's useful or not. Thanks! -- Tim ============================= Tim Bird Architecture Group Chair, CE Workgroup of the Linux Foundation Senior Staff Engineer, Sony Network Entertainment ============================= -- To unsubscribe from this list: send the line "unsubscribe linux-embedded" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html