jsch...@linux.vnet.ibm.com writes: > These patches implement asn1 ber visitors for encoding and decoding data. > References: <20130226230354.982917...@linux.vnet.ibm.com> > 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 <stef...@linux.vnet.ibm.com> > Signed-off-by: Joel Schopp <jsch...@linux.vnet.ibm.com> > --- > 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) > {