On Jan 24, 2008 12:15 AM, walt <[EMAIL PROTECTED]> wrote: > Bean wrote: > > This patch should fix the problem... > > Yes, thanks! I had to use the -l flag before patch would use it, > and even then the last hunk needed increased fuzz. > > Are you going to commit it today?
thanks for the testing, if you have ufs2, please check it as well. this is the new patch after adding changelog: * fs/ufs.c (GRUB_UFS_MAX_VOLLEN) : New constant. (grub_ufs_sblock) : New member volume name. (grub_ufs_find_file) : Fix string copy bug. (grub_ufs_label) : Implement this function properly. diff --git a/fs/ufs.c b/fs/ufs.c index 917d9a2..a1fdcda 100644 --- a/fs/ufs.c +++ b/fs/ufs.c @@ -38,6 +38,8 @@ #define GRUB_UFS_ATTR_DIR 040000 +#define GRUB_UFS_MAX_VOLLEN 32 + /* 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 = fpath; char *next; unsigned int pos = 0; int dirino; - grub_strncpy (fpath, path, grub_strlen (path)); + grub_strcpy (fpath, path); /* Skip the first slash. */ if (name[0] == '/') @@ -649,10 +656,30 @@ grub_ufs_close (grub_file_t file) static grub_err_t -grub_ufs_label (grub_device_t device __attribute ((unused)), - char **label __attribute ((unused))) +grub_ufs_label (grub_device_t device, char **label) { - return GRUB_ERR_NONE; + struct grub_ufs_data *data = 0; + +#ifndef GRUB_UTIL + grub_dl_ref (my_mod); +#endif + + *label = 0; + + data = grub_ufs_mount (device->disk); + if (data) + { + if (data->ufs_type == UFS2) + *label = grub_strdup ((char *) data->sblock.volume_name); + } + +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); +#endif + + grub_free (data); + + return grub_errno; } -- Bean _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel