wok diff linux/stuff/linux-romfs.u @ rev 19661

Up openssl (1.0.2k)
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Jan 28 13:51:03 2017 +0200 (2017-01-28)
parents
children 708b5293dd29
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/linux/stuff/linux-romfs.u	Sat Jan 28 13:51:03 2017 +0200
     1.3 @@ -0,0 +1,98 @@
     1.4 +--- linux-3.2.53/fs/romfs/super.c
     1.5 ++++ linux-3.2.53/fs/romfs/super.c
     1.6 +@@ -74,6 +74,8 @@
     1.7 + #include <linux/uaccess.h>
     1.8 + #include "internal.h"
     1.9 + 
    1.10 ++#define MS_ROMFS_WITH_DATE	MS_VERBOSE
    1.11 ++
    1.12 + static struct kmem_cache *romfs_inode_cachep;
    1.13 + 
    1.14 + static const umode_t romfs_modemap[8] = {
    1.15 +@@ -302,6 +304,7 @@
    1.16 + 	unsigned nextfh;
    1.17 + 	int ret;
    1.18 + 	umode_t mode;
    1.19 ++	unsigned long spec;
    1.20 + 
    1.21 + 	/* we might have to traverse a chain of "hard link" file entries to get
    1.22 + 	 * to the actual file */
    1.23 +@@ -312,11 +315,12 @@
    1.24 + 
    1.25 + 		/* XXX: do romfs_checksum here too (with name) */
    1.26 + 
    1.27 ++		spec = be32_to_cpu(ri.spec);
    1.28 + 		nextfh = be32_to_cpu(ri.next);
    1.29 + 		if ((nextfh & ROMFH_TYPE) != ROMFH_HRD)
    1.30 + 			break;
    1.31 + 
    1.32 +-		pos = be32_to_cpu(ri.spec) & ROMFH_MASK;
    1.33 ++		pos = spec & ROMFH_MASK;
    1.34 + 	}
    1.35 + 
    1.36 + 	/* determine the length of the filename */
    1.37 +@@ -352,6 +356,12 @@
    1.38 + 		i->i_fop = &romfs_dir_operations;
    1.39 + 		if (nextfh & ROMFH_EXEC)
    1.40 + 			mode |= S_IXUGO;
    1.41 ++		spec &= 0xf;
    1.42 ++		if (spec != 0) {
    1.43 ++			sb->s_flags |= MS_ROMFS_WITH_DATE;
    1.44 ++			set_nlink(i, spec);
    1.45 ++		}
    1.46 ++		spec = i->i_size;
    1.47 + 		break;
    1.48 + 	case ROMFH_REG:
    1.49 + 		i->i_fop = &romfs_ro_fops;
    1.50 +@@ -367,16 +377,40 @@
    1.51 + 		i->i_data.a_ops = &romfs_aops;
    1.52 + 		mode |= S_IRWXUGO;
    1.53 + 		break;
    1.54 ++	case ROMFH_SCK:
    1.55 ++	case ROMFH_FIF:
    1.56 ++		spec = 0;
    1.57 + 	default:
    1.58 + 		/* depending on MBZ for sock/fifos */
    1.59 +-		nextfh = be32_to_cpu(ri.spec);
    1.60 +-		init_special_inode(i, mode, MKDEV(nextfh >> 16,
    1.61 +-						  nextfh & 0xffff));
    1.62 ++		init_special_inode(i, mode, MKDEV(spec >> 16,
    1.63 ++						  spec & 0xffff));
    1.64 ++		spec = i->i_size;
    1.65 ++		i->i_size = 0;
    1.66 + 		break;
    1.67 + 	}
    1.68 + 
    1.69 + 	i->i_mode = mode;
    1.70 + 
    1.71 ++	if (sb->s_flags & MS_ROMFS_WITH_DATE) {
    1.72 ++
    1.73 ++	        int signed_spec = spec;
    1.74 ++
    1.75 ++		i->i_uid  = signed_spec >> 20;
    1.76 ++		i->i_gid  = (spec >> 12) & 0xFF;
    1.77 ++		if (spec & 0100) 
    1.78 ++			i->i_gid |= ~0xFF;	/* sign extention */
    1.79 ++		i->i_mode &= ~07677;
    1.80 ++		i->i_mode |= spec & 07677;
    1.81 ++
    1.82 ++	/* backward compatibility for blocks and char devices
    1.83 ++	 * when spec is 0, uid = gid = 0 = root and mode is rw- --- ---
    1.84 ++	 * so, these devices have a null size with old romfs code
    1.85 ++	 */
    1.86 ++		i->i_mode ^= 0600;
    1.87 ++
    1.88 ++	        i->i_mtime.tv_sec = i->i_atime.tv_sec = 
    1.89 ++		i->i_ctime.tv_sec = ntohl(ri.checksum);
    1.90 ++	}
    1.91 + 	unlock_new_inode(i);
    1.92 + 	return i;
    1.93 + 
    1.94 +@@ -428,6 +462,7 @@
    1.95 + 		(romfs_maxsize(dentry->d_sb) + ROMBSIZE - 1) >> ROMBSBITS;
    1.96 + 	buf->f_fsid.val[0] = (u32)id;
    1.97 + 	buf->f_fsid.val[1] = (u32)(id >> 32);
    1.98 ++	sb->s_flags &= MS_ROMFS_WITH_DATE;
    1.99 + 	return 0;
   1.100 + }
   1.101 +