[haiku-commits] haiku: hrev46823 - src/add-ons/kernel/file_systems/exfat

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 6 Feb 2014 02:36:03 +0100 (CET)

hrev46823 adds 2 changesets to branch 'master'
old head: dae266a8a4141d0c1059685b78bb9bd5b27c8389
new head: 48fcadd44cec578e9dcd4af44e6596714e3086c7
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=48fcadd+%5Edae266a

----------------------------------------------------------------------------

3ba171a: exfat: small correction in comment, name not _name

48fcadd: exfat: recheck device size is big enough to hold fs
  
  I didn't mean to omit this check, I just need to save deviceSize below for
  get_default_volume_name() so that it will match the mount point name.
  
  Checked to make sure the calculation works on a 2GiB, 32GiB, and 128GiB
  (virtual) exfat volume.

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 11 insertions(+), 5 deletions(-)
src/add-ons/kernel/file_systems/exfat/Utility.h  |  2 +-
src/add-ons/kernel/file_systems/exfat/Volume.cpp | 14 ++++++++++----

############################################################################

Commit:      3ba171a37ab405bd788a9289db89d75b0b626619
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3ba171a
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Thu Feb  6 01:30:35 2014 UTC

exfat: small correction in comment, name not _name

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/exfat/Utility.h 
b/src/add-ons/kernel/file_systems/exfat/Utility.h
index 2251f61..6143f8a 100644
--- a/src/add-ons/kernel/file_systems/exfat/Utility.h
+++ b/src/add-ons/kernel/file_systems/exfat/Utility.h
@@ -46,7 +46,7 @@ open_mode_to_access(int openMode)
 
 
 /*!    Reads the volume name from an exfat entry and writes it to
-       \a _name as a UTF-8 char array.
+       \a name as a UTF-8 char array.
 
        Writes a blank string to \a name if the volume name is not set.
 

############################################################################

Revision:    hrev46823
Commit:      48fcadd44cec578e9dcd4af44e6596714e3086c7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=48fcadd
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Thu Feb  6 01:34:14 2014 UTC

exfat: recheck device size is big enough to hold fs

I didn't mean to omit this check, I just need to save deviceSize below for
get_default_volume_name() so that it will match the mount point name.

Checked to make sure the calculation works on a 2GiB, 32GiB, and 128GiB
(virtual) exfat volume.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/exfat/Volume.cpp 
b/src/add-ons/kernel/file_systems/exfat/Volume.cpp
index 2868e8a..757f7ce 100644
--- a/src/add-ons/kernel/file_systems/exfat/Volume.cpp
+++ b/src/add-ons/kernel/file_systems/exfat/Volume.cpp
@@ -334,6 +334,15 @@ Volume::Mount(const char* deviceName, uint32 flags)
        fEntriesPerBlock = (fBlockSize / sizeof(struct exfat_entry));
 
        // check if the device size is large enough to hold the file system
+       off_t fileSystemSize;
+       status = opener.GetSize(&fileSystemSize);
+       if (status != B_OK)
+               return status;
+
+       off_t deviceSize = (off_t)fSuperBlock.NumBlocks() << 
fSuperBlock.BlockShift();
+       if (fileSystemSize < deviceSize)
+               return B_BAD_VALUE;
+
        fBlockCache = opener.InitCache(fSuperBlock.NumBlocks(), fBlockSize);
        if (fBlockCache == NULL)
                return B_ERROR;
@@ -363,11 +372,8 @@ Volume::Mount(const char* deviceName, uint32 flags)
        LabelVisitor visitor(this);
        iterator.Iterate(visitor);
 
-       if (fName[0] == '\0') {
-               off_t deviceSize = (off_t)fSuperBlock.NumBlocks()
-                       << fSuperBlock.BlockShift();
+       if (fName[0] == '\0')
                get_default_volume_name(deviceSize, fName, sizeof(fName));
-       }
 
        return B_OK;
 }


Other related posts:

  • » [haiku-commits] haiku: hrev46823 - src/add-ons/kernel/file_systems/exfat - jscipione