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

Re: [libvirt] Re: [Libvir] Reopening the old discussion about virDomainBlockPeek



"Richard W.M. Jones" <rjones redhat com> wrote:
> Attached is an updated patch.  The changes are:
>  - updated to latest CVS
>  - run make check / syntax-check
>  - remove virsh subcommand (as per Dan's suggestion - see below)
>  - some more things that Dan pointed out - see below
...
> Index: src/xend_internal.c
> ===================================================================
...
> +    data.path = path;
> +    data.ok = 0;
> +
> +    if (xend_parse_sexp_blockdevs (domain->conn, root,
> +                                   priv->xendConfigVersion,
> +                                   check_path, &data) == -1)
> +        return -1;
> +
> +    if (!data.ok) {
> +        virXendError (domain->conn, VIR_ERR_INVALID_ARG,
> +                      _("invalid path"));
> +        return -1;
> +    }
> +
> +    /* The path is correct, now try to open it and get its size. */
> +    fd = open (path, O_RDONLY);
> +    if (fd == -1 || fstat (fd, &statbuf) == -1) {
> +        virXendError (domain->conn, VIR_ERR_SYSTEM_ERROR, strerror (errno));
> +        goto done;
> +    }
> +
> +    /* Seek and read. */
> +    /* NB. Because we configure with AC_SYS_LARGEFILE, off_t should
> +     * be 64 bits on all platforms.
> +     */
> +    if (lseek (fd, offset, SEEK_SET) == (off_t) -1 ||
> +        saferead (fd, buffer, size) == (ssize_t) -1) {
> +        virXendError (domain->conn, VIR_ERR_SYSTEM_ERROR, strerror (errno));
> +        goto done;
> +    }

Hi Rich,

Sorry it took so long.

This all looks fine.
The only suggestion I can make is to include the "path"
in the three diagnostics above.  I imagine it might otherwise
be hard to understand what the diagnostic is talking about otherwise.


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