From: Corey Bryant <coreyb@linux.vnet.ibm.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: libvir-list@redhat.com, aliguori@us.ibm.com,
qemu-devel@nongnu.org, tchicks@us.ibm.com
Subject: Re: [Qemu-devel] [PATCH v3] Add support for fd: protocol
Date: Thu, 11 Aug 2011 12:28:56 -0400 [thread overview]
Message-ID: <4E440348.7050508@linux.vnet.ibm.com> (raw)
In-Reply-To: <1311684710-27074-1-git-send-email-coreyb@linux.vnet.ibm.com>
On 07/26/2011 08:51 AM, Corey Bryant wrote:
> +static int raw_open_fd(BlockDriverState *bs, const char *filename,
int flags)
> +{
> + BDRVRawState *s = bs->opaque;
> + const char *fd_str;
> + int fd;
> +
> + /* extract the file descriptor - fail if it's not fd: */
> + if (!strstart(filename, "fd:",&fd_str)) {
> + return -EINVAL;
> + }
> +
> + if (!qemu_isdigit(fd_str[0])) {
> + /* get fd from monitor */
> + fd = qemu_get_fd(fd_str);
> + if (fd == -1) {
> + return -EBADF;
> + }
> + } else {
> + char *endptr = NULL;
> +
> + fd = strtol(fd_str,&endptr, 10);
> + if (*endptr || (fd == 0&& fd_str == endptr)) {
> + return -EBADF;
> + }
> + }
> +
> + s->fd = fd;
> + s->type = FTYPE_FILE;
> +
> + return raw_open_common(bs, filename, flags, 0);
> +}
> +
> +static BlockDriver bdrv_file_fd = {
> + .format_name = "file",
> + .protocol_name = "fd",
> + .instance_size = sizeof(BDRVRawState),
> + .bdrv_probe = NULL, /* no probe for protocols */
> + .bdrv_file_open = raw_open_fd,
> + .bdrv_read = raw_read,
> + .bdrv_write = raw_write,
> + .bdrv_close = raw_close,
> + .bdrv_flush = raw_flush,
> + .bdrv_discard = raw_discard,
> +
> + .bdrv_aio_readv = raw_aio_readv,
> + .bdrv_aio_writev = raw_aio_writev,
> + .bdrv_aio_flush = raw_aio_flush,
> +
> + .bdrv_truncate = raw_truncate,
> + .bdrv_getlength = raw_getlength,
> +
> + .create_options = raw_create_options,
> +};
> +
I'm a bit unsure of how to support CD-ROM with the fd: protocol.
I don't think use of bdrv_file_fd is an option. For example, while
raw_open_fd may work, there is no eject support.
Another approach is to have 2 BlockDriver structs that support the fd
protocol. For example, creating a new BlockDriver struct that mirrors
bdrv_host_cdrom. So you would have bdrv_host_cdrom_fd with a
corresponding cdrom_open_fd function. But that doesn't appear possible
as it appears that the protocol must be unique among all BlockDriver
structs.
Do we need to introduce a similar protocol (maybe "cdfd") to support
passing of CD-ROM file descriptors?
next prev parent reply other threads:[~2011-08-11 16:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-26 12:51 [Qemu-devel] [PATCH v3] Add support for fd: protocol Corey Bryant
2011-07-26 13:02 ` Christoph Hellwig
2011-07-26 13:15 ` Corey Bryant
2011-07-26 14:02 ` [Qemu-devel] [libvirt] " Eric Blake
2011-07-26 14:05 ` [Qemu-devel] " Kevin Wolf
2011-07-26 14:46 ` Corey Bryant
2011-07-26 14:54 ` Kevin Wolf
2011-07-26 14:00 ` [Qemu-devel] [libvirt] " Eric Blake
2011-07-26 14:19 ` Kevin Wolf
2011-07-26 15:18 ` [Qemu-devel] " Kevin Wolf
2011-07-26 16:57 ` Corey Bryant
2011-07-26 17:10 ` Alexander Graf
2011-07-26 19:00 ` Corey Bryant
2011-07-27 8:11 ` Kevin Wolf
2011-07-27 8:22 ` Daniel P. Berrange
2011-07-27 8:36 ` Kevin Wolf
2011-07-27 8:43 ` Daniel P. Berrange
2011-07-27 13:09 ` Corey Bryant
2011-07-27 14:57 ` Kevin Wolf
2011-07-27 21:36 ` Blue Swirl
2011-08-11 16:28 ` Corey Bryant [this message]
2011-08-12 10:07 ` Kevin Wolf
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=4E440348.7050508@linux.vnet.ibm.com \
--to=coreyb@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=kwolf@redhat.com \
--cc=libvir-list@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=tchicks@us.ibm.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.