wok-6.x annotate linux/stuff/linux-romfs.u @ rev 23548

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