Re: early_printk accessing __log_buf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 18 Jul 2007 23:37:34 -0400 Robin Getz <[email protected]> wrote:

> On Wed 18 Jul 2007 19:53, Mike Frysinger pondered:
> > On 7/18/07, Robin Getz <[email protected]> wrote:
> > > On Wed 18 Jul 2007 18:16, Andrew Morton pondered:
> > > > I'd suggest that any interface into here should be via function calls,
> > > > not via direct access to printk internals: think up some nice
> > > > copy_me_some_of_the_log_buffer() interface.
> > >
> > > If so - I would still like to put it in:
> > >  - ifdef CONFIG_EARLY_PRINTK
> > >  - and define as __init
> > >
> > > so that people don't use it when they shouldn't (when the kernel is up an
> > > running).
> > >
> > > Something simple like - early_copy_log_buff(void *dest, size_t n)
> > >
> > > copies n bytes from log_buf to memory area dest. Returns number of bytes that
> > > could not be copied. Can find out how many bytes are in the log_buff by
> > > calling with zero size.
> > >
> > > This is not destructive to existing interfaces (log_start and con_start are
> > > not updated/used). This should ensure that if booting does work - that normal
> > > messages come out the standard method.
> > >
> > > Any other suggestions?
> > 
> > maybe something as cheesy as early_get_log_buf() ?  that way you dont
> > have to do any buffer management, you can just operate read-only on
> > the string ...
> 
> I actually thought I might just do something like:
> 
>   char *c;
>   while (early_copy_log_buff(c, 1))
> 	out_early_serial_byte(c);
> 
> that way - I don't need to be very complex in the arch code.
> 
> That is about as cheesy/easy as I could think of...
> 

Let's forget the "early" stuff - there are applications of this at
oops-time as well, and that's as late as it gets ;)


How about

	int log_buf_read(int index, char *my_char);

You pass it a zero to start off, and it returns 0 or -1 if `index' is out
of bounds.

Probably we'd also need a log_buf_size(int) to find out how much is in there
at present (for people who want to read the last 1000 bytes).


Something simple and general, anyway.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux