]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/fs/ntfs.c: Handle 48-bit MFT no.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 21 Oct 2013 10:58:38 +0000 (12:58 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 21 Oct 2013 10:58:38 +0000 (12:58 +0200)
ChangeLog
grub-core/fs/ntfs.c
include/grub/ntfs.h

index 29525cb53f27874974bc1e26132f8baed2579e8a..149808624bba61b38fdd641d7230cef2b7677688 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-21  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/fs/ntfs.c: Handle 48-bit MFT no.
+
 2013-10-21  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/fs/ntfs.c (read_run_data): Rewrite using bitfields.
index f917ab91c5d5eeacc55d472cd76b2142593f7fed..05405e6b9094b7945fc584bc34c44120312b53f5 100644 (file)
@@ -87,7 +87,7 @@ fixup (grub_uint8_t *buf, grub_size_t len, const grub_uint8_t *magic)
 }
 
 static grub_err_t read_mft (struct grub_ntfs_data *data, grub_uint8_t *buf,
-                           grub_uint32_t mftno);
+                           grub_uint64_t mftno);
 static grub_err_t read_attr (struct grub_ntfs_attr *at, grub_uint8_t *dest,
                             grub_disk_addr_t ofs, grub_size_t len,
                             int cached,
@@ -488,17 +488,17 @@ read_attr (struct grub_ntfs_attr *at, grub_uint8_t *dest, grub_disk_addr_t ofs,
 }
 
 static grub_err_t
-read_mft (struct grub_ntfs_data *data, grub_uint8_t *buf, grub_uint32_t mftno)
+read_mft (struct grub_ntfs_data *data, grub_uint8_t *buf, grub_uint64_t mftno)
 {
   if (read_attr
       (&data->mmft.attr, buf, mftno * ((grub_disk_addr_t) data->mft_size << GRUB_NTFS_BLK_SHR),
        data->mft_size << GRUB_NTFS_BLK_SHR, 0, 0, 0))
-    return grub_error (GRUB_ERR_BAD_FS, "read MFT 0x%X fails", mftno);
+    return grub_error (GRUB_ERR_BAD_FS, "read MFT 0x%llx fails", (unsigned long long) mftno);
   return fixup (buf, data->mft_size, (const grub_uint8_t *) "FILE");
 }
 
 static grub_err_t
-init_file (struct grub_ntfs_file *mft, grub_uint32_t mftno)
+init_file (struct grub_ntfs_file *mft, grub_uint64_t mftno)
 {
   unsigned short flag;
 
@@ -513,7 +513,8 @@ init_file (struct grub_ntfs_file *mft, grub_uint32_t mftno)
 
   flag = u16at (mft->buf, 0x16);
   if ((flag & 1) == 0)
-    return grub_error (GRUB_ERR_BAD_FS, "MFT 0x%X is not in use", mftno);
+    return grub_error (GRUB_ERR_BAD_FS, "MFT 0x%llx is not in use",
+                      (unsigned long long) mftno);
 
   if ((flag & 2) == 0)
     {
@@ -521,7 +522,8 @@ init_file (struct grub_ntfs_file *mft, grub_uint32_t mftno)
 
       pa = locate_attr (&mft->attr, mft, GRUB_NTFS_AT_DATA);
       if (pa == NULL)
-       return grub_error (GRUB_ERR_BAD_FS, "no $DATA in MFT 0x%X", mftno);
+       return grub_error (GRUB_ERR_BAD_FS, "no $DATA in MFT 0x%llx",
+                          (unsigned long long) mftno);
 
       if (!pa[8])
        mft->size = u32at (pa, 0x10);
@@ -573,12 +575,6 @@ list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos,
          struct grub_ntfs_file *fdiro;
          grub_uint32_t attr;
 
-         if (u16at (pos, 4))
-           {
-             grub_error (GRUB_ERR_BAD_FS, "64-bit MFT number");
-             return 0;
-           }
-
          attr = u32at (pos, 0x48);
          if (attr & GRUB_NTFS_ATTR_REPARSE)
            type = GRUB_FSHELP_SYMLINK;
@@ -592,7 +588,7 @@ list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos,
            return 0;
 
          fdiro->data = diro->data;
-         fdiro->ino = u32at (pos, 0);
+         fdiro->ino = u64at (pos, 0) & 0xffffffffffffULL;
          fdiro->mtime = u64at (pos, 0x20);
 
          ustr = grub_malloc (ns * GRUB_MAX_UTF8_PER_UTF16 + 1);
index e52c6634937fd8e733c6e489f8f78b4cb247fe89..0ae3defdf255a3ca6c9d6fe820c87beb9e18861c 100644 (file)
@@ -143,7 +143,7 @@ struct grub_ntfs_file
   grub_uint8_t *buf;
   grub_uint64_t size;
   grub_uint64_t mtime;
-  grub_uint32_t ino;
+  grub_uint64_t ino;
   int inode_read;
   struct grub_ntfs_attr attr;
 };