wok view 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 source
1 --- linux-3.2.53/fs/romfs/super.c
2 +++ linux-3.2.53/fs/romfs/super.c
3 @@ -74,6 +74,8 @@
4 #include <linux/uaccess.h>
5 #include "internal.h"
7 +#define MS_ROMFS_WITH_DATE MS_VERBOSE
8 +
9 static struct kmem_cache *romfs_inode_cachep;
11 static const umode_t romfs_modemap[8] = {
12 @@ -302,6 +304,7 @@
13 unsigned nextfh;
14 int ret;
15 umode_t mode;
16 + unsigned long spec;
18 /* we might have to traverse a chain of "hard link" file entries to get
19 * to the actual file */
20 @@ -312,11 +315,12 @@
22 /* XXX: do romfs_checksum here too (with name) */
24 + spec = be32_to_cpu(ri.spec);
25 nextfh = be32_to_cpu(ri.next);
26 if ((nextfh & ROMFH_TYPE) != ROMFH_HRD)
27 break;
29 - pos = be32_to_cpu(ri.spec) & ROMFH_MASK;
30 + pos = spec & ROMFH_MASK;
31 }
33 /* determine the length of the filename */
34 @@ -352,6 +356,12 @@
35 i->i_fop = &romfs_dir_operations;
36 if (nextfh & ROMFH_EXEC)
37 mode |= S_IXUGO;
38 + spec &= 0xf;
39 + if (spec != 0) {
40 + sb->s_flags |= MS_ROMFS_WITH_DATE;
41 + set_nlink(i, spec);
42 + }
43 + spec = i->i_size;
44 break;
45 case ROMFH_REG:
46 i->i_fop = &romfs_ro_fops;
47 @@ -367,16 +377,40 @@
48 i->i_data.a_ops = &romfs_aops;
49 mode |= S_IRWXUGO;
50 break;
51 + case ROMFH_SCK:
52 + case ROMFH_FIF:
53 + spec = 0;
54 default:
55 /* depending on MBZ for sock/fifos */
56 - nextfh = be32_to_cpu(ri.spec);
57 - init_special_inode(i, mode, MKDEV(nextfh >> 16,
58 - nextfh & 0xffff));
59 + init_special_inode(i, mode, MKDEV(spec >> 16,
60 + spec & 0xffff));
61 + spec = i->i_size;
62 + i->i_size = 0;
63 break;
64 }
66 i->i_mode = mode;
68 + if (sb->s_flags & MS_ROMFS_WITH_DATE) {
69 +
70 + int signed_spec = spec;
71 +
72 + i->i_uid = signed_spec >> 20;
73 + i->i_gid = (spec >> 12) & 0xFF;
74 + if (spec & 0100)
75 + i->i_gid |= ~0xFF; /* sign extention */
76 + i->i_mode &= ~07677;
77 + i->i_mode |= spec & 07677;
78 +
79 + /* backward compatibility for blocks and char devices
80 + * when spec is 0, uid = gid = 0 = root and mode is rw- --- ---
81 + * so, these devices have a null size with old romfs code
82 + */
83 + i->i_mode ^= 0600;
84 +
85 + i->i_mtime.tv_sec = i->i_atime.tv_sec =
86 + i->i_ctime.tv_sec = ntohl(ri.checksum);
87 + }
88 unlock_new_inode(i);
89 return i;
91 @@ -428,6 +462,7 @@
92 (romfs_maxsize(dentry->d_sb) + ROMBSIZE - 1) >> ROMBSBITS;
93 buf->f_fsid.val[0] = (u32)id;
94 buf->f_fsid.val[1] = (u32)(id >> 32);
95 + sb->s_flags &= MS_ROMFS_WITH_DATE;
96 return 0;
97 }