Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[openSUSE] Add packaging for documentation in info format #65

Open
wants to merge 24 commits into
base: factory
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
47d1318
[openSUSE] Update version to 9.1.0
dfaggioli Sep 4, 2024
969f032
[openSUSE][RPM] configure: remove options for removed features
Jul 12, 2024
6be8350
[openSUSE][RPM] Update tests acpi path
Jul 12, 2024
0f50dd0
[openSUSE][RPM] Remove nios2
Jul 12, 2024
c8d5b1f
[openSUSE][RPM] Exclude riscv edk2 files
Jul 12, 2024
fc0f5c8
[openSUSE][RPM] configure: Fix with-pkgversion option
Jul 12, 2024
e4ea83e
[openSUSE] block: Allow the wrapper script to see functions declared …
May 26, 2023
cf5dfab
[openSUSE] block: Temporarily mark bdrv_co_get_allocated_file_size as…
May 17, 2023
ef7177f
[openSUSE] block: Take the graph lock in bdrv_snapshot_list (bsc#1211…
Mar 27, 2024
c63baa6
[openSUSE] block: Reschedule query-block during qcow2 invalidation (b…
Apr 2, 2024
c44c6bd
[openSUSE] block: Run bdrv_do_query_node_info in a coroutine (bsc#121…
Mar 27, 2024
743c05d
[openSUSE] block: Convert bdrv_query_block_graph_info to coroutine (b…
Mar 27, 2024
a757dcc
[openSUSE] block: Convert bdrv_query_image_info to coroutine (bsc#121…
Mar 27, 2024
3270c1c
[openSUSE] block: Convert bdrv_block_device_info into co_wrapper (bsc…
Jun 7, 2023
74540fb
[openSUSE] block: Don't query all block devices at hmp_nbd_server_sta…
Jun 8, 2023
5237e55
[openSUSE] block: Convert qmp_query_block and qmp_query_named_block_n…
morecache May 14, 2023
71f8744
[openSUSE] block: Add a thread-pool version of fstat (bsc#1211000)
May 18, 2023
35150dc
[openSUSE][RPM] package qemu-vmsr-helper
dfaggioli Sep 4, 2024
7ff7eb6
[openSUSE][RPM] (commented out) services for qemu-pr-helper
dfaggioli Sep 4, 2024
bf08ca4
[openSUSE][RPM] Consolidate handling of conditional features
dfaggioli Sep 5, 2024
846d33a
[openSUSE][RPM] Consolidate disabling all features during 'configure'…
dfaggioli Sep 5, 2024
d6950a3
[openSUSE][RPM] explicitly enable qemu-img support for vhdx and vpc
dfaggioli Sep 11, 2024
ea24638
build: Build and install a Texinfo version of the manual.
Apteryks Sep 17, 2020
271a3f2
Add info subpackage with documentation in Info format
Thaodan Mar 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions block.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,7 @@ static void GRAPH_WRLOCK bdrv_backing_attach(BdrvChild *c)
parent->backing_blocker);
bdrv_op_unblock(backing_hd, BLOCK_OP_TYPE_BACKUP_TARGET,
parent->backing_blocker);
bdrv_op_unblock(backing_hd, BLOCK_OP_TYPE_INFO, parent->backing_blocker);
}

static void bdrv_backing_detach(BdrvChild *c)
Expand Down Expand Up @@ -6227,18 +6228,18 @@ BlockDriverState *bdrv_find_node(const char *node_name)
}

/* Put this QMP function here so it can access the static graph_bdrv_states. */
BlockDeviceInfoList *bdrv_named_nodes_list(bool flat,
Error **errp)
BlockDeviceInfoList *coroutine_fn bdrv_co_named_nodes_list(bool flat,
Error **errp)
{
BlockDeviceInfoList *list;
BlockDriverState *bs;

GLOBAL_STATE_CODE();
GRAPH_RDLOCK_GUARD_MAINLOOP();
GRAPH_RDLOCK_GUARD();

list = NULL;
QTAILQ_FOREACH(bs, &graph_bdrv_states, node_list) {
BlockDeviceInfo *info = bdrv_block_device_info(NULL, bs, flat, errp);
BlockDeviceInfo *info = bdrv_co_block_device_info(NULL, bs, flat, errp);
if (!info) {
qapi_free_BlockDeviceInfoList(list);
return NULL;
Expand Down
40 changes: 37 additions & 3 deletions block/file-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ typedef struct RawPosixAIOData {
struct {
unsigned long op;
} zone_mgmt;
struct {
struct stat *st;
} fstat;
};
} RawPosixAIOData;

Expand Down Expand Up @@ -2624,6 +2627,34 @@ static void raw_close(BlockDriverState *bs)
}
}

static int handle_aiocb_fstat(void *opaque)
{
RawPosixAIOData *aiocb = opaque;

if (fstat(aiocb->aio_fildes, aiocb->fstat.st) < 0) {
return -errno;
}

return 0;
}

static int coroutine_fn raw_co_fstat(BlockDriverState *bs, struct stat *st)
{
BDRVRawState *s = bs->opaque;
RawPosixAIOData acb;

acb = (RawPosixAIOData) {
.bs = bs,
.aio_fildes = s->fd,
.aio_type = QEMU_AIO_FSTAT,
.fstat = {
.st = st,
},
};

return raw_thread_pool_submit(handle_aiocb_fstat, &acb);
}

/**
* Truncates the given regular file @fd to @offset and, when growing, fills the
* new space according to @prealloc.
Expand Down Expand Up @@ -2868,11 +2899,14 @@ static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs)
static int64_t coroutine_fn raw_co_get_allocated_file_size(BlockDriverState *bs)
{
struct stat st;
BDRVRawState *s = bs->opaque;
int ret;

if (fstat(s->fd, &st) < 0) {
return -errno;
ret = raw_co_fstat(bs, &st);

if (ret) {
return ret;
}

return (int64_t)st.st_blocks * 512;
}

Expand Down
1 change: 1 addition & 0 deletions block/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ block_gen_c = custom_target('block-gen.c',
'../include/block/dirty-bitmap.h',
'../include/block/block_int-io.h',
'../include/block/block-global-state.h',
'../include/block/qapi.h',
'../include/sysemu/block-backend-global-state.h',
'../include/sysemu/block-backend-io.h',
'coroutines.h'
Expand Down
1 change: 1 addition & 0 deletions block/mirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@ static void mirror_complete(Job *job, Error **errp)
error_setg(&s->replace_blocker,
"block device is in use by block-job-complete");
bdrv_op_block_all(s->to_replace, s->replace_blocker);
bdrv_op_unblock(s->to_replace, BLOCK_OP_TYPE_INFO, s->replace_blocker);
bdrv_ref(s->to_replace);
}

Expand Down
34 changes: 25 additions & 9 deletions block/monitor/block-hmp-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,12 @@ void hmp_nbd_server_start(Monitor *mon, const QDict *qdict)
bool writable = qdict_get_try_bool(qdict, "writable", false);
bool all = qdict_get_try_bool(qdict, "all", false);
Error *local_err = NULL;
BlockInfoList *block_list, *info;
BlockBackend *blk;
SocketAddress *addr;
NbdServerAddOptions export;

GRAPH_RDLOCK_GUARD_MAINLOOP();

if (writable && !all) {
error_setg(&local_err, "-w only valid together with -a");
goto exit;
Expand All @@ -416,29 +418,43 @@ void hmp_nbd_server_start(Monitor *mon, const QDict *qdict)
/* Then try adding all block devices. If one fails, close all and
* exit.
*/
block_list = qmp_query_block(NULL);
for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) {
BlockDriverState *bs = blk_bs(blk);

for (info = block_list; info; info = info->next) {
if (!info->value->inserted) {
if (!*blk_name(blk)) {
continue;
}

/*
* Note: historically we used to call qmp_query_block() to get
* the list of block devices. The two 'continue' cases below
* are the same as used by that function and are here to
* preserve behavior.
*/

if (!blk_get_attached_dev(blk)) {
continue;
}

bs = bdrv_skip_implicit_filters(bs);
if (!bs || !bs->drv) {
continue;
}

export = (NbdServerAddOptions) {
.device = info->value->device,
.device = g_strdup(blk_name(blk)),
.has_writable = true,
.writable = writable,
};

qmp_nbd_server_add(&export, &local_err);

g_free(export.device);
if (local_err != NULL) {
qmp_nbd_server_stop(NULL);
break;
}
}

qapi_free_BlockInfoList(block_list);

exit:
hmp_handle_error(mon, local_err);
}
Expand Down Expand Up @@ -723,7 +739,7 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
}
}

void hmp_info_block(Monitor *mon, const QDict *qdict)
void coroutine_fn hmp_info_block(Monitor *mon, const QDict *qdict)
{
BlockInfoList *block_list, *info;
BlockDeviceInfoList *blockdev_list, *blockdev;
Expand Down
63 changes: 32 additions & 31 deletions block/qapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
#include "qemu/qemu-print.h"
#include "sysemu/block-backend.h"

BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
BlockDriverState *bs,
bool flat,
Error **errp)
BlockDeviceInfo *coroutine_fn bdrv_co_block_device_info(BlockBackend *blk,
BlockDriverState *bs,
bool flat,
Error **errp)
{
ERRP_GUARD();
ImageInfo **p_image_info;
Expand Down Expand Up @@ -152,7 +152,7 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
* Skip automatically inserted nodes that the user isn't aware of for
* query-block (blk != NULL), but not for query-named-block-nodes
*/
bdrv_query_image_info(bs, p_image_info, flat, blk != NULL, errp);
bdrv_co_query_image_info(bs, p_image_info, flat, blk != NULL, errp);
if (*errp) {
qapi_free_BlockDeviceInfo(info);
return NULL;
Expand Down Expand Up @@ -225,16 +225,17 @@ int bdrv_query_snapshot_info_list(BlockDriverState *bs,
* Helper function for other query info functions. Store information about @bs
* in @info, setting @errp on error.
*/
static void GRAPH_RDLOCK
bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, Error **errp)
void coroutine_fn
bdrv_co_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info,
Error **errp)
{
int64_t size;
const char *backing_filename;
BlockDriverInfo bdi;
int ret;
Error *err = NULL;

size = bdrv_getlength(bs);
size = bdrv_co_getlength(bs);
if (size < 0) {
error_setg_errno(errp, -size, "Can't get image size '%s'",
bs->exact_filename);
Expand All @@ -246,13 +247,13 @@ bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, Error **errp)
info->filename = g_strdup(bs->filename);
info->format = g_strdup(bdrv_get_format_name(bs));
info->virtual_size = size;
info->actual_size = bdrv_get_allocated_file_size(bs);
info->actual_size = bdrv_co_get_allocated_file_size(bs);
info->has_actual_size = info->actual_size >= 0;
if (bs->encrypted) {
info->encrypted = true;
info->has_encrypted = true;
}
if (bdrv_get_info(bs, &bdi) >= 0) {
if (bdrv_co_get_info(bs, &bdi) >= 0) {
if (bdi.cluster_size != 0) {
info->cluster_size = bdi.cluster_size;
info->has_cluster_size = true;
Expand Down Expand Up @@ -303,7 +304,7 @@ bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, Error **errp)
}

/**
* bdrv_query_image_info:
* bdrv_co_query_image_info:
* @bs: block node to examine
* @p_info: location to store image information
* @flat: skip backing node information
Expand All @@ -324,17 +325,15 @@ bdrv_do_query_node_info(BlockDriverState *bs, BlockNodeInfo *info, Error **errp)
*
* @p_info will be set only on success. On error, store error in @errp.
*/
void bdrv_query_image_info(BlockDriverState *bs,
ImageInfo **p_info,
bool flat,
bool skip_implicit_filters,
Error **errp)
void coroutine_fn
bdrv_co_query_image_info(BlockDriverState *bs, ImageInfo **p_info, bool flat,
bool skip_implicit_filters, Error **errp)
{
ERRP_GUARD();
ImageInfo *info;

info = g_new0(ImageInfo, 1);
bdrv_do_query_node_info(bs, qapi_ImageInfo_base(info), errp);
bdrv_co_do_query_node_info(bs, qapi_ImageInfo_base(info), errp);
if (*errp) {
goto fail;
}
Expand All @@ -352,8 +351,8 @@ void bdrv_query_image_info(BlockDriverState *bs,
}

if (backing) {
bdrv_query_image_info(backing, &info->backing_image, false,
skip_implicit_filters, errp);
bdrv_co_query_image_info(backing, &info->backing_image, false,
skip_implicit_filters, errp);
if (*errp) {
goto fail;
}
Expand All @@ -369,7 +368,7 @@ void bdrv_query_image_info(BlockDriverState *bs,
}

/**
* bdrv_query_block_graph_info:
* bdrv_co_query_block_graph_info:
* @bs: root node to start from
* @p_info: location to store image information
* @errp: location to store error information
Expand All @@ -378,17 +377,19 @@ void bdrv_query_image_info(BlockDriverState *bs,
*
* @p_info will be set only on success. On error, store error in @errp.
*/
void bdrv_query_block_graph_info(BlockDriverState *bs,
BlockGraphInfo **p_info,
Error **errp)
void coroutine_fn
bdrv_co_query_block_graph_info(BlockDriverState *bs, BlockGraphInfo **p_info,
Error **errp)
{
ERRP_GUARD();
BlockGraphInfo *info;
BlockChildInfoList **children_list_tail;
BdrvChild *c;

assert_bdrv_graph_readable();

info = g_new0(BlockGraphInfo, 1);
bdrv_do_query_node_info(bs, qapi_BlockGraphInfo_base(info), errp);
bdrv_co_do_query_node_info(bs, qapi_BlockGraphInfo_base(info), errp);
if (*errp) {
goto fail;
}
Expand All @@ -402,7 +403,7 @@ void bdrv_query_block_graph_info(BlockDriverState *bs,
QAPI_LIST_APPEND(children_list_tail, c_info);

c_info->name = g_strdup(c->name);
bdrv_query_block_graph_info(c->bs, &c_info->info, errp);
bdrv_co_query_block_graph_info(c->bs, &c_info->info, errp);
if (*errp) {
goto fail;
}
Expand All @@ -417,8 +418,8 @@ void bdrv_query_block_graph_info(BlockDriverState *bs,
}

/* @p_info will be set only on success. */
static void GRAPH_RDLOCK
bdrv_query_info(BlockBackend *blk, BlockInfo **p_info, Error **errp)
static void GRAPH_RDLOCK coroutine_fn
bdrv_co_query_info(BlockBackend *blk, BlockInfo **p_info, Error **errp)
{
BlockInfo *info = g_malloc0(sizeof(*info));
BlockDriverState *bs = blk_bs(blk);
Expand Down Expand Up @@ -450,7 +451,7 @@ bdrv_query_info(BlockBackend *blk, BlockInfo **p_info, Error **errp)
}

if (bs && bs->drv) {
info->inserted = bdrv_block_device_info(blk, bs, false, errp);
info->inserted = bdrv_co_block_device_info(blk, bs, false, errp);
if (info->inserted == NULL) {
goto err;
}
Expand Down Expand Up @@ -660,13 +661,13 @@ bdrv_query_bds_stats(BlockDriverState *bs, bool blk_level)
return s;
}

BlockInfoList *qmp_query_block(Error **errp)
BlockInfoList *coroutine_fn qmp_query_block(Error **errp)
{
BlockInfoList *head = NULL, **p_next = &head;
BlockBackend *blk;
Error *local_err = NULL;

GRAPH_RDLOCK_GUARD_MAINLOOP();
GRAPH_RDLOCK_GUARD();

for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) {
BlockInfoList *info;
Expand All @@ -676,7 +677,7 @@ BlockInfoList *qmp_query_block(Error **errp)
}

info = g_malloc0(sizeof(*info));
bdrv_query_info(blk, &info->value, &local_err);
bdrv_co_query_info(blk, &info->value, &local_err);
if (local_err) {
error_propagate(errp, local_err);
g_free(info);
Expand Down
Loading