From: Matt Helsley <matthltc@us.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
Paul Menage <menage@google.com>, Li Zefan <lizf@cn.fujitsu.com>,
Linux-Kernel <linux-kernel@vger.kernel.org>,
Linux Containers <containers@lists.linux-foundation.org>,
linux-pm@lists.linux-foundation.org
Subject: [PATCH 6/6] Container Freezer: Use cgroup write_string method
Date: Thu, 31 Jul 2008 22:07:05 -0700 [thread overview]
Message-ID: <20080801050701.603089371@us.ibm.com> (raw)
In-Reply-To: 20080801050659.924495279@us.ibm.com
Use the new cgroup write_string method rather than the raw write method
because it better matches the needs of the freezer cgroup subsystem.
Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
---
kernel/cgroup_freezer.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
Index: linux-2.6.27-rc1-mm1/kernel/cgroup_freezer.c
===================================================================
--- linux-2.6.27-rc1-mm1.orig/kernel/cgroup_freezer.c
+++ linux-2.6.27-rc1-mm1/kernel/cgroup_freezer.c
@@ -29,11 +29,10 @@
static const char *freezer_state_strs[] = {
"RUNNING",
"FREEZING",
"FROZEN",
};
-#define STATE_MAX_STRLEN 8
/*
* State diagram (transition labels in parenthesis):
*
* RUNNING -(FROZEN)-> FREEZING -(FROZEN)-> FROZEN
@@ -278,27 +277,17 @@ out:
spin_unlock_irq(&freezer->lock);
return retval;
}
-static ssize_t freezer_write(struct cgroup *cgroup,
- struct cftype *cft,
- struct file *file,
- const char __user *userbuf,
- size_t nbytes, loff_t *unused_ppos)
+static int freezer_write(struct cgroup *cgroup,
+ struct cftype *cft,
+ const char *buffer)
{
- char buffer[STATE_MAX_STRLEN + 1];
- int retval = 0;
+ int retval;
enum freezer_state goal_state;
- if (nbytes >= PATH_MAX)
- return -E2BIG;
- nbytes = min(sizeof(buffer) - 1, nbytes);
- if (copy_from_user(buffer, userbuf, nbytes))
- return -EFAULT;
- buffer[nbytes + 1] = 0; /* nul-terminate */
- strstrip(buffer); /* remove any trailing whitespace */
if (strcmp(buffer, freezer_state_strs[STATE_RUNNING]) == 0)
goal_state = STATE_RUNNING;
else if (strcmp(buffer, freezer_state_strs[STATE_FROZEN]) == 0)
goal_state = STATE_FROZEN;
else
@@ -313,11 +302,11 @@ static ssize_t freezer_write(struct cgro
static struct cftype files[] = {
{
.name = "state",
.read_seq_string = freezer_read,
- .write = freezer_write,
+ .write_string = freezer_write,
},
};
static int freezer_populate(struct cgroup_subsys *ss, struct cgroup *cgroup)
{
--
next prev parent reply other threads:[~2008-08-01 5:09 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-01 5:06 [PATCH 0/6] Container Freezer: Reuse Suspend Freezer Matt Helsley
2008-08-01 5:07 ` [PATCH 1/6] Container Freezer: Add TIF_FREEZE flag to all architectures Matt Helsley
2008-08-01 10:32 ` Nigel Cunningham
2008-08-01 12:32 ` Cedric Le Goater
2008-08-01 22:05 ` Matt Helsley
2008-08-01 22:54 ` Rafael J. Wysocki
2008-08-02 1:13 ` Nigel Cunningham
2008-08-01 5:07 ` [PATCH 2/6] Container Freezer: Make refrigerator always available Matt Helsley
2008-08-01 10:33 ` Nigel Cunningham
2008-08-01 14:27 ` Thomas Petazzoni
2008-08-01 19:08 ` Matt Helsley
2008-08-01 22:53 ` Rafael J. Wysocki
2008-08-01 23:24 ` Matt Helsley
2008-08-02 14:34 ` Rafael J. Wysocki
2008-08-02 2:30 ` Matt Helsley
2008-08-02 10:39 ` Thomas Petazzoni
2008-08-01 5:07 ` [PATCH 3/6] Container Freezer: Implement freezer cgroup subsystem Matt Helsley
2008-08-01 22:58 ` Rafael J. Wysocki
2008-08-02 0:11 ` Matt Helsley
2008-08-02 7:38 ` Cedric Le Goater
2008-08-02 14:37 ` Rafael J. Wysocki
2008-08-01 5:07 ` [PATCH 4/6] Container Freezer: Skip frozen cgroups during power management resume Matt Helsley
2008-08-01 10:24 ` Nigel Cunningham
2008-08-01 5:07 ` [PATCH 5/6] Container Freezer: Prevent frozen tasks or cgroups from changing Matt Helsley
2008-08-01 5:07 ` Matt Helsley [this message]
2008-08-01 5:16 ` [PATCH 0/6] Container Freezer: Reuse Suspend Freezer Matt Helsley
2008-08-01 13:04 ` Rafael J. Wysocki
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=20080801050701.603089371@us.ibm.com \
--to=matthltc@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=containers@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=lizf@cn.fujitsu.com \
--cc=menage@google.com \
--cc=rjw@sisk.pl \
/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