mtd/fs/jffs2/ecos/src dir-ecos.c, 1.11, 1.12 flashio.c, 1.1, 1.2 fs-ecos.c, 1.44, 1.45 os-ecos.h, 1.24, 1.25

lunn at infradead.org lunn at infradead.org
Sat Jul 30 11:25:49 EDT 2005


Update of /home/cvs/mtd/fs/jffs2/ecos/src
In directory phoenix.infradead.org:/tmp/cvs-serv8934/src

Modified Files:
	dir-ecos.c flashio.c fs-ecos.c os-ecos.h 
Log Message:
Merge with eCos sources and clean up some compiler warnings.


Index: dir-ecos.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/dir-ecos.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- dir-ecos.c	8 Feb 2005 19:36:27 -0000	1.11
+++ dir-ecos.c	30 Jul 2005 15:25:45 -0000	1.12
@@ -38,8 +38,8 @@
 	for (fd_list = dir_f->dents; fd_list && fd_list->nhash <= hash; fd_list = fd_list->next) {
 		if (fd_list->nhash == hash && 
 		    (!fd || fd_list->version > fd->version) &&
-		    strlen(fd_list->name) == namelen &&
-		    !strncmp(fd_list->name, d_name, namelen)) {
+		    strlen((char *)fd_list->name) == namelen &&
+		    !strncmp((char *)fd_list->name, (char *)d_name, namelen)) {
 			fd = fd_list;
 		}
 	}
@@ -90,7 +90,8 @@
 	dir_f = JFFS2_INODE_INFO(dir_i);
 
 	ret = jffs2_do_create(c, dir_f, f, ri, 
-			      d_name, strlen(d_name));
+			      (const char *)d_name, 
+                              strlen((char *)d_name));
 
 	if (ret) {
 		inode->i_nlink = 0;
@@ -117,8 +118,8 @@
 	struct jffs2_inode_info *dead_f = JFFS2_INODE_INFO(d_inode);
 	int ret;
 
-	ret = jffs2_do_unlink(c, dir_f, d_name, 
-			       strlen(d_name), dead_f);
+	ret = jffs2_do_unlink(c, dir_f, (const char *)d_name, 
+			       strlen((char *)d_name), dead_f);
 	if (dead_f->inocache)
 		d_inode->i_nlink = dead_f->inocache->nlink;
 	return ret;
@@ -137,7 +138,9 @@
 	uint8_t type = (old_d_inode->i_mode & S_IFMT) >> 12;
 	if (!type) type = DT_REG;
 
-	ret = jffs2_do_link(c, dir_f, f->inocache->ino, type, d_name, strlen(d_name));
+	ret = jffs2_do_link(c, dir_f, f->inocache->ino, type, 
+                            (const char * )d_name, 
+                            strlen((char *)d_name));
 
 	if (!ret) {
 		down(&f->sem);
@@ -171,7 +174,7 @@
 	/* Try to reserve enough space for both node and dirent. 
 	 * Just the node will do for now, though 
 	 */
-	namelen = strlen(d_name);
+	namelen = strlen((char *)d_name);
 	ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL);
 
 	if (ret) {
@@ -331,7 +334,8 @@
 
 	ret = jffs2_do_link(c, JFFS2_INODE_INFO(new_dir_i), 
 			    d_inode->i_ino, type,
-			    new_d_name, strlen(new_d_name));
+			    (const char *)new_d_name, 
+                            strlen((char *)new_d_name));
 
 	if (ret)
 		return ret;
@@ -349,7 +353,8 @@
 
 	/* Unlink the original */
 	ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), 
