qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PATCH for-2.10 07/16] block/file-posix: G


From: Stefan Hajnoczi
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH for-2.10 07/16] block/file-posix: Generalize raw_regular_truncate
Date: Wed, 22 Mar 2017 16:44:13 +0000
User-agent: Mutt/1.7.1 (2016-10-04)

On Mon, Mar 20, 2017 at 04:11:24PM +0100, Max Reitz wrote:
> On 20.03.2017 12:00, Stefan Hajnoczi wrote:
> > On Mon, Mar 13, 2017 at 10:40:36PM +0100, Max Reitz wrote:
> >> +static int raw_regular_truncate(int fd, BlockDriverState *bs, int64_t 
> >> offset,
> > 
> > The presence of both a file descriptor and a BlockDriverState (actually
> > it must be a BDRVRawState) arguments is unusual.  It seems bs is needed
> > for bdrv_getlength().
> > 
> > How about using fstat(fd, &st) and then dropping bs and create?
> 
> Well, I could do that, but bdrv_getlength() is a bit simpler and I don't
> see much of an issue with specifying both an fd and a bs.

Arguments that provide overlapping information make the function harder
to understand and use correctly (there are combinations of these
arguments that are invalid or don't make sense).  Saving a few lines of
code in the function implementation is a poor trade-off IMO.

Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]