From: Herbert Poetzl <herbert@13thfloor.at>
To: linux-kernel@vger.kernel.org
Subject: ATTR_ATTR_FLAG
Date: Mon, 3 May 2004 19:24:37 +0200 [thread overview]
Message-ID: <20040503172437.GA23521@MAIL.13thfloor.at> (raw)
Hi Folks!
stumbled about ATTR_ATTR_FLAG, and asked myself,
shouldn't this be handled in *_setattr() too?
maybe something like this:
(of course it would need some modifications for
filesystems handling *_setattr special)
best,
Herbert
--- linux/fs/attr.c 2002-02-25 20:38:07.000000000 +0100
+++ linux.new/fs/attr.c 2004-04-30 23:55:01.000000000 +0200
@@ -58,6 +58,?? @@ error:
return retval;
}
+
+int inode_setattr_flags(struct inode *inode, unsigned int flags)
+{
+ unsigned int oldflags, newflags;
+
+ oldflags = inode->i_flags;
+ newflags = oldflags & ~(S_SYNC | S_NOATIME | S_APPEND | S_IMMUTABLE);
+ if (flags & ATTR_FLAG_SYNCRONOUS)
+ newflags |= S_SYNC;
+ if (flags & ATTR_FLAG_NOATIME || flags & ATTR_FLAG_NODIRATIME)
+ newflags |= S_NOATIME;
+ if (flags & ATTR_FLAG_APPEND)
+ newflags |= S_APPEND;
+ if (flags & ATTR_FLAG_IMMUTABLE)
+ newflags |= S_IMMUTABLE;
+
+ if (oldflags ^ newflags) {
+ inode->i_flags = newflags;
+ }
+ return 0;
+}
+
+
int inode_setattr(struct inode * inode, struct iattr * attr)
{
unsigned int ia_valid = attr->ia_valid;
@@ -84,6 +112,8 @@ int inode_setattr(struct inode * inode,
if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
inode->i_mode &= ~S_ISGID;
}
+ if (ia_valid & ATTR_ATTR_FLAG)
+ inode_setattr_flags(inode, attr->ia_attr_flags);
mark_inode_dirty(inode);
out:
return error;
reply other threads:[~2004-05-03 17:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040503172437.GA23521@MAIL.13thfloor.at \
--to=herbert@13thfloor.at \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®