mtd/fs/jffs2/ecos/src dir-ecos.c,1.3,1.4 file-ecos.c,1.5,1.6 fs-ecos.c,1.10,1.11 jffs2port.h,1.3,1.4 os-ecos.h,1.7,1.8

David Woodhouse dwmw2 at infradead.org
Thu Nov 20 11:42:01 EST 2003


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

Modified Files:
	dir-ecos.c file-ecos.c fs-ecos.c jffs2port.h os-ecos.h 
Log Message:
Bring eCos support up to date

Index: dir-ecos.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/dir-ecos.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dir-ecos.c	22 Jan 2003 00:04:13 -0000	1.3
+++ dir-ecos.c	20 Nov 2003 16:41:58 -0000	1.4
@@ -162,7 +162,6 @@
 	struct jffs2_full_dirent *fd;
 	int namelen;
 	uint32_t alloclen, phys_ofs;
-	uint32_t writtenlen;
 	int ret;
 
 	mode |= S_IFDIR;
@@ -197,7 +196,7 @@
 	ri->data_crc = cpu_to_je32(0);
 	ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
 	
-	fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, &writtenlen);
+	fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, ALLOC_NORMAL);
 
 	jffs2_free_raw_inode(ri);
 
@@ -214,20 +213,12 @@
 	f->metadata = fn;
 	up(&f->sem);
 
-	/* Work out where to put the dirent node now. */
-	writtenlen = PAD(writtenlen);
-	phys_ofs += writtenlen;
-	alloclen -= writtenlen;
-
-	if (alloclen < sizeof(*rd)+namelen) {
-		/* Not enough space left in this chunk. Get some more */
-		jffs2_complete_reservation(c);
-		ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_NORMAL);
-		if (ret) {
-			/* Eep. */
-			jffs2_clear_inode(inode);
-			return ret;
-		}
+	jffs2_complete_reservation(c);
+	ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_NORMAL);
+	if (ret) {
+		/* Eep. */
+		jffs2_clear_inode(inode);
+		return ret;
 	}
 	
 	rd = jffs2_alloc_raw_dirent();
@@ -255,7 +246,7 @@
 	rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
 	rd->name_crc = cpu_to_je32(crc32(0, d_name->name, namelen));
 
-	fd = jffs2_write_dirent(c, dir_f, rd, d_name->name, namelen, phys_ofs, &writtenlen);
+	fd = jffs2_write_dirent(c, dir_f, rd, d_name->name, namelen, phys_ofs, ALLOC_NORMAL);
 	
 	jffs2_complete_reservation(c);
 	jffs2_free_raw_dirent(rd);

Index: file-ecos.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/file-ecos.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- file-ecos.c	22 Jan 2003 00:04:13 -0000	1.5
+++ file-ecos.c	20 Nov 2003 16:41:58 -0000	1.6
@@ -115,7 +115,7 @@
 		ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
 		ri.data_crc = cpu_to_je32(0);
 		
-		fn = jffs2_write_dnode(c, f, &ri, NULL, 0, phys_ofs, NULL);
+		fn = jffs2_write_dnode(c, f, &ri, NULL, 0, phys_ofs, ALLOC_NORMAL);
 		jffs2_complete_reservation(c);
 		if (IS_ERR(fn)) {
 			ret = PTR_ERR(fn);

Index: fs-ecos.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/fs-ecos.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- fs-ecos.c	20 Nov 2003 09:33:31 -0000	1.10
+++ fs-ecos.c	20 Nov 2003 16:41:58 -0000	1.11
@@ -567,7 +567,7 @@
 		jffs2_sb->s_root->i_count = 1;	// Ensures the root inode is always in ram until umount
 
 		D2(printf("jffs2_mount erasing pending blocks\n"));
-		jffs2_erase_pending_blocks(c);
+		jffs2_erase_pending_blocks(c,0);
 	}
 	mte->data = (CYG_ADDRWORD) jffs2_sb;
 
@@ -1705,6 +1705,21 @@
 
 	return inode;
 }
+struct inode *ilookup(struct super_block *sb, cyg_uint32 ino)
+{
+	struct inode *inode = NULL;
+
+	D2(printf("ilookup\n"));
+	// Check for this inode in the cache
+	for (inode = sb->s_root; inode != NULL; inode = inode->i_cache_next) {
+		if (inode->i_ino == ino) {
+			inode->i_count++;
+			break;
+		}
+	}
+
+	return inode;
+}
 
 struct inode *iget(struct super_block *sb, cyg_uint32 ino)
 {
@@ -1722,12 +1737,9 @@
 
 	D2(printf("iget\n"));
 
-	// Check for this inode in the cache
-	for (inode = sb->s_root; inode != NULL; inode = inode->i_cache_next) {
-		if (inode->i_ino == ino)
-			return inode;
-	}
-	inode = NULL;
+	inode = ilookup(sb, ino);
+	if (inode)
+		return inode;
 
 	// Not cached, so malloc it
 	inode = new_inode(sb);
@@ -1736,7 +1748,7 @@
 
 	inode->i_ino = ino;
 	jffs2_read_inode(inode);
-
+	inode->i_count = 1;
 	return inode;
 }
 
@@ -1851,7 +1863,7 @@
 }
 
 int
-jffs2_flash_writev(struct jffs2_sb_info *c, const struct iovec *vecs,
+jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct iovec *vecs,
 		   unsigned long count, loff_t to, size_t * retlen)
 {
 	unsigned long i;

Index: jffs2port.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/jffs2port.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- jffs2port.h	21 Jan 2003 18:13:22 -0000	1.3
+++ jffs2port.h	20 Nov 2003 16:41:58 -0000	1.4
@@ -189,7 +189,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);
 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);
-int jffs2_flash_writev(struct jffs2_sb_info *c, const struct iovec *vecs, unsigned long count, loff_t to, size_t *retlen);
+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);
 
 

Index: os-ecos.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/os-ecos.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- os-ecos.h	20 Nov 2003 09:33:31 -0000	1.7
+++ os-ecos.h	20 Nov 2003 16:41:58 -0000	1.8
@@ -233,13 +233,14 @@
 #define jffs2_cleanmarker_oob(c) (0)
 #define jffs2_write_nand_cleanmarker(c,jeb) (-EIO)
 
-#define jffs2_flush_wbuf(c, flag) do { ; } while(0)
+#define jffs2_flush_wbuf_pad(c) ({ (void)(c), 0; })
+#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) do { ; } while(0)
 #define jffs2_nand_flash_setup(c) (0)
 #define jffs2_nand_flash_cleanup(c) do {} while(0)
 #define jffs2_wbuf_dirty(c) (0)
-#define jffs2_flash_writev jffs2_flash_writev
+#define jffs2_flash_writev(a,b,c,d,e,f) jffs2_flash_direct_writev(a,b,c,d,e)
 #define jffs2_wbuf_timeout NULL
 #define jffs2_wbuf_process NULL
 #else
@@ -254,5 +255,7 @@
 	memset(f, 0, sizeof(*f));
 	init_MUTEX_LOCKED(&f->sem);
 }
+
+#define BUG_ON(x) do { if (unlikely(x)) BUG(); } while(0)
 
 #endif /* __JFFS2_OS_ECOS_H__ */




More information about the linux-mtd-cvs mailing list