The access, modify and change times are added to volumes and corresponding xml representations. --- docs/schemas/storagevol.rng | 17 +++++++++++++++++ src/conf/storage_conf.c | 9 +++++++++ src/conf/storage_conf.h | 9 +++++++++ src/storage/storage_backend.c | 4 ++++ 4 files changed, 39 insertions(+) diff --git a/docs/schemas/storagevol.rng b/docs/schemas/storagevol.rng index 7a74331..fc7eb09 100644 --- a/docs/schemas/storagevol.rng +++ 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> + </define> + <define name='target'> <element name='target'> <optional> @@ -72,6 +88,7 @@ </optional> <ref name='format'/> <ref name='permissions'/> + <ref name='timestamps'/> <optional> <ref name='encryption'/> </optional> diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index ab8df9e..a4cdac8 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1272,6 +1272,15 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options, virBufferAddLit(buf," </permissions>\n"); + virBufferAddLit(buf," <timestamps>\n"); + virBufferAsprintf(buf," <atime>%llu</atime>\n", + (unsigned long long) def->timestamps.atime); + virBufferAsprintf(buf," <mtime>%llu</mtime>\n", + (unsigned long long) def->timestamps.mtime); + virBufferAsprintf(buf," <ctime>%llu</ctime>\n", + (unsigned long long) def->timestamps.ctime); + virBufferAddLit(buf," </timestamps>\n"); + if (def->encryption) { virBufferAdjustIndent(buf, 4); if (virStorageEncryptionFormat(buf, def->encryption) < 0) diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index 5733b57..8cd1d63 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -46,6 +46,14 @@ struct _virStoragePerms { /* Storage volumes */ +typedef struct _virStorageTimestamps virStorageTimestamps; +typedef virStorageTimestamps *virStorageTimestampsPtr; +struct _virStorageTimestamps { + time_t atime; + time_t mtime; + time_t ctime; +}; + /* * How the volume's data is stored on underlying @@ -77,6 +85,7 @@ struct _virStorageVolTarget { char *path; int format; virStoragePerms perms; + virStorageTimestamps timestamps; int type; /* only used by disk backend for partition type */ /* Currently used only in virStorageVolDef.target, not in .backingstore. */ virStorageEncryptionPtr encryption; diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index e2e9b51..c827e3c 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -1209,6 +1209,10 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target, target->perms.uid = sb.st_uid; target->perms.gid = sb.st_gid; + target->timestamps.atime = sb.st_atime; + target->timestamps.mtime = sb.st_mtime; + target->timestamps.ctime = sb.st_ctime; + VIR_FREE(target->perms.label); #if HAVE_SELINUX -- 1.7.9.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list