1 /* misc.c - miscellaneous functions */
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2005,2007 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>
27 /* Print the information on the device NAME. */
29 grub_normal_print_device_info (const char *name
)
34 p
= grub_strchr (name
, ',');
36 grub_printf ("\tPartition %s: ", name
);
38 grub_printf ("Device %s: ", name
);
40 dev
= grub_device_open (name
);
42 grub_printf ("Filesystem cannot be accessed");
47 fs
= grub_fs_probe (dev
);
48 /* Ignore all errors. */
53 grub_printf ("Filesystem type %s", fs
->name
);
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
;
69 (fs
->uuid
) (dev
, &uuid
);
70 if (grub_errno
== GRUB_ERR_NONE
)
72 if (uuid
&& grub_strlen (uuid
))
73 grub_printf (", UUID %s", uuid
);
76 grub_errno
= GRUB_ERR_NONE
;
79 else if (! dev
->disk
->has_partitions
|| dev
->disk
->partition
)
80 grub_printf ("Unknown filesystem");
82 grub_printf ("Partition table");
84 grub_device_close (dev
);