From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: "Albert D. Cahalan" <acahalan@cs.uml.edu>
Cc: linux-kernel@vger.kernel.org, chaffee@cs.berkeley.edu
Subject: Re: [patch] fat/msdos/vfat crud removal
Date: Sun, 09 Jun 2002 18:00:30 +0900 [thread overview]
Message-ID: <871ybgddxt.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <200206090603.g5963FA458690@saturn.cs.uml.edu>
"Albert D. Cahalan" <acahalan@cs.uml.edu> writes:
> Use the packed attribute on the struct, along with
> the right types. I don't think you need get_unaligned
> with a packed struct, because gcc will know that it
> needs to emit code for unaligned data.
>
> At the very least you can get rid of the cast.
>
> Before:
> logical_sector_size = le16_to_cpu(get_unaligned((u16*)&b->sector_size));
>
> After:
> logical_sector_size = le16_to_cpu(b->sector_size);
>
> The new struct:
>
> /* Note the end: __attribute__ ((packed)) */
> struct fat_boot_sector {
> char ignored[3]; /* Boot strap short or near jump */
> __u64 system_id; /* Name - can be used to special case
> partition manager volumes */
> __u16 sector_size; /* bytes per logical sector */
> __u8 cluster_size; /* sectors/cluster */
> __u16 reserved; /* reserved sectors */
> __u8 fats; /* number of FATs */
> __u16 dir_entries; /* root directory entries */
> __u16 sectors; /* number of sectors */
> __u8 media; /* media code */
> __u16 fat_length; /* sectors/FAT */
> __u16 secs_track; /* sectors per track */
> __u16 heads; /* number of heads */
> __u32 hidden; /* hidden sectors (unused) */
> __u32 total_sect; /* number of sectors (if sectors == 0) */
>
> /* The following fields are only used by FAT32 */
> __u32 fat32_length; /* sectors/FAT */
> __u16 flags; /* bit 8: fat mirroring, low 4: active fat */
> __u16 version; /* major, minor filesystem version */
> __u32 root_cluster; /* first cluster in root directory */
> __u16 info_sector; /* filesystem info sector */
> __u16 backup_boot; /* backup boot sector */
> __u16 reserved2[6]; /* Unused */
> } __attribute__ ((packed)) ;
BTW, is this safe on other of i386 (ex. mips etc.)? I'm not sure.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
next prev parent reply other threads:[~2002-06-09 9:00 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-09 2:47 [patch] fat/msdos/vfat crud removal Albert D. Cahalan
2002-06-09 4:24 ` OGAWA Hirofumi
2002-06-09 4:32 ` OGAWA Hirofumi
2002-06-09 4:46 ` Albert D. Cahalan
2002-06-09 5:07 ` OGAWA Hirofumi
2002-06-09 6:03 ` Albert D. Cahalan
2002-06-09 6:32 ` OGAWA Hirofumi
2002-06-09 7:09 ` Albert D. Cahalan
2002-06-09 7:49 ` OGAWA Hirofumi
2002-06-09 9:46 ` Dave Jones
2002-06-09 17:52 ` Eric W. Biederman
2002-06-09 18:49 ` H. Peter Anvin
2002-06-09 19:00 ` Thunder from the hill
2002-06-09 19:29 ` David Woodhouse
2002-06-09 20:19 ` Thunder from the hill
2002-06-10 13:51 ` Eric W. Biederman
2002-06-09 21:04 ` Albert D. Cahalan
2002-06-10 13:55 ` Eric W. Biederman
2002-06-11 16:49 ` Jamie Lokier
2002-06-12 6:50 ` Eric W. Biederman
2002-06-12 11:47 ` Thunder from the hill
2002-06-09 9:00 ` OGAWA Hirofumi [this message]
2002-06-09 13:51 ` Martin Dalecki
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=871ybgddxt.fsf@devron.myhome.or.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=acahalan@cs.uml.edu \
--cc=chaffee@cs.berkeley.edu \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox