bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] fix compiler warnings in hurd/ext2fs


From: Flavio Cruz
Subject: [PATCH] fix compiler warnings in hurd/ext2fs
Date: Tue, 29 Dec 2015 18:11:06 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

ext2fs: Fix compiler warnings.

* ext2fs/balloc.c: Use unsigned char instead of char.
* ext2fs/bitmap.c Use unsigned char for bitmaps.
* ext2fs/dir.c: Fix format.
* ext2fs/ext2fs.h: Use unsigned char for bitmaps.
* ext2fs/ialloc.c: Use unsigned char for bitmaps. Fix format string in
ext2_warning.
* ext2fs/pager.c: Fix format string in ext2_warning and ext2_error.

diff --git a/ext2fs/balloc.c b/ext2fs/balloc.c
index efef8ae..0b9e5a5 100644
--- a/ext2fs/balloc.c
+++ b/ext2fs/balloc.c
@@ -57,7 +57,7 @@ memscan (void *buf, unsigned char ch, size_t len)
 void
 ext2_free_blocks (block_t block, unsigned long count)
 {
-  char *bh;
+  unsigned char *bh;
   unsigned long block_group;
   unsigned long bit;
   unsigned long i;
@@ -140,8 +140,8 @@ ext2_new_block (block_t goal,
                block_t prealloc_goal,
                block_t *prealloc_count, block_t *prealloc_block)
 {
-  char *bh = NULL;
-  char *p, *r;
+  unsigned char *bh = NULL;
+  unsigned char *p, *r;
   int i, j, k, tmp;
   unsigned long lmap;
   struct ext2_group_desc *gdp;
@@ -231,9 +231,9 @@ repeat:
        * Search first in the remainder of the current group; then,
        * cyclicly search through the rest of the groups.
        */
-      p = ((char *) bh) + (j >> 3);
+      p = bh + (j >> 3);
       r = memscan (p, 0, (sblock->s_blocks_per_group - j + 7) >> 3);
-      k = (r - ((char *) bh)) << 3;
+      k = (r - bh) << 3;
       if (k < sblock->s_blocks_per_group)
        {
          j = k;
@@ -434,7 +434,7 @@ block_in_use (block_t block, unsigned char *map)
 void
 ext2_check_blocks_bitmap ()
 {
-  char *bh;
+  unsigned char *bh;
   unsigned long desc_count, bitmap_count, x;
   unsigned long desc_blocks;
   struct ext2_group_desc *gdp;
diff --git a/ext2fs/bitmap.c b/ext2fs/bitmap.c
index 9285023..c6d882b 100644
--- a/ext2fs/bitmap.c
+++ b/ext2fs/bitmap.c
@@ -32,7 +32,7 @@
 static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
 
 static inline
-unsigned long count_free (char * map, unsigned int numchars)
+unsigned long count_free (unsigned char *map, unsigned int numchars)
 {
        unsigned int i;
        unsigned long sum = 0;
diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index 6cdfba2..bc375c3 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -413,7 +413,7 @@ dirscanblock (vm_address_t blockaddr, struct node *dp, int 
idx,
          || EXT2_DIR_REC_LEN (entry->name_len) > entry->rec_len
          || memchr (entry->name, '\0', entry->name_len))
        {
-         ext2_warning ("bad directory entry: inode: %Ld offset: %zd",
+         ext2_warning ("bad directory entry: inode: %Ld offset: %lu",
                        dp->cache_id,
                        currentoff - blockaddr + idx * DIRBLKSIZ);
          return ENOENT;
diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h
index b839819..070d5bd 100644
--- a/ext2fs/ext2fs.h
+++ b/ext2fs/ext2fs.h
@@ -116,14 +116,14 @@ void pokel_inherit (struct pokel *pokel, struct pokel 
*from);
 
 #include <stdint.h>
 
-extern int test_bit (unsigned num, char *bitmap);
+extern int test_bit (unsigned num, unsigned char *bitmap);
 
-extern int set_bit (unsigned num, char *bitmap);
+extern int set_bit (unsigned num, unsigned char *bitmap);
 
 #if defined(__USE_EXTERN_INLINES) || defined(EXT2FS_DEFINE_EI)
 /* Returns TRUE if bit NUM is set in BITMAP.  */
 EXT2FS_EI int
-test_bit (unsigned num, char *bitmap)
+test_bit (unsigned num, unsigned char *bitmap)
 {
   const uint32_t *const bw = (uint32_t *) bitmap + (num >> 5);
   const uint_fast32_t mask = 1 << (num & 31);
@@ -133,7 +133,7 @@ test_bit (unsigned num, char *bitmap)
 /* Sets bit NUM in BITMAP, and returns the previous state of the bit.  Unlike
    the linux version, this function is NOT atomic!  */
 EXT2FS_EI int
-set_bit (unsigned num, char *bitmap)
+set_bit (unsigned num, unsigned char *bitmap)
 {
   uint32_t *const bw = (uint32_t *) bitmap + (num >> 5);
   const uint_fast32_t mask = 1 << (num & 31);
@@ -143,7 +143,7 @@ set_bit (unsigned num, char *bitmap)
 /* Clears bit NUM in BITMAP, and returns the previous state of the bit.
    Unlike the linux version, this function is NOT atomic!  */
 EXT2FS_EI int
-clear_bit (unsigned num, char *bitmap)
+clear_bit (unsigned num, unsigned char *bitmap)
 {
   uint32_t *const bw = (uint32_t *) bitmap + (num >> 5);
   const uint_fast32_t mask = 1 << (num & 31);
@@ -437,7 +437,7 @@ struct pokel global_pokel;
 /* If the block size is less than the page size, then this bitmap is used to
    record which disk blocks are actually modified, so we don't stomp on parts
    of the disk which are backed by file pagers.  */
-char *modified_global_blocks;
+unsigned char *modified_global_blocks;
 pthread_spinlock_t modified_global_blocks_lock;
 
 extern int global_block_modified (block_t block);
diff --git a/ext2fs/hyper.c b/ext2fs/hyper.c
index 5f288bf..91d9d12 100644
--- a/ext2fs/hyper.c
+++ b/ext2fs/hyper.c
@@ -24,7 +24,7 @@
 #include "ext2fs.h"
 
 vm_address_t zeroblock;
-char *modified_global_blocks;
+unsigned char *modified_global_blocks;
 
 static void
 allocate_mod_map (void)
diff --git a/ext2fs/ialloc.c b/ext2fs/ialloc.c
index 7cfc4f3..2809371 100644
--- a/ext2fs/ialloc.c
+++ b/ext2fs/ialloc.c
@@ -52,7 +52,7 @@
 void
 diskfs_free_node (struct node *np, mode_t old_mode)
 {
-  char *bh;
+  unsigned char *bh;
   unsigned long block_group;
   unsigned long bit;
   struct ext2_group_desc *gdp;
@@ -114,7 +114,7 @@ diskfs_free_node (struct node *np, mode_t old_mode)
 ino_t
 ext2_alloc_inode (ino_t dir_inum, mode_t mode)
 {
-  char *bh = NULL;
+  unsigned char *bh = NULL;
   int i, j, avefreei;
   ino_t inum;
   struct ext2_group_desc *gdp;
@@ -225,7 +225,7 @@ repeat:
     {
       if (set_bit (inum, bh))
        {
-         ext2_warning ("bit already set for inode %d", inum);
+         ext2_warning ("bit already set for inode %llu", inum);
          disk_cache_block_deref (bh);
          bh = NULL;
          goto repeat;
@@ -250,7 +250,7 @@ repeat:
   if (inum < EXT2_FIRST_INO (sblock) || inum > sblock->s_inodes_count)
     {
       ext2_error ("reserved inode or inode > inodes count - "
-                 "block_group = %d,inode=%d", i, inum);
+                 "block_group = %d,inode=%llu", i, inum);
       inum = 0;
       goto sync_out;
     }
diff --git a/ext2fs/pager.c b/ext2fs/pager.c
index 47c5f94..458b822 100644
--- a/ext2fs/pager.c
+++ b/ext2fs/pager.c
@@ -636,7 +636,7 @@ pager_unlock_page (struct user_pager_info *pager, 
vm_offset_t page)
       if (err == ENOSPC)
        ext2_warning ("This filesystem is out of space, and will now crash.  
Bye!");
       else if (err)
-       ext2_warning ("inode=%Ld, page=0x%zx: %s",
+       ext2_warning ("inode=%Ld, page=0x%lx: %s",
                      node->cache_id, page, strerror (err));
 
       return err;
@@ -988,7 +988,7 @@ disk_cache_return_unused (void)
                       1);
   else
     {
-      printf ("ext2fs: disk cache is starving\n");
+      ext2_debug ("ext2fs: disk cache is starving\n");
 
       /* Give it some time.  This should happen rarely.  */
       sleep (1);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]