qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/3] two new file wrappers


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 1/3] two new file wrappers
Date: Tue, 26 Feb 2013 20:19:51 -0600
User-agent: Notmuch/0.13.2+93~ged93d79 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu)

address@hidden writes:

> These patches implement asn1 ber visitors for encoding and decoding data.
> References: <address@hidden>
> Content-Disposition: inline; filename=qemu_file_bits.diff

Not sure how you sent this but it's not threaded properly and the diffs
aren't git diffs.  Please use git-send-email.

>
> Signed-off-by: Stefan Berger <address@hidden>
> Signed-off-by: Joel Schopp <address@hidden>
> ---
>  include/migration/qemu-file.h |    4 ++++
>  qemu-file.c                   |   33 ++++++++++++++++++++++++++++++++-
>  2 files changed, 36 insertions(+), 1 deletion(-)
>
> Index: b/qemu-file.c
> ===================================================================
> --- a/qemu-file.c
> +++ b/qemu-file.c
> @@ -367,7 +367,7 @@ static void qemu_file_set_error(QEMUFile
>  /** Flushes QEMUFile buffer
>   *
>   */
> -static int qemu_fflush(QEMUFile *f)
> +int qemu_fflush(QEMUFile *f)
>  {
>      int ret = 0;
>  
> @@ -668,3 +668,34 @@ uint64_t qemu_get_be64(QEMUFile *f)
>      v |= qemu_get_be32(f);
>      return v;
>  }
> +
> +int qemu_read_bytes(QEMUFile *f, uint8_t *buf, int size)
> +{
> +    if (qemu_file_get_error(f)) {
> +        return -1;
> +    }
> +    return qemu_get_buffer(f, buf, size);
> +}
> +
> +int qemu_peek_bytes(QEMUFile *f, uint8_t *buf, int size, size_t offset)
> +{
> +    if (qemu_file_get_error(f)) {
> +        return -1;
> +    }
> +    return qemu_peek_buffer(f, buf, size, offset);
> +}
> +
> +int qemu_write_bytes(QEMUFile *f, const uint8_t *buf, int size)
> +{
> +    if (qemu_file_get_error(f)) {
> +        return -1;
> +    }
> +
> +    qemu_put_buffer(f, buf, size);
> +
> +    if (qemu_file_get_error(f)) {
> +        return -1;
> +    }
> +
> +    return size;
> +}

I think we've moved away from using qemu-file for anything other than
migration.

Regards,

Anthony Liguori

> Index: b/include/migration/qemu-file.h
> ===================================================================
> --- a/include/migration/qemu-file.h
> +++ b/include/migration/qemu-file.h
> @@ -79,11 +79,15 @@ QEMUFile *qemu_fdopen(int fd, const char
>  QEMUFile *qemu_fopen_socket(int fd);
>  QEMUFile *qemu_popen(FILE *popen_file, const char *mode);
>  QEMUFile *qemu_popen_cmd(const char *command, const char *mode);
> +int qemu_fflush(QEMUFile *f);
>  int qemu_get_fd(QEMUFile *f);
>  int qemu_fclose(QEMUFile *f);
>  int64_t qemu_ftell(QEMUFile *f);
>  void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size);
>  void qemu_put_byte(QEMUFile *f, int v);
> +int qemu_read_bytes(QEMUFile *f, uint8_t *buf, int size);
> +int qemu_peek_bytes(QEMUFile *f, uint8_t *buf, int size, size_t offset);
> +int qemu_write_bytes(QEMUFile *f, const uint8_t *buf, int size);
>  
>  static inline void qemu_put_ubyte(QEMUFile *f, unsigned int v)
>  {



reply via email to

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