X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=yaffs_endian.h;h=8c271891a0197cb2d8e1d039c289e27208cd09b8;hp=d37bc50a7e5a8538d5ac1d2c8b24bad295a4a70a;hb=1d642a6bacba667d53d3bba29d77c7bd7c956681;hpb=21b2dedaa32ab309f6d1daec966528b7586bd207 diff --git a/yaffs_endian.h b/yaffs_endian.h index d37bc50..8c27189 100644 --- a/yaffs_endian.h +++ b/yaffs_endian.h @@ -1,8 +1,7 @@ /* * YAFFS: Yet another Flash File System . A NAND-flash specific file system. * - * Copyright (C) 2002-2011 Aleph One Ltd. - * for Toby Churchill Ltd and Brightstar Engineering + * Copyright (C) 2002-2018 Aleph One Ltd. * * Created by Charles Manning * @@ -29,19 +28,22 @@ static inline u32 swap_u32(u32 val) #define swap_s32(val) \ (s32)(swap_u32((u32)(val))) -static inline Y_LOFF_T swap_loff_t(Y_LOFF_T lval) +static inline loff_t swap_loff_t(loff_t lval) { - u32 vall = swap_u32((u32) (lval & 0xffffffff)); + u32 vall = swap_u32(FSIZE_LOW(lval)); u32 valh; - if (sizeof(Y_LOFF_T) == sizeof(u32)) - return (Y_LOFF_T) vall; + if (sizeof(loff_t) == sizeof(u32)) + return (loff_t) vall; - valh = swap_u32((u32) ((lval >> 32) & 0xffffffff)); + valh = swap_u32(FSIZE_HIGH(lval)); - return (Y_LOFF_T)((((u64)vall) << 32) | valh); + return FSIZE_COMBINE(vall, valh); /*NB: h and l are swapped. */ } + + +struct yaffs_dev; void yaffs_do_endian_s32(struct yaffs_dev *dev, s32 *val); void yaffs_do_endian_u32(struct yaffs_dev *dev, u32 *val); void yaffs_do_endian_oh(struct yaffs_dev *dev, struct yaffs_obj_hdr *oh);