All of lore.kernel.org
 help / color / mirror / Atom feed
From: Omniflux <omniflux+lists@omniflux.com>
To: grub-devel@gnu.org
Subject: fs/fat.c assumes that 0UL is the same for 32bit and 64bit archs
Date: Wed, 16 Feb 2005 01:56:10 -0700	[thread overview]
Message-ID: <42130AAA.7030500@omniflux.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 287 bytes --]

fs/fat.c assumes that 0UL is the same for 32bit and 64bit archs, but it
is not.

There are four locations in fs/fat.c where a 32bit unsigned int is set
equal to 0UL. This causes warnings when compiling on 64bit architectures
   as 0UL is 0xffffffffffffffff (64bits) there.

-- 
Omniflux

[-- Attachment #2: 0UL-fix.diff --]
[-- Type: text/plain, Size: 1145 bytes --]

--- grub2/fs/fat.c	2004-08-28 07:14:29.000000000 -0600
+++ grub2.modified/fs/fat.c	2005-02-16 00:39:25.271409504 -0700
@@ -243,7 +243,7 @@
   else
     {
       /* FAT12 or FAT16.  */
-      data->root_cluster = ~0UL;
+      data->root_cluster = 0xffffffff;
 
       if (data->num_clusters <= 4085 + 2)
 	{
@@ -293,7 +293,7 @@
 
   /* Start from the root directory.  */
   data->file_cluster = data->root_cluster;
-  data->cur_cluster_num = ~0UL;
+  data->cur_cluster_num = 0xffffffff;
   data->attr = GRUB_FAT_ATTR_DIRECTORY;
   return data;
 
@@ -318,7 +318,7 @@
   
   /* This is a special case. FAT12 and FAT16 doesn't have the root directory
      in clusters.  */
-  if (data->file_cluster == ~0UL)
+  if (data->file_cluster == 0xffffffff)
     {
       size = (data->num_root_sectors << GRUB_DISK_SECTOR_BITS) - offset;
       if (size > len)
@@ -613,7 +613,7 @@
   data->file_size = grub_le_to_cpu32 (dir.file_size);
   data->file_cluster = ((grub_le_to_cpu16 (dir.first_cluster_high) << 16)
 			| grub_le_to_cpu16 (dir.first_cluster_low));
-  data->cur_cluster_num = ~0UL;
+  data->cur_cluster_num = 0xffffffff;
   
   return dirp;
 }


             reply	other threads:[~2005-02-16  9:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-16  8:56 Omniflux [this message]
2005-03-02 21:01 ` fs/fat.c assumes that 0UL is the same for 32bit and 64bit archs Yoshinori K. Okuji
2005-03-02 21:20   ` Marco Gerards
2005-03-02 21:40     ` Yoshinori K. Okuji

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42130AAA.7030500@omniflux.com \
    --to=omniflux+lists@omniflux.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.