Skip to content

Commit

Permalink
Merge branch 'master' into build-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkSymsCtx committed Feb 13, 2024
2 parents 498a124 + 26019a2 commit 59f2f9e
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 29 deletions.
5 changes: 3 additions & 2 deletions cbt/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ sbin_PROGRAMS = cbt-util
noinst_LTLIBRARIES = libcbtutil.la

libcbtutil_la_SOURCES = cbt-util.c
libcbtutil_la_LIBADD = -luuid

libcbtutil_la_LIBADD = -luuid

cbt_util_SOURCES = main.c
cbt_util_LDADD = -lrt libcbtutil.la
cbt_util_LDADD = libcbtutil.la

clean-local:
-rm -rf *.gc??
18 changes: 14 additions & 4 deletions control/tap-ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,21 @@ tap_cli_list(int argc, char **argv)
if (pid >= 0 && entry->pid != pid)
continue;

if (type && entry->type && strcmp(entry->type, type))
continue;
if (type) {
if (!entry->type)
continue;

if (file && entry->path && strcmp(entry->path, file))
continue;
if (strcmp(entry->type, type))
continue;
}

if (file) {
if (!entry->path)
continue;

if (strcmp(entry->path, file))
continue;
}

if (tty)
tap_cli_list_row(entry);
Expand Down
34 changes: 25 additions & 9 deletions drivers/tapdisk-vbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ char* op_strings[TD_OPS_END] ={"read", "write", "block_status"};

static void tapdisk_vbd_complete_vbd_request(td_vbd_t *, td_vbd_request_t *);
static int tapdisk_vbd_queue_ready(td_vbd_t *);
static void tapdisk_vbd_check_queue_state(td_vbd_t *);
static void tapdisk_vbd_check_complete_requests(td_vbd_t *);
static void tapdisk_vbd_check_requests_for_issue(td_vbd_t *);

static bool log=true;

Expand Down Expand Up @@ -944,12 +945,13 @@ tapdisk_vbd_pause(td_vbd_t *vbd)
if (vbd->nbdserver)
tapdisk_nbdserver_pause(vbd->nbdserver, log);

list_for_each_entry(blkif, &vbd->rings, entry)
tapdisk_xenblkif_suspend(blkif);

err = tapdisk_vbd_quiesce_queue(vbd);
if (err)
return err;

list_for_each_entry(blkif, &vbd->rings, entry)
tapdisk_xenblkif_suspend(blkif);

tapdisk_vbd_close_vdi(vbd);

Expand Down Expand Up @@ -1062,7 +1064,7 @@ tapdisk_vbd_request_timeout(td_vbd_request_t *vreq)
}

static void
tapdisk_vbd_check_queue_state(td_vbd_t *vbd)
tapdisk_vbd_check_complete_requests(td_vbd_t *vbd)
{
td_vbd_request_t *vreq, *tmp;
struct timeval now;
Expand All @@ -1071,25 +1073,36 @@ tapdisk_vbd_check_queue_state(td_vbd_t *vbd)
tapdisk_vbd_for_each_request(vreq, tmp, &vbd->failed_requests)
if (__tapdisk_vbd_request_timeout(vreq, &now))
tapdisk_vbd_complete_vbd_request(vbd, vreq);
}

static void
tapdisk_vbd_check_requests_for_issue(td_vbd_t *vbd)
{
if (!list_empty(&vbd->new_requests) ||
!list_empty(&vbd->failed_requests))
tapdisk_vbd_issue_requests(vbd);

}

