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

Re: [Libguestfs] [PATCH 8/12] hivex: Add HIVEX_OPEN_WRITE flag to allow hive to be opened for writing.



On 03/02/10 18:34, Richard W.M. Jones wrote:
> Subject: [PATCH 08/12] hivex: Add HIVEX_OPEN_WRITE flag to allow hive to be opened for writing.
> 
> If this flag is omitted (as in the case for all existing callers)
> then the hive is still opened read-only.
> 
> We add a 'writable' flag to the hive handle, and we change the way
> that the hive file (data) is stored.  The data is still mmapped if
> the file is opened read-only, since that is more efficient and allows
> us to handle larger hives.  However if we need to write to the file
> then we have to read it all into memory, since if we had to extend the
> file we need to realloc that data.
> 
> Note the manpage section L</WRITING TO HIVE FILES> comes in a later
> commit.

I'm not convinced this is a good idea. It introduces an asymmetry which
is like to lead to head-scratching bugs down the line.

Why can't we mremap where realloc would be necessary?

Matt
-- 
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

M:       +44 (0)7977 267231
GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490


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