[haiku-commits] haiku: hrev47245 - src/add-ons/kernel/file_systems/fat

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 22 May 2014 16:13:00 +0200 (CEST)

hrev47245 adds 2 changesets to branch 'master'
old head: e2e54a381bbe2fae7c1b925fc486fc9b816420d8
new head: ee6a0b91b25518c51906b7ee8895a6f6b09b593f
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=ee6a0b9+%5Ee2e54a3

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

257739f: FAT: improved last fix.
  
  * Don't use filename at all, since it's not clear if puni has already
    been set at this point.
  * Also, fixed warning *vnid is ino_t, not a pointer.

ee6a0b9: FAT: minor style cleanup.

                                   [ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]

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

1 file changed, 18 insertions(+), 18 deletions(-)
src/add-ons/kernel/file_systems/fat/dir.c | 36 +++++++++++++--------------

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

Commit:      257739f2d43f5a0bc1977b980d33e10ef89b1ac7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=257739f
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Thu May 22 14:09:34 2014 UTC

FAT: improved last fix.

* Don't use filename at all, since it's not clear if puni has already
  been set at this point.
* Also, fixed warning *vnid is ino_t, not a pointer.

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

diff --git a/src/add-ons/kernel/file_systems/fat/dir.c 
b/src/add-ons/kernel/file_systems/fat/dir.c
index 62afde2..fb4870e 100644
--- a/src/add-ons/kernel/file_systems/fat/dir.c
+++ b/src/add-ons/kernel/file_systems/fat/dir.c
@@ -81,18 +81,15 @@ _next_dirent_(struct diri *iter, struct _dirent_info_ 
*oinfo, char *filename,
                DPRINTF(2, ("_next_dirent_: %lx/%lx/%lx\n", iter->csi.cluster,
                        iter->csi.sector, iter->current_index));
                if (buffer[0] == 0) { // quit if at end of table
-                       if (start_index != 0xffff) {
-                               *puni = 0;
-                               dprintf("lfn entry (%s) with no alias\n", uni);
-                       }
+                       if (start_index != 0xffff)
+                               dprintf("lfn entry (%" B_PRIu32 ") with no 
alias\n", lfn_count);
                        return ENOENT;
                }
 
                if (buffer[0] == 0xe5) { // skip erased entries
                        if (start_index != 0xffff) {
-                               *puni = 0;
-                               dprintf("lfn entry (%s) with intervening erased 
entries\n",
-                                       uni);
+                               dprintf("lfn entry (%" B_PRIu32 ") with 
intervening erased "
+                                       "entries\n", lfn_count);
                                start_index = 0xffff;
                        }
                        DPRINTF(2, ("entry erased, skipping...\n"));
@@ -265,7 +262,7 @@ get_next_dirent(nspace *vol, vnode *dir, struct diri *iter, 
ino_t *vnid,
        }
 
        DPRINTF(2, ("get_next_dirent: found %s (vnid %Lx)\n", filename,
-               vnid != NULL ? *vnid : NULL));
+               vnid != NULL ? *vnid : (ino_t)0));
 
        return B_NO_ERROR;
 }

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

Revision:    hrev47245
Commit:      ee6a0b91b25518c51906b7ee8895a6f6b09b593f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ee6a0b9
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Thu May 22 14:12:37 2014 UTC

FAT: minor style cleanup.

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

diff --git a/src/add-ons/kernel/file_systems/fat/dir.c 
b/src/add-ons/kernel/file_systems/fat/dir.c
index fb4870e..7d35276 100644
--- a/src/add-ons/kernel/file_systems/fat/dir.c
+++ b/src/add-ons/kernel/file_systems/fat/dir.c
@@ -57,14 +57,15 @@ static status_t
 _next_dirent_(struct diri *iter, struct _dirent_info_ *oinfo, char *filename,
        int len)
 {
-       uint8 *buffer, hash = 0; /* quiet warning */
+       uint8 *buffer;
+       uint8 hash = 0;
        uchar uni[1024];
        uint16 *puni;
        uint32 i;
 
        // lfn state
-       uint32 start_index = 0xffff, filename_len = 0; /* quiet warning */
-       uint32 lfn_count = 0 /* quiet warning */;
+       uint32 start_index = 0xffff, filename_len = 0;
+       uint32 lfn_count = 0;
 
        if (iter->current_block == NULL)
                return ENOENT;
@@ -74,8 +75,8 @@ _next_dirent_(struct diri *iter, struct _dirent_info_ *oinfo, 
char *filename,
                return ENOMEM;
        }
 
-       buffer = iter->current_block
-               + ((iter->current_index) % (iter->csi.vol->bytes_per_sector / 
0x20)) * 0x20;
+       buffer = iter->current_block + ((iter->current_index)
+               % (iter->csi.vol->bytes_per_sector / 0x20)) * 0x20;
 
        for (; buffer != NULL; buffer = diri_next_entry(iter)) {
                DPRINTF(2, ("_next_dirent_: %lx/%lx/%lx\n", iter->csi.cluster,
@@ -167,11 +168,12 @@ _next_dirent_(struct diri *iter, struct _dirent_info_ 
*oinfo, char *filename,
                                dprintf("error: long file name too long\n");
 
                                diri_free(iter);
-                               diri_init(iter->csi.vol, 
iter->starting_cluster, start_index, iter);
+                               diri_init(iter->csi.vol, 
iter->starting_cluster, start_index,
+                                       iter);
                                return ENAMETOOLONG;
                        } else if (hash_msdos_name((const char *)buffer) != 
hash) {
-                               dprintf("error: long file name (%s) hash and 
short file name don't match\n",
-                                       filename);
+                               dprintf("error: long file name (%s) hash and 
short file name "
+                                       "don't match\n", filename);
                                start_index = 0xffff;
                        }
                }
@@ -245,7 +247,8 @@ get_next_dirent(nspace *vol, vnode *dir, struct diri *iter, 
ino_t *vnid,
                                        *vnid = loc;
                                }
                        } else if (result != B_OK) {
-                               dprintf("get_next_dirent: unknown error 
(%s)\n", strerror(result));
+                               dprintf("get_next_dirent: unknown error (%s)\n",
+                                       strerror(result));
                                return result;
                        }
 
@@ -273,7 +276,7 @@ check_dir_empty(nspace *vol, vnode *dir)
 {
        uint32 i;
        struct diri iter;
-       status_t result = B_ERROR; /* quiet warning */
+       status_t result = B_ERROR;
 
        if (diri_init(vol, dir->cluster, 0, &iter) == NULL) {
                dprintf("check_dir_empty: error opening directory\n");


Other related posts:

  • » [haiku-commits] haiku: hrev47245 - src/add-ons/kernel/file_systems/fat - axeld