void
tapdisk_vbd_check_state(td_vbd_t *vbd)
{
struct td_xenblkif *blkif;

/* Don't check if we're already quiesced */
if (td_flag_test(vbd->state, TD_VBD_QUIESCED))
return;

/*
* TODO don't ignore return value
*/
list_for_each_entry(blkif, &vbd->rings, entry)
tapdisk_xenblkif_ring_stats_update(blkif);

tapdisk_vbd_check_queue_state(vbd);
tapdisk_vbd_check_complete_requests(vbd);

if (!td_flag_test(vbd->state, TD_VBD_QUIESCE_REQUESTED) &&
!td_flag_test(vbd->state, TD_VBD_PAUSE_REQUESTED))
tapdisk_vbd_check_requests_for_issue(vbd);

if (td_flag_test(vbd->state, TD_VBD_QUIESCE_REQUESTED))
tapdisk_vbd_quiesce_queue(vbd);
Expand Down Expand Up @@ -1344,7 +1357,7 @@ tapdisk_vbd_forward_request(td_request_t treq)
if (tapdisk_vbd_queue_ready(vbd))
__tapdisk_vbd_reissue_td_request(vbd, image, treq);
else
__tapdisk_vbd_complete_td_request(vbd, vreq, treq, -EBUSY);
td_complete_request(treq, -EBUSY);
}

int
Expand Down Expand Up @@ -1672,16 +1685,19 @@ tapdisk_vbd_issue_new_requests(td_vbd_t *vbd)
int
tapdisk_vbd_recheck_state(td_vbd_t *vbd)
{
int err = 0;

if (list_empty(&vbd->new_requests))
return 0;

if (td_flag_test(vbd->state, TD_VBD_QUIESCED) ||
td_flag_test(vbd->state, TD_VBD_QUIESCE_REQUESTED))
return 0;

tapdisk_vbd_issue_new_requests(vbd);
err = tapdisk_vbd_issue_requests(vbd);

return 1;
/* If we have errors stop checking in this cycle */
return err ? 0 : 1;
}

static int
Expand Down
2 changes: 1 addition & 1 deletion mockatests/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ACLOCAL_AMFLAGS = -I m4

CFLAGS:=$(filter-out -fsanitize=leak,$(LDFLAGS))
CFLAGS:=$(filter-out -fsanitize=leak,$(CFLAGS))
LDFLAGS:=$(filter-out -static-liblsan,$(LDFLAGS))

SUBDIRS = wrappers
Expand Down
7 changes: 4 additions & 3 deletions mockatests/cbt/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CFLAGS:=$(filter-out -fsanitize=leak,$(LDFLAGS))
CFLAGS:=$(filter-out -fsanitize=leak,$(CFLAGS))
LDFLAGS:=$(filter-out -static-liblsan,$(LDFLAGS))

AM_CFLAGS = -Wall
Expand All @@ -11,9 +11,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/cbt -I../include
check_PROGRAMS = test-cbt-util
TESTS = test-cbt-util

test_cbt_util_LDADD = $(top_srcdir)/cbt/libcbtutil.la ../wrappers/libwrappers.la

test_cbt_util_SOURCES = test-cbt-util.c test-cbt-util-commands.c test-cbt-util-set.c test-cbt-util-get.c test-cbt-util-create.c test-cbt-util-coalesce.c
test_cbt_util_LDFLAGS = $(top_srcdir)/cbt/libcbtutil.la -lcmocka -luuid
test_cbt_util_LDFLAGS += ../wrappers/libwrappers.la
test_cbt_util_LDFLAGS = -lcmocka
test_cbt_util_LDFLAGS += -Wl,--wrap=fopen,--wrap=fclose
test_cbt_util_LDFLAGS += -Wl,--wrap=malloc,--wrap=free,--wrap=calloc
# Need to wrap both of these as rpmbuild/mock set -D_FORTIFY_SOURCE=2
Expand Down
8 changes: 4 additions & 4 deletions mockatests/control/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CFLAGS:=$(filter-out -fsanitize=leak,$(LDFLAGS))
CFLAGS:=$(filter-out -fsanitize=leak,$(CFLAGS))
LDFLAGS:=$(filter-out -static-liblsan,$(LDFLAGS))

AM_CFLAGS = -Wall
Expand All @@ -11,11 +11,11 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/control -I../include
check_PROGRAMS = test-control
TESTS = test-control

test_control_SOURCES = test-control.c test-tap-ctl-free.c test-tap-ctl-allocate.c test-tap-ctl-close.c test-tap-ctl-list.c control-wrappers.c util.c
test_control_LDFLAGS = $(top_srcdir)/control/libblktapctl.la -lcmocka -luuid
test_control_LDADD = $(top_srcdir)/control/libblktapctl.la ../wrappers/libwrappers.la

