aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions/check.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2010-08-10 21:03:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 11:59:20 -0400
commit9c867fbe06458a8957024236b574733fae0cefed (patch)
tree6eae6def53e4ca9e30f90f6e9c07d8044581f08f /fs/partitions/check.c
parentecd6269174c04da5efbd17d6bff793e428eb45ef (diff)
partitions: fix sometimes unreadable partition strings
Fix this garbage happening quite often: ==> sda: scsi 3:0:0:0: CD-ROM TOSHIBA ==> sda1 sda2 sda3 sda4 <sr0: scsi3-mmc drive: 24x/24x writer dvd-ram cd/rw xa/form2 cdda tray ^^^ Uniform CD-ROM driver Revision: 3.20 sr 3:0:0:0: Attached scsi CD-ROM sr0 ==> sda5 sda6 sda7 > Make "sda: sda1 ..." lines actually lines. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/partitions/check.c')
-rw-r--r--fs/partitions/check.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 72c52656dc2..79fbf3f390f 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -164,10 +164,16 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
164 state = kzalloc(sizeof(struct parsed_partitions), GFP_KERNEL); 164 state = kzalloc(sizeof(struct parsed_partitions), GFP_KERNEL);
165 if (!state) 165 if (!state)
166 return NULL; 166 return NULL;
167 state->pp_buf = (char *)__get_free_page(GFP_KERNEL);
168 if (!state->pp_buf) {
169 kfree(state);
170 return NULL;
171 }
172 state->pp_buf[0] = '\0';
167 173
168 state->bdev = bdev; 174 state->bdev = bdev;
169 disk_name(hd, 0, state->name); 175 disk_name(hd, 0, state->name);
170 printk(KERN_INFO " %s:", state->name); 176 snprintf(state->pp_buf, PAGE_SIZE, " %s:", state->name);
171 if (isdigit(state->name[strlen(state->name)-1])) 177 if (isdigit(state->name[strlen(state->name)-1]))
172 sprintf(state->name, "p"); 178 sprintf(state->name, "p");
173 179
@@ -185,17 +191,25 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
185 } 191 }
186 192
187 } 193 }
188 if (res > 0) 194 if (res > 0) {
195 printk(KERN_INFO "%s", state->pp_buf);
196
197 free_page((unsigned long)state->pp_buf);
189 return state; 198 return state;
199 }
190 if (state->access_beyond_eod) 200 if (state->access_beyond_eod)
191 err = -ENOSPC; 201 err = -ENOSPC;
192 if (err) 202 if (err)
193 /* The partition is unrecognized. So report I/O errors if there were any */ 203 /* The partition is unrecognized. So report I/O errors if there were any */
194 res = err; 204 res = err;
195 if (!res) 205 if (!res)
196 printk(" unknown partition table\n"); 206 strlcat(state->pp_buf, " unknown partition table\n", PAGE_SIZE);
197 else if (warn_no_part) 207 else if (warn_no_part)
198 printk(" unable to read partition table\n"); 208 strlcat(state->pp_buf, " unable to read partition table\n", PAGE_SIZE);
209
210 printk(KERN_INFO "%s", state->pp_buf);
211
212 free_page((unsigned long)state->pp_buf);
199 kfree(state); 213 kfree(state);
200 return ERR_PTR(res); 214 return ERR_PTR(res);
201} 215}