[PATCH 3/5] Change configfs_example.c to use the new interface

From: Chandra Seetharaman
Date: Tue Oct 10 2006 - 14:22:14 EST


Change the example to suit the modified interface to use seq_file.

Signed-Off-By: Chandra Seetharaman <sekharan@xxxxxxxxxx>
--

Documentation/filesystems/configfs/configfs_example.c | 30 +++++++++---------
1 files changed, 15 insertions(+), 15 deletions(-)

Index: linux-2.6.18/Documentation/filesystems/configfs/configfs_example.c
===================================================================
--- linux-2.6.18.orig/Documentation/filesystems/configfs/configfs_example.c
+++ linux-2.6.18/Documentation/filesystems/configfs/configfs_example.c
@@ -53,7 +53,7 @@ struct childless {

struct childless_attribute {
struct configfs_attribute attr;
- ssize_t (*show)(struct childless *, char *);
+ ssize_t (*show)(struct childless *, struct seq_file *);
ssize_t (*store)(struct childless *, const char *, size_t);
};

@@ -63,20 +63,20 @@ static inline struct childless *to_child
}

static ssize_t childless_showme_read(struct childless *childless,
- char *page)
+ struct seq_file *s)
{
ssize_t pos;

- pos = sprintf(page, "%d\n", childless->showme);
+ pos = seq_printf(s, "%d\n", childless->showme);
childless->showme++;

return pos;
}

static ssize_t childless_storeme_read(struct childless *childless,
- char *page)
+ struct seq_file *s)
{
- return sprintf(page, "%d\n", childless->storeme);
+ return seq_printf(s, "%d\n", childless->storeme);
}

static ssize_t childless_storeme_write(struct childless *childless,
@@ -99,9 +99,9 @@ static ssize_t childless_storeme_write(s
}

static ssize_t childless_description_read(struct childless *childless,
- char *page)
+ struct seq_file *s)
{
- return sprintf(page,
+ return seq_printf(s,
"[01-childless]\n"
"\n"
"The childless subsystem is the simplest possible subsystem in\n"
@@ -133,7 +133,7 @@ static struct configfs_attribute *childl

static ssize_t childless_attr_show(struct config_item *item,
struct configfs_attribute *attr,
- char *page)
+ struct seq_file *s)
{
struct childless *childless = to_childless(item);
struct childless_attribute *childless_attr =
@@ -141,7 +141,7 @@ static ssize_t childless_attr_show(struc
ssize_t ret = 0;

if (childless_attr->show)
- ret = childless_attr->show(childless, page);
+ ret = childless_attr->show(childless, s);
return ret;
}

@@ -216,12 +216,12 @@ static struct configfs_attribute *simple

static ssize_t simple_child_attr_show(struct config_item *item,
struct configfs_attribute *attr,
- char *page)
+ struct seq_file *s)
{
ssize_t count;
struct simple_child *simple_child = to_simple_child(item);

- count = sprintf(page, "%d\n", simple_child->storeme);
+ count = seq_printf(s, "%d\n", simple_child->storeme);

return count;
}
@@ -304,9 +304,9 @@ static struct configfs_attribute *simple

static ssize_t simple_children_attr_show(struct config_item *item,
struct configfs_attribute *attr,
- char *page)
+ struct seq_file *s)
{
- return sprintf(page,
+ return seq_printf(s,
"[02-simple-children]\n"
"\n"
"This subsystem allows the creation of child config_items. These\n"
@@ -390,9 +390,9 @@ static struct configfs_attribute *group_

static ssize_t group_children_attr_show(struct config_item *item,
struct configfs_attribute *attr,
- char *page)
+ struct seq_file *s)
{
- return sprintf(page,
+ return seq_printf(s,
"[03-group-children]\n"
"\n"
"This subsystem allows the creation of child config_groups. These\n"

--

----------------------------------------------------------------------
Chandra Seetharaman | Be careful what you choose....
- sekharan@xxxxxxxxxx | .......you may get it.
----------------------------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/