[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] F2FS support
From: |
Andrei Borzenkov |
Subject: |
Re: [PATCH v2] F2FS support |
Date: |
Sun, 3 May 2015 09:28:58 +0300 |
В Sat, 2 May 2015 20:15:45 +0300
Andrei Borzenkov <address@hidden> пишет:
> > +
> > +static inline int
> > +grub_generic_test_bit (int nr, const grub_uint32_t *addr)
> > +{
> > + return 1UL & (addr[nr / 32] >> (nr & 31));
> > +}
> > +
>
> This is used only in grub_f2fs_check_dentries() with on-disk bitmap.
> On-disk bitmap is little-endian; code is wrong on big-endian system.
>
> Also dentry_bitmap is not multiple of 4 bytes as you replied earlier.
> You should rather compute correct byte address instead and make all
> parameters grub_uint8_t *. This will also avoid all those casts later.
>
> That's really just
>
> grub_uint8_t *addr;
>
> byte = nr >> 3;
> #ifdef WORDS_BIGENDIAN
> byte ^= 3;
> #endif
Scratch it. We do know that byte order is LE so it is fixed. Sorry.
> return addr[byte] & (1 << nr & 7);
>