]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
HFS filesystem mtime support
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 11 Dec 2010 06:00:31 +0000 (07:00 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 11 Dec 2010 06:00:31 +0000 (07:00 +0100)
grub-core/fs/hfs.c
include/grub/hfs.h

index cef856326948a625ad96a08ba0f449f35578a94c..a40171dbdd10c7712cafa3bdf532fd264178707a 100644 (file)
@@ -1072,6 +1072,23 @@ grub_hfs_label (grub_device_t device, char **label)
   return grub_errno;
 }
 
+static grub_err_t
+grub_hfs_mtime (grub_device_t device, grub_int32_t *tm)
+{
+  struct grub_hfs_data *data;
+
+  data = grub_hfs_mount (device->disk);
+
+  if (data)
+    *tm = grub_be_to_cpu32 (data->sblock.mtime) - 2082844800;
+  else
+    *tm = 0;
+
+  grub_free (data);
+  return grub_errno;
+}
+
+
 static grub_err_t
 grub_hfs_uuid (grub_device_t device, char **uuid)
 {
@@ -1107,6 +1124,7 @@ static struct grub_fs grub_hfs_fs =
     .close = grub_hfs_close,
     .label = grub_hfs_label,
     .uuid = grub_hfs_uuid,
+    .mtime = grub_hfs_mtime,
     .next = 0
   };
 
index d93b9a2c9d80abb4bfc7517e5adc7542a780d28a..bf98610d9830f1fcc7edaf5ad60dea1e9ae0fa62 100644 (file)
@@ -39,7 +39,9 @@ typedef struct grub_hfs_extent grub_hfs_datarecord_t[3];
 struct grub_hfs_sblock
 {
   grub_uint16_t magic;
-  grub_uint8_t unused[18];
+  grub_uint32_t ctime;
+  grub_uint32_t mtime;
+  grub_uint8_t unused[10];
   grub_uint32_t blksz;
   grub_uint8_t unused2[4];
   grub_uint16_t first_block;