1
/* misc.c - miscellaneous functions */
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2005 Free Software Foundation, Inc.
6
* 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
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
#include <grub/normal.h>
22
#include <grub/disk.h>
25
#include <grub/misc.h>
28
/* Print the information on the device NAME. */
30
grub_normal_print_device_info (const char *name)
35
p = grub_strchr (name, ',');
37
grub_printf ("\tPartition %s: ", name);
39
grub_printf ("Device %s: ", name);
41
dev = grub_device_open (name);
43
grub_printf ("Filesystem cannot be accessed");
44
else if (! dev->disk || ! dev->disk->has_partitions || dev->disk->partition)
49
fs = grub_fs_probe (dev);
50
/* Ignore all errors. */
53
grub_printf ("Filesystem type %s", fs ? fs->name : "unknown");
57
(fs->label) (dev, &label);
58
if (grub_errno == GRUB_ERR_NONE)
60
if (label && grub_strlen (label))
61
grub_printf (", Label %s", label);
64
grub_errno = GRUB_ERR_NONE;
66
grub_device_close (dev);