From b6eeba2254e63074dff8fb7312d4d43d19dd4e38 Mon Sep 17 00:00:00 2001 From: zhangyan Date: Wed, 14 Apr 2021 16:45:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20linux=20kernel=20jffs=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=E9=97=B4=E6=A0=87=E5=BF=97=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit re #I3ITAG Signed-off-by: yansira Change-Id: I94955aba1e64df8e2564f865b3e616aad2de7a1e --- fs/jffs2/fs.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index d25e6f8..8aa7afd 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c @@ -92,11 +92,29 @@ int jffs2_setattr (struct jffs2_inode *inode, struct IATTR *attr) tmp_mode = attr->attr_chg_mode | tmp_mode; // add old file type } } + + if (ivalid & CHG_ATIME) { + if ((c_uid != inode->i_uid) || (attr->attr_chg_uid != inode->i_uid)) { + return -EPERM; + } else { + ri->atime = cpu_to_je32(attr->attr_chg_atime); + } + } else { + ri->atime = cpu_to_je32(inode->i_atime); + } + + if (ivalid & CHG_MTIME) { + if ((c_uid != inode->i_uid) || (attr->attr_chg_uid != inode->i_uid)) { + return -EPERM; + } else { + ri->mtime = cpu_to_je32(attr->attr_chg_mtime); + } + } else { + ri->mtime = cpu_to_je32(Jffs2CurSec()); + } ri->mode = cpu_to_jemode(tmp_mode); ri->isize = cpu_to_je32((ivalid & CHG_SIZE) ? attr->attr_chg_size : inode->i_size); - ri->atime = cpu_to_je32(inode->i_atime); - ri->mtime = cpu_to_je32(Jffs2CurSec()); ri->ctime = cpu_to_je32(Jffs2CurSec()); ri->offset = cpu_to_je32(0); -- Gitee