test_control_SOURCES = test-control.c test-tap-ctl-free.c test-tap-ctl-allocate.c test-tap-ctl-close.c test-tap-ctl-list.c control-wrappers.c util.c
test_control_LDFLAGS = -lcmocka
test_control_LDFLAGS += -static-libtool-libs
test_control_LDFLAGS += ../wrappers/libwrappers.la
# Would be good to use the cmocka malloc wraps but looks like maybe strdup doesn't call malloc
#test_control_LDFLAGS += -Wl,--wrap=malloc,--wrap=free
test_control_LDFLAGS += -Wl,--wrap=socket,--wrap=connect,--wrap=read,--wrap=select,--wrap=write,--wrap=fdopen
Expand Down
6 changes: 4 additions & 2 deletions mockatests/drivers/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CFLAGS:=$(filter-out -fsanitize=leak,$(LDFLAGS))
CFLAGS:=$(filter-out -fsanitize=leak,$(CFLAGS))
LDFLAGS:=$(filter-out -static-liblsan,$(LDFLAGS))

AM_CFLAGS = -Wall
Expand All @@ -11,8 +11,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/drivers -I../include
check_PROGRAMS = test-drivers
TESTS = test-drivers

test_drivers_LDADD = $(top_srcdir)/drivers/libtapdisk.la

test_drivers_SOURCES = test-drivers.c test-tapdisk-stats.c test-tapdisk-vbd.c vbd-wrappers.c test-tapdisk-nbdserver.c
test_drivers_LDFLAGS = $(top_srcdir)/drivers/libtapdisk.la -lcmocka -luuid
test_drivers_LDFLAGS = -lcmocka
test_drivers_LDFLAGS += -Wl,--wrap=tapdisk_image_check_request
test_drivers_LDFLAGS += -Wl,--wrap=td_queue_block_status
test_drivers_LDFLAGS += -Wl,--wrap=send
Expand Down
6 changes: 4 additions & 2 deletions mockatests/vhd/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CFLAGS:=$(filter-out -fsanitize=leak,$(LDFLAGS))
CFLAGS:=$(filter-out -fsanitize=leak,$(CFLAGS))
LDFLAGS:=$(filter-out -static-liblsan,$(LDFLAGS))

AM_CFLAGS = -Wall
Expand All @@ -12,8 +12,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/cbt -I../include
check_PROGRAMS = test-vhd-util
TESTS = test-vhd-util

test_vhd_util_LDADD = $(top_srcdir)/vhd/lib/libvhd.la

test_vhd_util_SOURCES = test-vhd-util.c test-vhd-util-snapshot.c test-canonpath.c test-vhd-util-utilities.c vhd-wrappers.c
test_vhd_util_LDFLAGS = $(top_srcdir)/vhd/lib/libvhd.la -lcmocka -luuid
test_vhd_util_LDFLAGS = -lcmocka
test_vhd_util_LDFLAGS += -static-libtool-libs
test_vhd_util_LDFLAGS += -Wl,--wrap=free,--wrap=malloc,--wrap=realloc
test_vhd_util_LDFLAGS += -Wl,--wrap=canonpath
Expand Down
2 changes: 1 addition & 1 deletion mockatests/wrappers/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CFLAGS:=$(filter-out -fsanitize=leak,$(LDFLAGS))
CFLAGS:=$(filter-out -fsanitize=leak,$(CFLAGS))
LDFLAGS:=$(filter-out -static-liblsan,$(LDFLAGS))

AM_CFLAGS = -Wall -g -Og
Expand Down
2 changes: 1 addition & 1 deletion vhd/lib/libvhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2905,7 +2905,7 @@ vhd_initialize_header_parent_name(vhd_context_t *ctx, const char *parent_path)
cd = iconv_open(UTF_16BE, "ASCII");
if (cd == (iconv_t)-1) {
err = -errno;
goto out;
return err;
}

ppath = strdup(parent_path);
Expand Down

0 comments on commit 59f2f9e

Please sign in to comment.