bugGNU GRUB - Bugs: bug #60739, make it possible to use raw disk...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #60739: make it possible to use raw disk as grubenv

Submitter:  Volodymyr Prodan <vovcat>
Submitted:  Sun 06 Jun 2021 05:37:26 PM UTC
   
 
Category:  Filesystem Severity:  Major
Priority:  5 - Normal Item Group:  Feature Request
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open Release:  Git master
Release:  Reproducibility:  Every Time
Planned Release:  None

Sun 06 Jun 2021 05:37:26 PM UTC, original submission:  

commit 80ffbb3265889af739659d365dd87f8022387104 (HEAD -> grub2-master)
Author: Volodymyr Prodan <vovcat@gmail.com>
Date:   Fri Jun 4 21:33:28 2021 +0300

    Make grub_fs_blocklist_read() to call file->read_hook().
   
    This makes it possible to use raw disk as grubenv, save_env -f (hd0)1024+2
    for example.

diff --git grub-core/kern/fs.c grub-core/kern/fs.c
index f90be6566..cf4289081 100644
--- grub-core/kern/fs.c
+++ grub-core/kern/fs.c
@@ -224,8 +224,11 @@ grub_fs_blocklist_read (grub_file_t file, char *buf, grub_size_t len)
               >> GRUB_DISK_SECTOR_BITS) > p->length - sector)
            size = ((p->length - sector) << GRUB_DISK_SECTOR_BITS) - offset;
 
-         if (grub_disk_read (file->device->disk, p->offset + sector, offset,
-                             size, buf) != GRUB_ERR_NONE)
+         file->device->disk->read_hook = file->read_hook;
+         file->device->disk->read_hook_data = file->read_hook_data;
+         grub_err_t err = grub_disk_read (file->device->disk, p->offset + sector, offset, size, buf);
+         file->device->disk->read_hook = 0;
+         if (err != GRUB_ERR_NONE)
            return -1;
 
          ret += size;

Volodymyr Prodan <vovcat>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #51523:  raw-disk-as-grubenv.patch added by vovcat (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by vovcat (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-06-06 vovcat Attached File- Added raw-disk-as-grubenv.patch, #51523

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code