]> git.pld-linux.org Git - packages/util-linux.git/blob - util-linux-procpartitions.patch
- patches from fedora (details in patches if not obvious)
[packages/util-linux.git] / util-linux-procpartitions.patch
1 Mount has to read /proc/partitions in one gulp. It doesn't. Failed for me 
2 after a hard powerdown (oops) and the resulting fsck-the-world frenzy on 
3 startup, before the mount -a. Falure cause is identical (getting out of 
4 sync with the text at the 1K boundary), but failure mode not quite so 
5 drastic as it doesn't bail out like fsck does.
6
7 --- util-linux-2.11y/disk-utils/blockdev.c.procpartitions       2002-03-08 17:57:02.000000000 -0500
8 +++ util-linux-2.11y/disk-utils/blockdev.c      2003-01-13 14:28:41.000000000 -0500
9 @@ -290,6 +290,7 @@
10         char ptname[200];
11         char device[210];
12         int ma, mi, sz;
13 +       char iobuf[32*1024];
14  
15         procpt = fopen(PROC_PARTITIONS, "r");
16         if (!procpt) {
17 @@ -297,6 +298,7 @@
18                         progname, PROC_PARTITIONS);
19                 exit(1);
20         }
21 +       setvbuf(procpt, iobuf, _IOFBF, sizeof(iobuf));
22  
23         while (fgets(line, sizeof(line), procpt)) {
24                 if (sscanf (line, " %d %d %d %[^\n ]",
25 --- util-linux-2.11y/fdisk/fdisk.c.procpartitions       2003-01-13 14:28:41.000000000 -0500
26 +++ util-linux-2.11y/fdisk/fdisk.c      2003-01-13 14:28:41.000000000 -0500
27 @@ -2371,12 +2371,14 @@
28         FILE *procpt;
29         char line[100], ptname[100], devname[120], *s;
30         int ma, mi, sz;
31 +       char iobuf[32*1024];
32  
33         procpt = fopen(PROC_PARTITIONS, "r");
34         if (procpt == NULL) {
35                 fprintf(stderr, _("cannot open %s\n"), PROC_PARTITIONS);
36                 return;
37         }
38 +       setvbuf(procpt, iobuf, _IOFBF, sizeof(iobuf));
39  
40         while (fgets(line, sizeof(line), procpt)) {
41                 if (sscanf (line, " %d %d %d %[^\n ]",
42 --- util-linux-2.11y/mount/mount_by_label.c.procpartitions      2002-11-26 04:23:49.000000000 -0500
43 +++ util-linux-2.11y/mount/mount_by_label.c     2003-01-13 14:31:53.000000000 -0500
44 @@ -136,9 +136,7 @@
45         char device[110];
46         int firstPass;
47         int handleOnFirst;
48 -#if 0
49         char iobuf[32*1024];    /* For setvbuf */
50 -#endif
51  
52         if (uuidCache)
53                 return;
54 @@ -155,7 +153,6 @@
55                        PROC_PARTITIONS);
56                 return;
57         }
58 -#if 0
59  /* Ugly kludge - the contents of /proc/partitions change in time,
60     and this causes failures when the file is not read in one go.
61     In particular, one cannot use stdio on /proc/partitions.
62 @@ -166,9 +163,12 @@
63     to keep statistics in /proc/partitions. Of course, statistics belong
64     in some /proc/diskstats, not in some /proc file that happened to
65     exist already. */
66 -
67 +/* Until someone actually implements something else, /proc/partitions _IS_ 
68 +   /proc/diskstats. And no matter what file we are reading, we will still 
69 +   need to increase the buffer size, because 8k is just not Enough For 
70 +   Everyone even if stats aren't in /proc/partitions.
71 +*/
72         setvbuf(procpt, iobuf, _IOFBF, sizeof(iobuf));
73 -#endif
74  
75         for (firstPass = 1; firstPass >= 0; firstPass--) {
76             fseek(procpt, 0, SEEK_SET);
This page took 0.191082 seconds and 4 git commands to generate.