lkml.org 
[lkml]   [2008]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 38/79] block: move header for /proc/partitions to seq_start
Date
The seq_start call is the better place for the header for the file, that
way we don't have to be mucking in the class structure to try to figure
out if this is the first partition or not.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
block/genhd.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index f03bdad..70f1d70 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -305,6 +305,10 @@ static int find_start(struct device *dev, void *data)
static void *part_start(struct seq_file *part, loff_t *pos)
{
struct device *dev;
+ loff_t n = *pos;
+
+ if (!n)
+ seq_puts(part, "major minor #blocks name\n\n");

mutex_lock(&block_class_lock);
dev = class_find_device(&block_class, NULL, (void *)pos, find_start);
@@ -338,9 +342,6 @@ static int show_partition(struct seq_file *part, void *v)
int n;
char buf[BDEVNAME_SIZE];

- if (&sgp->dev.node == block_class.devices.next)
- seq_puts(part, "major minor #blocks name\n\n");
-
/* Don't show non-partitionable removeable devices or empty devices */
if (!get_capacity(sgp) ||
(sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE)))
--
1.5.6.3


\
 
 \ /
  Last update: 2008-07-22 07:37    [W:0.284 / U:0.632 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site