From: Li Zefan <lizf@cn.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: menage@google.com, kamezawa.hiroyu@jp.fujitsu.com,
balbir@linux.vnet.ibm.com, dhaval@linux.vnet.ibm.com,
serue@us.ibm.com, linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org
Subject: [PATCH] cgroups: show correct file mode, fix
Date: Wed, 04 Mar 2009 09:52:57 +0800 [thread overview]
Message-ID: <49ADDEF9.7020308@cn.fujitsu.com> (raw)
In-Reply-To: <20090303122733.af5ceea9.akpm@linux-foundation.org>
- 'mode' should have type mode_t
- use S_IRUGO/S_IWUSR instead of 0444/0200
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
against cgroups-show-correct-file-mode.patch
---
include/linux/cgroup.h | 2 +-
kernel/cgroup.c | 24 ++++++++++++------------
kernel/cpuset.c | 2 +-
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 31cc1a9..665fa70 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -262,7 +262,7 @@ struct cftype {
* If not 0, file mode is set to this value, otherwise it will
* be figured out automatically
*/
- int mode;
+ mode_t mode;
/*
* If non-zero, defines the maximum length of string that can
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 043b24e..ad10c5d 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1686,7 +1686,7 @@ static struct inode_operations cgroup_dir_inode_operations = {
.rename = cgroup_rename,
};
-static int cgroup_create_file(struct dentry *dentry, int mode,
+static int cgroup_create_file(struct dentry *dentry, mode_t mode,
struct super_block *sb)
{
static struct dentry_operations cgroup_dops = {
@@ -1732,7 +1732,7 @@ static int cgroup_create_file(struct dentry *dentry, int mode,
* @mode: mode to set on new directory.
*/
static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry,
- int mode)
+ mode_t mode)
{
struct dentry *parent;
int error = 0;
@@ -1755,24 +1755,24 @@ static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry,
* @cft: the control file in question
*
* returns cft->mode if ->mode is not 0
- * returns 0644 if it has both a read and a write handler
- * returns 0444 if it has only a read handler
- * returns 0200 if it has only a write hander
+ * returns S_IRUGO|S_IWUSR if it has both a read and a write handler
+ * returns S_IRUGO if it has only a read handler
+ * returns S_IWUSR if it has only a write hander
*/
-static int cgroup_file_mode(const struct cftype *cft)
+static mode_t cgroup_file_mode(const struct cftype *cft)
{
- int mode = 0;
+ mode_t mode = 0;
if (cft->mode)
return cft->mode;
if (cft->read || cft->read_u64 || cft->read_s64 ||
cft->read_map || cft->read_seq_string)
- mode |= 0444;
+ mode |= S_IRUGO;
if (cft->write || cft->write_u64 || cft->write_s64 ||
cft->write_string || cft->trigger)
- mode |= 0200;
+ mode |= S_IWUSR;
return mode;
}
@@ -1784,7 +1784,7 @@ int cgroup_add_file(struct cgroup *cgrp,
struct dentry *dir = cgrp->dentry;
struct dentry *dentry;
int error;
- int mode;
+ mode_t mode;
char name[MAX_CGROUP_TYPE_NAMELEN + MAX_CFTYPE_NAME + 2] = { 0 };
if (subsys && !test_bit(ROOT_NOPREFIX, &cgrp->root->flags)) {
@@ -2378,7 +2378,7 @@ static struct cftype files[] = {
.write_u64 = cgroup_tasks_write,
.release = cgroup_tasks_release,
.private = FILE_TASKLIST,
- .mode = 0644,
+ .mode = S_IRUGO | S_IWUSR,
},
{
@@ -2479,7 +2479,7 @@ static void cgroup_unlock_hierarchy(struct cgroupfs_root *root)
* Must be called with the mutex on the parent inode held
*/
static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
- int mode)
+ mode_t mode)
{
struct cgroup *cgrp;
struct cgroupfs_root *root = parent->root;
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 31e28b3..0619f10 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1678,7 +1678,7 @@ static struct cftype files[] = {
.read_u64 = cpuset_read_u64,
.write_u64 = cpuset_write_u64,
.private = FILE_MEMORY_PRESSURE,
- .mode = 0444,
+ .mode = S_IRUGO,
},
{
--
1.5.4.rc3
next prev parent reply other threads:[~2009-03-04 1:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-03 5:29 [PATCH] cgroups: show correct file mode Li Zefan
[not found] ` <49ACC037.2090507-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-03-03 20:27 ` Andrew Morton
2009-03-03 20:27 ` Andrew Morton
2009-03-04 1:52 ` Li Zefan [this message]
[not found] ` <49ADDEF9.7020308-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-03-04 1:54 ` [PATCH] cgroups: show correct file mode, fix KAMEZAWA Hiroyuki
2009-03-04 1:54 ` KAMEZAWA Hiroyuki
2009-03-04 1:59 ` Li Zefan
[not found] ` <49ADE099.1090009-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-03-04 2:05 ` KAMEZAWA Hiroyuki
2009-03-04 2:05 ` KAMEZAWA Hiroyuki
[not found] ` <20090304105403.23352011.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2009-03-04 1:59 ` Li Zefan
[not found] ` <20090303122733.af5ceea9.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2009-03-04 1:52 ` Li Zefan
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=49ADDEF9.7020308@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=containers@lists.linux-foundation.org \
--cc=dhaval@linux.vnet.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=serue@us.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.