1f0a95e481
* DISTLIST: Replace commands/i386/pc/vbe_list_modes.c and commands/i386/pc/vbe_test.c with commands/i386/pc/vbeinfo.c and commands/i386/pc/vbetest.c. * video/i386/pc/vbe.c (grub_vbe_probe): If INFOBLOCK is not NULL, call grub_vbe_get_controller_info again, because the returned information is volatile. (grub_vbe_set_video_mode): Mostly rewritten. (grub_vbe_get_video_mode): Use grub_vbe_probe and use grub_vbe_status_t correctly. (grub_vbe_get_video_mode_info): Likewise. (grub_vbe_set_pixel_rgb): Use a switch statement rather than several if statements. * commands/i386/pc/vbe_list_modes.c: Renamed to ... * commands/i386/pc/vbeinfo.c: ... this. * commands/i386/pc/vbe_test.c: Renamed to ... * commands/i386/pc/vbetest.c: ... this. * commands/i386/pc/vbeinfo.c (grub_cmd_vbe_list_modes): Renamed to ... (grub_cmd_vbeinfo): ... this. Save video modes before iterating. Skip a video mode, if it is not available, not enough information is given or it is monochrome. Show the memory model. Leave the interpretation of MODEVAR to grub_strtoul completely. (GRUB_MOD_INIT): Rename vbe_list_modes to vbeinfo. (GRUB_MOD_FINI): Likewise. * commands/i386/pc/vbetest.c (grub_cmd_vbe_test): Renamed to ... (grub_cmd_vbetest): ... this. Don't print unnecessarily. Use grub_err_t instead of grub_uint32_t. Don't use SPTR. Remove a duplicated grub_env_get. Leave the interpretation of MODEVAR to grub_strtoul completely. (real2pm): Removed. (GRUB_MOD_INIT): Rename vbe_test to vbetest. (GRUB_MOD_FINI): Likewise. * normal/misc.c: Include grub/mm.h. * conf/i386-pc.rmk (pkgdata_MODULES): Replaced vbe_test.mod and vbe_list_modes with vbetest.mod and vbeinfo.mod. (vbe_list_modes_mod_SOURCES): Removed. (vbe_list_modes_mod_CFLAGS): Likewise. (vbe_test_mod_SOURCES): Likewise. (vbe_test_mod_CFLAGS): Likewise. (vbeinfo_mod_SOURCES): New variable. (vbeinfo_mod_CFLAGS): Likewise. (vbetest_mod_SOURCES): Likewise. (vbetest_mod_CFLAGS): Likewise.
71 lines
1.9 KiB
C
71 lines
1.9 KiB
C
/* misc.c - miscellaneous functions */
|
|
/*
|
|
* GRUB -- GRand Unified Bootloader
|
|
* Copyright (C) 2005 Free Software Foundation, Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*/
|
|
|
|
#include <grub/normal.h>
|
|
#include <grub/disk.h>
|
|
#include <grub/fs.h>
|
|
#include <grub/err.h>
|
|
#include <grub/misc.h>
|
|
#include <grub/mm.h>
|
|
|
|
/* Print the information on the device NAME. */
|
|
grub_err_t
|
|
grub_normal_print_device_info (const char *name)
|
|
{
|
|
grub_device_t dev;
|
|
char *p;
|
|
|
|
p = grub_strchr (name, ',');
|
|
if (p)
|
|
grub_printf ("\tPartition %s: ", name);
|
|
else
|
|
grub_printf ("Device %s: ", name);
|
|
|
|
dev = grub_device_open (name);
|
|
if (! dev)
|
|
grub_printf ("Filesystem cannot be accessed");
|
|
else if (! dev->disk || ! dev->disk->has_partitions || dev->disk->partition)
|
|
{
|
|
char *label;
|
|
grub_fs_t fs;
|
|
|
|
fs = grub_fs_probe (dev);
|
|
/* Ignore all errors. */
|
|
grub_errno = 0;
|
|
|
|
grub_printf ("Filesystem type %s", fs ? fs->name : "unknown");
|
|
|
|
if (fs && fs->label)
|
|
{
|
|
(fs->label) (dev, &label);
|
|
if (grub_errno == GRUB_ERR_NONE)
|
|
{
|
|
if (label && grub_strlen (label))
|
|
grub_printf (", Label %s", label);
|
|
grub_free (label);
|
|
}
|
|
grub_errno = GRUB_ERR_NONE;
|
|
}
|
|
grub_device_close (dev);
|
|
}
|
|
|
|
grub_printf ("\n");
|
|
return grub_errno;
|
|
}
|