Minor cdprobe message additions; usyslogd logs shorter lines
This commit is contained in:
parent
fe3a7d6b5a
commit
10aa135d82
2 changed files with 26 additions and 5 deletions
|
@ -25,7 +25,8 @@ void logline(FILE *outfp, char *proc, char *line)
|
||||||
/* Trim off year and newline. */
|
/* Trim off year and newline. */
|
||||||
if((s=strrchr(d, ' ')))
|
if((s=strrchr(d, ' ')))
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
fprintf(outfp, "%s %s kernel: %s\n", d, nodename, line);
|
if(s=strchr(d, ' ')) d = s+1;
|
||||||
|
fprintf(outfp, "%s %s: %s\n", d, nodename, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy(int in_fd, FILE *outfp)
|
void copy(int in_fd, FILE *outfp)
|
||||||
|
|
|
@ -25,6 +25,8 @@ PUBLIC int cdprobe(void)
|
||||||
#define AT_MINORS 4
|
#define AT_MINORS 4
|
||||||
int i, minors[AT_MINORS] = { 0, 5, 10, 15 }, dev = 0, found = 0;
|
int i, minors[AT_MINORS] = { 0, 5, 10, 15 }, dev = 0, found = 0;
|
||||||
char pvd[CD_SECTOR];
|
char pvd[CD_SECTOR];
|
||||||
|
printf("\nLooking for boot CD. This may take several minutes.\n"
|
||||||
|
"Please ignore any error messages.\n\n");
|
||||||
for(i = 0; i < AT_MINORS && !found; i++) {
|
for(i = 0; i < AT_MINORS && !found; i++) {
|
||||||
struct super_block probe_super;
|
struct super_block probe_super;
|
||||||
int r, minor;
|
int r, minor;
|
||||||
|
@ -35,52 +37,70 @@ PUBLIC int cdprobe(void)
|
||||||
* Check for this.
|
* Check for this.
|
||||||
*/
|
*/
|
||||||
if((r = dev_open(dev, FS_PROC_NR, R_BIT|W_BIT)) == OK) {
|
if((r = dev_open(dev, FS_PROC_NR, R_BIT|W_BIT)) == OK) {
|
||||||
|
printf("%d. no - can open r/w, so no cd\n", i);
|
||||||
dev_close(dev);
|
dev_close(dev);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
printf("passed no-r/w test ", i);
|
||||||
|
|
||||||
/* 2. The drive should be a CD. Open whole drive and
|
/* 2. The drive should be a CD. Open whole drive and
|
||||||
* check for the PVD.
|
* check for the PVD.
|
||||||
*/
|
*/
|
||||||
if((r = dev_open(dev, FS_PROC_NR, R_BIT)) != OK) {
|
if((r = dev_open(dev, FS_PROC_NR, R_BIT)) != OK) {
|
||||||
|
printf("%d. no - can't open readonly\n", i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
printf("%d. passed open-readonly test ", i);
|
||||||
|
|
||||||
if((r = dev_io(DEV_READ, dev, FS_PROC_NR, pvd,
|
if((r = dev_io(DEV_READ, dev, FS_PROC_NR, pvd,
|
||||||
16*CD_SECTOR, sizeof(pvd), 0)) != sizeof(pvd)) {
|
16*CD_SECTOR, sizeof(pvd), 0)) != sizeof(pvd)) {
|
||||||
|
printf("%d. no - can't read pvd (%d)\n", i, r);
|
||||||
dev_close(dev);
|
dev_close(dev);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dev_close(dev);
|
dev_close(dev);
|
||||||
|
printf("%d. passed read pvd test ", i);
|
||||||
|
|
||||||
/* Check PVD ID. */
|
/* Check PVD ID. */
|
||||||
if(pvd[0] != 1 || pvd[1] != 'C' || pvd[2] != 'D' ||
|
if(pvd[0] != 1 || pvd[1] != 'C' || pvd[2] != 'D' ||
|
||||||
pvd[3] != '0' || pvd[4] != '0' || pvd[5] != '1' || pvd[6] != 1 ||
|
pvd[3] != '0' || pvd[4] != '0' || pvd[5] != '1' || pvd[6] != 1 ||
|
||||||
strncmp(pvd + 40, "MINIX", 5)) {
|
strncmp(pvd + 40, "MINIX", 5)) {
|
||||||
|
printf("%d. no - cd signature or minix label not found\n", i, r);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
printf("%d. pvd id test ", i);
|
||||||
|
|
||||||
/* 3. Both c0dXp1 and p2 should have a superblock. */
|
/* 3. Both c0dXp1 and p2 should have a superblock. */
|
||||||
for(minor = minors[i]+2; minor <= minors[i]+3; minor++) {
|
for(minor = minors[i]+2; minor <= minors[i]+3; minor++) {
|
||||||
dev = (AT_MAJOR << MAJOR) | minor;
|
dev = (AT_MAJOR << MAJOR) | minor;
|
||||||
if((r = dev_open(dev, FS_PROC_NR, R_BIT)) != OK)
|
if((r = dev_open(dev, FS_PROC_NR, R_BIT)) != OK) {
|
||||||
continue;
|
printf("%d. no - couldn't open subdev %d\n", i, dev);
|
||||||
|
break;
|
||||||
|
}
|
||||||
probe_super.s_dev = dev;
|
probe_super.s_dev = dev;
|
||||||
r = read_super(&probe_super);
|
r = read_super(&probe_super);
|
||||||
dev_close(dev);
|
dev_close(dev);
|
||||||
if(r != OK) {
|
if(r != OK) {
|
||||||
|
printf("%d. subdev %d doesn't contain a superblock\n", i, dev);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
printf("%d. (%d) passed superblock test ", i, minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(minor > minors[i]+3) {
|
if(minor > minors[i]+3) {
|
||||||
/* Success? Then set dev to p1. */
|
/* Success? Then set dev to p1. */
|
||||||
dev = (AT_MAJOR << MAJOR) | (minors[i]+2);
|
dev = (AT_MAJOR << MAJOR) | (minors[i]+2);
|
||||||
found = 1;
|
found = 1;
|
||||||
|
printf("%d. YES - passed all tests, root is %d\n", i, dev);
|
||||||
break;
|
break;
|
||||||
}
|
} else printf("%d. no superblock(s)\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found) return NO_DEV;
|
if(!found) {
|
||||||
|
return NO_DEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\nCD probing done.\n");
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue