}
/* Helper for grub_cmd_blocklist. */
-static void
+static grub_err_t
read_blocklist (grub_disk_addr_t sector, unsigned offset, unsigned length,
- void *data)
+ char *buf __attribute__ ((unused)), void *data)
{
struct blocklist_ctx *ctx = data;
}
if (!length)
- return;
+ return GRUB_ERR_NONE;
print_blocklist (ctx->start_sector, ctx->num_sectors, 0, 0, ctx);
ctx->num_sectors = 0;
}
}
if (!length)
- return;
+ return GRUB_ERR_NONE;
if (length & (GRUB_DISK_SECTOR_SIZE - 1))
{
ctx->start_sector = sector;
ctx->num_sectors = length >> GRUB_DISK_SECTOR_BITS;
}
+
+ return GRUB_ERR_NONE;
}
static grub_err_t
};
/* Store blocklists in a linked list. */
-static void
+static grub_err_t
save_env_read_hook (grub_disk_addr_t sector, unsigned offset, unsigned length,
- void *data)
+ char *buf __attribute__ ((unused)), void *data)
{
struct grub_cmd_save_env_ctx *ctx = data;
struct blocklist *block;
block = grub_malloc (sizeof (*block));
if (! block)
- return;
+ return GRUB_ERR_NONE;
block->sector = sector;
block->offset = offset;
ctx->tail = block;
if (! ctx->head)
ctx->head = block;
+
+ return GRUB_ERR_NONE;
}
static grub_err_t
GRUB_MOD_LICENSE ("GPLv3+");
/* Helper for grub_cmd_testload. */
-static void
+static grub_err_t
read_progress (grub_disk_addr_t sector __attribute__ ((unused)),
unsigned offset __attribute__ ((unused)),
unsigned len,
+ char *buf __attribute__ ((unused)),
void *data __attribute__ ((unused)))
{
for (; len >= GRUB_DISK_SECTOR_SIZE; len -= GRUB_DISK_SECTOR_SIZE)
if (len)
grub_xputs (".");
grub_refresh ();
+ return GRUB_ERR_NONE;
}
static grub_err_t
{
grub_memcpy (buf, node->cbuf + pos, len);
if (grub_file_progress_hook && node->file)
- grub_file_progress_hook (0, 0, len, node->file);
+ grub_file_progress_hook (0, 0, len, NULL, node->file);
return len;
}
grub_memcpy (buf, node->cbuf + (pos % HFSPLUS_COMPRESS_BLOCK_SIZE),
curlen);
if (grub_file_progress_hook && node->file)
- grub_file_progress_hook (0, 0, curlen, node->file);
+ grub_file_progress_hook (0, 0, curlen, NULL, node->file);
buf += curlen;
pos += curlen;
len -= curlen;
grub_memset (buf, 0, nn * GRUB_NTFS_COM_LEN);
buf += nn * GRUB_NTFS_COM_LEN;
if (grub_file_progress_hook && ctx->file)
- grub_file_progress_hook (0, 0, nn * GRUB_NTFS_COM_LEN,
+ grub_file_progress_hook (0, 0, nn * GRUB_NTFS_COM_LEN, NULL,
ctx->file);
}
}
if (buf)
buf += GRUB_NTFS_COM_LEN;
if (grub_file_progress_hook && ctx->file)
- grub_file_progress_hook (0, 0, GRUB_NTFS_COM_LEN,
+ grub_file_progress_hook (0, 0, GRUB_NTFS_COM_LEN, NULL,
ctx->file);
nn--;
}
if (grub_file_progress_hook && ctx->file)
grub_file_progress_hook (0, 0,
tt << (ctx->comp.log_spc
- + GRUB_NTFS_BLK_SHR),
+ + GRUB_NTFS_BLK_SHR), NULL,
ctx->file);
buf += tt << (ctx->comp.log_spc + GRUB_NTFS_BLK_SHR);
}
if (grub_file_progress_hook && ctx->file)
grub_file_progress_hook (0, 0,
nn << (ctx->comp.log_spc
- + GRUB_NTFS_BLK_SHR),
+ + GRUB_NTFS_BLK_SHR), NULL,
ctx->file);
}
ctx->target_vcn += nn;
grub_memcpy (dest, ctx->attr->sbuf + ofs - ctx->attr->save_pos, n);
if (grub_file_progress_hook && ctx->file)
- grub_file_progress_hook (0, 0, n, ctx->file);
+ grub_file_progress_hook (0, 0, n, NULL, ctx->file);
if (n == len)
return 0;
n = len;
grub_memcpy (dest, &ctx->attr->sbuf[o], n);
if (grub_file_progress_hook && ctx->file)
- grub_file_progress_hook (0, 0, n, ctx->file);
+ grub_file_progress_hook (0, 0, n, NULL, ctx->file);
if (n == len)
goto quit;
dest += n;
grub_memcpy (dest, ctx->attr->sbuf, len);
if (grub_file_progress_hook && file)
- grub_file_progress_hook (0, 0, len, file);
+ grub_file_progress_hook (0, 0, len, NULL, file);
}
quit:
if (err)
return err;
if (disk->read_hook)
- (disk->read_hook) (sector + (offset >> GRUB_DISK_SECTOR_BITS),
- offset & (GRUB_DISK_SECTOR_SIZE - 1),
- size, disk->read_hook_data);
- return GRUB_ERR_NONE;
+ err = (disk->read_hook) (sector + (offset >> GRUB_DISK_SECTOR_BITS),
+ offset & (GRUB_DISK_SECTOR_SIZE - 1),
+ size, buf, disk->read_hook_data);
+ return err;
}
/* Read data from the disk. */
if (disk->read_hook)
(disk->read_hook) (sector, 0, agglomerate << (GRUB_DISK_CACHE_BITS + GRUB_DISK_SECTOR_BITS),
- disk->read_hook_data);
+ buf, disk->read_hook_data);
sector += agglomerate << GRUB_DISK_CACHE_BITS;
size -= agglomerate << (GRUB_DISK_CACHE_BITS + GRUB_DISK_SECTOR_BITS);
{
if (disk->read_hook)
(disk->read_hook) (sector, 0, (GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS),
- disk->read_hook_data);
+ buf, disk->read_hook_data);
sector += GRUB_DISK_CACHE_SIZE;
buf = (char *) buf + (GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS);
size -= (GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS);
#define UPDATE_INTERVAL 800
-static void
+static grub_err_t
grub_file_progress_hook_real (grub_disk_addr_t sector __attribute__ ((unused)),
unsigned offset __attribute__ ((unused)),
- unsigned length, void *data)
+ unsigned length,
+ char *buf __attribute__ ((unused)), void *data)
{
static int call_depth = 0;
grub_uint64_t now;
file->progress_offset += length;
if (call_depth)
- return;
+ return GRUB_ERR_NONE;
e = grub_env_get ("enable_progress_indicator");
if (e && e[0] == '0') {
- return;
+ return GRUB_ERR_NONE;
}
call_depth = 1;
last_progress_update_time = now;
}
call_depth = 0;
+
+ return GRUB_ERR_NONE;
}
GRUB_MOD_INIT(progress)
total += amount;
file->device->net->offset += amount;
if (grub_file_progress_hook)
- grub_file_progress_hook (0, 0, amount, file);
+ grub_file_progress_hook (0, 0, amount, NULL, file);
if (buf)
{
grub_memcpy (ptr, nb->data, amount);
struct grub_partition;
-typedef void (*grub_disk_read_hook_t) (grub_disk_addr_t sector,
- unsigned offset, unsigned length,
- void *data);
+typedef grub_err_t (*grub_disk_read_hook_t) (grub_disk_addr_t sector,
+ unsigned offset, unsigned length,
+ char *buf, void *data);
/* Disk. */
struct grub_disk