* [PATCH 7/8] fs: use get_unaligned_* helpers
@ 2008-05-02 3:52 Harvey Harrison
2008-05-02 11:40 ` Stefan Richter
0 siblings, 1 reply; 3+ messages in thread
From: Harvey Harrison @ 2008-05-02 3:52 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
fs/partitions/ldm.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/partitions/ldm.h b/fs/partitions/ldm.h
index 80f63b5..8c341f3 100644
--- a/fs/partitions/ldm.h
+++ b/fs/partitions/ldm.h
@@ -99,9 +99,9 @@ struct parsed_partitions;
#define TOC_BITMAP2 "log" /* bitmaps in the TOCBLOCK. */
/* Most numbers we deal with are big-endian and won't be aligned. */
-#define BE16(x) ((u16)be16_to_cpu(get_unaligned((__be16*)(x))))
-#define BE32(x) ((u32)be32_to_cpu(get_unaligned((__be32*)(x))))
-#define BE64(x) ((u64)be64_to_cpu(get_unaligned((__be64*)(x))))
+#define BE16(x) get_unaligned_be16((x))
+#define BE32(x) get_unaligned_be32((x))
+#define BE64(x) get_unaligned_be64((x))
/* Borrowed from msdos.c */
#define SYS_IND(p) (get_unaligned(&(p)->sys_ind))
--
1.5.5.1.350.gbbbf
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 7/8] fs: use get_unaligned_* helpers
2008-05-02 3:52 [PATCH 7/8] fs: use get_unaligned_* helpers Harvey Harrison
@ 2008-05-02 11:40 ` Stefan Richter
2008-05-02 18:17 ` Harvey Harrison
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Richter @ 2008-05-02 11:40 UTC (permalink / raw)
To: Harvey Harrison; +Cc: Andrew Morton, LKML
Harvey Harrison wrote:
> fs/partitions/ldm.h | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/partitions/ldm.h b/fs/partitions/ldm.h
...
> /* Most numbers we deal with are big-endian and won't be aligned. */
> -#define BE16(x) ((u16)be16_to_cpu(get_unaligned((__be16*)(x))))
> -#define BE32(x) ((u32)be32_to_cpu(get_unaligned((__be32*)(x))))
> -#define BE64(x) ((u64)be64_to_cpu(get_unaligned((__be64*)(x))))
> +#define BE16(x) get_unaligned_be16((x))
> +#define BE32(x) get_unaligned_be32((x))
> +#define BE64(x) get_unaligned_be64((x))
Why the double parentheses?
More importantly, I would say ldm.c should rather use
get_unaligned_be*() directly. No need to hide what these macros are
about by using a local alias.
After that, ldm.c should be inspected for whether really all of the
accesses are unaligned. If there are any which are guaranteed to be
aligned, they should of course be turned into be*_to_cpu(). But
separately from this conversion to get_unaligned_be*().
--
Stefan Richter
-=====-==--- -=-= ---=-
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 7/8] fs: use get_unaligned_* helpers
2008-05-02 11:40 ` Stefan Richter
@ 2008-05-02 18:17 ` Harvey Harrison
0 siblings, 0 replies; 3+ messages in thread
From: Harvey Harrison @ 2008-05-02 18:17 UTC (permalink / raw)
To: Stefan Richter; +Cc: Andrew Morton, LKML
On Fri, 2008-05-02 at 13:40 +0200, Stefan Richter wrote:
> Harvey Harrison wrote:
> > fs/partitions/ldm.h | 6 +++---
> > 1 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/partitions/ldm.h b/fs/partitions/ldm.h
> ...
> > /* Most numbers we deal with are big-endian and won't be aligned. */
> > -#define BE16(x) ((u16)be16_to_cpu(get_unaligned((__be16*)(x))))
> > -#define BE32(x) ((u32)be32_to_cpu(get_unaligned((__be32*)(x))))
> > -#define BE64(x) ((u64)be64_to_cpu(get_unaligned((__be64*)(x))))
> > +#define BE16(x) get_unaligned_be16((x))
> > +#define BE32(x) get_unaligned_be32((x))
> > +#define BE64(x) get_unaligned_be64((x))
>
> Why the double parentheses?
No reason.
>
> More importantly, I would say ldm.c should rather use
> get_unaligned_be*() directly. No need to hide what these macros are
> about by using a local alias.
Done, will send out a revised set.
>
> After that, ldm.c should be inspected for whether really all of the
> accesses are unaligned. If there are any which are guaranteed to be
> aligned, they should of course be turned into be*_to_cpu(). But
> separately from this conversion to get_unaligned_be*().
It looks like they are all needed from a quick inspection, the comments
seem to suggest that lots of the accesses will be unaligned.
Cheers,
Harvey
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-02 18:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-02 3:52 [PATCH 7/8] fs: use get_unaligned_* helpers Harvey Harrison
2008-05-02 11:40 ` Stefan Richter
2008-05-02 18:17 ` Harvey Harrison
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox