qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Tomáš Golembiovský" <tgolembi@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-nbd: Shrink image size by specified offset
Date: Mon, 3 Oct 2016 15:50:45 +0200	[thread overview]
Message-ID: <20161003155045.6889f89d@fiorina> (raw)
In-Reply-To: <806811cc-5788-a93c-43a3-59271b2cdfbb@redhat.com>

Whops, somehow I completely forgot about this.

On Tue, 20 Sep 2016 09:09:59 -0500
Eric Blake <eblake@redhat.com> wrote:

> On 09/20/2016 04:37 AM, Tomáš Golembiovský wrote:
> 
> [meta-comment]: Your series came through without any threading (you sent
> three threads, instead of patch 1 and 2 being marked In-Reply-To the 0/2
> cover letter).

Thanks for the comment. Unfortunately it was my email client
interfering. It should be better next time.


> > When --offset is set the apparent device size has to be adjusted
> > accordingly. Otherwise client may request read/write beyond the file end
> > which would fail.
> > 
> > Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
> > ---
> >  qemu-nbd.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/qemu-nbd.c b/qemu-nbd.c
> > index 99297a5..629bce1 100644
> > --- a/qemu-nbd.c
> > +++ b/qemu-nbd.c
> > @@ -901,6 +901,13 @@ int main(int argc, char **argv)
> >          exit(EXIT_FAILURE);
> >      }  
> 
> Additional context:
> 
>     off_t dev_offset = 0;
> 
>     off_t fd_size;
> 
> >  
> > +    if (dev_offset >= fd_size) {
> > +        error_report("Offset (%lu) has to be smaller than the image size (%lu)",
> > +                     dev_offset, fd_size);  
> 
> Whoops, this fails to compile on 32-bit platforms.  %lu is not
> necessarily synonymous with off_t values.

After some digging I figured off_t is in fact signed type. That makes
the formatting wrong everywhere. Unfortunately I didn't find any good
definition of the type. Any suggestion what format flag should I use? Or
should I just use a temporary variable of known size for that?


Thanks,

    Tomas


-- 
Tomáš Golembiovský <tgolembi@redhat.com>

  reply	other threads:[~2016-10-03 13:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-20  9:37 [Qemu-devel] [PATCH 1/2] qemu-nbd: Shrink image size by specified offset Tomáš Golembiovský
2016-09-20  9:59 ` Paolo Bonzini
2016-09-20 14:09 ` Eric Blake
2016-10-03 13:50   ` Tomáš Golembiovský [this message]
2016-10-03 15:12     ` Eric Blake

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=20161003155045.6889f89d@fiorina \
    --to=tgolembi@redhat.com \
    --cc=eblake@redhat.com \
    --cc=pbonzini@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).