]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
SFS mtime support
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 11 Dec 2010 21:48:29 +0000 (22:48 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 11 Dec 2010 21:48:29 +0000 (22:48 +0100)
grub-core/fs/sfs.c

index b49420de12871afa61a4761bddfa3f34736bf493..dc4fbd45c1612d0c51a99baf149414e03ce2cc82 100644 (file)
@@ -66,7 +66,7 @@ struct grub_sfs_obj
       grub_uint32_t dir_objc;
     } dir __attribute__ ((packed));
   } file_dir;
-  grub_uint8_t unused3[4];
+  grub_uint32_t mtime;
   grub_uint8_t type;
   grub_uint8_t filename[1];
   grub_uint8_t comment[1];
@@ -119,6 +119,7 @@ struct grub_fshelp_node
   struct grub_sfs_data *data;
   int block;
   int size;
+  grub_uint32_t mtime;
 };
 
 /* Information about a "mounted" sfs filesystem.  */
@@ -355,10 +356,12 @@ grub_sfs_iterate_dir (grub_fshelp_node_t dir,
   int pos;
 
   auto int NESTED_FUNC_ATTR grub_sfs_create_node (const char *name, int block,
-                                                 int size, int type);
+                                                 int size, int type,
+                                                 grub_uint32_t mtime);
 
   int NESTED_FUNC_ATTR grub_sfs_create_node (const char *name, int block,
-                                            int size, int type)
+                                            int size, int type,
+                                            grub_uint32_t mtime)
     {
       node = grub_malloc (sizeof (*node));
       if (!node)
@@ -367,6 +370,7 @@ grub_sfs_iterate_dir (grub_fshelp_node_t dir,
       node->data = data;
       node->size = size;
       node->block = block;
+      node->mtime = mtime;
 
       return hook (name, type, node);
     }
@@ -426,7 +430,7 @@ grub_sfs_iterate_dir (grub_fshelp_node_t dir,
 
          if (grub_sfs_create_node (filename, block,
                                    grub_be_to_cpu32 (obj->file_dir.file.size),
-                                   type))
+                                   type, grub_be_to_cpu32 (obj->mtime)))
            {
              grub_free (objc_data);
              return 1;
@@ -525,6 +529,8 @@ grub_sfs_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.mtime = node->mtime + 8 * 365 * 86400 + 86400 * 2;
+      info.mtimeset = 1;
       grub_free (node);
       return hook (filename, &info);
     }