mtd/fs/jffs2/ecos/src dir-ecos.c,1.8,1.9 fs-ecos.c,1.23,1.24 os-ecos.h,1.15,1.16 jffs2port.h,1.12,NONE

David Woodhouse dwmw2 at infradead.org
Wed Nov 26 10:24:31 EST 2003


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

Modified Files:
	dir-ecos.c fs-ecos.c os-ecos.h 
Removed Files:
	jffs2port.h 
Log Message:
Abolish qstr. Take jffs2_to_os_mode() and its converse out of line, 
remove jffs2port.h completely.


Index: dir-ecos.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/dir-ecos.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- dir-ecos.c	26 Nov 2003 13:28:10 -0000	1.8
+++ dir-ecos.c	26 Nov 2003 15:24:29 -0000	1.9
@@ -17,17 +17,14 @@
 
 /***********************************************************************/
 
-
-/* We keep the dirent list sorted in increasing order of name hash,
-   and we use the same hash function as the dentries. Makes this 
-   nice and simple
-*/
-struct _inode *jffs2_lookup(struct _inode *dir_i, struct qstr *d_name)
+/* Takes length argument because it can be either NUL-terminated or '/'-terminated */
+struct _inode *jffs2_lookup(struct _inode *dir_i, const unsigned char *d_name, int namelen)
 {
 	struct jffs2_inode_info *dir_f;
 	struct jffs2_sb_info *c;
 	struct jffs2_full_dirent *fd = NULL, *fd_list;
 	uint32_t ino = 0;
+	uint32_t hash = full_name_hash(d_name, namelen);
 	struct _inode *inode = NULL;
 
 	D1(printk("jffs2_lookup()\n"));
@@ -38,11 +35,11 @@
 	down(&dir_f->sem);
 
 	/* NB: The 2.2 backport will need to explicitly check for '.' and '..' here */
-	for (fd_list = dir_f->dents; fd_list && fd_list->nhash <= d_name->hash; fd_list = fd_list->next) {
-		if (fd_list->nhash == d_name->hash && 
+	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) == d_name->len &&
-		    !strncmp(fd_list->name, d_name->name, d_name->len)) {
+		    strlen(fd_list->name) == namelen &&
+		    !strncmp(fd_list->name, d_name, namelen)) {
 			fd = fd_list;
 		}
 	}
@@ -64,7 +61,7 @@
 
 
 
-int jffs2_create(struct _inode *dir_i, struct qstr *d_name, int mode,
+int jffs2_create(struct _inode *dir_i, const unsigned char *d_name, int mode,
                  struct _inode **new_i)
 {
 	struct jffs2_raw_inode *ri;
@@ -93,7 +90,7 @@
 	dir_f = JFFS2_INODE_INFO(dir_i);
 
 	ret = jffs2_do_create(c, dir_f, f, ri, 
-			      d_name->name, d_name->len);
+			      d_name, strlen(d_name));
 
 	if (ret) {
 		inode->i_nlink = 0;
@@ -113,15 +110,15 @@
 /***********************************************************************/
 
 
-int jffs2_unlink(struct _inode *dir_i, struct _inode *d_inode, struct qstr *d_name)
+int jffs2_unlink(struct _inode *dir_i, struct _inode *d_inode, const unsigned char *d_name)
 {
 	struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb);
 	struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i);
 	struct jffs2_inode_info *dead_f = JFFS2_INODE_INFO(d_inode);
 	int ret;
 
-	ret = jffs2_do_unlink(c, dir_f, d_name->name, 
-			       d_name->len, dead_f);
+	ret = jffs2_do_unlink(c, dir_f, d_name, 
+			       strlen(d_name), dead_f);
 	if (dead_f->inocache)
 		d_inode->i_nlink = dead_f->inocache->nlink;
 	return ret;
@@ -129,7 +126,7 @@
 /***********************************************************************/
 
 
-int jffs2_link (struct _inode *old_d_inode, struct _inode *dir_i, struct qstr *d_name)
+int jffs2_link (struct _inode *old_d_inode, struct _inode *dir_i, const unsigned char *d_name)
 {
 	struct jffs2_sb_info *c = JFFS2_SB_INFO(old_d_inode->i_sb);
 	struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_d_inode);
@@ -140,7 +137,7 @@
 	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->name, d_name->len);
