Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / common / boot / grub2 / normal / misc.c
blob83bf28fa8ce74eb2142b0f5cc65b23faaf1cb15a
1 /* misc.c - miscellaneous functions */
2 /*
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>
22 #include <grub/fs.h>
23 #include <grub/err.h>
24 #include <grub/misc.h>
25 #include <grub/mm.h>
27 /* Print the information on the device NAME. */
28 grub_err_t
29 grub_normal_print_device_info (const char *name)
31 grub_device_t dev;
32 char *p;
34 p = grub_strchr (name, ',');
35 if (p)
36 grub_printf ("\tPartition %s: ", name);
37 else
38 grub_printf ("Device %s: ", name);
40 dev = grub_device_open (name);
41 if (! dev)
42 grub_printf ("Filesystem cannot be accessed");
43 else if (dev->disk)
45 grub_fs_t fs;
47 fs = grub_fs_probe (dev);
48 /* Ignore all errors. */
49 grub_errno = 0;
51 if (fs)
53 grub_printf ("Filesystem type %s", fs->name);
54 if (fs->label)
56 char *label;
57 (fs->label) (dev, &label);
58 if (grub_errno == GRUB_ERR_NONE)
60 if (label && grub_strlen (label))
61 grub_printf (", Label %s", label);
62 grub_free (label);
64 grub_errno = GRUB_ERR_NONE;
66 if (fs->uuid)
68 char *uuid;
69 (fs->uuid) (dev, &uuid);
70 if (grub_errno == GRUB_ERR_NONE)
72 if (uuid && grub_strlen (uuid))
73 grub_printf (", UUID %s", uuid);
74 grub_free (uuid);
76 grub_errno = GRUB_ERR_NONE;
79 else if (! dev->disk->has_partitions || dev->disk->partition)
80 grub_printf ("Unknown filesystem");
81 else
82 grub_printf ("Partition table");
84 grub_device_close (dev);
87 grub_printf ("\n");
88 return grub_errno;