All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexandre DERUMIER <aderumier@odiso.com>
Cc: kwolf@redhat.com, qemu-devel <qemu-devel@nongnu.org>,
	ronnie sahlberg <ronniesahlberg@gmail.com>
Subject: Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi)
Date: Thu, 25 Oct 2012 09:42:37 +0200	[thread overview]
Message-ID: <5088ED6D.5030805@redhat.com> (raw)
In-Reply-To: <93cf825d-ecca-4367-8b74-4a69c53b5801@mailpro>

Il 25/10/2012 09:25, Alexandre DERUMIER ha scritto:
> What is the best way to get it working ?
> 
> 1)add a .bdrv_create in block/iscsi.c ? 
> 
> (like host_device block driver, only open/close the device and check if size if big enough)
> 
>     if (fstat(fd, &stat_buf) < 0)
>         ret = -errno;
>     else if (!S_ISBLK(stat_buf.st_mode) && !S_ISCHR(stat_buf.st_mode))
>         ret = -ENODEV;

I'm not even sure this S_ISBLK/S_ISCHR test is necessary.

>     else if (lseek(fd, 0, SEEK_END) < total_size * BDRV_SECTOR_SIZE)
>         ret = -ENOSPC;
> 
>     qemu_close(fd);
>     return ret;
> }
> 
> 
> 2)or add a fallback in qemu-img, if bdrv_create doesn't exist, use bdrv_open to see if the backend device is pre-existing ?

Or even add it in block.c, so that it also applies to live snapshots etc.

Paolo

  reply	other threads:[~2012-10-25  7:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <37f26e36-0239-4598-bfc3-477e7dcf3787@mailpro>
2012-10-25  7:25 ` [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi) Alexandre DERUMIER
2012-10-25  7:42   ` Paolo Bonzini [this message]
2012-10-25  7:46   ` Kevin Wolf
2012-10-25  7:52     ` Paolo Bonzini
2012-10-25  8:02       ` Kevin Wolf
2012-10-25 13:41         ` ronnie sahlberg
2012-10-25 13:54           ` Kevin Wolf
2012-10-25 13:58           ` Paolo Bonzini
2012-10-25 14:00             ` ronnie sahlberg
2012-10-26  5:37               ` Alexandre DERUMIER

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=5088ED6D.5030805@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aderumier@odiso.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@gmail.com \
    /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.