Extend cdprobe probe list to c1, and reorder minors to do most-likely

first.

Make at_wini include instance number in error messages.
This commit is contained in:
Ben Gras 2007-02-08 15:56:58 +00:00
parent ebde52a9bc
commit 624f17ee04
2 changed files with 18 additions and 7 deletions

View File

@ -31,15 +31,22 @@ char pvd[CD_SECTOR];
*===========================================================================*/
int main(void)
{
int i, r, fd, minor, found;
int controller, disk, r, fd, minor, found;
off_t pos;
u16_t *magicp;
char name1[]= "/dev/c0dX";
char name2[]= "/dev/c0dXpY";
int probelist[AT_MINORS] = { 2, 3, 1, 0, 6, 7, 5, 4 };
found= 0;
for(i = 0; i < AT_MINORS; i++) {
name1[8]= '0' + i;
for(controller = 0; controller <= 1; controller++) {
name1[6] = '0' + controller;
name2[6] = '0' + controller;
for(disk = 0; disk < AT_MINORS; disk++) {
name1[8]= '0' + probelist[disk];
fprintf(stderr, "Trying %s \r", name1);
fflush(stderr);
fd = open(name1, O_RDONLY);
if (fd < 0)
@ -78,10 +85,10 @@ int main(void)
continue;
}
/* 3. Both c0dXp1 and p2 should have a superblock. */
/* 3. Both cXdYp1 and p2 should have a superblock. */
found= 1; /* Assume everything is okay */
for (minor = 1; minor <= 2; minor++) {
name2[8]= '0' + i;
name2[8]= '0' + probelist[disk];
name2[10]= '0' + minor;
fd = open(name2, O_RDONLY);
@ -120,10 +127,13 @@ int main(void)
if (found)
{
fprintf(stderr, "\nFound.\n");
printf("%s\n", name1);
exit(0);
}
}
}
fprintf(stderr, "\nNot found.\n");
return 1;
}

View File

@ -1011,9 +1011,10 @@ PRIVATE int w_identify()
PRIVATE char *w_name()
{
/* Return a name for the current device. */
static char name[] = "AT-D0";
static char name[] = "AT0-D0";
name[4] = '0' + w_drive;
name[2] = '0' + w_instance;
name[5] = '0' + w_drive;
return name;
}