From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46191 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwUlF-0007Yy-N4 for qemu-devel@nongnu.org; Fri, 17 Sep 2010 02:49:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwUlC-0008C2-0L for qemu-devel@nongnu.org; Fri, 17 Sep 2010 02:49:26 -0400 Received: from a.mx.secunet.com ([195.81.216.161]:52165) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwUlB-0008BK-Jf for qemu-devel@nongnu.org; Fri, 17 Sep 2010 02:49:25 -0400 Message-ID: <4C930F9B.5010007@secunet.com> Date: Fri, 17 Sep 2010 08:50:03 +0200 From: Mathias Krause MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] CMOS file support References: <1284645517-32743-1-git-send-email-mathias.krause@secunet.com> <4C9251C6.2090705@codemonkey.ws> In-Reply-To: <4C9251C6.2090705@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org 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? >> +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