1 |
/* disk_io.c - implement abstract BIOS disk input and output */ |
/* disk_io.c - implement abstract BIOS disk input and output */ |
2 |
/* |
/* |
3 |
* GRUB -- GRand Unified Bootloader |
* GRUB -- GRand Unified Bootloader |
4 |
* Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc. |
* Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc. |
5 |
* |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
948 |
if (*device != ',' && *device != ')') |
if (*device != ',' && *device != ')') |
949 |
{ |
{ |
950 |
char ch = *device; |
char ch = *device; |
951 |
|
#ifdef SUPPORT_NETBOOT |
952 |
if (*device == 'f' || *device == 'h' || *device == 'n') |
if (*device == 'f' || *device == 'h' || |
953 |
|
(*device == 'n' && network_ready)) |
954 |
|
#else |
955 |
|
if (*device == 'f' || *device == 'h') |
956 |
|
#endif /* SUPPORT_NETBOOT */ |
957 |
{ |
{ |
958 |
/* user has given '([fhn]', check for resp. add 'd' and |
/* user has given '([fhn]', check for resp. add 'd' and |
959 |
let disk_choice handle what disks we have */ |
let disk_choice handle what disks we have */ |
968 |
return device + 2; |
return device + 2; |
969 |
} |
} |
970 |
|
|
971 |
if ((*device == 'f' || *device == 'h' || *device == 'n') |
#ifdef SUPPORT_NETBOOT |
972 |
|
if ((*device == 'f' || *device == 'h' || |
973 |
|
(*device == 'n' && network_ready)) |
974 |
|
#else |
975 |
|
if ((*device == 'f' || *device == 'h') |
976 |
|
#endif /* SUPPORT_NETBOOT */ |
977 |
&& (device += 2, (*(device - 1) != 'd'))) |
&& (device += 2, (*(device - 1) != 'd'))) |
978 |
errnum = ERR_NUMBER_PARSING; |
errnum = ERR_NUMBER_PARSING; |
979 |
|
|
980 |
if (ch == 'n') |
#ifdef SUPPORT_NETBOOT |
981 |
|
if (ch == 'n' && network_ready) |
982 |
current_drive = NETWORK_DRIVE; |
current_drive = NETWORK_DRIVE; |
983 |
else |
else |
984 |
|
#endif /* SUPPORT_NETBOOT */ |
985 |
{ |
{ |
986 |
safe_parse_maxint (&device, (int *) ¤t_drive); |
safe_parse_maxint (&device, (int *) ¤t_drive); |
987 |
|
|
1337 |
if (! is_completion) |
if (! is_completion) |
1338 |
grub_printf (" Possible disks are: "); |
grub_printf (" Possible disks are: "); |
1339 |
|
|
1340 |
for (i = (ptr && (*(ptr-2) == 'h' && *(ptr-1) == 'd') ? 1 : 0); |
#ifdef SUPPORT_NETBOOT |
1341 |
i < (ptr && (*(ptr-2) == 'f' && *(ptr-1) == 'd') ? 1 : 2); |
if (!ptr || *(ptr-1) != 'd' || *(ptr-2) != 'n') |
1342 |
i++) |
#endif /* SUPPORT_NETBOOT */ |
1343 |
{ |
{ |
1344 |
for (j = 0; j < 8; j++) |
for (i = (ptr && (*(ptr-1) == 'd' && *(ptr-2) == 'h') ? 1:0); |
1345 |
|
i < (ptr && (*(ptr-1) == 'd' && *(ptr-2) == 'f') ? 1:2); |
1346 |
|
i++) |
1347 |
{ |
{ |
1348 |
disk_no = (i * 0x80) + j; |
for (j = 0; j < 8; j++) |
|
if ((disk_choice || disk_no == current_drive) |
|
|
&& ! get_diskinfo (disk_no, &geom)) |
|
1349 |
{ |
{ |
1350 |
char dev_name[8]; |
disk_no = (i * 0x80) + j; |
1351 |
|
if ((disk_choice || disk_no == current_drive) |
1352 |
|
&& ! get_diskinfo (disk_no, &geom)) |
1353 |
|
{ |
1354 |
|
char dev_name[8]; |
1355 |
|
|
1356 |
grub_sprintf (dev_name, "%cd%d", i ? 'h' : 'f', j); |
grub_sprintf (dev_name, "%cd%d", i ? 'h':'f', j); |
1357 |
print_a_completion (dev_name); |
print_a_completion (dev_name); |
1358 |
|
} |
1359 |
} |
} |
1360 |
} |
} |
1361 |
} |
} |
|
|
|
1362 |
# ifdef SUPPORT_NETBOOT |
# ifdef SUPPORT_NETBOOT |
1363 |
if (network_ready) |
if (network_ready && |
1364 |
|
(disk_choice || NETWORK_DRIVE == current_drive) && |
1365 |
|
(!ptr || *(ptr-1) == '(' || |
1366 |
|
(*(ptr-1) == 'd' && *(ptr-2) == 'n'))) |
1367 |
print_a_completion ("nd"); |
print_a_completion ("nd"); |
1368 |
# endif /* SUPPORT_NETBOOT */ |
# endif /* SUPPORT_NETBOOT */ |
1369 |
|
|