1
/* misc.c - miscellaneous functions */
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc.
6
* GRUB 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 3 of the License, or
9
* (at your option) any later version.
11
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
20
#include <grub/normal.h>
21
#include <grub/disk.h>
24
#include <grub/misc.h>
26
#include <grub/datetime.h>
27
#include <grub/term.h>
28
#include <grub/i18n.h>
30
/* Print the information on the device NAME. */
32
grub_normal_print_device_info (const char *name)
37
p = grub_strchr (name, ',');
41
grub_printf_ (N_("Partition %s:"), name);
46
grub_printf_ (N_("Device %s:"), name);
50
dev = grub_device_open (name);
52
grub_printf ("%s", _("Filesystem cannot be accessed"));
57
fs = grub_fs_probe (dev);
58
/* Ignore all errors. */
63
grub_printf_ (N_("Filesystem type %s"), fs->name);
67
(fs->label) (dev, &label);
68
if (grub_errno == GRUB_ERR_NONE)
70
if (label && grub_strlen (label))
73
grub_printf_ (N_("- Label \"%s\""), label);
77
grub_errno = GRUB_ERR_NONE;
82
struct grub_datetime datetime;
83
(fs->mtime) (dev, &tm);
84
if (grub_errno == GRUB_ERR_NONE)
86
grub_unixtime2datetime (tm, &datetime);
88
grub_printf_ (N_("- Last modification time %d-%02d-%02d "
90
datetime.year, datetime.month, datetime.day,
91
datetime.hour, datetime.minute, datetime.second,
92
grub_get_weekday_name (&datetime));
95
grub_errno = GRUB_ERR_NONE;
100
(fs->uuid) (dev, &uuid);
101
if (grub_errno == GRUB_ERR_NONE)
103
if (uuid && grub_strlen (uuid))
104
grub_printf (", UUID %s", uuid);
107
grub_errno = GRUB_ERR_NONE;
110
else if (! dev->disk->has_partitions || dev->disk->partition)
111
grub_printf ("%s", _("Unknown filesystem"));
113
grub_printf ("%s", _("Partition table"));
115
grub_device_close (dev);