Lines Matching refs:blk
58 static int init_check_command(BlockBackend *blk, const cmdinfo_t *ct) in init_check_command() argument
63 if (!(ct->flags & CMD_NOFILE_OK) && !blk) { in init_check_command()
70 static int command(BlockBackend *blk, const cmdinfo_t *ct, int argc, in command() argument
75 if (!init_check_command(blk, ct)) { in command()
108 assert(blk || !ct->perm); in command()
109 if (ct->perm && blk_is_available(blk)) { in command()
111 blk_get_perm(blk, &orig_perm, &orig_shared_perm); in command()
120 ret = blk_set_perm(blk, new_perm, orig_shared_perm, &local_err); in command()
129 return ct->cfunc(blk, argc, argv); in command()
341 static void *qemu_io_alloc(BlockBackend *blk, size_t len, int pattern, in qemu_io_alloc() argument
349 buf = blk_blockalign(blk, len); in qemu_io_alloc()
352 blk_register_buf(blk, buf, len, &error_abort); in qemu_io_alloc()
360 static void qemu_io_free(BlockBackend *blk, void *p, size_t len, in qemu_io_free() argument
368 blk_unregister_buf(blk, p, len); in qemu_io_free()
388 static void *qemu_io_alloc_from_file(BlockBackend *blk, size_t len, in qemu_io_alloc_from_file() argument
401 alloc_buf = buf = blk_blockalign(blk, alloc_len); in qemu_io_alloc_from_file()
423 blk_register_buf(blk, alloc_buf, alloc_len, &error_abort); in qemu_io_alloc_from_file()
438 qemu_io_free(blk, alloc_buf, alloc_len, false); in qemu_io_alloc_from_file()
496 create_iovec(BlockBackend *blk, QEMUIOVector *qiov, char **argv, int nr_iov, in create_iovec() argument
533 buf = p = qemu_io_alloc(blk, count, pattern, register_buf); in create_iovec()
545 static int do_pread(BlockBackend *blk, char *buf, int64_t offset, in do_pread() argument
554 ret = blk_pread(blk, offset, bytes, (uint8_t *)buf, flags); in do_pread()
562 static int do_pwrite(BlockBackend *blk, char *buf, int64_t offset, in do_pwrite() argument
571 ret = blk_pwrite(blk, offset, bytes, (uint8_t *)buf, flags); in do_pwrite()
579 static int do_pwrite_zeroes(BlockBackend *blk, int64_t offset, in do_pwrite_zeroes() argument
583 int ret = blk_pwrite_zeroes(blk, offset, bytes, in do_pwrite_zeroes()
593 static int do_write_compressed(BlockBackend *blk, char *buf, int64_t offset, in do_write_compressed() argument
602 ret = blk_pwrite_compressed(blk, offset, bytes, buf); in do_write_compressed()
610 static int do_load_vmstate(BlockBackend *blk, char *buf, int64_t offset, in do_load_vmstate() argument
617 *total = blk_load_vmstate(blk, (uint8_t *)buf, offset, count); in do_load_vmstate()
624 static int do_save_vmstate(BlockBackend *blk, char *buf, int64_t offset, in do_save_vmstate() argument
631 *total = blk_save_vmstate(blk, (uint8_t *)buf, offset, count); in do_save_vmstate()
644 static int do_aio_readv(BlockBackend *blk, QEMUIOVector *qiov, in do_aio_readv() argument
649 blk_aio_preadv(blk, offset, qiov, flags, aio_rw_done, &async_ret); in do_aio_readv()
658 static int do_aio_writev(BlockBackend *blk, QEMUIOVector *qiov, in do_aio_writev() argument
663 blk_aio_pwritev(blk, offset, qiov, flags, aio_rw_done, &async_ret); in do_aio_writev()
695 static int read_f(BlockBackend *blk, int argc, char **argv);
708 static int read_f(BlockBackend *blk, int argc, char **argv) in read_f() argument
826 buf = qemu_io_alloc(blk, count, 0xab, flags & BDRV_REQ_REGISTERED_BUF); in read_f()
830 ret = do_load_vmstate(blk, buf, offset, count, &total); in read_f()
832 ret = do_pread(blk, buf, offset, count, flags, &total); in read_f()
869 qemu_io_free(blk, buf, count, flags & BDRV_REQ_REGISTERED_BUF); in read_f()
893 static int readv_f(BlockBackend *blk, int argc, char **argv);
905 static int readv_f(BlockBackend *blk, int argc, char **argv) in readv_f() argument
961 buf = create_iovec(blk, &qiov, &argv[optind], nr_iov, 0xab, in readv_f()
968 ret = do_aio_readv(blk, &qiov, offset, flags, &total); in readv_f()
1003 qemu_io_free(blk, buf, qiov.size, flags & BDRV_REQ_REGISTERED_BUF); in readv_f()
1034 static int write_f(BlockBackend *blk, int argc, char **argv);
1048 static int write_f(BlockBackend *blk, int argc, char **argv) in write_f() argument
1182 buf = qemu_io_alloc_from_file(blk, count, file_name, in write_f()
1188 buf = qemu_io_alloc(blk, count, pattern, in write_f()
1195 ret = do_save_vmstate(blk, buf, offset, count, &total); in write_f()
1197 ret = do_pwrite_zeroes(blk, offset, count, flags, &total); in write_f()
1199 ret = do_write_compressed(blk, buf, offset, count, &total); in write_f()
1201 ret = do_pwrite(blk, buf, offset, count, flags, &total); in write_f()
1223 qemu_io_free(blk, buf, count, flags & BDRV_REQ_REGISTERED_BUF); in write_f()
1248 static int writev_f(BlockBackend *blk, int argc, char **argv);
1261 static int writev_f(BlockBackend *blk, int argc, char **argv) in writev_f() argument
1314 buf = create_iovec(blk, &qiov, &argv[optind], nr_iov, pattern, in writev_f()
1321 ret = do_aio_writev(blk, &qiov, offset, flags, &total); in writev_f()
1340 qemu_io_free(blk, buf, qiov.size, flags & BDRV_REQ_REGISTERED_BUF); in writev_f()
1346 BlockBackend *blk; member
1371 block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct); in aio_write_done()
1375 block_acct_done(blk_get_stats(ctx->blk), &ctx->acct); in aio_write_done()
1387 qemu_io_free(ctx->blk, ctx->buf, ctx->qiov.size, in aio_write_done()
1403 block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct); in aio_read_done()
1418 block_acct_done(blk_get_stats(ctx->blk), &ctx->acct); in aio_read_done()
1433 qemu_io_free(ctx->blk, ctx->buf, ctx->qiov.size, in aio_read_done()
1464 static int aio_read_f(BlockBackend *blk, int argc, char **argv);
1476 static int aio_read_f(BlockBackend *blk, int argc, char **argv) in aio_read_f() argument
1481 ctx->blk = blk; in aio_read_f()
1497 block_acct_invalid(blk_get_stats(blk), BLOCK_ACCT_READ); in aio_read_f()
1532 ctx->buf = create_iovec(blk, &ctx->qiov, &argv[optind], nr_iov, 0xab, in aio_read_f()
1535 block_acct_invalid(blk_get_stats(blk), BLOCK_ACCT_READ); in aio_read_f()
1541 block_acct_start(blk_get_stats(blk), &ctx->acct, ctx->qiov.size, in aio_read_f()
1543 blk_aio_preadv(blk, ctx->offset, &ctx->qiov, ctx->flags, aio_read_done, in aio_read_f()
1576 static int aio_write_f(BlockBackend *blk, int argc, char **argv);
1589 static int aio_write_f(BlockBackend *blk, int argc, char **argv) in aio_write_f() argument
1595 ctx->blk = blk; in aio_write_f()
1622 block_acct_invalid(blk_get_stats(blk), BLOCK_ACCT_WRITE); in aio_write_f()
1683 blk_aio_pwrite_zeroes(blk, ctx->offset, count, ctx->flags, in aio_write_f()
1687 ctx->buf = create_iovec(blk, &ctx->qiov, &argv[optind], nr_iov, in aio_write_f()
1690 block_acct_invalid(blk_get_stats(blk), BLOCK_ACCT_WRITE); in aio_write_f()
1696 block_acct_start(blk_get_stats(blk), &ctx->acct, ctx->qiov.size, in aio_write_f()
1699 blk_aio_pwritev(blk, ctx->offset, &ctx->qiov, ctx->flags, in aio_write_f()
1706 static int aio_flush_f(BlockBackend *blk, int argc, char **argv) in aio_flush_f() argument
1709 block_acct_start(blk_get_stats(blk), &cookie, 0, BLOCK_ACCT_FLUSH); in aio_flush_f()
1711 block_acct_done(blk_get_stats(blk), &cookie); in aio_flush_f()
1721 static int flush_f(BlockBackend *blk, int argc, char **argv) in flush_f() argument
1723 return blk_flush(blk); in flush_f()
1738 static int zone_report_f(BlockBackend *blk, int argc, char **argv) in zone_report_f() argument
1765 ret = blk_zone_report(blk, offset, &nr_zones, zones); in zone_report_f()
1791 static int zone_open_f(BlockBackend *blk, int argc, char **argv) in zone_open_f() argument
1807 ret = blk_zone_mgmt(blk, BLK_ZO_OPEN, offset, len); in zone_open_f()
1824 static int zone_close_f(BlockBackend *blk, int argc, char **argv) in zone_close_f() argument
1840 ret = blk_zone_mgmt(blk, BLK_ZO_CLOSE, offset, len); in zone_close_f()
1857 static int zone_finish_f(BlockBackend *blk, int argc, char **argv) in zone_finish_f() argument
1873 ret = blk_zone_mgmt(blk, BLK_ZO_FINISH, offset, len); in zone_finish_f()
1890 static int zone_reset_f(BlockBackend *blk, int argc, char **argv) in zone_reset_f() argument
1906 ret = blk_zone_mgmt(blk, BLK_ZO_RESET, offset, len); in zone_reset_f()
1923 static int do_aio_zone_append(BlockBackend *blk, QEMUIOVector *qiov, in do_aio_zone_append() argument
1928 blk_aio_zone_append(blk, offset, qiov, flags, aio_rw_done, &async_ret); in do_aio_zone_append()
1937 static int zone_append_f(BlockBackend *blk, int argc, char **argv) in zone_append_f() argument
1964 buf = create_iovec(blk, &qiov, &argv[optind], nr_iov, pattern, in zone_append_f()
1969 ret = do_aio_zone_append(blk, &qiov, &offset, flags, &total); in zone_append_f()
1981 qemu_io_free(blk, buf, qiov.size, in zone_append_f()
1997 static int truncate_f(BlockBackend *blk, int argc, char **argv);
2009 static int truncate_f(BlockBackend *blk, int argc, char **argv) in truncate_f() argument
2043 ret = blk_truncate(blk, offset, false, prealloc, 0, &local_err); in truncate_f()
2052 static int length_f(BlockBackend *blk, int argc, char **argv) in length_f() argument
2057 size = blk_getlength(blk); in length_f()
2077 static int info_f(BlockBackend *blk, int argc, char **argv) in info_f() argument
2079 BlockDriverState *bs = blk_bs(blk); in info_f()
2146 static int discard_f(BlockBackend *blk, int argc, char **argv);
2160 static int discard_f(BlockBackend *blk, int argc, char **argv) in discard_f() argument
2204 ret = blk_pdiscard(blk, offset, bytes); in discard_f()
2221 static int alloc_f(BlockBackend *blk, int argc, char **argv) in alloc_f() argument
2223 BlockDriverState *bs = blk_bs(blk); in alloc_f()
2311 static int map_f(BlockBackend *blk, int argc, char **argv) in map_f() argument
2320 bytes = blk_getlength(blk); in map_f()
2327 ret = map_is_allocated(blk_bs(blk), offset, bytes, &num); in map_f()
2374 static int reopen_f(BlockBackend *blk, int argc, char **argv);
2396 static int reopen_f(BlockBackend *blk, int argc, char **argv) in reopen_f() argument
2398 BlockDriverState *bs = blk_bs(blk); in reopen_f()
2403 bool writethrough = !blk_enable_write_cache(blk); in reopen_f()
2452 if (!writethrough != blk_enable_write_cache(blk) && in reopen_f()
2453 blk_get_attached_dev(blk)) in reopen_f()
2465 blk_get_perm(blk, &orig_perm, &orig_shared_perm); in reopen_f()
2466 blk_set_perm(blk, in reopen_f()
2505 blk_set_enable_write_cache(blk, !writethrough); in reopen_f()
2509 static int break_f(BlockBackend *blk, int argc, char **argv) in break_f() argument
2513 ret = bdrv_debug_breakpoint(blk_bs(blk), argv[1], argv[2]); in break_f()
2522 static int remove_break_f(BlockBackend *blk, int argc, char **argv) in remove_break_f() argument
2526 ret = bdrv_debug_remove_breakpoint(blk_bs(blk), argv[1]); in remove_break_f()
2554 static int resume_f(BlockBackend *blk, int argc, char **argv) in resume_f() argument
2558 ret = bdrv_debug_resume(blk_bs(blk), argv[1]); in resume_f()
2576 static int wait_break_f(BlockBackend *blk, int argc, char **argv) in wait_break_f() argument
2578 while (!bdrv_debug_is_suspended(blk_bs(blk), argv[1])) { in wait_break_f()
2579 aio_poll(blk_get_aio_context(blk), true); in wait_break_f()
2593 static int abort_f(BlockBackend *blk, int argc, char **argv) in abort_f() argument
2619 static int sigraise_f(BlockBackend *blk, int argc, char **argv);
2632 static int sigraise_f(BlockBackend *blk, int argc, char **argv) in sigraise_f() argument
2661 static int sleep_f(BlockBackend *blk, int argc, char **argv) in sleep_f() argument
2722 static int help_f(BlockBackend *blk, int argc, char **argv) in help_f() argument
2756 int qemuio_command(BlockBackend *blk, const char *cmd) in qemuio_command() argument
2769 ret = command(blk, ct, c, v); in qemuio_command()