[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: GRUB 1.95 cannot read the ufs filesystem
From: |
Hitoshi Ozeki |
Subject: |
RE: GRUB 1.95 cannot read the ufs filesystem |
Date: |
Wed, 19 Sep 2007 11:35:10 +0900 |
Hello.
On 17 April 2007, I wrote:
--- begin grub-1.95/fs/ufs.c ----------------------------------
static struct grub_fs grub_ufs_fs =
{
.name = "ufs",
.dir = grub_ufs_dir,
.open = grub_ufs_open,
.read = grub_ufs_read,
.close = grub_ufs_close,
.label = grub_ufs_label,
.next = 0
};
--- end grub-1.95/fs/ufs.c ------------------------------------
The '.label' should set to 0.
On 4 September 2007, Okuji wrote:
but I think UFS2 supports a volume name.
This source is function "grub_normal_print_device_info()"
of the "grub-1.95/normal/misc.c".
--- begin grub-1.95/normal/misc.c -----------------------------
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); <---- We expect that C
string will be set as a 'label.'
if (grub_errno == GRUB_ERR_NONE)
{
if (label && grub_strlen (label)) <--- ouch! 'label'
is not C string.
grub_printf (", Label %s", label);
grub_free (label); <--- gaaaaah!
}
grub_errno = GRUB_ERR_NONE;
}
--- end grub-1.95/normal/misc.c -------------------------------
In ufs.c, "label" function does nothing.
but, In "normal/misc.c" expects that "ufs.c" allocates a memory and
terminates with NIL.
Even if we did not have any return value in the "label" function, it is not
good to do nothing.
static grub_err_t
grub_ufs_label (grub_device_t device __attribute ((unused)),
char **label)
{
*label = grub_malloc (1);
**label = '\0';
return GRUB_ERR_NONE;
}
--
Regards,
Hitoshi Ozeki