bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 34/41] ext2fs: Port to x86_64


From: Sergey Bugaev
Subject: [PATCH 34/41] ext2fs: Port to x86_64
Date: Tue, 9 May 2023 00:31:29 +0300

---
 ext2fs/dir.c    | 13 ++++++++-----
 ext2fs/ext2fs.c |  3 ++-
 ext2fs/hyper.c  |  3 ++-
 ext2fs/ialloc.c | 10 ++++++----
 ext2fs/inode.c  |  3 ++-
 ext2fs/pager.c  |  5 +++--
 6 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index 963f0843..ede3eda5 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <dirent.h>
 #include <stddef.h>
+#include <inttypes.h>
 
 #include <hurd/sigpreempt.h>
 
@@ -415,7 +416,7 @@ dirscanblock (vm_address_t blockaddr, struct node *dp, int 
idx,
          || EXT2_DIR_REC_LEN (entry->name_len) > le16toh (entry->rec_len)
          || memchr (entry->name, '\0', entry->name_len))
        {
-         ext2_warning ("bad directory entry: inode: %Ld offset: %lu",
+         ext2_warning ("bad directory entry: inode: %" PRIu64 " offset: %lu",
                        dp->cache_id,
                        (unsigned long)(currentoff - blockaddr + idx * 
DIRBLKSIZ));
          return ENOENT;
@@ -838,7 +839,7 @@ diskfs_drop_dirstat (struct node *dp, struct dirstat *ds)
 static error_t
 count_dirents (struct node *dp, block_t nb, char *buf)
 {
-  size_t amt;
+  mach_msg_type_number_t amt;
   char *offinblk;
   struct ext2_dir_entry_2 *entry;
   int count = 0;
@@ -893,7 +894,7 @@ diskfs_get_directs (struct node *dp,
   char *datap;
   struct ext2_dir_entry_2 *entryp;
   int allocsize;
-  size_t checklen;
+  mach_msg_type_number_t checklen;
   struct dirent *userp;
 
   nblks = dp->dn_stat.st_size/DIRBLKSIZ;
@@ -1069,7 +1070,8 @@ diskfs_get_directs (struct node *dp,
 
       if (le16toh (entryp->rec_len) == 0)
        {
-         ext2_warning ("zero length directory entry: inode: %Ld offset: %zd",
+         ext2_warning ("zero length directory entry: inode: %" PRIu64
+                       " offset: %zd",
                        dp->cache_id,
                        blkno * DIRBLKSIZ + bufp - buf);
          return EIO;
@@ -1083,7 +1085,8 @@ diskfs_get_directs (struct node *dp,
        }
       else if (bufp - buf > DIRBLKSIZ)
        {
-         ext2_warning ("directory entry too long: inode: %Ld offset: %zd",
+         ext2_warning ("directory entry too long: inode: %" PRIu64
+                       " offset: %zd",
                        dp->cache_id,
              blkno * DIRBLKSIZ + bufp - buf - le16toh (entryp->rec_len));
          return EIO;
diff --git a/ext2fs/ext2fs.c b/ext2fs/ext2fs.c
index 8e434969..3c76d8c8 100644
--- a/ext2fs/ext2fs.c
+++ b/ext2fs/ext2fs.c
@@ -28,6 +28,7 @@
 #include <error.h>
 #include <argz.h>
 #include <argp.h>
+#include <inttypes.h>
 #include <hurd/store.h>
 #include <version.h>
 #include "ext2fs.h"
@@ -230,7 +231,7 @@ main (int argc, char **argv)
                            &store_parsed, &bootstrap);
 
   if (store->size < SBLOCK_OFFS + SBLOCK_SIZE)
-    ext2_panic ("device too small for superblock (%Ld bytes)", store->size);
+    ext2_panic ("device too small for superblock (%" PRIi64 " bytes)", 
store->size);
   if (store->log2_blocks_per_page < 0)
     ext2_panic ("device block size (%zu) greater than page size (%lu)",
                store->block_size, (unsigned long)vm_page_size);
diff --git a/ext2fs/hyper.c b/ext2fs/hyper.c
index 3fe4a7d7..dd09442a 100644
--- a/ext2fs/hyper.c
+++ b/ext2fs/hyper.c
@@ -20,6 +20,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <error.h>
+#include <inttypes.h>
 #include <hurd/store.h>
 #include "ext2fs.h"
 
@@ -104,7 +105,7 @@ get_hypermetadata (void)
               (long long int) le32toh (sblock->s_blocks_count) << 
log2_block_size);
   if (log2_dev_blocks_per_fs_block != 0
       && (store->size & ((1 << log2_dev_blocks_per_fs_block) - 1)) != 0)
-    ext2_warning ("%Ld (%zd byte) device blocks "
+    ext2_warning ("%" PRIi64 " (%zd byte) device blocks "
                  " unused after last filesystem (%d byte) block",
                  (store->size & ((1 << log2_dev_blocks_per_fs_block) - 1)),
                  store->block_size, block_size);
diff --git a/ext2fs/ialloc.c b/ext2fs/ialloc.c
index 3e26be7e..d6f5ac79 100644
--- a/ext2fs/ialloc.c
+++ b/ext2fs/ialloc.c
@@ -43,6 +43,8 @@
 
 #include "ext2fs.h"
 #include "bitmap.c"
+
+#include <inttypes.h>
 
 /* ---------------------------------------------------------------- */
 
@@ -68,7 +70,7 @@ diskfs_free_node (struct node *np, mode_t old_mode)
 
   if (inum < EXT2_FIRST_INO (sblock) || inum > le32toh 
(sblock->s_inodes_count))
     {
-      ext2_error ("reserved inode or nonexistent inode: %Ld", inum);
+      ext2_error ("reserved inode or nonexistent inode: %" PRIu64, inum);
       pthread_spin_unlock (&global_lock);
       return;
     }
@@ -80,7 +82,7 @@ diskfs_free_node (struct node *np, mode_t old_mode)
   bh = disk_cache_block_ref (le32toh (gdp->bg_inode_bitmap));
 
   if (!clear_bit (bit, bh))
-    ext2_warning ("bit already cleared for inode %Ld", inum);
+    ext2_warning ("bit already cleared for inode %" PRIu64, inum);
   else
     {
       disk_cache_block_ref_ptr (bh);
@@ -228,7 +230,7 @@ repeat:
     {
       if (set_bit (inum, bh))
        {
-         ext2_warning ("bit already set for inode %llu", inum);
+         ext2_warning ("bit already set for inode %" PRIu64, inum);
          disk_cache_block_deref (bh);
          bh = NULL;
          goto repeat;
@@ -253,7 +255,7 @@ repeat:
   if (inum < EXT2_FIRST_INO (sblock) || inum > le32toh 
(sblock->s_inodes_count))
     {
       ext2_error ("reserved inode or inode > inodes count - "
-                 "block_group = %d,inode=%llu", i, inum);
+                 "block_group = %d,inode=%" PRIu64, i, inum);
       inum = 0;
       goto sync_out;
     }
diff --git a/ext2fs/inode.c b/ext2fs/inode.c
index 0bfaa77f..2e3ca9a9 100644
--- a/ext2fs/inode.c
+++ b/ext2fs/inode.c
@@ -23,6 +23,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdio.h>
+#include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/statfs.h>
 #include <sys/statvfs.h>
@@ -215,7 +216,7 @@ diskfs_user_read_node (struct node *np, struct 
lookup_context *ctx)
          if (le32toh (di->i_size_high))        /* XXX */
            {
              dino_deref (di);
-             ext2_warning ("cannot handle large file inode %Ld", np->cache_id);
+             ext2_warning ("cannot handle large file inode %" PRIu64, 
np->cache_id);
              diskfs_end_catch_exception ();
              return EFBIG;
            }
diff --git a/ext2fs/pager.c b/ext2fs/pager.c
index e6e1dca6..2869f4dc 100644
--- a/ext2fs/pager.c
+++ b/ext2fs/pager.c
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <errno.h>
 #include <error.h>
+#include <inttypes.h>
 #include <hurd/store.h>
 #include "ext2fs.h"
 
@@ -642,7 +643,7 @@ pager_unlock_page (struct user_pager_info *pager, 
vm_offset_t page)
       if (err == ENOSPC)
        ext2_warning ("This filesystem is out of space.");
       else if (err)
-       ext2_warning ("inode=%Ld, page=0x%lx: %s",
+       ext2_warning ("inode=%" PRIu64 ", page=0x%lx: %s",
                      node->cache_id, (unsigned long)page, strerror (err));
 
       return err;
@@ -730,7 +731,7 @@ diskfs_grow (struct node *node, off_t size, struct protid 
*cred)
                  dn->last_page_partially_writable
                  ? " (last page writable)": "");
       if (err)
-       ext2_warning ("inode=%Ld, target=%Ld: %s",
+       ext2_warning ("inode=%" PRIu64 ", target=%" PRIi64 ": %s",
                      node->cache_id, new_size, strerror (err));
 
       node->allocsize = new_size;
-- 
2.40.1




reply via email to

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