mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-20 22:48:22 +00:00
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:
1 parent
f92ece7d45
commit
7d0ac93163
2 files changed
+31
-8
No files matched your search
+17
-8
@@ -57,8 +57,6 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
#define REISERFS_MAGIC_DESC_BLOCK "ReIsErLB"
|
||||
/* If the 3rd bit of an item state is set, then it's visible. */
|
||||
#define GRUB_REISERFS_VISIBLE_MASK ((grub_uint16_t) 0x04)
|
||||
#define REISERFS_MAX_LABEL_LENGTH 16
|
||||
#define REISERFS_LABEL_OFFSET 0x64
|
||||
|
||||
#define S_IFLNK 0xA000
|
||||
|
||||
@@ -109,6 +107,7 @@ struct grub_reiserfs_superblock
|
||||
grub_uint32_t inode_generation;
|
||||
grub_uint8_t unused[4];
|
||||
grub_uint16_t uuid[8];
|
||||
char label[16];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_reiserfs_journal_header
|
||||
@@ -1323,14 +1322,24 @@ grub_reiserfs_dir (grub_device_t device, const char *path,
|
||||
static grub_err_t
|
||||
grub_reiserfs_label (grub_device_t device, char **label)
|
||||
{
|
||||
*label = grub_malloc (REISERFS_MAX_LABEL_LENGTH);
|
||||
if (*label)
|
||||
struct grub_reiserfs_data *data;
|
||||
grub_disk_t disk = device->disk;
|
||||
|
||||
grub_dl_ref (my_mod);
|
||||
|
||||
data = grub_reiserfs_mount (disk);
|
||||
if (data)
|
||||
{
|
||||
grub_disk_read (device->disk,
|
||||
REISERFS_SUPER_BLOCK_OFFSET / GRUB_DISK_SECTOR_SIZE,
|
||||
REISERFS_LABEL_OFFSET, REISERFS_MAX_LABEL_LENGTH,
|
||||
*label);
|
||||
*label = grub_strndup (data->superblock.label,
|
||||
sizeof (data->superblock.label));
|
||||
}
|
||||
else
|
||||
*label = NULL;
|
||||
|
||||
grub_dl_unref (my_mod);
|
||||
|
||||
grub_free (data);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user