Make reiserfs label retrieval similar to other *_label functions.

* grub-core/fs/reiserfs.c (grub_reiserfs_superblock): New field label.
	(REISERFS_MAX_LABEL_LENGTH): Removed.
	(REISERFS_LABEL_OFFSET): Likewise.
	(grub_reiserfs_label): Rewritten.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-11-03 14:57:34 +01:00
parent f92ece7d45
commit 7d0ac93163
2 changed files with 31 additions and 8 deletions

View file

@ -1,3 +1,17 @@
2011-11-03 Vladimir Serbinenko <phcoder@gmail.com>
Make reiserfs label retrieval similar to other *_label functions.
* grub-core/fs/reiserfs.c (grub_reiserfs_superblock): New field label.
(REISERFS_MAX_LABEL_LENGTH): Removed.
(REISERFS_LABEL_OFFSET): Likewise.
(grub_reiserfs_label): Rewritten.
2011-11-03 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/nilfs2.c (grub_nilfs2_mtime): Use correct superblock
field.
2011-11-03 Vladimir Serbinenko <phcoder@gmail.com> 2011-11-03 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/zfs/zfs.c (read_device): Support raidz3. * grub-core/fs/zfs/zfs.c (read_device): Support raidz3.

View file

@ -57,8 +57,6 @@ GRUB_MOD_LICENSE ("GPLv3+");
#define REISERFS_MAGIC_DESC_BLOCK "ReIsErLB" #define REISERFS_MAGIC_DESC_BLOCK "ReIsErLB"
/* If the 3rd bit of an item state is set, then it's visible. */ /* If the 3rd bit of an item state is set, then it's visible. */
#define GRUB_REISERFS_VISIBLE_MASK ((grub_uint16_t) 0x04) #define GRUB_REISERFS_VISIBLE_MASK ((grub_uint16_t) 0x04)
#define REISERFS_MAX_LABEL_LENGTH 16
#define REISERFS_LABEL_OFFSET 0x64
#define S_IFLNK 0xA000 #define S_IFLNK 0xA000
@ -109,6 +107,7 @@ struct grub_reiserfs_superblock
grub_uint32_t inode_generation; grub_uint32_t inode_generation;
grub_uint8_t unused[4]; grub_uint8_t unused[4];
grub_uint16_t uuid[8]; grub_uint16_t uuid[8];
char label[16];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct grub_reiserfs_journal_header struct grub_reiserfs_journal_header
@ -1323,14 +1322,24 @@ grub_reiserfs_dir (grub_device_t device, const char *path,
static grub_err_t static grub_err_t
grub_reiserfs_label (grub_device_t device, char **label) grub_reiserfs_label (grub_device_t device, char **label)
{ {
*label = grub_malloc (REISERFS_MAX_LABEL_LENGTH); struct grub_reiserfs_data *data;
if (*label) grub_disk_t disk = device->disk;
grub_dl_ref (my_mod);
data = grub_reiserfs_mount (disk);
if (data)
{ {
grub_disk_read (device->disk, *label = grub_strndup (data->superblock.label,
REISERFS_SUPER_BLOCK_OFFSET / GRUB_DISK_SECTOR_SIZE, sizeof (data->superblock.label));
REISERFS_LABEL_OFFSET, REISERFS_MAX_LABEL_LENGTH,
*label);
} }
else
*label = NULL;
grub_dl_unref (my_mod);
grub_free (data);
return grub_errno; return grub_errno;
} }