Re: [PATCH 4/6] storage: Make virStorageFileReadHeader more universal

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

 



On Sat, Jul 01, 2017 at 10:43:09 -0400, John Ferlan wrote:
> 
> 
> On 06/23/2017 09:33 AM, Peter Krempa wrote:
> > Allow specifying offset to read an arbitrary position in the file. This
> > warrants a rename to virStorageFileRead.
> > ---
> >  src/qemu/qemu_driver.c                |  3 +--
> >  src/storage/storage_backend.h         |  9 +++++----
> >  src/storage/storage_backend_fs.c      | 20 +++++++++++++------
> >  src/storage/storage_backend_gluster.c | 37 ++++++++++++++++++++++-------------
> >  src/storage/storage_source.c          | 30 +++++++++++++++-------------
> >  src/storage/storage_source.h          |  7 ++++---
> >  6 files changed, 63 insertions(+), 43 deletions(-)
> > 
> 
> [...]
> 
> > diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
> > index 93dce4042..8ea7e603c 100644
> > --- a/src/storage/storage_backend_gluster.c
> > +++ b/src/storage/storage_backend_gluster.c

[...]

> > @@ -292,7 +292,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
> >          goto cleanup;
> >      }
> > 
> 
> Should :
> 
>     ssize_t len = VIR_STORAGE_MAX_HEADER;
> 
> change to size_t and a new variable "ssize_t read_len" be created and
> used for the following and subsequent virStorageFileGetMetadataFromBuf
> call?  (although that also takes a size_t for the 3rd param).

I actually just used VIR_STORAGE_MAX_HEADER constant directly in the
call of virStorageBackendGlusterRead. The original variable will thus be
used only for the return value, which is signed.


> 
> > -    if ((len = virStorageBackendGlusterReadHeader(fd, name, len, &header)) < 0)
> > +    if ((len = virStorageBackendGlusterRead(fd, name, len, &header)) < 0)
> >          goto cleanup;
> > 
> >      if (!(meta = virStorageFileGetMetadataFromBuf(name, header, len,

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux