>From 54ee5eaa158496963cc5f65bff28a4a39aff8bcd Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Jun 2012 14:02:38 +0200 Subject: [PATCH 1/3] Minor fixes - some inlines - extern "C" to include yaffsfs.h from C++ - u32/unsigned type mismatch in yaffs_query_init_block_state() prototype - int yaffsfs_GetLastError(void) should be defined is yaffs_osglue.h - struct yaffsfs_DeviceConfiguration no longer needed in yaffscfg.h - remove invalid state value in trace message in yaffs2_checkpt_find_block() - some redundant includes in yaffsfs.c --- direct/yaffs_osglue.h | 1 + direct/yaffscfg.h | 6 ------ direct/yaffsfs.c | 10 +++------- direct/yaffsfs.h | 13 +++++++++++-- direct/yportenv.h | 2 +- yaffs_checkptrw.c | 4 ++-- yaffs_guts.c | 7 +++++-- yaffs_nand.h | 2 +- 8 files changed, 24 insertions(+), 21 deletions(-) diff --git a/direct/yaffs_osglue.h b/direct/yaffs_osglue.h index bb008f9..cec1c86 100644 --- a/direct/yaffs_osglue.h +++ b/direct/yaffs_osglue.h @@ -31,6 +31,7 @@ void yaffsfs_Unlock(void); u32 yaffsfs_CurrentTime(void); void yaffsfs_SetError(int err); +int yaffsfs_GetLastError(void); void *yaffsfs_malloc(size_t size); void yaffsfs_free(void *ptr); diff --git a/direct/yaffscfg.h b/direct/yaffscfg.h index 1ffaae9..671496b 100644 --- a/direct/yaffscfg.h +++ b/direct/yaffscfg.h @@ -29,11 +29,5 @@ #define YAFFSFS_N_DSC 20 -struct yaffsfs_DeviceConfiguration { - const YCHAR *prefix; - struct yaffs_dev *dev; -}; - - #endif diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index 9f1397b..0538ce6 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -13,12 +13,8 @@ #include "yaffsfs.h" #include "yaffs_guts.h" -#include "yaffscfg.h" -#include "yportenv.h" #include "yaffs_trace.h" -#include "string.h" - #define YAFFSFS_MAX_SYMLINK_DEREFERENCES 5 #ifndef NULL @@ -386,7 +382,7 @@ static void yaffsfs_BreakDeviceHandles(struct yaffs_dev *dev) */ #ifdef CONFIG_YAFFS_CASE_INSENSITIVE -static int yaffs_toupper(YCHAR a) +static inline int yaffs_toupper(YCHAR a) { if (a >= 'a' && a <= 'z') return (a - 'a') + 'A'; @@ -394,12 +390,12 @@ static int yaffs_toupper(YCHAR a) return a; } -int yaffsfs_Match(YCHAR a, YCHAR b) +static inline int yaffsfs_Match(YCHAR a, YCHAR b) { return (yaffs_toupper(a) == yaffs_toupper(b)); } #else -int yaffsfs_Match(YCHAR a, YCHAR b) +static inline int yaffsfs_Match(YCHAR a, YCHAR b) { /* case sensitive */ return (a == b); diff --git a/direct/yaffsfs.h b/direct/yaffsfs.h index c20da16..eda547f 100644 --- a/direct/yaffsfs.h +++ b/direct/yaffsfs.h @@ -34,6 +34,12 @@ ( (sizeof(loff_t) < 8) ? YAFFS_MAX_FILE_SIZE_32 : (0x800000000LL - 1) ) +#ifdef __cplusplus +extern "C" +{ +#endif + + struct yaffs_dirent { long d_ino; /* inode number */ off_t d_off; /* offset to this dirent */ @@ -46,7 +52,6 @@ struct yaffs_dirent { typedef struct opaque_structure yaffs_DIR; - struct yaffs_stat { int st_dev; /* device */ int st_ino; /* inode */ @@ -189,7 +194,6 @@ struct yaffs_dev; void yaffs_add_device(struct yaffs_dev *dev); int yaffs_start_up(void); -int yaffsfs_GetLastError(void); /* Functions to iterate through devices. NB Use with extreme care! */ void yaffs_dev_rewind(void); @@ -207,4 +211,9 @@ int yaffs_set_error(int error); /* Trace control functions */ unsigned yaffs_set_trace(unsigned tm); unsigned yaffs_get_trace(void); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/direct/yportenv.h b/direct/yportenv.h index b47a4d6..abc761b 100644 --- a/direct/yportenv.h +++ b/direct/yportenv.h @@ -22,7 +22,7 @@ #ifdef CONFIG_YAFFS_DEFINES_TYPES typedef unsigned char u8; typedef unsigned short u16; -typedef unsigned u32; +typedef unsigned int u32; #endif diff --git a/yaffs_checkptrw.c b/yaffs_checkptrw.c index d897044..926f90c 100644 --- a/yaffs_checkptrw.c +++ b/yaffs_checkptrw.c @@ -149,8 +149,8 @@ static void yaffs2_checkpt_find_block(struct yaffs_dev *dev) dev->param.read_chunk_tags_fn(dev, realigned_chunk, NULL, &tags); yaffs_trace(YAFFS_TRACE_CHECKPOINT, - "find next checkpt block: search: block %d state %d oid %d seq %d eccr %d", - i, (int) state, + "find next checkpt block: search: block %d oid %d seq %d eccr %d", + i, tags.obj_id, tags.seq_number, tags.ecc_result); diff --git a/yaffs_guts.c b/yaffs_guts.c index f3bc419..0f1b471 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -4326,7 +4326,7 @@ static void yaffs_del_dir_contents(struct yaffs_obj *dir) } } -static void yaffs_empty_l_n_f(struct yaffs_dev *dev) +static inline void yaffs_empty_l_n_f(struct yaffs_dev *dev) { yaffs_del_dir_contents(dev->lost_n_found); } @@ -5018,7 +5018,10 @@ int yaffs_get_n_free_chunks(struct yaffs_dev *dev) void yaffs_oh_size_load(struct yaffs_obj_hdr *oh, loff_t fsize) { oh->file_size_low = (fsize & 0xFFFFFFFF); - oh->file_size_high = ((fsize >> 32) & 0xFFFFFFFF); + if (sizeof(loff_t) >= 8) + oh->file_size_high = ((fsize >> 32) & 0xFFFFFFFF); + else + oh->file_size_high = 0; } loff_t yaffs_oh_to_size(struct yaffs_obj_hdr *oh) diff --git a/yaffs_nand.h b/yaffs_nand.h index 7134662..4f206c7 100644 --- a/yaffs_nand.h +++ b/yaffs_nand.h @@ -29,7 +29,7 @@ int yaffs_mark_bad(struct yaffs_dev *dev, int block_no); int yaffs_query_init_block_state(struct yaffs_dev *dev, int block_no, enum yaffs_block_state *state, - unsigned *seq_number); + u32 *seq_number); int yaffs_erase_block(struct yaffs_dev *dev, int flash_block); -- 1.7.10