+	ret = jffs2_do_link(c, dir_f, f->inocache->ino, type, d_name, strlen(d_name));
 
 	if (!ret) {
 		down(&f->sem);
@@ -150,7 +147,7 @@
 	return ret;
 }
 
-int jffs2_mkdir (struct _inode *dir_i, struct qstr *d_name, int mode)
+int jffs2_mkdir (struct _inode *dir_i, const unsigned char *d_name, int mode)
 {
 	struct jffs2_inode_info *f, *dir_f;
 	struct jffs2_sb_info *c;
@@ -174,7 +171,7 @@
 	/* Try to reserve enough space for both node and dirent. 
 	 * Just the node will do for now, though 
 	 */
-	namelen = d_name->len;
+	namelen = strlen(d_name);
 	ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL);
 
 	if (ret) {
@@ -246,9 +243,9 @@
 	rd->nsize = namelen;
 	rd->type = DT_DIR;
 	rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
-	rd->name_crc = cpu_to_je32(crc32(0, d_name->name, namelen));
+	rd->name_crc = cpu_to_je32(crc32(0, d_name, namelen));
 
-	fd = jffs2_write_dirent(c, dir_f, rd, d_name->name, namelen, phys_ofs, ALLOC_NORMAL);
+	fd = jffs2_write_dirent(c, dir_f, rd, d_name, namelen, phys_ofs, ALLOC_NORMAL);
 	
 	jffs2_complete_reservation(c);
 	jffs2_free_raw_dirent(rd);
@@ -271,7 +268,7 @@
 	return 0;
 }
 
-int jffs2_rmdir (struct _inode *dir_i, struct _inode *d_inode, struct qstr *d_name)
+int jffs2_rmdir (struct _inode *dir_i, struct _inode *d_inode, const unsigned char *d_name)
 {
 	struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode);
 	struct jffs2_full_dirent *fd;
@@ -283,8 +280,8 @@
 	return jffs2_unlink(dir_i, d_inode, d_name);
 }
 
-int jffs2_rename (struct _inode *old_dir_i, struct _inode *d_inode, struct qstr *old_d_name,
-                        struct _inode *new_dir_i, struct qstr *new_d_name)
+int jffs2_rename (struct _inode *old_dir_i, struct _inode *d_inode, const unsigned char *old_d_name,
+		  struct _inode *new_dir_i, const unsigned char *new_d_name)
 {
 	int ret;
 	struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb);
@@ -334,7 +331,7 @@
 
 	ret = jffs2_do_link(c, JFFS2_INODE_INFO(new_dir_i), 
 			    d_inode->i_ino, type,
-			    new_d_name->name, new_d_name->len);
+			    new_d_name, strlen(new_d_name));
 
 	if (ret)
 		return ret;
@@ -352,7 +349,7 @@
 
 	/* Unlink the original */
 	ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), 
