Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JHOK0-0006kZ-0F for mharc-grub-devel@gnu.org; Tue, 22 Jan 2008 13:58:08 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHOJy-0006kE-84 for grub-devel@gnu.org; Tue, 22 Jan 2008 13:58:06 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHOJw-0006jS-Os for grub-devel@gnu.org; Tue, 22 Jan 2008 13:58:05 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHOJw-0006jG-L5 for grub-devel@gnu.org; Tue, 22 Jan 2008 13:58:04 -0500 Received: from nz-out-0506.google.com ([64.233.162.226]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JHOJw-000882-EG for grub-devel@gnu.org; Tue, 22 Jan 2008 13:58:04 -0500 Received: by nz-out-0506.google.com with SMTP id f1so1454600nzc.21 for ; Tue, 22 Jan 2008 10:58:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=SMYAJjZfwMSnaGEv+DgWXfPOrWr6e8s/Jn0NT4k+PZs=; b=ZmWGWFYfBNdN9VH7QS3WWtwLacre7IbU3iscQTnrNFp0jjN1rvTb4mDAOSu4kltpdsz0veknnTQ91YNFzLUqdOhk1ufzMRKFNmMMqcfsFVMH/R1vkhrlFiWn+15nP6VevhvjbkoRtdCoAA+xKIksZZ42aGK21fufn4n8/leCnsA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=D9I013QB8U7fM88N9uTDF4E3ONzZBiy1hLeigBjwnpK9hLvxiYGvCIFc3sIHQ7wT2pMPrTUNfevHAIaeyG+JTMa3eE4++U+67XBbphrAWHXO+jD1MouiDLX1nrnmtEVDaR+a1776n+mpojrhRR1Eea/d9lqvFVUn65bxNJTH7FU= Received: by 10.110.52.5 with SMTP id z5mr3970404tiz.17.1201028282058; Tue, 22 Jan 2008 10:58:02 -0800 (PST) Received: by 10.110.31.8 with HTTP; Tue, 22 Jan 2008 10:58:02 -0800 (PST) Message-ID: Date: Wed, 23 Jan 2008 02:58:02 +0800 From: Bean To: "The development of GRUB 2" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20080119170105.GJ1341@kirkkit.kollasch.net> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: Re: UFS (FFS) support seems broken in grub2 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2008 18:58:06 -0000 This patch should fix the problem. diff --git a/fs/ufs.c b/fs/ufs.c index 917d9a2..bef19e6 100644 --- a/fs/ufs.c +++ b/fs/ufs.c @@ -38,6 +38,8 @@ #define GRUB_UFS_ATTR_DIR=09040000 +#define GRUB_UFS_MAX_VOLLEN=0932 + /* Calculate in which group the inode can be found. */ #define inode_group(inode,sblock) () @@ -86,7 +88,12 @@ struct grub_ufs_sblock /* The frags per cylinder group. */ grub_uint32_t frags_per_group; - grub_uint8_t unused7[1180]; + grub_uint8_t unused7[488]; + + /* Volume name for UFS2. */ + grub_uint8_t volume_name[GRUB_UFS_MAX_VOLLEN]; + + grub_uint8_t unused8[660]; /* Magic value to check if this is really a UFS filesystem. */ grub_uint32_t magic; @@ -393,13 +400,13 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino) static grub_err_t grub_ufs_find_file (struct grub_ufs_data *data, const char *path) { - char fpath[grub_strlen (path)]; + char fpath[grub_strlen (path) + 1]; char *name =3D fpath; char *next; unsigned int pos =3D 0; int dirino; - grub_strncpy (fpath, path, grub_strlen (path)); + grub_strcpy (fpath, path); /* Skip the first slash. */ if (name[0] =3D=3D '/') @@ -649,10 +656,30 @@ grub_ufs_close (grub_file_t file) static grub_err_t -grub_ufs_label (grub_device_t device __attribute ((unused)), -=09=09char **label __attribute ((unused))) +grub_ufs_label (grub_device_t device,char **label) { - return GRUB_ERR_NONE; + struct grub_ufs_data *data =3D 0; + +#ifndef GRUB_UTIL + grub_dl_ref (my_mod); +#endif + + *label =3D 0; + + data =3D grub_ufs_mount (device->disk); + if (data) + { + if (data->ufs_type =3D=3D UFS2) + *label =3D grub_strdup ((char *) data->sblock.volume_name); + } + +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); +#endif + + grub_free (data); + + return grub_errno; } =0C --=20 Bean