Clean up some compilation warnings for VxWorks aleph1-release
authorCharles Manning <cdhmanning@gmail.com>
Fri, 11 Aug 2017 04:28:05 +0000 (16:28 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Fri, 11 Aug 2017 04:28:05 +0000 (16:28 +1200)
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
direct/yaffs_list.h
direct/ydirectenv.h
yaffs_endian.h
yaffs_guts.c
yaffs_guts.h

index a7afaea27b13b413007ca721efd9ab0a4eebc702..c0994934ad0af08d8a0523d9c12c33c55dcbba27 100644 (file)
@@ -36,6 +36,10 @@ struct list_head {
 
 
 /* Initialise a static list */
 
 
 /* Initialise a static list */
+#ifdef LIST_HEAD
+#undef LIST_HEAD
+#endif
+
 #define LIST_HEAD(name) \
 struct list_head name = { &(name), &(name)}
 
 #define LIST_HEAD(name) \
 struct list_head name = { &(name), &(name)}
 
index b15147cad55fccf8e53578915d94b273070a0711..126b6ce79b1ed9b407fa43f747e6bafe9d8a47e1 100644 (file)
@@ -39,6 +39,9 @@ void yaffs_bug_fn(const char *file_name, int line_no);
 #define Y_LOFF_T loff_t
 #endif
 
 #define Y_LOFF_T loff_t
 #endif
 
+/* Some RTOSs (eg. VxWorks) need strnlen. */
+size_t strnlen(const char *s, size_t maxlen);
+
 #define yaffs_strcat(a, b)     strcat(a, b)
 #define yaffs_strcpy(a, b)     strcpy(a, b)
 #define yaffs_strncpy(a, b, c) strncpy(a, b, c)
 #define yaffs_strcat(a, b)     strcat(a, b)
 #define yaffs_strcpy(a, b)     strcpy(a, b)
 #define yaffs_strncpy(a, b, c) strncpy(a, b, c)
index d9b4e07d21f334eef70d412f5fe75209a0a757f6..e2fc602edf9c4da545e651f053d66963175a80ec 100644 (file)
@@ -31,17 +31,19 @@ static inline u32 swap_u32(u32 val)
 
 static inline loff_t swap_loff_t(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(loff_t) == sizeof(u32))
                return (loff_t) vall;
 
        u32 valh;
 
        if (sizeof(loff_t) == sizeof(u32))
                return (loff_t) vall;
 
-       valh = swap_u32((u32) ((lval >> 32) & 0xffffffff));
+       valh = swap_u32(FSIZE_HIGH(lval));
 
 
-       return (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);
 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);
index e95d87022f95d3f51cea961671eef476e410ef89..44b1805c2f0e2fba3b26713c702863d997caf985 100644 (file)
@@ -5158,8 +5158,9 @@ void yaffs_oh_size_load(struct yaffs_dev *dev,
                        loff_t fsize,
                        int do_endian)
 {
                        loff_t fsize,
                        int do_endian)
 {
-       oh->file_size_low = (fsize & 0xFFFFFFFF);
-       oh->file_size_high = ((fsize >> 32) & 0xFFFFFFFF);
+       oh->file_size_low = FSIZE_LOW(fsize);
+
+       oh->file_size_high = FSIZE_HIGH(fsize);
 
        if (do_endian) {
                yaffs_do_endian_u32(dev, &oh->file_size_low);
 
        if (do_endian) {
                yaffs_do_endian_u32(dev, &oh->file_size_low);
@@ -5181,8 +5182,7 @@ loff_t yaffs_oh_to_size(struct yaffs_dev *dev, struct yaffs_obj_hdr *oh,
                        yaffs_do_endian_u32 (dev, &low);
                        yaffs_do_endian_u32 (dev, &high);
                }
                        yaffs_do_endian_u32 (dev, &low);
                        yaffs_do_endian_u32 (dev, &high);
                }
-               retval = (((loff_t) high) << 32) |
-                       (((loff_t) low) & 0xFFFFFFFF);
+               retval = FSIZE_COMBINE(high, low);
        } else {
                u32 low = oh->file_size_low;
 
        } else {
                u32 low = oh->file_size_low;
 
index 6bcf12dcd07fe676beb97f58cd43cae47d0f467c..974396ff65c6b770239fbcbdafe21aff91b01778 100644 (file)
@@ -1050,4 +1050,21 @@ void yaffs_count_blocks_by_state(struct yaffs_dev *dev, int bs[10]);
 int yaffs_find_chunk_in_file(struct yaffs_obj *in, int inode_chunk,
                                    struct yaffs_ext_tags *tags);
 
 int yaffs_find_chunk_in_file(struct yaffs_obj *in, int inode_chunk,
                                    struct yaffs_ext_tags *tags);
 
+/*
+ * Define LOFF_T_32_BIT if a 32-bit LOFF_T is being used.
+ * Not serious if you get this wrong - you might just get some warnings.
+*/
+
+#ifdef  LOFF_T_32_BIT
+#define FSIZE_LOW(fsize) (fsize)
+#define FSIZE_HIGH(fsize) 0
+#define FSIZE_COMBINE(high, low) (low)
+#else
+#define FSIZE_LOW(fsize) ((fsize) & 0xffffffff)
+#define FSIZE_HIGH(fsize)(((fsize) >> 32) & 0xffffffff)
+#define FSIZE_COMBINE(high, low) ((((loff_t) (high)) << 32) | \
+                                       (((loff_t) (low)) & 0xFFFFFFFF))
+#endif
+
+
 #endif
 #endif