]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
mtime support for ntfs
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 12 Dec 2010 00:00:33 +0000 (01:00 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 12 Dec 2010 00:00:33 +0000 (01:00 +0100)
grub-core/fs/ntfs.c
include/grub/ntfs.h

index 414f6513d9450b5aac07299e7a388f43a54cc795..7a5e2b158787bd56d80518d435a2d702f797e6a5 100644 (file)
@@ -610,6 +610,10 @@ list_file (struct grub_ntfs_file *diro, char *pos,
 
          fdiro->data = diro->data;
          fdiro->ino = u32at (pos, 0);
+         if (u64at (pos, 0x20) > u64at (pos, 0x28))
+           fdiro->mtime = u64at (pos, 0x20);
+         else
+           fdiro->mtime = u64at (pos, 0x28);
 
          ustr = grub_malloc (ns * 4 + 1);
          if (ustr == NULL)
@@ -880,6 +884,10 @@ grub_ntfs_dir (grub_device_t device, const char *path,
       struct grub_dirhook_info info;
       grub_memset (&info, 0, sizeof (info));
       info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
+      info.mtimeset = 1;
+      info.mtime = grub_divmod64 (node->mtime, 10000000, 0) 
+       - 86400ULL * 365 * (1970 - 1601)
+       - 86400ULL * ((1970 - 1601) / 4) + 86400ULL * ((1970 - 1601) / 100);
       grub_free (node);
       return hook (filename, &info);
   }
index 31b99398bed04644e282c7647198be2498a94c5c..0a089b3c09760d57f81e7d4ed583091c021ee3b1 100644 (file)
@@ -135,6 +135,7 @@ struct grub_fshelp_node
   struct grub_ntfs_data *data;
   char *buf;
   grub_uint64_t size;
+  grub_uint64_t mtime;
   grub_uint32_t ino;
   int inode_read;
   struct grub_ntfs_attr attr;