-		      old_d_name, strlen(old_d_name), NULL);
+                              (const char *)old_d_name, 
+                              strlen((char *)old_d_name), NULL);
 
 	if (ret) {
 		/* Oh shit. We really ought to make a single node which can do both atomically */

Index: flashio.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/flashio.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- flashio.c	26 Nov 2003 14:09:29 -0000	1.1
+++ flashio.c	30 Jul 2005 15:25:45 -0000	1.2
@@ -21,7 +21,7 @@
 
 cyg_bool jffs2_flash_read(struct jffs2_sb_info * c,
 			  cyg_uint32 read_buffer_offset, const size_t size,
-			  size_t * return_size, char *write_buffer)
+			  size_t * return_size, unsigned char *write_buffer)
 {
 	Cyg_ErrNo err;
 	cyg_uint32 len = size;
@@ -39,7 +39,7 @@
 
 cyg_bool jffs2_flash_write(struct jffs2_sb_info * c,
 			   cyg_uint32 write_buffer_offset, const size_t size,
-			   size_t * return_size, char *read_buffer)
+			   size_t * return_size, unsigned char *read_buffer)
 {
 
 	Cyg_ErrNo err;

Index: fs-ecos.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/fs-ecos.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- fs-ecos.c	24 Jul 2005 15:29:57 -0000	1.44
+++ fs-ecos.c	30 Jul 2005 15:25:45 -0000	1.45
@@ -167,12 +167,12 @@
 // Directory operations
 
 struct jffs2_dirsearch {
-	struct _inode *dir;	// directory to search
-	const char *path;	// path to follow
-	struct _inode *node;	// Node found
-	const char *name;	// last name fragment used
-	int namelen;		// name fragment length
-	cyg_bool last;		// last name in path?
+	struct _inode *dir;	    // directory to search
+	const unsigned char *path;  // path to follow
+	struct _inode *node;	    // Node found
+	const unsigned char *name;  // last name fragment used
+	int namelen;		    // name fragment length
+	cyg_bool last;		    // last name in path?
 };
 
 typedef struct jffs2_dirsearch jffs2_dirsearch;
@@ -221,7 +221,7 @@
 // Initialize a dirsearch object to start a search
 
 static void init_dirsearch(jffs2_dirsearch * ds,
-			   struct _inode *dir, const char *name)
+			   struct _inode *dir, const unsigned char *name)
 {
 	D2(printf("init_dirsearch name = %s\n", name));
 	D2(printf("init_dirsearch dir = %x\n", dir));
@@ -243,8 +243,8 @@
 static int find_entry(jffs2_dirsearch * ds)
 {
 	struct _inode *dir = ds->dir;
-	const char *name = ds->path;
-	const char *n = name;
+	const unsigned char *name = ds->path;
+	const unsigned char *n = name;
 	char namelen = 0;
 	struct _inode *d;
 
@@ -693,7 +693,8 @@
 	if (mode & (O_CREAT|O_TRUNC|O_WRONLY))
 		return EROFS;
 #endif
-	init_dirsearch(&ds, (struct _inode *) dir, name);
+	init_dirsearch(&ds, (struct _inode *) dir, 
+                       (const unsigned char *) name);
 
 	err = jffs2_find(&ds);
 
@@ -776,7 +777,8 @@
 
 	D2(printf("jffs2_ops_unlink\n"));
 
-	init_dirsearch(&ds, (struct _inode *) dir, name);
+	init_dirsearch(&ds, (struct _inode *) dir, 
+                       (const unsigned char *)name);
 
 	err = jffs2_find(&ds);
 
@@ -812,7 +814,8 @@
 
 	D2(printf("jffs2_ops_mkdir\n"));
 
-	init_dirsearch(&ds, (struct _inode *) dir, name);
+	init_dirsearch(&ds, (struct _inode *) dir, 
+                       (const unsigned char *)name);
 
 	err = jffs2_find(&ds);
 
@@ -848,7 +851,8 @@
 
 	D2(printf("jffs2_ops_rmdir\n"));
 
-	init_dirsearch(&ds, (struct _inode *) dir, name);
+	init_dirsearch(&ds, (struct _inode *) dir, 
+                       (const unsigned char *)name);
 
 	err = jffs2_find(&ds);
 
@@ -883,7 +887,8 @@
 
 	D2(printf("jffs2_ops_rename\n"));
 
-	init_dirsearch(&ds1, (struct _inode *) dir1, name1);
+	init_dirsearch(&ds1, (struct _inode *) dir1, 
+                       (const unsigned char *)name1);
 
 	err = jffs2_find(&ds1);
 
@@ -892,7 +897,8 @@
 		return err;
 	}
 
-	init_dirsearch(&ds2, (struct _inode *) dir2, name2);
+	init_dirsearch(&ds2, (struct _inode *) dir2, 
+                       (const unsigned char *)name2);
 
 	err = jffs2_find(&ds2);
 
@@ -983,7 +989,8 @@
 	if (type != CYG_FSLINK_HARD)
 		return EINVAL;
 
-	init_dirsearch(&ds1, (struct _inode *) dir1, name1);
+	init_dirsearch(&ds1, (struct _inode *) dir1, 
+                       (const unsigned char *) name1);
 
 	err = jffs2_find(&ds1);
 
@@ -992,7 +999,8 @@
 		return err;
 	}
 
-	init_dirsearch(&ds2, (struct _inode *) dir2, name2);
+	init_dirsearch(&ds2, (struct _inode *) dir2, 
+                       (const unsigned char *) name2);
 
 	err = jffs2_find(&ds2);
 
@@ -1046,7 +1054,8 @@
 
 	D2(printf("jffs2_opendir\n"));
 
-	init_dirsearch(&ds, (struct _inode *) dir, name);
+	init_dirsearch(&ds, (struct _inode *) dir, 
+                       (const unsigned char *) name);
 
 	err = jffs2_find(&ds);
 
