mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-26 00:59:55 +00:00
disable the device map file by default.
This commit is contained in:
1 parent
c95941d65d
commit
8bc82ce256
5 files changed
+110
-98
No files matched your search
+83
-79
@@ -223,7 +223,7 @@ init_device_map (void)
|
||||
{
|
||||
int i;
|
||||
int num_hd = 0;
|
||||
FILE *fp;
|
||||
FILE *fp = 0;
|
||||
|
||||
static void print_error (int no, const char *msg)
|
||||
{
|
||||
@@ -240,96 +240,100 @@ init_device_map (void)
|
||||
for (i = 0; i < NUM_DISKS; i++)
|
||||
device_map[i] = 0;
|
||||
|
||||
/* Open the device map file. */
|
||||
fp = fopen (device_map_file, "r");
|
||||
if (fp)
|
||||
if (device_map_file)
|
||||
{
|
||||
/* If there is the device map file, use the data in it instead of
|
||||
probing devices. */
|
||||
char buf[1024]; /* XXX */
|
||||
int line_number = 0;
|
||||
|
||||
while (fgets (buf, sizeof (buf), fp))
|
||||
/* Open the device map file. */
|
||||
fp = fopen (device_map_file, "r");
|
||||
if (fp)
|
||||
{
|
||||
char *ptr, *eptr;
|
||||
int drive;
|
||||
int is_floppy = 0;
|
||||
/* If there is the device map file, use the data in it instead of
|
||||
probing devices. */
|
||||
char buf[1024]; /* XXX */
|
||||
int line_number = 0;
|
||||
|
||||
/* Increase the number of lines. */
|
||||
line_number++;
|
||||
|
||||
/* If the first character is '#', skip it. */
|
||||
if (buf[0] == '#')
|
||||
continue;
|
||||
|
||||
ptr = buf;
|
||||
/* Skip leading spaces. */
|
||||
while (*ptr && isspace (*ptr))
|
||||
ptr++;
|
||||
|
||||
if (*ptr != '(')
|
||||
while (fgets (buf, sizeof (buf), fp))
|
||||
{
|
||||
print_error (line_number, "No open parenthesis found");
|
||||
stop ();
|
||||
char *ptr, *eptr;
|
||||
int drive;
|
||||
int is_floppy = 0;
|
||||
|
||||
/* Increase the number of lines. */
|
||||
line_number++;
|
||||
|
||||
/* If the first character is '#', skip it. */
|
||||
if (buf[0] == '#')
|
||||
continue;
|
||||
|
||||
ptr = buf;
|
||||
/* Skip leading spaces. */
|
||||
while (*ptr && isspace (*ptr))
|
||||
ptr++;
|
||||
|
||||
if (*ptr != '(')
|
||||
{
|
||||
print_error (line_number, "No open parenthesis found");
|
||||
stop ();
|
||||
}
|
||||
|
||||
ptr++;
|
||||
if ((*ptr != 'f' && *ptr != 'h') || *(ptr + 1) != 'd')
|
||||
{
|
||||
print_error (line_number, "Bad drive name");
|
||||
stop ();
|
||||
}
|
||||
|
||||
if (*ptr == 'f')
|
||||
is_floppy = 1;
|
||||
|
||||
ptr += 2;
|
||||
drive = strtoul (ptr, &ptr, 10);
|
||||
if (drive < 0 || drive > 8)
|
||||
{
|
||||
print_error (line_number, "Bad device number");
|
||||
stop ();
|
||||
}
|
||||
|
||||
if (! is_floppy)
|
||||
drive += 0x80;
|
||||
|
||||
if (*ptr != ')')
|
||||
{
|
||||
print_error (line_number, "No close parenthesis found");
|
||||
stop ();
|
||||
}
|
||||
|
||||
ptr++;
|
||||
/* Skip spaces. */
|
||||
while (*ptr && isspace (*ptr))
|
||||
ptr++;
|
||||
|
||||
if (! *ptr)
|
||||
{
|
||||
print_error (line_number, "No filename found");
|
||||
stop ();
|
||||
}
|
||||
|
||||
/* Terminate the filename. */
|
||||
eptr = ptr;
|
||||
while (*eptr && ! isspace (*eptr))
|
||||
eptr++;
|
||||
*eptr = 0;
|
||||
|
||||
assign_device_name (drive, ptr);
|
||||
}
|
||||
|
||||
ptr++;
|
||||
if ((*ptr != 'f' && *ptr != 'h') || *(ptr + 1) != 'd')
|
||||
{
|
||||
print_error (line_number, "Bad drive name");
|
||||
stop ();
|
||||
}
|
||||
|
||||
if (*ptr == 'f')
|
||||
is_floppy = 1;
|
||||
|
||||
ptr += 2;
|
||||
drive = strtoul (ptr, &ptr, 10);
|
||||
if (drive < 0 || drive > 8)
|
||||
{
|
||||
print_error (line_number, "Bad device number");
|
||||
stop ();
|
||||
}
|
||||
|
||||
if (! is_floppy)
|
||||
drive += 0x80;
|
||||
|
||||
if (*ptr != ')')
|
||||
{
|
||||
print_error (line_number, "No close parenthesis found");
|
||||
stop ();
|
||||
}
|
||||
|
||||
ptr++;
|
||||
/* Skip spaces. */
|
||||
while (*ptr && isspace (*ptr))
|
||||
ptr++;
|
||||
|
||||
if (! *ptr)
|
||||
{
|
||||
print_error (line_number, "No filename found");
|
||||
stop ();
|
||||
}
|
||||
|
||||
/* Terminate the filename. */
|
||||
eptr = ptr;
|
||||
while (*eptr && ! isspace (*eptr))
|
||||
eptr++;
|
||||
*eptr = 0;
|
||||
|
||||
assign_device_name (drive, ptr);
|
||||
fclose (fp);
|
||||
return;
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Print something as the user does not think GRUB has been crashed. */
|
||||
fprintf (stderr,
|
||||
"Probe devices to guess BIOS drives. This may take a long time.\n");
|
||||
|
||||
/* Try to open the device map file to write the probed data. */
|
||||
fp = fopen (device_map_file, "w");
|
||||
if (device_map_file)
|
||||
/* Try to open the device map file to write the probed data. */
|
||||
fp = fopen (device_map_file, "w");
|
||||
|
||||
/* Floppies. */
|
||||
if (! no_floppy)
|
||||
|
||||
+3
-5
@@ -38,11 +38,10 @@ int verbose = 0;
|
||||
int read_only = 0;
|
||||
int no_floppy = 0;
|
||||
int probe_second_floppy = 0;
|
||||
char *device_map_file = "/boot/grub/device.map";
|
||||
char *device_map_file = 0;
|
||||
static int default_boot_drive;
|
||||
static int default_install_partition;
|
||||
static char *default_config_file;
|
||||
static char *default_device_map_file;
|
||||
|
||||
#define OPT_HELP -2
|
||||
#define OPT_VERSION -3
|
||||
@@ -94,7 +93,7 @@ Enter the GRand Unified Bootloader command shell.\n\
|
||||
--batch turn on batch mode for non-interactive use\n\
|
||||
--boot-drive=DRIVE specify stage2 boot_drive [default=0x%x]\n\
|
||||
--config-file=FILE specify stage2 config_file [default=%s]\n\
|
||||
--device-map=FILE specify the device map file [default=%s]\n\
|
||||
--device-map=FILE Use the device map file FILE\n\
|
||||
--help display this message and exit\n\
|
||||
--hold wait until a debugger will attach\n\
|
||||
--install-partition=PAR specify stage2 install_partition [default=0x%x]\n\
|
||||
@@ -109,7 +108,7 @@ Enter the GRand Unified Bootloader command shell.\n\
|
||||
Report bugs to bug-grub@gnu.org\n\
|
||||
",
|
||||
default_boot_drive, default_config_file,
|
||||
default_device_map_file, default_install_partition);
|
||||
default_install_partition);
|
||||
|
||||
exit (status);
|
||||
}
|
||||
@@ -133,7 +132,6 @@ main (int argc, char **argv)
|
||||
default_config_file = config_file;
|
||||
else
|
||||
default_config_file = "NONE";
|
||||
default_device_map_file = device_map_file;
|
||||
|
||||
/* Parse command-line options. */
|
||||
do
|
||||
|
||||
Reference in new issue
Block a user