From: Charles Manning Date: Thu, 14 Jun 2012 01:22:40 +0000 (+1200) Subject: Merge branch '32-bit-loff_t' X-Git-Tag: pre-driver-refactoring~6 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=878880321c4fa7ab0e431d22a3dd156a9a272c68;hp=-c Merge branch '32-bit-loff_t' Signed-off-by: Charles Manning --- 878880321c4fa7ab0e431d22a3dd156a9a272c68 diff --combined direct/yaffsfs.c index 61aee74,b418eca..d208e25 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@@ -74,7 -74,7 +74,7 @@@ struct yaffsfs_FileDes u8 shareWrite:1; int inodeId:12; /* Index to corresponding yaffsfs_Inode */ int handleCount:10; /* Number of handles for this fd */ - loff_t position; /* current position in file */ + Y_LOFF_T position; /* current position in file */ }; struct yaffsfs_Handle { @@@ -394,19 -394,19 +394,19 @@@ static int yaffs_toupper(YCHAR a return a; } -int yaffsfs_Match(YCHAR a, YCHAR b) +static int yaffsfs_Match(YCHAR a, YCHAR b) { return (yaffs_toupper(a) == yaffs_toupper(b)); } #else -int yaffsfs_Match(YCHAR a, YCHAR b) +static int yaffsfs_Match(YCHAR a, YCHAR b) { /* case sensitive */ return (a == b); } #endif -int yaffsfs_IsPathDivider(YCHAR ch) +static int yaffsfs_IsPathDivider(YCHAR ch) { const YCHAR *str = YAFFS_PATH_DIVIDERS; @@@ -419,7 -419,7 +419,7 @@@ return 0; } -int yaffsfs_CheckNameLength(const char *name) +static int yaffsfs_CheckNameLength(const char *name) { int retVal = 0; @@@ -1000,7 -1000,7 +1000,7 @@@ int yaffs_open(const YCHAR *path, int o YAFFS_SHARE_READ | YAFFS_SHARE_WRITE); } -int yaffs_Dofsync(int handle, int datasync) +static int yaffs_Dofsync(int handle, int datasync) { int retVal = -1; struct yaffs_obj *obj; @@@ -1063,18 -1063,18 +1063,18 @@@ int yaffs_close(int handle return retVal; } -int yaffsfs_do_read(int handle, void *vbuf, unsigned int nbyte, +static int yaffsfs_do_read(int handle, void *vbuf, unsigned int nbyte, - int isPread, loff_t offset) + int isPread, Y_LOFF_T offset) { struct yaffsfs_FileDes *fd = NULL; struct yaffs_obj *obj = NULL; - loff_t pos = 0; - loff_t startPos = 0; - loff_t endPos = 0; + Y_LOFF_T pos = 0; + Y_LOFF_T startPos = 0; + Y_LOFF_T endPos = 0; int nRead = 0; int nToRead = 0; int totalRead = 0; - loff_t maxRead; + Y_LOFF_T maxRead; u8 *buf = (u8 *) vbuf; if (!vbuf) { @@@ -1180,19 -1180,19 +1180,19 @@@ int yaffs_read(int handle, void *buf, u return yaffsfs_do_read(handle, buf, nbyte, 0, 0); } - int yaffs_pread(int handle, void *buf, unsigned int nbyte, loff_t offset) + int yaffs_pread(int handle, void *buf, unsigned int nbyte, Y_LOFF_T offset) { return yaffsfs_do_read(handle, buf, nbyte, 1, offset); } -int yaffsfs_do_write(int handle, const void *vbuf, unsigned int nbyte, +static int yaffsfs_do_write(int handle, const void *vbuf, unsigned int nbyte, - int isPwrite, loff_t offset) + int isPwrite, Y_LOFF_T offset) { struct yaffsfs_FileDes *fd = NULL; struct yaffs_obj *obj = NULL; - loff_t pos = 0; - loff_t startPos = 0; - loff_t endPos; + Y_LOFF_T pos = 0; + Y_LOFF_T startPos = 0; + Y_LOFF_T endPos; int nWritten = 0; int totalWritten = 0; int write_trhrough = 0; @@@ -1297,12 -1297,12 +1297,12 @@@ int yaffs_write(int fd, const void *buf return yaffsfs_do_write(fd, buf, nbyte, 0, 0); } - int yaffs_pwrite(int fd, const void *buf, unsigned int nbyte, loff_t offset) + int yaffs_pwrite(int fd, const void *buf, unsigned int nbyte, Y_LOFF_T offset) { return yaffsfs_do_write(fd, buf, nbyte, 1, offset); } - int yaffs_truncate(const YCHAR *path, loff_t new_size) + int yaffs_truncate(const YCHAR *path, Y_LOFF_T new_size) { struct yaffs_obj *obj = NULL; struct yaffs_obj *dir = NULL; @@@ -1347,7 -1347,7 +1347,7 @@@ return (result) ? 0 : -1; } - int yaffs_ftruncate(int handle, loff_t new_size) + int yaffs_ftruncate(int handle, Y_LOFF_T new_size) { struct yaffsfs_FileDes *fd = NULL; struct yaffs_obj *obj = NULL; @@@ -1375,12 -1375,12 +1375,12 @@@ } - loff_t yaffs_lseek(int handle, loff_t offset, int whence) + Y_LOFF_T yaffs_lseek(int handle, Y_LOFF_T offset, int whence) { struct yaffsfs_FileDes *fd = NULL; struct yaffs_obj *obj = NULL; - loff_t pos = -1; - loff_t fSize = -1; + Y_LOFF_T pos = -1; + Y_LOFF_T fSize = -1; yaffsfs_Lock(); fd = yaffsfs_HandleToFileDes(handle); @@@ -1416,7 -1416,7 +1416,7 @@@ return pos; } -int yaffsfs_DoUnlink(const YCHAR *path, int isDirectory) +static int yaffsfs_DoUnlink(const YCHAR *path, int isDirectory) { struct yaffs_obj *dir = NULL; struct yaffs_obj *obj = NULL; @@@ -2648,9 -2648,9 +2648,9 @@@ int yaffs_unmount(const YCHAR *path return yaffs_unmount2(path, 0); } - loff_t yaffs_freespace(const YCHAR *path) + Y_LOFF_T yaffs_freespace(const YCHAR *path) { - loff_t retVal = -1; + Y_LOFF_T retVal = -1; struct yaffs_dev *dev = NULL; YCHAR *dummy; @@@ -2677,9 -2677,9 +2677,9 @@@ return retVal; } - loff_t yaffs_totalspace(const YCHAR *path) + Y_LOFF_T yaffs_totalspace(const YCHAR *path) { - loff_t retVal = -1; + Y_LOFF_T retVal = -1; struct yaffs_dev *dev = NULL; YCHAR *dummy; @@@ -2710,7 -2710,7 +2710,7 @@@ int yaffs_inodecount(const YCHAR *path) { - loff_t retVal = -1; + Y_LOFF_T retVal = -1; struct yaffs_dev *dev = NULL; YCHAR *dummy; @@@ -3137,9 -3137,9 +3137,9 @@@ int yaffs_link(const YCHAR *oldpath, co int yaffs_mknod(const YCHAR *pathname, mode_t mode, dev_t dev) { - pathname = pathname; - mode = mode; - dev = dev; + (void) pathname; + (void) mode; + (void) dev; yaffsfs_SetError(-EINVAL); return -1; @@@ -3189,7 -3189,7 +3189,7 @@@ int yaffs_set_error(int error int yaffs_dump_dev(const YCHAR *path) { #if 1 - path = path; + (void) path; #else YCHAR *rest; diff --combined yaffs_guts.c index dfa775f,f3bc419..1602c4b --- a/yaffs_guts.c +++ b/yaffs_guts.c @@@ -185,6 -185,31 +185,6 @@@ void yaffs_release_temp_buffer(struct y } -/* - * Determine if we have a managed buffer. - */ -int yaffs_is_managed_tmp_buffer(struct yaffs_dev *dev, const u8 *buffer) -{ - int i; - - for (i = 0; i < YAFFS_N_TEMP_BUFFERS; i++) { - if (dev->temp_buffer[i].buffer == buffer) - return 1; - } - - for (i = 0; i < dev->param.n_caches; i++) { - if (dev->cache[i].data == buffer) - return 1; - } - - if (buffer == dev->checkpt_buffer) - return 1; - - yaffs_trace(YAFFS_TRACE_ALWAYS, - "yaffs: unmaged buffer detected."); - return 0; -} - /* * Functions for robustisizing TODO * @@@ -194,18 -219,18 +194,18 @@@ static void yaffs_handle_chunk_wr_ok(st const u8 *data, const struct yaffs_ext_tags *tags) { - dev = dev; - nand_chunk = nand_chunk; - data = data; - tags = tags; + (void) dev; + (void) nand_chunk; + (void) data; + (void) tags; } static void yaffs_handle_chunk_update(struct yaffs_dev *dev, int nand_chunk, const struct yaffs_ext_tags *tags) { - dev = dev; - nand_chunk = nand_chunk; - tags = tags; + (void) dev; + (void) nand_chunk; + (void) tags; } void yaffs_handle_chunk_error(struct yaffs_dev *dev, @@@ -675,7 -700,10 +675,10 @@@ void yaffs_set_obj_name_from_oh(struct loff_t yaffs_max_file_size(struct yaffs_dev *dev) { - return ((loff_t) YAFFS_MAX_CHUNK_ID) * dev->data_bytes_per_chunk; + if(sizeof(loff_t) < 8) + return YAFFS_MAX_FILE_SIZE_32; + else + return ((loff_t) YAFFS_MAX_CHUNK_ID) * dev->data_bytes_per_chunk; } /*-------------------- TNODES ------------------- @@@ -714,7 -742,7 +717,7 @@@ static void yaffs_deinit_tnodes_and_obj dev->n_tnodes = 0; } -void yaffs_load_tnode_0(struct yaffs_dev *dev, struct yaffs_tnode *tn, +static void yaffs_load_tnode_0(struct yaffs_dev *dev, struct yaffs_tnode *tn, unsigned pos, unsigned val) { u32 *map = (u32 *) tn; @@@ -791,7 -819,7 +794,7 @@@ struct yaffs_tnode *yaffs_find_tnode_0( int required_depth; int level = file_struct->top_level; - dev = dev; + (void) dev; /* Check sane level and chunk Id */ if (level < 0 || level > YAFFS_TNODES_MAX_LEVEL) @@@ -1901,7 -1929,7 +1904,7 @@@ struct yaffs_obj *yaffs_find_by_number( return NULL; } -struct yaffs_obj *yaffs_new_obj(struct yaffs_dev *dev, int number, +static struct yaffs_obj *yaffs_new_obj(struct yaffs_dev *dev, int number, enum yaffs_obj_type type) { struct yaffs_obj *the_obj = NULL; @@@ -3198,7 -3226,7 +3201,7 @@@ static void yaffs_load_name_from_oh(str } } else { #else - dev = dev; + (void) dev; { #endif strncpy(name, oh_name, buff_size - 1); @@@ -3835,7 -3863,7 +3838,7 @@@ static int yaffs_unlink_file_if_needed( return ret_val; } -int yaffs_del_file(struct yaffs_obj *in) +static int yaffs_del_file(struct yaffs_obj *in) { int ret_val = YAFFS_OK; int deleted; /* Need to cache value on stack if in is freed */ @@@ -4983,8 -5011,8 +4986,8 @@@ int yaffs_get_n_free_chunks(struct yaff return n_free; } - /*\ - * Marshalling functions to get loff_t file sizes into aand out of + /* + * Marshalling functions to get loff_t file sizes into and out of * object headers. */ void yaffs_oh_size_load(struct yaffs_obj_hdr *oh, loff_t fsize) @@@ -4997,7 -5025,7 +5000,7 @@@ loff_t yaffs_oh_to_size(struct yaffs_ob { loff_t retval; - if (~(oh->file_size_high)) + if (sizeof(loff_t) >= 8 && ~(oh->file_size_high)) retval = (((loff_t) oh->file_size_high) << 32) | (((loff_t) oh->file_size_low) & 0xFFFFFFFF); else