From: walt <wa1ter@myrealbox.com>
To: grub-devel@gnu.org
Subject: Re: UFS (FFS) support seems broken in grub2
Date: Sat, 19 Jan 2008 10:27:20 -0800 [thread overview]
Message-ID: <fmtfdf$ano$1@ger.gmane.org> (raw)
In-Reply-To: <20080119170105.GJ1341@kirkkit.kollasch.net>
[-- Attachment #1: Type: text/plain, Size: 389 bytes --]
jakllsch@kollasch.net wrote:
> Hi,
>
> The UFS (or FFS as it's known to NetBSD)
> support in grub2 does not seem to work for me.
There was an interesting but strangely incomplete discussion of
UFS back in April 2007. Hitoshi Ozeki posted the attached patch,
which lets me list UFS filesystems but not read from them.
If you can use his patch to devise a real fix, I'd be very happy.
[-- Attachment #2: ufs.patch --]
[-- Type: text/x-patch, Size: 2960 bytes --]
--- grub-1.95/fs/ufs.c 2006-06-04 17:55:56.000000000 +0900
+++ grub-1.95-new/fs/ufs.c 2007-04-12 08:05:09.698149332 +0900
@@ -394,16 +394,13 @@
static grub_err_t
grub_ufs_find_file (struct grub_ufs_data *data, const char *path)
{
- char fpath[grub_strlen (path)];
- char *name = fpath;
- char *next;
+ const char *name = path;
+ const char *next;
unsigned int pos = 0;
int dirino;
- grub_strncpy (fpath, path, grub_strlen (path));
-
/* Skip the first slash. */
- if (name[0] == '/')
+ if (*name == '/')
{
name++;
if (!*name)
@@ -412,17 +409,14 @@
/* Extract the actual part from the pathname. */
next = grub_strchr (name, '/');
- if (next)
- {
- next[0] = '\0';
- next++;
- }
+ if (!next)
+ next = &name[grub_strlen(name)];
do
{
struct grub_ufs_dirent dirent;
- if (grub_strlen (name) == 0)
+ if (next <= name)
return GRUB_ERR_NONE;
if (grub_ufs_read_file (data, 0, pos, sizeof (dirent),
@@ -430,15 +424,13 @@
return grub_errno;
{
- char filename[dirent.namelen + 1];
+ char filename[dirent.namelen];
if (grub_ufs_read_file (data, 0, pos + sizeof (dirent),
dirent.namelen, filename) < 0)
return grub_errno;
- filename[dirent.namelen] = '\0';
-
- if (!grub_strcmp (name, filename))
+ if ((&name[dirent.namelen] == next) && !grub_strncmp (name, filename, dirent.namelen))
{
dirino = data->ino;
grub_ufs_read_inode (data, grub_le_to_cpu32 (dirent.ino));
@@ -450,18 +442,15 @@
return grub_errno;
}
- if (!next)
+ if (!*next)
return 0;
pos = 0;
- name = next;
- next = grub_strchr (name, '/');
- if (next)
- {
- next[0] = '\0';
- next++;
- }
+ name = next + 1;
+ next = grub_strchr (name, '/');
+ if (!next)
+ next = &name[grub_strlen(name)];
if (!(dirent.filetype & GRUB_UFS_FILETYPE_DIR))
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
@@ -599,34 +588,43 @@
grub_ufs_open (struct grub_file *file, const char *name)
{
struct grub_ufs_data *data;
+
+#ifndef GRUB_UTIL
+ grub_dl_ref (my_mod);
+#endif
+
data = grub_ufs_mount (file->device->disk);
if (!data)
return grub_errno;
grub_ufs_read_inode (data, 2);
if (grub_errno)
- {
- grub_free (data);
- return grub_errno;
- }
+ goto fail;
if (!name || name[0] != '/')
{
grub_error (GRUB_ERR_BAD_FILENAME, "bad filename");
- return grub_errno;
+ goto fail;
}
grub_ufs_find_file (data, name);
if (grub_errno)
- {
- grub_free (data);
- return grub_errno;
- }
+ goto fail;
file->data = data;
file->size = INODE_SIZE (data);
return GRUB_ERR_NONE;
+
+ fail:
+
+ grub_free (data);
+
+#ifndef GRUB_UTIL
+ grub_dl_unref (my_mod);
+#endif
+
+ return grub_errno;
}
next prev parent reply other threads:[~2008-01-19 18:27 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-19 17:01 UFS (FFS) support seems broken in grub2 jakllsch
2008-01-19 18:27 ` walt [this message]
2008-01-22 18:58 ` Bean
2008-01-22 20:04 ` Robert Millan
2008-01-23 9:02 ` Marco Gerards
2008-01-23 16:15 ` walt
2008-01-23 16:31 ` Bean
2008-01-23 19:21 ` Marco Gerards
2008-01-23 20:26 ` Bean
2008-01-23 22:49 ` walt
2008-01-23 23:53 ` Robert Millan
2008-01-24 1:21 ` walt
2008-01-24 12:30 ` booting *BSD kernels (Re: UFS (FFS) support seems broken in grub2) Robert Millan
2008-01-24 8:33 ` UFS (FFS) support seems broken in grub2 Marco Gerards
2008-01-24 14:20 ` walt
2008-01-24 14:33 ` booting kernel of NetBSD (Re: UFS (FFS) support seems broken in grub2) Robert Millan
2008-01-24 14:53 ` Robert Millan
2008-01-24 16:47 ` walt
2008-01-24 17:12 ` Robert Millan
2008-01-26 15:01 ` Bean
2008-01-26 17:24 ` Robert Millan
2008-01-26 18:19 ` walt
2008-01-26 18:24 ` Bean
2008-01-26 18:31 ` Bean
2008-01-26 19:57 ` Robert Millan
2008-01-26 19:57 ` Robert Millan
2008-01-26 21:24 ` walt
2008-01-27 1:35 ` Bean
2008-01-27 20:13 ` walt
2008-01-27 20:25 ` Bean
2008-01-28 1:54 ` walt
2008-01-28 8:52 ` Robert Millan
2008-01-28 10:02 ` Bean
2008-01-28 13:00 ` Marco Gerards
2008-01-28 13:02 ` Bean
2008-02-02 14:16 ` Bean
2008-01-27 8:53 ` Robert Millan
2008-01-27 20:09 ` walt
2008-01-27 22:11 ` Robert Millan
2008-01-28 8:57 ` Marco Gerards
2008-01-28 10:06 ` Bean
2008-01-28 10:41 ` Robert Millan
2008-02-06 15:32 ` Robert Millan
2008-02-06 16:03 ` Bean
2008-01-24 18:16 ` UFS (FFS) support seems broken in grub2 Marco Gerards
2008-01-24 18:19 ` Robert Millan
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='fmtfdf$ano$1@ger.gmane.org' \
--to=wa1ter@myrealbox.com \
--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.