[libvirt] [PATCH v3 02/31] util: Introduce virFileInData

John Ferlan jferlan at redhat.com
Tue May 16 20:55:12 UTC 2017



On 05/16/2017 10:03 AM, Michal Privoznik wrote:
> This function takes a FD and determines whether the current
> position is in data section or in a hole. In addition to that,
> it also determines how much bytes are there remaining till the
> current section ends.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/libvirt_private.syms |   1 +
>  src/util/virfile.c       |  82 +++++++++++++++++++
>  src/util/virfile.h       |   4 +
>  tests/virfiletest.c      | 203 +++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 290 insertions(+)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index bbe283529..4102a002b 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1628,6 +1628,7 @@ virFileGetHugepageSize;
>  virFileGetMountReverseSubtree;
>  virFileGetMountSubtree;
>  virFileHasSuffix;
> +virFileInData;
>  virFileIsAbsPath;
>  virFileIsDir;
>  virFileIsExecutable;
> diff --git a/src/util/virfile.c b/src/util/virfile.c
> index ea44a647c..5b10f9489 100644
> --- a/src/util/virfile.c
> +++ b/src/util/virfile.c
> @@ -3793,6 +3793,88 @@ virFileComparePaths(const char *p1, const char *p2)
>   cleanup:
>      VIR_FREE(res1);
>      VIR_FREE(res2);
> +
> +    return ret;
> +}
> +
> +

Still undocumented.

I know it got discussed a few times...  I guess the odd thing I find
about "long long" is that all the stream mgmt lengths/sizes, etc. are
size_t.   You also only test for smaller values only.  Just saying...

Please just add the function description *and* why a long long is being
used here.  Also a brief summary of what's being done and of course that
lseek @cleanup:

Reviewed-by: John Ferlan <jferlan at redhat.com>


John

> +int
> +virFileInData(int fd,
> +              int *inData,
> +              long long *length)
> +{

[...]




More information about the libvir-list mailing list