mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Baudis <pasky@pasky.ji.cz>
To: marcelo@connectiva.com.br
Cc: linux-kernel@vger.kernel.org, aeb@cwi.nl
Subject: [PATCH] [2.4.19] Extended /proc/partitions
Date: Sat, 2 Nov 2002 18:20:48 +0100	[thread overview]
Message-ID: <20021102172048.GA2535@pasky.ji.cz> (raw)

  Hello,

  this patch (against 2.4.19) extends contents of /proc/partitions by starting
offset of each partition. This can be terribly useful if you (or someone who
then passed you the computer for a repair) by some mistake over-dd'd the
partition table on a disk, but the system is still up. I know that you can also
dig this out by some ioctl()s, but this can make life a lot easier for those
who don't know C or can't dig the ioctl codes from the kernel source code.

  Note that it's possibly totally flawed (I don't know anything about this
piece of code), but it looks to work ok.

  Kind regards,

--- linux-2.4.19/drivers/block/genhd.c	Fri Nov  1 21:28:24 2002
+++ linux-2.4.19+pasky/drivers/block/genhd.c	Fri Nov  1 21:27:41 2002
@@ -163,7 +163,7 @@
 	char buf[64];
 	int len, n;
 
-	len = sprintf(page, "major minor  #blocks  name\n\n");
+	len = sprintf(page, "major minor startblock   #blocks  name\n\n");
 		
 	read_lock(&gendisk_lock);
 	for (gp = gendisk_head; gp; gp = gp->next) {
@@ -173,8 +173,9 @@
 
 			hd = &gp->part[n]; disk_round_stats(hd);
 			len += sprintf(page + len,
-				"%4d  %4d %10d %s\n", gp->major,
-				n, gp->sizes[n], disk_name(gp, n, buf));
+				"%4d  %4d  %10ld %10d %s\n", gp->major,
+				n, hd->start_sect, gp->sizes[n],
+				disk_name(gp, n, buf));
 
 			if (len < offset)
 				offset -= len, len = 0;

-- 
 
				Petr "Pasky" Baudis
 
* ELinks maintainer                * IPv6 guy (XS26 co-coordinator)
* IRCnet operator                  * FreeCiv AI occassional hacker
.
This host is a black hole at HTTP wavelengths. GETs go in, and nothing
comes out, not even Hawking radiation.
                -- Graaagh the Mighty on rec.games.roguelike.angband
.
Public PGP key && geekcode && homepage: http://pasky.ji.cz/~pasky/

             reply	other threads:[~2002-11-02 17:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-02 17:20 Petr Baudis [this message]
2002-11-02 19:19 Andries.Brouwer
2002-11-02 19:57 ` Petr Baudis

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=20021102172048.GA2535@pasky.ji.cz \
    --to=pasky@pasky.ji.cz \
    --cc=aeb@cwi.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@connectiva.com.br \
    /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®