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

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

 



"Richard W.M. Jones" <rjones@xxxxxxxxxx> 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.

--
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]