From: "Hitoshi Ozeki" <h-ozeki@ck2.so-net.ne.jp>
To: "'The development of GRUB 2'" <grub-devel@gnu.org>
Subject: RE: GRUB 1.95 cannot read the ufs filesystem
Date: Wed, 19 Sep 2007 11:35:10 +0900 [thread overview]
Message-ID: <000001c7fa65$b370bf20$030010ac@temjin> (raw)
In-Reply-To: <200709032249.26299.okuji@enbug.org>
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
prev parent reply other threads:[~2007-09-19 2:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-12 19:14 GRUB 1.95 cannot read the ufs filesystem Hitoshi Ozeki
2007-04-16 12:26 ` Johan Rydberg
2007-04-16 12:28 ` Johan Rydberg
2007-04-17 18:31 ` Hitoshi Ozeki
2007-04-18 10:48 ` Johan Rydberg
2007-04-18 10:49 ` Johan Rydberg
2007-04-18 21:13 ` Hitoshi Ozeki
2007-09-03 20:49 ` Yoshinori K. Okuji
2007-09-04 1:57 ` Bean
2007-09-19 2:35 ` Hitoshi Ozeki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000001c7fa65$b370bf20$030010ac@temjin' \
--to=h-ozeki@ck2.so-net.ne.jp \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.