ZFS mtime support

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-12-11 15:01:33 +01:00
parent eb03b55271
commit ea0df4e953

View file

@ -2565,6 +2565,29 @@ zfs_uuid (grub_device_t device, char **uuid)
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }
static grub_err_t
zfs_mtime (grub_device_t device, grub_int32_t *mt)
{
struct grub_zfs_data *data;
grub_zfs_endian_t ub_endian = UNKNOWN_ENDIAN;
uberblock_t *ub;
*mt = 0;
data = zfs_mount (device);
if (! data)
return grub_errno;
ub = &(data->current_uberblock);
ub_endian = (grub_zfs_to_cpu64 (ub->ub_magic,
LITTLE_ENDIAN) == UBERBLOCK_MAGIC
? LITTLE_ENDIAN : BIG_ENDIAN);
*mt = grub_zfs_to_cpu64 (ub->ub_timestamp, ub_endian);
zfs_unmount (data);
return GRUB_ERR_NONE;
}
/* /*
* zfs_open() locates a file in the rootpool by following the * zfs_open() locates a file in the rootpool by following the
* MOS and places the dnode of the file in the memory address DNODE. * MOS and places the dnode of the file in the memory address DNODE.
@ -2934,7 +2957,7 @@ static struct grub_fs grub_zfs_fs = {
.close = grub_zfs_close, .close = grub_zfs_close,
.label = zfs_label, .label = zfs_label,
.uuid = zfs_uuid, .uuid = zfs_uuid,
.mtime = 0, .mtime = zfs_mtime,
.next = 0 .next = 0
}; };