patch-2.4.0-test8 linux/fs/partitions/check.c

Next file: linux/fs/proc/array.c
Previous file: linux/fs/ntfs/support.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test7/linux/fs/partitions/check.c linux/fs/partitions/check.c
@@ -228,24 +228,35 @@
 }
 
 #ifdef CONFIG_PROC_FS
-int get_partition_list(char * page)
+int get_partition_list(char *page, char **start, off_t offset, int count)
 {
-	struct gendisk *p;
-	char buf[64];
-	int n, len;
+	struct gendisk *dsk;
+	int len;
 
 	len = sprintf(page, "major minor  #blocks  name\n\n");
-	for (p = gendisk_head; p; p = p->next) {
-		for (n=0; n < (p->nr_real << p->minor_shift); n++) {
-			if (p->part[n].nr_sects && len < PAGE_SIZE - 80) {
-				len += sprintf(page+len,
+	for (dsk = gendisk_head; dsk; dsk = dsk->next) {
+		int n;
+
+		for (n = 0; n < (dsk->nr_real << dsk->minor_shift); n++)
+			if (dsk->part[n].nr_sects) {
+				char buf[64];
+
+				len += sprintf(page + len,
 					       "%4d  %4d %10d %s\n",
-					       p->major, n, p->sizes[n],
-					       disk_name(p, n, buf));
+					       dsk->major, n, dsk->sizes[n],
+					       disk_name(dsk, n, buf));
+				if (len < offset)
+					offset -= len, len = 0;
+				else if (len >= offset + count)
+					goto leave_loops;
 			}
-		}
 	}
-	return len;
+leave_loops:
+	*start = page + offset;
+	len -= offset;
+	if (len < 0)
+		len = 0;
+	return len > count ? count : len;
 }
 #endif
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)