Remove nested functions from disk and file read hooks.
* include/grub/disk.h (grub_disk_read_hook_t): New type. (struct grub_disk): Add read_hook_data member. * include/grub/file.h (struct grub_file): Likewise. * include/grub/fshelp.h (grub_fshelp_read_file): Add read_hook_data argument. Update all callers.
This commit is contained in:
parent
df6da5a52d
commit
4eb8b75659
29 changed files with 409 additions and 345 deletions
|
@ -19,6 +19,8 @@
|
|||
#ifndef GRUB_DISK_HEADER
|
||||
#define GRUB_DISK_HEADER 1
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
|
@ -99,6 +101,10 @@ extern grub_disk_dev_t EXPORT_VAR (grub_disk_dev_list);
|
|||
|
||||
struct grub_partition;
|
||||
|
||||
typedef void (*grub_disk_read_hook_t) (grub_disk_addr_t sector,
|
||||
unsigned offset, unsigned length,
|
||||
void *data);
|
||||
|
||||
/* Disk. */
|
||||
struct grub_disk
|
||||
{
|
||||
|
@ -122,8 +128,10 @@ struct grub_disk
|
|||
|
||||
/* Called when a sector was read. OFFSET is between 0 and
|
||||
the sector size minus 1, and LENGTH is between 0 and the sector size. */
|
||||
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
|
||||
unsigned offset, unsigned length);
|
||||
grub_disk_read_hook_t read_hook;
|
||||
|
||||
/* Caller-specific data passed to the read hook. */
|
||||
void *read_hook_data;
|
||||
|
||||
/* Device-specific data. */
|
||||
void *data;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/fs.h>
|
||||
#include <grub/disk.h>
|
||||
|
||||
/* File description. */
|
||||
struct grub_file
|
||||
|
@ -46,8 +47,10 @@ struct grub_file
|
|||
void *data;
|
||||
|
||||
/* This is called when a sector is read. Used only for a disk device. */
|
||||
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
|
||||
unsigned offset, unsigned length);
|
||||
grub_disk_read_hook_t read_hook;
|
||||
|
||||
/* Caller-specific data passed to the read hook. */
|
||||
void *read_hook_data;
|
||||
};
|
||||
typedef struct grub_file *grub_file_t;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/disk.h>
|
||||
|
||||
typedef struct grub_fshelp_node *grub_fshelp_node_t;
|
||||
|
||||
|
@ -68,9 +69,8 @@ EXPORT_FUNC(grub_fshelp_find_file) (const char *path,
|
|||
blocks have a size of LOG2BLOCKSIZE (in log2). */
|
||||
grub_ssize_t
|
||||
EXPORT_FUNC(grub_fshelp_read_file) (grub_disk_t disk, grub_fshelp_node_t node,
|
||||
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
|
||||
unsigned offset,
|
||||
unsigned length),
|
||||
grub_disk_read_hook_t read_hook,
|
||||
void *read_hook_data,
|
||||
grub_off_t pos, grub_size_t len, char *buf,
|
||||
grub_disk_addr_t (*get_block) (grub_fshelp_node_t node,
|
||||
grub_disk_addr_t block),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue