[libvirt] [PATCH] Added timestamps to volumes

Eric Blake eblake at redhat.com
Tue Jul 10 13:14:13 UTC 2012


On 07/10/2012 05:52 AM, Hendrik Schwartke wrote:
> The access, modify and change times are added to volumes and
> corresponding xml representations.
> ---
>  docs/schemas/storagevol.rng   |   17 +++++++++++++++++

Incomplete.  You must also document this in docs/formatstorage.html.in
before this patch can be applied.

>  src/conf/storage_conf.c       |    9 +++++++++
>  src/conf/storage_conf.h       |    9 +++++++++
>  src/storage/storage_backend.c |    4 ++++
>  4 files changed, 39 insertions(+)

> +++ b/docs/schemas/storagevol.rng
> @@ -63,6 +63,22 @@
>      </optional>
>    </define>
>  
> +  <define name='timestamps'>
> +    <optional>
> +      <element name='timestamps'>
> +        <element name='atime'>
> +          <ref name='unsignedLong'/>
> +        </element>
> +        <element name='mtime'>
> +          <ref name='unsignedLong'/>
> +        </element>
> +        <element name='ctime'>
> +          <ref name='unsignedLong'/>
> +        </element>
> +      </element>
> +    </optional>

Sounds interesting.  Should we also list birth-time, which is available
from some filesystems as a fourth timestamp?  On BSD and Cygwin,
birthtime is available as part of stat(); on Linux, you still have to
use ioctl() or wait for the proposed xstat() interface to ever be
finalized, and even then, not all file systems track that information,
so it would have to be an optional element.

I also think we need to track things to full precision, as in seconds +
nanoseconds since epoch.  That is, a proper timestamp would look like
1341925773.351768083 on a file system with full 9-digit sub-second
resolution.

>  
> +    virBufferAddLit(buf,"    <timestamps>\n");

Space after comma, throughout the patch.

> +typedef virStorageTimestamps *virStorageTimestampsPtr;
> +struct _virStorageTimestamps {
> +    time_t atime;

Store this as struct timespec, to match the POSIX definition of st_atim
having both seconds and nanoseconds as part of stat() (oh phooey - the
gnulib module stat-time for portably getting at nanoseconds is currently
LGPLv3+; I'll see about whether we can get that relaxed).

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120710/7c60cacd/attachment-0001.sig>


More information about the libvir-list mailing list