lkml.org 
[lkml]   [2020]   [Jan]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v8 01/13] exfat: add in-memory and on-disk structures and headers
2020-01-02 20:06 GMT+09:00, Pali Rohár <pali.rohar@gmail.com>:
> Hello, just remainder for question below, so it would not be lost.
>
> I guess that if comment for structure says that it needs to have exact
> size then structure should be marked as packed to prevent any unexpected
> paddings added by compiler (as IIRC compiler is free to add any padding
> between any structure members).
Okay, I will fix it on next version.

Thanks!
>
> On Sunday 29 December 2019 15:11:08 Pali Rohár wrote:
>> On Friday 20 December 2019 01:24:07 Namjae Jeon wrote:
>> > +
>> > +#define JUMP_BOOT_LEN 3
>> > +#define OEM_NAME_LEN 8
>> > +#define MUST_BE_ZERO_LEN 53
>> > +#define EXFAT_FILE_NAME_LEN 15
>> > +
>> > +/* EXFAT BIOS parameter block (64 bytes) */
>> > +struct bpb64 {
>> > + __u8 jmp_boot[JUMP_BOOT_LEN];
>> > + __u8 oem_name[OEM_NAME_LEN];
>> > + __u8 res_zero[MUST_BE_ZERO_LEN];
>> > +};
>> > +
>> > +/* EXFAT EXTEND BIOS parameter block (56 bytes) */
>> > +struct bsx64 {
>> > + __le64 vol_offset;
>> > + __le64 vol_length;
>> > + __le32 fat_offset;
>> > + __le32 fat_length;
>> > + __le32 clu_offset;
>> > + __le32 clu_count;
>> > + __le32 root_cluster;
>> > + __le32 vol_serial;
>> > + __u8 fs_version[2];
>> > + __le16 vol_flags;
>> > + __u8 sect_size_bits;
>> > + __u8 sect_per_clus_bits;
>> > + __u8 num_fats;
>> > + __u8 phy_drv_no;
>> > + __u8 perc_in_use;
>> > + __u8 reserved2[7];
>> > +};
>>
>> Should not be this structure marked as packed? Also those two below.
>>
>> > +/* EXFAT PBR[BPB+BSX] (120 bytes) */
>> > +struct pbr64 {
>> > + struct bpb64 bpb;
>> > + struct bsx64 bsx;
>> > +};
>> > +
>> > +/* Common PBR[Partition Boot Record] (512 bytes) */
>> > +struct pbr {
>> > + union {
>> > + __u8 raw[64];
>> > + struct bpb64 f64;
>> > + } bpb;
>> > + union {
>> > + __u8 raw[56];
>> > + struct bsx64 f64;
>> > + } bsx;
>> > + __u8 boot_code[390];
>> > + __le16 signature;
>> > +};
>>
>
> --
> Pali Rohár
> pali.rohar@gmail.com
>

\
 
 \ /
  Last update: 2020-01-02 12:12    [W:0.048 / U:10.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site