All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Mathias Krause <mathias.krause@secunet.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] CMOS file support
Date: Fri, 17 Sep 2010 08:27:56 -0500	[thread overview]
Message-ID: <4C936CDC.1030207@codemonkey.ws> (raw)
In-Reply-To: <4C930F9B.5010007@secunet.com>

On 09/17/2010 01:50 AM, Mathias Krause wrote:
> Am 16.09.2010 19:20 schrieb Anthony Liguori:
>    
>> Instead of using FILE, I'd suggest using a BlockDriver to read and write
>> the data.
>>      
> I'll fix that as soon as I figured how to use this interface.
>
>    
>> I think it would be very nice to add write support too so that writes to
>> CMOS were persisted across boots.
>>      
> Indeed. Also I would like to have a command line interface like '-cmos
> cmos.bin' instead of the ugly '-global mc146818rtc.file=cmos.bin'. But
> I'm not aware how to create such an alias. Any pointers?
>    

Unfortunately, it's a little complicated although it should get better 
in the future.   The right way to do this today would be:

   -drive file=cmos.bin,if=none,id=nvram -global mc146818rtc.drive=nvram

The use of -drive is historic.  We'll have a better option in the future 
that will look something like:

  -blockdev file=cmos.bin,id=nvram -global mc146818rtc.drive=nvram

But in either case, I'd suggest adding an -nvram option that was:

  -nvram <filename>

Which would do:

   drive_add(optarg, "if=none,id=nvram");

And then in the RTC code, default drive to nvram.

It gets a little tough to handle the case of in memory CMOS.

Regards,

Anthony Liguori

>    
>>> +static long get_file_size(FILE *f)
>>> +{
>>> +    long where, size;
>>> +
>>> +    /* XXX: on Unix systems, using fstat() probably makes more sense */
>>> +
>>> +    where = ftell(f);
>>> +    fseek(f, 0, SEEK_END);
>>> +    size = ftell(f);
>>> +    fseek(f, where, SEEK_SET);
>>> +
>>> +    return size;
>>> +}
>>>
>>>        
>> BlockDrivers have a getlength() functions.
>>      
> Would reduce the size of the patch which is always a good thing (tm).
>
>
> Mathias
>    

  reply	other threads:[~2010-09-17 13:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-16 13:58 [Qemu-devel] [PATCH] CMOS file support Mathias Krause
2010-09-16 16:49 ` Stefan Weil
2010-09-17  6:42   ` Mathias Krause
2010-09-17 10:44     ` Kevin Wolf
2010-09-17 11:28       ` Mathias Krause
2010-09-24 12:40         ` Markus Armbruster
2010-09-17 10:58     ` Stefan Weil
2010-09-17 11:16       ` Mathias Krause
2010-09-16 17:20 ` Anthony Liguori
2010-09-17  6:50   ` Mathias Krause
2010-09-17 13:27     ` Anthony Liguori [this message]
2010-09-22 19:43       ` Mathias Krause
2010-09-23 12:12         ` [Qemu-devel] " Paolo Bonzini
2010-09-24 12:47         ` [Qemu-devel] " Markus Armbruster
2010-09-26 20:44           ` Mathias Krause
2010-10-11 13:25             ` Markus Armbruster
2010-09-24 12:42   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C936CDC.1030207@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=armbru@redhat.com \
    --cc=mathias.krause@secunet.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.