-		      old_d_name->name, old_d_name->len, NULL);
+		      old_d_name, strlen(old_d_name), NULL);
 
 	if (ret) {
 		/* Oh shit. We really ought to make a single node which can do both atomically */

Index: fs-ecos.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/fs-ecos.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- fs-ecos.c	26 Nov 2003 14:09:29 -0000	1.23
+++ fs-ecos.c	26 Nov 2003 15:24:29 -0000	1.24
@@ -225,11 +225,6 @@
 
 static int find_entry(jffs2_dirsearch * ds)
 {
-	unsigned long hash;
-	struct qstr this;
-	unsigned int c;
-	const char *hashname;
-
 	struct _inode *dir = ds->dir;
 	const char *name = ds->path;
 	const char *n = name;
@@ -276,24 +271,12 @@
 			ds->dir->i_count++;
 			return ENOERR;
 		}
+
 	// Here we have the name and its length set up.
 	// Search the directory for a matching entry
 
-	hashname = name;
-	this.name = hashname;
-	c = *(const unsigned char *) hashname;
-
-	hash = init_name_hash();
-	do {
-		hashname++;
-		hash = partial_name_hash(c, hash);
-		c = *(const unsigned char *) hashname;
-	} while (c && (c != '/'));
-	this.len = hashname - (const char *) this.name;
-	this.hash = end_name_hash(hash);
-
 	D2(printf("find_entry for name = %s\n", ds->path));
-	d = jffs2_lookup(dir, &this);
+	d = jffs2_lookup(dir, name, namelen);
 	D2(printf("find_entry got dir = %x\n", d));
 
 	if (d == NULL)
@@ -481,10 +464,6 @@
 		goto out_nodes;
 	}
 
-	//	sb->s_blocksize = PAGE_CACHE_SIZE;
-	//	sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
-	//	sb->s_magic = JFFS2_SUPER_MAGIC;
-
 	return 0;
 
       out_nodes:
@@ -662,29 +641,12 @@
 
 	if (err == ENOENT) {
 		if (ds.last && (mode & O_CREAT)) {
-			unsigned long hash;
-			struct qstr this;
-			unsigned int c;
-			const char *hashname;
 
 			// No node there, if the O_CREAT bit is set then we must
 			// create a new one. The dir and name fields of the dirsearch
 			// object will have been updated so we know where to put it.
 
-			hashname = ds.name;
-			this.name = hashname;
-			c = *(const unsigned char *) hashname;
-
-			hash = init_name_hash();
-			do {
-				hashname++;
-				hash = partial_name_hash(c, hash);
-				c = *(const unsigned char *) hashname;
-			} while (c && (c != '/'));
-			this.len = hashname - (const char *) this.name;
-			this.hash = end_name_hash(hash);
-
-			err = jffs2_create(ds.dir, &this, S_IRUGO|S_IXUGO|S_IWUSR|S_IFREG, &node);
+			err = jffs2_create(ds.dir, ds.name, S_IRUGO|S_IXUGO|S_IWUSR|S_IFREG, &node);
 
 			if (err != 0) {
 				//Possible orphaned inode on the flash - but will be gc'd
@@ -744,10 +706,6 @@
 
 static int jffs2_ops_unlink(cyg_mtab_entry * mte, cyg_dir dir, const char *name)
 {
-	unsigned long hash;
-	struct qstr this;
-	unsigned int c;
-	const char *hashname;
 	jffs2_dirsearch ds;
 	int err;
 
@@ -771,20 +729,7 @@
 
 	// Delete it from its directory
 
-	hashname = ds.name;
-	this.name = hashname;
-	c = *(const unsigned char *) hashname;
-
-	hash = init_name_hash();
-	do {
-		hashname++;
-		hash = partial_name_hash(c, hash);
-		c = *(const unsigned char *) hashname;
-	} while (c && (c != '/'));
-	this.len = hashname - (const char *) this.name;
-	this.hash = end_name_hash(hash);
-
-	err = jffs2_unlink(ds.dir, ds.node, &this);
+	err = jffs2_unlink(ds.dir, ds.node, ds.name);
 	jffs2_iput(ds.dir);
 	jffs2_iput(ds.node);
 
@@ -808,27 +753,10 @@
 
 	if (err == ENOENT) {
 		if (ds.last) {
-			unsigned long hash;
-			struct qstr this;
-			unsigned int c;
-			const char *hashname;
 			// The entry does not exist, and it is the last element in
 			// the pathname, so we can create it here.
 
-			hashname = ds.name;
-			this.name = hashname;
-			c = *(const unsigned char *) hashname;
-
-			hash = init_name_hash();
-			do {
-				hashname++;
-				hash = partial_name_hash(c, hash);
-				c = *(const unsigned char *) hashname;
-			} while (c && (c != '/'));
-			this.len = hashname - (const char *) this.name;
-			this.hash = end_name_hash(hash);
-
-			err = -jffs2_mkdir(ds.dir, &this, S_IRUGO|S_IXUGO|S_IWUSR);
+			err = -jffs2_mkdir(ds.dir, ds.name, S_IRUGO|S_IXUGO|S_IWUSR);
 		}
 		// If this was not the last element, then an intermediate
 		// directory does not exist.
@@ -849,10 +777,6 @@
 
 static int jffs2_ops_rmdir(cyg_mtab_entry * mte, cyg_dir dir, const char *name)
 {
-	unsigned long hash;
-	struct qstr this;
-	unsigned int c;
-	const char *hashname;
 	jffs2_dirsearch ds;
 	int err;
 
@@ -874,21 +798,7 @@
 		return EPERM;
 	}
 
-	// Delete the entry. 
-	hashname = ds.name;
-	this.name = hashname;
-	c = *(const unsigned char *) hashname;
-
-	hash = init_name_hash();
-	do {
-		hashname++;
-		hash = partial_name_hash(c, hash);
-		c = *(const unsigned char *) hashname;
-	} while (c && (c != '/'));
-	this.len = hashname - (const char *) this.name;
-	this.hash = end_name_hash(hash);
-
-	err = jffs2_rmdir(ds.dir, ds.node, &this);
+	err = jffs2_rmdir(ds.dir, ds.node, ds.name);
 
 	jffs2_iput(ds.dir);
 	jffs2_iput(ds.node);
@@ -902,10 +812,6 @@
 static int jffs2_ops_rename(cyg_mtab_entry * mte, cyg_dir dir1,
 			    const char *name1, cyg_dir dir2, const char *name2)
 {
-	unsigned long hash;
-	struct qstr this1, this2;
-	unsigned int c;
-	const char *hashname;
 	jffs2_dirsearch ds1, ds2;
 	int err;
 
@@ -943,32 +849,6 @@
 		goto out;
 	}
 
-	hashname = ds1.name;
-	this1.name = hashname;
-	c = *(const unsigned char *) hashname;
-
-	hash = init_name_hash();
-	do {
-		hashname++;
-		hash = partial_name_hash(c, hash);
-		c = *(const unsigned char *) hashname;
-	} while (c && (c != '/'));
-	this1.len = hashname - (const char *) this1.name;
-	this1.hash = end_name_hash(hash);
-
-	hashname = ds2.name;
-	this2.name = hashname;
-	c = *(const unsigned char *) hashname;
-
-	hash = init_name_hash();
-	do {
-		hashname++;
-		hash = partial_name_hash(c, hash);
-		c = *(const unsigned char *) hashname;
-	} while (c && (c != '/'));
-	this2.len = hashname - (const char *) this2.name;
-	this2.hash = end_name_hash(hash);
-
 	// First deal with any entry that is at the destination
 	if (ds2.node) {
 		// Check that we are renaming like-for-like
@@ -985,7 +865,7 @@
 
 		// Now delete the destination directory entry
 
-		err = -jffs2_unlink(ds2.dir, ds2.node, &this2);
+		err = -jffs2_unlink(ds2.dir, ds2.node, ds2.name);
 
 		if (err != 0)
 			goto out;
@@ -995,7 +875,7 @@
 	// make a new direntry at the destination and delete the old entry
 	// at the source.
 
-	err = -jffs2_rename(ds1.dir, ds1.node, &this1, ds2.dir, &this2);
+	err = -jffs2_rename(ds1.dir, ds1.node, ds1.name, ds2.dir, ds2.name);
 
 	// Update directory times
 	if (!err)
@@ -1019,10 +899,6 @@
 static int jffs2_ops_link(cyg_mtab_entry * mte, cyg_dir dir1, const char *name1,
 			  cyg_dir dir2, const char *name2, int type)
 {
-	unsigned long hash;
-	struct qstr this;
-	unsigned int c;
-	const char *hashname;
 	jffs2_dirsearch ds1, ds2;
 	int err;
 
@@ -1071,20 +947,7 @@
 	// Now we know that there is no existing node at the destination,
 	// make a new direntry at the destination.
 
-	hashname = ds2.name;
-	this.name = hashname;
-	c = *(const unsigned char *) hashname;
-
-	hash = init_name_hash();
-	do {
-		hashname++;
-		hash = partial_name_hash(c, hash);
-		c = *(const unsigned char *) hashname;
-	} while (c && (c != '/'));
-	this.len = hashname - (const char *) this.name;
-	this.hash = end_name_hash(hash);
-
-	err = jffs2_link(ds1.node, ds2.dir, &this);
+	err = jffs2_link(ds1.node, ds2.dir, ds2.name);
 
 	if (err == 0)
 		ds1.node->i_ctime =
@@ -2049,3 +1912,86 @@
 	return JFFS2_INODE_INFO(inode);
 }
 
+
+
+uint32_t jffs2_from_os_mode(uint32_t osmode)
+{
+	uint32_t jmode = ((osmode & S_IRUSR)?00400:0) |
+		((osmode & S_IWUSR)?00200:0) |
+		((osmode & S_IXUSR)?00100:0) |
+		((osmode & S_IRGRP)?00040:0) |
+		((osmode & S_IWGRP)?00020:0) |
+		((osmode & S_IXGRP)?00010:0) |
+		((osmode & S_IROTH)?00004:0) |
+		((osmode & S_IWOTH)?00002:0) |
+		((osmode & S_IXOTH)?00001:0);
+
+	switch (osmode & S_IFMT) {
+	case S_IFSOCK:
+		return jmode | 0140000;
+	case S_IFLNK:
+		return jmode | 0120000;
+	case S_IFREG:
+		return jmode | 0100000;
+	case S_IFBLK:
+		return jmode | 0060000;
+	case S_IFDIR:
+		return jmode | 0040000;
+	case S_IFCHR:
+		return jmode | 0020000;
+	case S_IFIFO:
+		return jmode | 0010000;
+	case S_ISUID:
+		return jmode | 0004000;
+	case S_ISGID:
+		return jmode | 0002000;
+#ifdef S_ISVTX
+	case S_ISVTX:
+		return jmode | 0001000;
+#endif
+	}
+	printf("os_to_jffs2_mode() cannot convert 0x%x\n", osmode);
+	BUG();
+	return 0;
+}
+
+uint32_t jffs2_to_os_mode (uint32_t jmode)
+{
+	uint32_t osmode = ((jmode & 00400)?S_IRUSR:0) |
+		((jmode & 00200)?S_IWUSR:0) |
+		((jmode & 00100)?S_IXUSR:0) |
+		((jmode & 00040)?S_IRGRP:0) |
+		((jmode & 00020)?S_IWGRP:0) |
+		((jmode & 00010)?S_IXGRP:0) |
+		((jmode & 00004)?S_IROTH:0) |
+		((jmode & 00002)?S_IWOTH:0) |
+		((jmode & 00001)?S_IXOTH:0);
+
+	switch(jmode & 00170000) {
+	case 0140000:
+		return osmode | S_IFSOCK;
+	case 0120000:
+		return osmode | S_IFLNK;
+	case 0100000:
+		return osmode | S_IFREG;
+	case 0060000:
+		return osmode | S_IFBLK;
+	case 0040000:
+		return osmode | S_IFDIR;
+	case 0020000:
+		return osmode | S_IFCHR;
+	case 0010000:
+		return osmode | S_IFIFO;
+	case 0004000:
+		return osmode | S_ISUID;
+	case 0002000:
+		return osmode | S_ISGID;
+#ifdef S_ISVTX
+	case 0001000:
+		return osmode | S_ISVTX;
+#endif
+	}
+	printf("jffs2_to_os_mode() cannot convert 0x%x\n", osmode);
+	BUG();
+	return 0;
+}

Index: os-ecos.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/os-ecos.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- os-ecos.h	26 Nov 2003 14:29:07 -0000	1.15
+++ os-ecos.h	26 Nov 2003 15:24:29 -0000	1.16
@@ -20,93 +20,53 @@
 #include <asm/atomic.h>
 #include <linux/stat.h>
 #include <linux/compiler.h>
-#include "jffs2port.h"
 
+#include <pkgconf/system.h>
+#include <pkgconf/hal.h>
+#include <pkgconf/io_fileio.h>
 
-#ifndef CONFIG_JFFS2_FS_DEBUG
-# define CONFIG_JFFS2_FS_DEBUG 0
-#endif
+#include <cyg/infra/cyg_trac.h>        // tracing macros
+#include <cyg/infra/cyg_ass.h>         // assertion macros
 
-static inline uint32_t os_to_jffs2_mode(uint32_t osmode)
-{
-	uint32_t jmode = ((osmode & S_IRUSR)?00400:0) |
-		((osmode & S_IWUSR)?00200:0) |
-		((osmode & S_IXUSR)?00100:0) |
-		((osmode & S_IRGRP)?00040:0) |
-		((osmode & S_IWGRP)?00020:0) |
-		((osmode & S_IXGRP)?00010:0) |
-		((osmode & S_IROTH)?00004:0) |
-		((osmode & S_IWOTH)?00002:0) |
-		((osmode & S_IXOTH)?00001:0);
-
-	switch (osmode & S_IFMT) {
-	case S_IFSOCK:
-		return jmode | 0140000;
-	case S_IFLNK:
-		return jmode | 0120000;
-	case S_IFREG:
-		return jmode | 0100000;
-	case S_IFBLK:
-		return jmode | 0060000;
-	case S_IFDIR:
-		return jmode | 0040000;
-	case S_IFCHR:
-		return jmode | 0020000;
-	case S_IFIFO:
-		return jmode | 0010000;
-	case S_ISUID:
-		return jmode | 0004000;
-	case S_ISGID:
-		return jmode | 0002000;
-#ifdef S_ISVTX
-	case S_ISVTX:
-		return jmode | 0001000;
-#endif
-	}
-	printf("os_to_jffs2_mode() cannot convert 0x%x\n", osmode);
-	BUG();
-	return 0;
-}
+#include <unistd.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <dirent.h>
 
-static inline uint32_t jffs2_to_os_mode (uint32_t jmode)
-{
-	uint32_t osmode = ((jmode & 00400)?S_IRUSR:0) |
-		((jmode & 00200)?S_IWUSR:0) |
-		((jmode & 00100)?S_IXUSR:0) |
-		((jmode & 00040)?S_IRGRP:0) |
-		((jmode & 00020)?S_IWGRP:0) |
-		((jmode & 00010)?S_IXGRP:0) |
-		((jmode & 00004)?S_IROTH:0) |
-		((jmode & 00002)?S_IWOTH:0) |
-		((jmode & 00001)?S_IXOTH:0);
-
-	switch(jmode & 00170000) {
-	case 0140000:
-		return osmode | S_IFSOCK;
-	case 0120000:
-		return osmode | S_IFLNK;
-	case 0100000:
-		return osmode | S_IFREG;
-	case 0060000:
-		return osmode | S_IFBLK;
-	case 0040000:
-		return osmode | S_IFDIR;
-	case 0020000:
-		return osmode | S_IFCHR;
-	case 0010000:
-		return osmode | S_IFIFO;
-	case 0004000:
-		return osmode | S_ISUID;
-	case 0002000:
-		return osmode | S_ISGID;
-#ifdef S_ISVTX
-	case 0001000:
-		return osmode | S_ISVTX;
-#endif
+#include <stdlib.h>
+#include <string.h>
+
+#include <cyg/fileio/fileio.h>
+
+#include <cyg/hal/drv_api.h>
+#include <cyg/infra/diag.h>
+
+#include <cyg/io/flash.h>
+
+#include <linux/types.h>
+#include <linux/list.h>
+#include <asm/bug.h>
+
+#define printf diag_printf
+
+struct _inode;
+struct super_block;
+
+struct iovec {
+        void *iov_base;
+        ssize_t iov_len; 
+};
+
+static inline unsigned int full_name_hash(const unsigned char * name, unsigned int len) {
+
+	unsigned hash = 0;
+ 	while (len--) {
+		hash = (hash << 4) | (hash >> 28);
+		hash ^= *(name++);
 	}
-	printf("jffs2_to_os_mode() cannot convert 0x%x\n", osmode);
-	BUG();
-	return 0;
+	return hash;
 }
 
  /* Read-only operation not currently implemented on eCos */
@@ -185,6 +145,11 @@
 				   unsigned long offset, unsigned long *priv);
 void jffs2_gc_release_page(struct jffs2_sb_info *c, unsigned char *pg, unsigned long *priv);
 
+/* Avoid polluting eCos namespace with names not starting in jffs2_ */
+#define os_to_jffs2_mode(x) jffs2_from_os_mode(x)
+uint32_t jffs2_from_os_mode(uint32_t osmode);
+uint32_t jffs2_to_os_mode (uint32_t jmode);
+
 
 /* flashio.c */
 cyg_bool jffs2_flash_read(struct jffs2_sb_info *c, cyg_uint32 read_buffer_offset,
@@ -196,14 +161,14 @@
 cyg_bool jffs2_flash_erase(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb);
 
 // dir-ecos.c
-struct _inode *jffs2_lookup(struct _inode *dir_i, struct qstr *name);
-int jffs2_create(struct _inode *dir_i, struct qstr *d_name, int mode, struct _inode **new_i);
-int jffs2_mkdir (struct _inode *dir_i, struct qstr *d_name, int mode);
-int jffs2_link (struct _inode *old_d_inode, struct _inode *dir_i, struct qstr *d_name);
-int jffs2_unlink(struct _inode *dir_i, struct _inode *d_inode, struct qstr *d_name);
-int jffs2_rmdir (struct _inode *dir_i, struct _inode *d_inode, struct qstr *d_name);
-int jffs2_rename (struct _inode *old_dir_i, struct _inode *d_inode, struct qstr *old_d_name,
-		  struct _inode *new_dir_i, struct qstr *new_d_name);
+struct _inode *jffs2_lookup(struct _inode *dir_i, const unsigned char *name, int namelen);
+int jffs2_create(struct _inode *dir_i, const unsigned char *d_name, int mode, struct _inode **new_i);
+int jffs2_mkdir (struct _inode *dir_i, const unsigned char *d_name, int mode);
+int jffs2_link (struct _inode *old_d_inode, struct _inode *dir_i, const unsigned char *d_name);
+int jffs2_unlink(struct _inode *dir_i, struct _inode *d_inode, const unsigned char *d_name);
+int jffs2_rmdir (struct _inode *dir_i, struct _inode *d_inode, const unsigned char *d_name);
+int jffs2_rename (struct _inode *old_dir_i, struct _inode *d_inode, const unsigned char *old_d_name,
+		  struct _inode *new_dir_i, const unsigned char *new_d_name);
 
 /* erase.c */
 static inline void jffs2_erase_pending_trigger(struct jffs2_sb_info *c)

--- jffs2port.h DELETED ---




More information about the linux-mtd-cvs mailing list