@@ -1090,7 +1099,8 @@
 		jffs2_dirsearch ds;
 		int err;
 
-		init_dirsearch(&ds, (struct _inode *) dir, name);
+		init_dirsearch(&ds, (struct _inode *) dir, 
+                               (const unsigned char *) name);
 
 		err = jffs2_find(&ds);
 		jffs2_iput(ds.dir);
@@ -1132,7 +1142,8 @@
 
 	D2(printf("jffs2_stat\n"));
 
-	init_dirsearch(&ds, (struct _inode *) dir, name);
+	init_dirsearch(&ds, (struct _inode *) dir, 
+                       (const unsigned char *) name);
 
 	err = jffs2_find(&ds);
 	jffs2_iput(ds.dir);
@@ -1169,7 +1180,8 @@
 
 	D2(printf("jffs2_getinfo\n"));
 
-	init_dirsearch(&ds, (struct _inode *) dir, name);
+	init_dirsearch(&ds, (struct _inode *) dir, 
+                       (const unsigned char *) name);
 
 	err = jffs2_find(&ds);
 	jffs2_iput(ds.dir);
@@ -1430,7 +1442,7 @@
 	// we get an error.
 	for (i = 0; i < uio->uio_iovcnt; i++) {
 		cyg_iovec *iov = &uio->uio_iov[i];
-		char *buf = (char *) iov->iov_base;
+		unsigned char *buf = iov->iov_base;
 		off_t len = iov->iov_len;
 
 		uint32_t writtenlen;
@@ -1621,7 +1633,7 @@
 // jffs2_fo_dirread()
 // Read a single directory entry from a file.
 
-static __inline void filldir(char *nbuf, int nlen, const char *name, int namlen)
+static __inline void filldir(char *nbuf, int nlen, const unsigned char *name, int namlen)
 {
 	int len = nlen < namlen ? nlen : namlen;
 	memcpy(nbuf, name, len);
@@ -1656,11 +1668,11 @@
 	if (offset == 0) {
 		D1(printk
 		   (KERN_DEBUG "Dirent 0: \".\", ino #%lu\n", inode->i_ino));
-		filldir(nbuf, nlen, ".", 1);
+		filldir(nbuf, nlen, (const unsigned char *) ".", 1);
 		goto out;
 	}
 	if (offset == 1) {
-		filldir(nbuf, nlen, "..", 2);
+		filldir(nbuf, nlen, (const unsigned char *) "..", 2);
 		goto out;
 	}
 
@@ -1687,7 +1699,7 @@
 		D2(printk
 		   (KERN_DEBUG "Dirent %ld: \"%s\", ino #%u, type %d\n", offset,
 		    fd->name, fd->ino, fd->type));
-		filldir(nbuf, nlen, fd->name, strlen(fd->name));
+		filldir(nbuf, nlen, fd->name, strlen((char *)fd->name));
 		goto out_sem;
 	}
 	/* Reached the end of the directory */

Index: os-ecos.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/os-ecos.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- os-ecos.h	9 Feb 2005 09:23:55 -0000	1.24
+++ os-ecos.h	30 Jul 2005 15:25:46 -0000	1.25
@@ -175,9 +175,9 @@
 
 /* flashio.c */
 cyg_bool jffs2_flash_read(struct jffs2_sb_info *c, cyg_uint32 read_buffer_offset,
-			  const size_t size, size_t * return_size, char * write_buffer);
+			  const size_t size, size_t * return_size, unsigned char * write_buffer);
 cyg_bool jffs2_flash_write(struct jffs2_sb_info *c, cyg_uint32 write_buffer_offset,
-			   const size_t size, size_t * return_size, char * read_buffer);
+			   const size_t size, size_t * return_size, unsigned char * read_buffer);
 int jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct iovec *vecs,
 			      unsigned long count, loff_t to, size_t *retlen);
 cyg_bool jffs2_flash_erase(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb);
@@ -197,11 +197,12 @@
 { }
 
 #ifndef CONFIG_JFFS2_FS_WRITEBUFFER
+#define SECTOR_ADDR(x) ( ((unsigned long)(x) & ~(c->sector_size-1)) )
 #define jffs2_can_mark_obsolete(c) (1)
 #define jffs2_cleanmarker_oob(c) (0)
 #define jffs2_write_nand_cleanmarker(c,jeb) (-EIO)
 
-#define jffs2_flush_wbuf_pad(c) ({ (void)(c), 0; })
+#define jffs2_flush_wbuf_pad(c) (c=c)
 #define jffs2_flush_wbuf_gc(c, i) ({ (void)(c), (void) i, 0; })
 #define jffs2_nand_read_failcnt(c,jeb) do { ; } while(0)
 #define jffs2_write_nand_badblock(c,jeb,p) (0)





More information about the linux-mtd-cvs mailing list