mtd/fs/jffs2 dir.c,1.74,1.75 gc.c,1.101,1.102 fs.c,1.23,1.24

David Woodhouse dwmw2 at infradead.org
Tue Apr 29 05:53:02 EDT 2003


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

Modified Files:
	dir.c gc.c fs.c 
Log Message:
Byteswap as appropriate for device node payload.


Index: dir.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/dir.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- dir.c	14 Jan 2003 14:06:22 -0000	1.74
+++ dir.c	29 Apr 2003 09:52:58 -0000	1.75
@@ -588,7 +588,7 @@
 	struct jffs2_full_dnode *fn;
 	struct jffs2_full_dirent *fd;
 	int namelen;
-	unsigned short dev;
+	jint16_t dev;
 	int devlen = 0;
 	uint32_t alloclen, phys_ofs;
 	uint32_t writtenlen;
@@ -601,7 +601,7 @@
 	c = JFFS2_SB_INFO(dir_i->i_sb);
 	
 	if (S_ISBLK(mode) || S_ISCHR(mode)) {
-		dev = (MAJOR(rdev) << 8) | MINOR(rdev);
+		dev = cpu_to_je16((MAJOR(rdev) << 8) | MINOR(rdev));
 		devlen = sizeof(dev);
 	}
 	

Index: gc.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/gc.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- gc.c	11 Mar 2003 17:19:56 -0000	1.101
+++ gc.c	29 Apr 2003 09:52:58 -0000	1.102
@@ -626,7 +626,7 @@
 {
 	struct jffs2_full_dnode *new_fn;
 	struct jffs2_raw_inode ri;
-	unsigned short dev;
+	jint16_t dev;
 	char *mdata = NULL, mdatalen = 0;
 	uint32_t alloclen, phys_ofs;
 	int ret;
@@ -635,8 +635,8 @@
 	    S_ISCHR(JFFS2_F_I_MODE(f)) ) {
 		/* For these, we don't actually need to read the old node */
 		/* FIXME: for minor or major > 255. */
-		dev =  ((JFFS2_F_I_RDEV_MAJ(f) << 8) | 
-			JFFS2_F_I_RDEV_MIN(f));
+		dev = cpu_to_je16(((JFFS2_F_I_RDEV_MAJ(f) << 8) | 
+			JFFS2_F_I_RDEV_MIN(f)));
 		mdata = (char *)&dev;
 		mdatalen = sizeof(dev);
 		D1(printk(KERN_DEBUG "jffs2_garbage_collect_metadata(): Writing %d bytes of kdev_t\n", mdatalen));

Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/fs.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- fs.c	21 Jan 2003 18:11:28 -0000	1.23
+++ fs.c	29 Apr 2003 09:52:58 -0000	1.24
@@ -100,7 +100,7 @@
 	inode->i_blocks = (inode->i_size + 511) >> 9;
 	
 	switch (inode->i_mode & S_IFMT) {
-		unsigned short rdev;
+		jint16_t rdev;
 
 	case S_IFLNK:
 		inode->i_op = &jffs2_symlink_inode_operations;
@@ -147,7 +147,7 @@
 	case S_IFSOCK:
 	case S_IFIFO:
 		inode->i_op = &jffs2_file_inode_operations;
-		init_special_inode(inode, inode->i_mode, kdev_t_to_nr(mk_kdev(rdev>>8, rdev&0xff)));
+		init_special_inode(inode, inode->i_mode, kdev_t_to_nr(mk_kdev(je16_to_cpu(rdev)>>8, je16_to_cpu(rdev)&0xff)));
 		break;
 
 	default:




More information about the linux-mtd-cvs mailing list