From nobody Sat Feb 7 03:51:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1671199007; cv=none; d=zohomail.com; s=zohoarc; b=EHZdtcuWWkTls3kNlbIfJbSe1HIZCBGORA5lKovLAtJgvg9fZ8gFzyaiqKOrAAhum22cn2NbcAhyBBL+EQGp4YHmQyQIgaxx/J+TSVkl1/c4K6UXOoBQ/ndpjKoI2xMcqABuQ4mOByYFiZErfnLKU+CjbOPA3bsQg1ZfaDNSAKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671199007; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aeU+V+762DrW/G51sF+7UgvhP2eL8Vqyi36GFbtZGBw=; b=mGtKWkDNIHKEH2wxPiElnUETjuhrZRFTW0xjyI3Fk7L8hYZkjwMRXpn2iNoDXEJDpBUQ2XTTikitYYhX8JJl0+j3mBHaZL/VJ7exI4SppTOFY2D2AxIN3AFhbTJhbHWWRahdu0RFj6YYJg30OODTvr1uJzt6BFaVSTSZBRjCVlY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671199007811156.70218336793812; Fri, 16 Dec 2022 05:56:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6BAq-0008D5-JI; Fri, 16 Dec 2022 08:54:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAo-0008C4-Lt for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAn-0007lG-1s for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:50 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-318-PFM8c4gYMEOMugelkjYTmw-1; Fri, 16 Dec 2022 08:54:44 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 97D4A857F42; Fri, 16 Dec 2022 13:54:44 +0000 (UTC) Received: from kostyanf14nb.lan (ovpn-193-42.brq.redhat.com [10.40.193.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 43CAC40C2005; Fri, 16 Dec 2022 13:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671198888; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aeU+V+762DrW/G51sF+7UgvhP2eL8Vqyi36GFbtZGBw=; b=fx0pTRw8Nc9ipzInTU5RsRDYCvPJTvlSZs/FPKrMrvrpYs1WGhyTywKewiUNYVGQKyxYee Xcn93q3NKEtVC7guFh3pzMP32/vLKFuMawHi132JNpqv/xCc661BYSlo3ayDlTF6fzp0VQ a6scAO+ga/lqqOFlRHxXEK3hJ3a2kUc= X-MC-Unique: PFM8c4gYMEOMugelkjYTmw-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 1/8] qga: Move FS TRIM code to commands-linux.c Date: Fri, 16 Dec 2022 15:54:32 +0200 Message-Id: <20221216135439.465033-2-kkostiuk@redhat.com> In-Reply-To: <20221216135439.465033-1-kkostiuk@redhat.com> References: <20221216135439.465033-1-kkostiuk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kkostiuk@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1671199008934100003 Content-Type: text/plain; charset="utf-8" From: Alexander Ivanov In the next patch ZFS TRIM support for FreeBSD will be added. Move Linux-specific TRIM code to commands-linux.c file. Signed-off-by: Alexander Ivanov Reviewed-by: Konstantin Kostiuk Signed-off-by: Konstantin Kostiuk --- qga/commands-linux.c | 73 ++++++++++++++++++++++++++++++++++++++++++++ qga/commands-posix.c | 72 ------------------------------------------- 2 files changed, 73 insertions(+), 72 deletions(-) diff --git a/qga/commands-linux.c b/qga/commands-linux.c index 214e408fcd..fb01114153 100644 --- a/qga/commands-linux.c +++ b/qga/commands-linux.c @@ -13,6 +13,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qga-qapi-commands.h" #include "commands-common.h" #include "cutils.h" #include @@ -284,3 +285,75 @@ int qmp_guest_fsfreeze_do_thaw(Error **errp) return i; } #endif /* CONFIG_FSFREEZE */ + +#if defined(CONFIG_FSTRIM) +/* + * Walk list of mounted file systems in the guest, and trim them. + */ +GuestFilesystemTrimResponse * +qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp) +{ + GuestFilesystemTrimResponse *response; + GuestFilesystemTrimResult *result; + int ret =3D 0; + FsMountList mounts; + struct FsMount *mount; + int fd; + struct fstrim_range r; + + slog("guest-fstrim called"); + + QTAILQ_INIT(&mounts); + if (!build_fs_mount_list(&mounts, errp)) { + return NULL; + } + + response =3D g_malloc0(sizeof(*response)); + + QTAILQ_FOREACH(mount, &mounts, next) { + result =3D g_malloc0(sizeof(*result)); + result->path =3D g_strdup(mount->dirname); + + QAPI_LIST_PREPEND(response->paths, result); + + fd =3D qga_open_cloexec(mount->dirname, O_RDONLY, 0); + if (fd =3D=3D -1) { + result->error =3D g_strdup_printf("failed to open: %s", + strerror(errno)); + result->has_error =3D true; + continue; + } + + /* We try to cull filesystems we know won't work in advance, but o= ther + * filesystems may not implement fstrim for less obvious reasons. + * These will report EOPNOTSUPP; while in some other cases ENOTTY + * will be reported (e.g. CD-ROMs). + * Any other error means an unexpected error. + */ + r.start =3D 0; + r.len =3D -1; + r.minlen =3D has_minimum ? minimum : 0; + ret =3D ioctl(fd, FITRIM, &r); + if (ret =3D=3D -1) { + result->has_error =3D true; + if (errno =3D=3D ENOTTY || errno =3D=3D EOPNOTSUPP) { + result->error =3D g_strdup("trim not supported"); + } else { + result->error =3D g_strdup_printf("failed to trim: %s", + strerror(errno)); + } + close(fd); + continue; + } + + result->has_minimum =3D true; + result->minimum =3D r.minlen; + result->has_trimmed =3D true; + result->trimmed =3D r.len; + close(fd); + } + + free_fs_mount_list(&mounts); + return response; +} +#endif /* CONFIG_FSTRIM */ diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 32493d6383..b2a6d8b227 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -1607,78 +1607,6 @@ GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error = **errp) } #endif /* CONFIG_FSFREEZE */ =20 -#if defined(CONFIG_FSTRIM) -/* - * Walk list of mounted file systems in the guest, and trim them. - */ -GuestFilesystemTrimResponse * -qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp) -{ - GuestFilesystemTrimResponse *response; - GuestFilesystemTrimResult *result; - int ret =3D 0; - FsMountList mounts; - struct FsMount *mount; - int fd; - struct fstrim_range r; - - slog("guest-fstrim called"); - - QTAILQ_INIT(&mounts); - if (!build_fs_mount_list(&mounts, errp)) { - return NULL; - } - - response =3D g_malloc0(sizeof(*response)); - - QTAILQ_FOREACH(mount, &mounts, next) { - result =3D g_malloc0(sizeof(*result)); - result->path =3D g_strdup(mount->dirname); - - QAPI_LIST_PREPEND(response->paths, result); - - fd =3D qga_open_cloexec(mount->dirname, O_RDONLY, 0); - if (fd =3D=3D -1) { - result->error =3D g_strdup_printf("failed to open: %s", - strerror(errno)); - result->has_error =3D true; - continue; - } - - /* We try to cull filesystems we know won't work in advance, but o= ther - * filesystems may not implement fstrim for less obvious reasons. - * These will report EOPNOTSUPP; while in some other cases ENOTTY - * will be reported (e.g. CD-ROMs). - * Any other error means an unexpected error. - */ - r.start =3D 0; - r.len =3D -1; - r.minlen =3D has_minimum ? minimum : 0; - ret =3D ioctl(fd, FITRIM, &r); - if (ret =3D=3D -1) { - result->has_error =3D true; - if (errno =3D=3D ENOTTY || errno =3D=3D EOPNOTSUPP) { - result->error =3D g_strdup("trim not supported"); - } else { - result->error =3D g_strdup_printf("failed to trim: %s", - strerror(errno)); - } - close(fd); - continue; - } - - result->has_minimum =3D true; - result->minimum =3D r.minlen; - result->has_trimmed =3D true; - result->trimmed =3D r.len; - close(fd); - } - - free_fs_mount_list(&mounts); - return response; -} -#endif /* CONFIG_FSTRIM */ - =20 #define LINUX_SYS_STATE_FILE "/sys/power/state" #define SUSPEND_SUPPORTED 0 --=20 2.25.1 From nobody Sat Feb 7 03:51:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1671199127; cv=none; d=zohomail.com; s=zohoarc; b=VXuzX0L9/S4h6AAn0AKO3+ScfEvjp5bv1RLCxO0LKPr5be2kuRV0ELLhW6Z0IhbHQX498t6nMa+7fhQi5ee1gEZecW760RakiWlel9Y0D5MSuWxFD7nDr0bQCFtHqZqGmWZv9pOBaUMaVMBPgaPsDjOiuNoeZw4W93/k6kvxYwQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671199127; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=amyO5A6TAVza9yGkm738fnrgpxj9PU3x4Ey/E0znrcc=; b=KnAeotWESQRY9+Zo+71+tdoDyrzDDdAGU0Nxs27GVf4q15goDaoE365e5GZBGBDzK85bd3XY8cPnDdSwfd2m2YAoQIiGOR5Z2whd0PetlKzjnUqI0/XYbQVSSLoN16y/tMeIJ2cAhD4H3gFIyQINGsjQVtUnApOhofWJjssM/DA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671199127564969.0378964919294; Fri, 16 Dec 2022 05:58:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6BAr-0008DV-P6; Fri, 16 Dec 2022 08:54:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAp-0008Cr-VQ for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAo-0007lT-7c for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:51 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-583-Jr6egCfdPvG8vbYR2gAqQw-1; Fri, 16 Dec 2022 08:54:46 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F249A802C1C; Fri, 16 Dec 2022 13:54:45 +0000 (UTC) Received: from kostyanf14nb.lan (ovpn-193-42.brq.redhat.com [10.40.193.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0177440C2064; Fri, 16 Dec 2022 13:54:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671198889; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=amyO5A6TAVza9yGkm738fnrgpxj9PU3x4Ey/E0znrcc=; b=YMM6p2z/NSPEzbb14KitlFV/mSAct9uCSVMmK82rx8fP3q75yHuWtdP/+GAgnmOZFaLAHh 7+/8MHGzJRV1h3YNx98WncUniwXTYJtF3m3UwDjyT3BoM4kV/aLYeWkK/QPVu+Ki7u1QmI FYaKNZxMwekxC2GPhd+TxrKn+MTCa/g= X-MC-Unique: Jr6egCfdPvG8vbYR2gAqQw-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 2/8] qga: Add ZFS TRIM support for FreeBSD Date: Fri, 16 Dec 2022 15:54:33 +0200 Message-Id: <20221216135439.465033-3-kkostiuk@redhat.com> In-Reply-To: <20221216135439.465033-1-kkostiuk@redhat.com> References: <20221216135439.465033-1-kkostiuk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kkostiuk@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1671199129474100005 Content-Type: text/plain; charset="utf-8" From: Alexander Ivanov Use zpool tool for ZFS pools trimming in FreeBSD. Signed-off-by: Alexander Ivanov Reviewed-by: Konstantin Kostiuk Signed-off-by: Konstantin Kostiuk --- qga/commands-bsd.c | 109 ++++++++++++++++++++++++++++++++++++++++++ qga/commands-common.h | 1 + 2 files changed, 110 insertions(+) diff --git a/qga/commands-bsd.c b/qga/commands-bsd.c index 15cade2d4c..960c4209e5 100644 --- a/qga/commands-bsd.c +++ b/qga/commands-bsd.c @@ -170,6 +170,115 @@ GuestCpuStatsList *qmp_guest_get_cpustats(Error **err= p) } #endif /* CONFIG_FSFREEZE */ =20 +#if defined(CONFIG_FSTRIM) +typedef struct FsPool { + char *name; + QTAILQ_ENTRY(FsPool) next; +} FsPool; + +typedef QTAILQ_HEAD(FsPoolList, FsPool) FsPoolList; + +static void build_fs_pool_list(FsPoolList *pools, Error **errp) +{ + FILE *fp; + char *line =3D NULL, *p; + size_t linecap =3D 0; + ssize_t linelen; + FsPool *pool; + + fp =3D popen("/sbin/zpool list -H", "r"); + if (fp =3D=3D NULL) { + error_setg_errno(errp, errno, "failed to run zpool"); + return; + } + + while ((linelen =3D getline(&line, &linecap, fp)) > 0) { + p =3D strchr(line, '\t'); + if (!p) { + continue; + } + + *p =3D '\0'; + + pool =3D g_new0(FsPool, 1); + pool->name =3D g_strdup(line); + QTAILQ_INSERT_TAIL(pools, pool, next); + } + + free(line); + pclose(fp); +} + +static void free_fs_pool_list(FsPoolList *pools) +{ + FsPool *pool, *temp; + + if (!pools) { + return; + } + + QTAILQ_FOREACH_SAFE(pool, pools, next, temp) { + QTAILQ_REMOVE(pools, pool, next); + g_free(pool->name); + g_free(pool); + } +} + +/* + * Walk the list of ZFS pools in the guest, and trim them. + */ +GuestFilesystemTrimResponse * +qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp) +{ + GuestFilesystemTrimResponse *response; + GuestFilesystemTrimResultList *list; + GuestFilesystemTrimResult *result; + int ret; + FsPoolList pools; + FsPool *pool; + char cmd[256]; + Error *local_err =3D NULL; + + slog("guest-fstrim called"); + + QTAILQ_INIT(&pools); + build_fs_pool_list(&pools, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return NULL; + } + + response =3D g_malloc0(sizeof(*response)); + + QTAILQ_FOREACH(pool, &pools, next) { + result =3D g_malloc0(sizeof(*result)); + result->path =3D g_strdup(pool->name); + + list =3D g_malloc0(sizeof(*list)); + list->value =3D result; + list->next =3D response->paths; + response->paths =3D list; + + snprintf(cmd, sizeof(cmd), "/sbin/zpool trim %s", pool->name); + ret =3D system(cmd); + if (ret !=3D 0) { + result->error =3D g_strdup_printf("failed to trim %s: %s", + pool->name, strerror(errno)); + result->has_error =3D true; + continue; + } + + result->has_minimum =3D true; + result->minimum =3D 0; + result->has_trimmed =3D true; + result->trimmed =3D 0; + } + + free_fs_pool_list(&pools); + return response; +} +#endif /* CONFIG_FSTRIM */ + #ifdef HAVE_GETIFADDRS /* * Fill "buf" with MAC address by ifaddrs. Pointer buf must point to a diff --git a/qga/commands-common.h b/qga/commands-common.h index 8c1c56aac9..922f9c479b 100644 --- a/qga/commands-common.h +++ b/qga/commands-common.h @@ -28,6 +28,7 @@ #ifdef UFSSUSPEND #define CONFIG_FSFREEZE #endif +#define CONFIG_FSTRIM #endif /* __FreeBSD__ */ =20 #if defined(CONFIG_FSFREEZE) || defined(CONFIG_FSTRIM) --=20 2.25.1 From nobody Sat Feb 7 03:51:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1671199127; cv=none; d=zohomail.com; s=zohoarc; b=Di7SUh6pa3Mrdp8CeFU7PA+ICtX+uaS72QE3iCTQPnjX3tTDpIROCemyPGQ2pyWy/DsvSsRpEQo1XsKcFY58vErLCPoq3HTWxPf2CNnaBxebJ8xTC8UjL4vt5UGLLrh0FihGFB3AqQNoELYfSQBV0HOxsITnxdLQNgV1AYq3JQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671199127; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=elk0Ql+J8g5yi+F0Q9RPVdDLypDI/fkOrSPZqoURnqg=; b=hLT/pOsVDKucSxG1v2gSnMevdyQxJgfVxAZ04itTRi+Z6lE0+rlUOhHSwpHOIwRwlPNjAS5nzDrCF1c2BMPbRupRdfV0onmV7uLst+rFsb8GvHXuiiuL1hMC3Q7U9rE867KueIA8B8xo+Vein5DcsPRpEvBUFaYsUhyYhe6Vc6w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671199127564503.49983297678807; Fri, 16 Dec 2022 05:58:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6BAs-0008Dm-An; Fri, 16 Dec 2022 08:54:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAr-0008DJ-09 for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAp-0007ll-GE for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:52 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-486-1ONJkBurPHWI4vUb-ivSBA-1; Fri, 16 Dec 2022 08:54:47 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 63ED5857F57; Fri, 16 Dec 2022 13:54:47 +0000 (UTC) Received: from kostyanf14nb.lan (ovpn-193-42.brq.redhat.com [10.40.193.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 581D340C2005; Fri, 16 Dec 2022 13:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671198891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=elk0Ql+J8g5yi+F0Q9RPVdDLypDI/fkOrSPZqoURnqg=; b=B43CVYtj6mJCBhoSP7xsg7RrLzZO00A0mQ//Aun0+FcX+mA1+ngz2Vn4d65DIO8BxaIvJl FWG2KcLzcSN4nph7kkbQ2ozHn5pStQdXfyusIWJq1UIfeJ7f+HyDpa8EE29XeQS8gmdDzc 7eP8FHc1UbBl5QvccR5IXPwYX9PVnMM= X-MC-Unique: 1ONJkBurPHWI4vUb-ivSBA-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 3/8] qga: Add initial OpenBSD and NetBSD support Date: Fri, 16 Dec 2022 15:54:34 +0200 Message-Id: <20221216135439.465033-4-kkostiuk@redhat.com> In-Reply-To: <20221216135439.465033-1-kkostiuk@redhat.com> References: <20221216135439.465033-1-kkostiuk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kkostiuk@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1671199129550100007 From: Brad Smith qga: Add initial OpenBSD and NetBSD support Signed-off-by: Brad Smith Reviewed-by: Konstantin Kostiuk Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Konstantin Kostiuk --- meson.build | 2 +- qga/commands-bsd.c | 5 +++++ qga/commands-posix.c | 9 +++++++-- qga/main.c | 6 +++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 5c6b5a1c75..4c6f8a674a 100644 --- a/meson.build +++ b/meson.build @@ -75,7 +75,7 @@ have_tools =3D get_option('tools') \ .allowed() have_ga =3D get_option('guest_agent') \ .disable_auto_if(not have_system and not have_tools) \ - .require(targetos in ['sunos', 'linux', 'windows', 'freebsd'], + .require(targetos in ['sunos', 'linux', 'windows', 'freebsd', 'netbsd', = 'openbsd'], error_message: 'unsupported OS for QEMU guest agent') \ .allowed() have_block =3D have_system or have_tools diff --git a/qga/commands-bsd.c b/qga/commands-bsd.c index 960c4209e5..0f1f0ca8aa 100644 --- a/qga/commands-bsd.c +++ b/qga/commands-bsd.c @@ -21,7 +21,12 @@ #include #include #include +#if defined(__NetBSD__) || defined(__OpenBSD__) +#include +#include +#else #include +#endif #include =20 #if defined(CONFIG_FSFREEZE) || defined(CONFIG_FSTRIM) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index b2a6d8b227..3ae4a93974 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -45,7 +45,12 @@ #include #include #include +#if defined(__NetBSD__) || defined(__OpenBSD__) +#include +#include +#else #include +#endif #include #ifdef CONFIG_SOLARIS #include @@ -2809,7 +2814,7 @@ static int guest_get_network_stats(const char *name, return -1; } =20 -#ifndef __FreeBSD__ +#ifndef CONFIG_BSD /* * Fill "buf" with MAC address by ifaddrs. Pointer buf must point to a * buffer with ETHER_ADDR_LEN length at least. @@ -2858,7 +2863,7 @@ bool guest_get_hw_addr(struct ifaddrs *ifa, unsigned = char *buf, close(sock); return true; } -#endif /* __FreeBSD__ */ +#endif /* CONFIG_BSD */ =20 /* * Build information about guest interfaces diff --git a/qga/main.c b/qga/main.c index b3580508fa..0865c992f0 100644 --- a/qga/main.c +++ b/qga/main.c @@ -40,11 +40,11 @@ #include "commands-common.h" =20 #ifndef _WIN32 -#ifdef __FreeBSD__ +#ifdef CONFIG_BSD #define QGA_VIRTIO_PATH_DEFAULT "/dev/vtcon/org.qemu.guest_agent.0" -#else /* __FreeBSD__ */ +#else /* CONFIG_BSD */ #define QGA_VIRTIO_PATH_DEFAULT "/dev/virtio-ports/org.qemu.guest_agent.0" -#endif /* __FreeBSD__ */ +#endif /* CONFIG_BSD */ #define QGA_SERIAL_PATH_DEFAULT "/dev/ttyS0" #define QGA_STATE_RELATIVE_DIR "run" #else --=20 2.25.1 From nobody Sat Feb 7 03:51:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1671198910; cv=none; d=zohomail.com; s=zohoarc; b=Q6i53Hn+ILBW0NlVYE61vBWDHL2PNjRB8laAkKvfsNpn8oVJl3Rs7Z3aW/20X8lHuTIcnSm8Txo16+J9XydOgomTW1j5ckRigYo7xDGQHfNQbHEjUksn58RKaH0kUnyscneXyddWXge3w6Q8GNMc/rAbAaxTONCR1nay3WJgqg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671198910; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=e27iy0TzT10hX3O83O80Ti/WPpogThz2gOpDlSQ7h9k=; b=gYL6mWflHhD/kzbdyRYRF7iYIS0oBCZM3W6krm66ys6Efelg6lTmS4GyW4BKPgqUqv8NYpYtEJQ8aPl/SeVLM/vj7iUespiYG+Sx4FJNhHVCUZP+GgAhuhKBTY6Cl0zn8Sw1ixTq/fbOrMkt4YGu92sNItYqGuIJ/Okgc8hcV9U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671198910492873.7413849911388; Fri, 16 Dec 2022 05:55:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6BAu-0008Ea-Gu; Fri, 16 Dec 2022 08:54:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAs-0008Dn-J8 for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAr-0007ly-5b for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:54 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-619-c6XqWlhzNmmYFC1Um-eTEQ-1; Fri, 16 Dec 2022 08:54:49 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CD38C101A52E; Fri, 16 Dec 2022 13:54:48 +0000 (UTC) Received: from kostyanf14nb.lan (ovpn-193-42.brq.redhat.com [10.40.193.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C2A8E40C2005; Fri, 16 Dec 2022 13:54:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671198892; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e27iy0TzT10hX3O83O80Ti/WPpogThz2gOpDlSQ7h9k=; b=ZyF588GxCqGvIkADR23yV4SAU3Z2luOdfSG+RScIZYnq/ONKw+0inQFdXhyAL/Jc1214zH uA/H3KxG2rS41mnE1MxAkqZese+2gI3kI44GmvyFXMs+Km9tT76ADgkJPux6ManZbaPD9W V4ohfwdVAexBjaTTFSLVEOa2WE6Occ8= X-MC-Unique: c6XqWlhzNmmYFC1Um-eTEQ-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 4/8] qga:/qga-win: adding a empty PCI address creation function Date: Fri, 16 Dec 2022 15:54:35 +0200 Message-Id: <20221216135439.465033-5-kkostiuk@redhat.com> In-Reply-To: <20221216135439.465033-1-kkostiuk@redhat.com> References: <20221216135439.465033-1-kkostiuk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kkostiuk@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1671198914463100001 From: Kfir Manor Refactoring code to avoid duplication of creating an empty PCI address code. Signed-off-by: Kfir Manor Reviewed-by: Konstantin Kostiuk Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Konstantin Kostiuk --- qga/commands-win32.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index ec9f55b453..a645480496 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -599,6 +599,18 @@ static void get_pci_address_for_device(GuestPCIAddress= *pci, } } =20 +static GuestPCIAddress *get_empty_pci_address(void) +{ + GuestPCIAddress *pci =3D NULL; + + pci =3D g_malloc0(sizeof(*pci)); + pci->domain =3D -1; + pci->slot =3D -1; + pci->function =3D -1; + pci->bus =3D -1; + return pci; +} + static GuestPCIAddress *get_pci_info(int number, Error **errp) { HDEVINFO dev_info =3D INVALID_HANDLE_VALUE; @@ -608,13 +620,7 @@ static GuestPCIAddress *get_pci_info(int number, Error= **errp) SP_DEVICE_INTERFACE_DATA dev_iface_data; HANDLE dev_file; int i; - GuestPCIAddress *pci =3D NULL; - - pci =3D g_malloc0(sizeof(*pci)); - pci->domain =3D -1; - pci->slot =3D -1; - pci->function =3D -1; - pci->bus =3D -1; + GuestPCIAddress *pci =3D get_empty_pci_address(); =20 dev_info =3D SetupDiGetClassDevs(&GUID_DEVINTERFACE_DISK, 0, 0, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); --=20 2.25.1 From nobody Sat Feb 7 03:51:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1671199009; cv=none; d=zohomail.com; s=zohoarc; b=j7ZHmreVoMQMWo1EvsBtgOvQmCTW06ogZuiG84f+8vh6uVJWWIGjmscgFf7q4xksUPJQKic2zcaYWn4hhbsoPaZui4da5gDwMTy66vrDKHzRXgnGDRksjdcP+Tu5UYaceLD/jV1/llje5bhjoPiMbQK9VfN87/+qjGP1uAT2qlw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671199009; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bPr1W9N+5+ER/HqpjJNLj1OYIGur0z3kodbAYoBZ9Bs=; b=DxTLthAd9lHQpAbvP2L/TYFgqPthjsO+9G/pfJdeOCfguUG9uiA/zq7KPSEZX4LPJ1wzv4uh8k136FNXe19+twQASeAOpx082j3gONzvmXSPDwgfE78d2m6gS/6sWOzhnK1E2mq68KMH63UDMCfm6XJvSInte6y4yKBKY01HTtk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671199009652351.5728980510397; Fri, 16 Dec 2022 05:56:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6BAv-0008F1-85; Fri, 16 Dec 2022 08:54:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAt-0008EI-Nb for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAs-0007mG-5k for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:55 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-45cBiKQvOQuAjnDWwG7V4Q-1; Fri, 16 Dec 2022 08:54:50 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4387E1C08992; Fri, 16 Dec 2022 13:54:50 +0000 (UTC) Received: from kostyanf14nb.lan (ovpn-193-42.brq.redhat.com [10.40.193.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 355C740C2064; Fri, 16 Dec 2022 13:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671198893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bPr1W9N+5+ER/HqpjJNLj1OYIGur0z3kodbAYoBZ9Bs=; b=GBxN70smSb+IZ+MULVpAMK5wTzqk6TM2Pa8L68isik92tvodsWGD/0+hqmoY+IDjggAnkg VzKMEWw4Mt+HkpfGl+NaAJkNIZuPc6Dqy5oqONwMOp455C21sAkawnBSM5DLE/czyLAEmQ oe47H62Yu4mR5ThCgxDcYR06zHuAo+I= X-MC-Unique: 45cBiKQvOQuAjnDWwG7V4Q-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 5/8] qga:/qga-win: skip getting pci info for USB disks Date: Fri, 16 Dec 2022 15:54:36 +0200 Message-Id: <20221216135439.465033-6-kkostiuk@redhat.com> In-Reply-To: <20221216135439.465033-1-kkostiuk@redhat.com> References: <20221216135439.465033-1-kkostiuk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kkostiuk@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1671199010899100005 From: Kfir Manor Skip getting PCI info from disks type USB and give them an empty PCI addres= s instead. Signed-off-by: Kfir Manor Reviewed-by: Konstantin Kostiuk Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Konstantin Kostiuk --- qga/commands-win32.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index a645480496..14c43b3de5 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -878,10 +878,14 @@ static void get_single_disk_info(int disk_number, * if that doesn't hold since that suggests some other unexpected * breakage */ - disk->pci_controller =3D get_pci_info(disk_number, &local_err); - if (local_err) { - error_propagate(errp, local_err); - goto err_close; + if (disk->bus_type =3D=3D GUEST_DISK_BUS_TYPE_USB) { + disk->pci_controller =3D get_empty_pci_address(); + } else { + disk->pci_controller =3D get_pci_info(disk_number, &local_err); + if (local_err) { + error_propagate(errp, local_err); + goto err_close; + } } if (disk->bus_type =3D=3D GUEST_DISK_BUS_TYPE_SCSI || disk->bus_type =3D=3D GUEST_DISK_BUS_TYPE_IDE --=20 2.25.1 From nobody Sat Feb 7 03:51:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1671199049; cv=none; d=zohomail.com; s=zohoarc; b=aL04Eb9iWojmnlUeLRYfe+TMJjDCsYNX+3fWr9iWZ8JE5lH5PbfOvP9RpNudMWi8BVph4PNdRNqcAFVneAML0G04lZ9p0N19f9+Gf9ThBsV3g2r2B0utVRqnR8RVdQqP/UDJKu+hKX2GxlfGF0q1Jy6DER1cZkxxU5n6TyeSyo8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671199049; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vdkUecZ3fnFBz2ce6lTzIducoVVwFlj7f/bkGwutaWQ=; b=iLdQMcjn5vg4QN1QxwkhzdaA/ki9QzPJeGOyv242ANsrMZ/Yki3fBUiNkSDa8LqOpbO0nLAz5dJT0CxXlhCYQGg2CovcQgrhvL4gINzf4BmDbGJxANiQj570BfERARWNjN7qYuBGOfTQw0IQH+OsJmCNu4P9YeXnZmOVi8L89Mk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671199049309700.4800751161125; Fri, 16 Dec 2022 05:57:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6BB0-0008LU-G4; Fri, 16 Dec 2022 08:55:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAv-0008FR-Rl for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAu-0007me-8E for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:57 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-613-j5XbqbytN-qJoQahaSmkuA-1; Fri, 16 Dec 2022 08:54:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8504A1C08980; Fri, 16 Dec 2022 13:54:51 +0000 (UTC) Received: from kostyanf14nb.lan (ovpn-193-42.brq.redhat.com [10.40.193.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A259E40C2064; Fri, 16 Dec 2022 13:54:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671198895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vdkUecZ3fnFBz2ce6lTzIducoVVwFlj7f/bkGwutaWQ=; b=HF09qMPLEarO0U7A3JcTU6Au/h/x69GSW7m1kqoc6+K6ozvmYfdlrZUPjo/ctixkp3dJD6 XRGhkULyf9TFFUnav0liNWsQYyTZGWJmupdZiG3V25sCuzRrSqOUt6ZRMx9aN+k8ml/NuE IdCFS7C2h8RFTTU++MQBfpJByGh51G0= X-MC-Unique: j5XbqbytN-qJoQahaSmkuA-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 6/8] qga-win: choose the right libpcre version to include in MSI package Date: Fri, 16 Dec 2022 15:54:37 +0200 Message-Id: <20221216135439.465033-7-kkostiuk@redhat.com> In-Reply-To: <20221216135439.465033-1-kkostiuk@redhat.com> References: <20221216135439.465033-1-kkostiuk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kkostiuk@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1671199051386100003 Content-Type: text/plain; charset="utf-8" From: Andrey Drobyshev via According to GLib changelog [1], since version 2.73.2 GLib is using libpcre2 instead of libpcre. As a result, qemu-ga MSI installation fails due to missing DLL when linked with the newer GLib. This commit makes wixl to put the right libpcre version into the MSI bundle: either libpcre-1.dll or libpcre2-8-0.dll, depending on the present version of GLib. [1] https://gitlab.gnome.org/GNOME/glib/-/releases#2.73.2 Previous version: https://lists.nongnu.org/archive/html/qemu-trivial/2022-11/msg00237.html Signed-off-by: Andrey Drobyshev Reviewed-by: Konstantin Kostiuk Tested-by: Konstantin Kostiuk Signed-off-by: Konstantin Kostiuk --- qga/installer/qemu-ga.wxs | 12 +++++++++--- qga/meson.build | 6 ++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs index 813d1c6ca6..447effdfe1 100644 --- a/qga/installer/qemu-ga.wxs +++ b/qga/installer/qemu-ga.wxs @@ -101,9 +101,15 @@ - - - + + + + + + + + + diff --git a/qga/meson.build b/qga/meson.build index 3cfb9166e5..d3b0f8bbd0 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -123,6 +123,11 @@ if targetos =3D=3D 'windows' qemu_ga_msi_vss =3D ['-D', 'InstallVss'] deps +=3D qga_vss endif + if glib.version() < '2.73.2' + libpcre =3D 'libpcre1' + else + libpcre =3D 'libpcre2' + endif qga_msi =3D custom_target('QGA MSI', input: files('installer/qemu-ga.wxs'), output: 'qemu-ga-@0@.msi'.format(host_arch), @@ -136,6 +141,7 @@ if targetos =3D=3D 'windows' '-D', 'QEMU_GA_VERSION=3D' + config_host['QE= MU_GA_VERSION'], '-D', 'QEMU_GA_MANUFACTURER=3D' + config_hos= t['QEMU_GA_MANUFACTURER'], '-D', 'QEMU_GA_DISTRO=3D' + config_host['QEM= U_GA_DISTRO'], + '-D', 'LIBPCRE=3D' + libpcre, ]) all_qga +=3D [qga_msi] alias_target('msi', qga_msi) --=20 2.25.1 From nobody Sat Feb 7 03:51:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1671199079; cv=none; d=zohomail.com; s=zohoarc; b=nusmrQzBF+dIFjcP6wyPxN1vC/b2z/VJIKqJidW0XJ0HnhAK1GDd7YcyWVgXUi2gBC+noDzkKTRjXJ2eQSXYUK8R/jxuKnMZSJW5OFQS81LleMMM716ZPej4/WK0W+1JKvef3ptdJkzLIRva8cLR2PlLGIXHGjtEdopxOY1ih7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671199079; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=I32EHhD5mYmcyXDJxUrKlzrMts/s6L00VLuANUyfKzM=; b=U8TcDA06eJkFnm7r34tQwNzOeXRkXUWc98W6RoKW7F8YJ1qh+fnr664tMxe/f9uiOKplMtGo7czU8DaHycbG4vp6WaPUgdpAqReiYUj1TUPGKNs44Tj5kVpnanBypdxVKJkujo899DOH4ajv7fWBwZJy7fM8+x97+JkmDd2iSas= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671199079022379.72888391265406; Fri, 16 Dec 2022 05:57:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6BB8-0008MY-EC; Fri, 16 Dec 2022 08:55:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAv-0008FA-Gv for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAt-0007mX-FN for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:57 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-163-o_aJ2kZ_MoGMTNIxza7lTQ-1; Fri, 16 Dec 2022 08:54:53 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E6BB71C0897D; Fri, 16 Dec 2022 13:54:52 +0000 (UTC) Received: from kostyanf14nb.lan (ovpn-193-42.brq.redhat.com [10.40.193.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9D9C40C2064; Fri, 16 Dec 2022 13:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671198894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I32EHhD5mYmcyXDJxUrKlzrMts/s6L00VLuANUyfKzM=; b=HO416846TX4+YltBkJ/JdmihkOWA+8NSwB29jJLSQrMi613vlaP1fqojTOVhm8EjEzCuZu luuGXVc3bYsGFQ9ChCMzTcoFyTA9DHKyzNCr8sd/EdqB2+a4iyh+DAEJ3OtZp8zazS8sgE kAusApxkn6xRCIAqvmAW4tQdpDVP8Uc= X-MC-Unique: o_aJ2kZ_MoGMTNIxza7lTQ-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 7/8] qga-win: add logging to Windows event log Date: Fri, 16 Dec 2022 15:54:38 +0200 Message-Id: <20221216135439.465033-8-kkostiuk@redhat.com> In-Reply-To: <20221216135439.465033-1-kkostiuk@redhat.com> References: <20221216135439.465033-1-kkostiuk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kkostiuk@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1671199079588100001 From: Andrey Drobyshev via This commit allows QGA to write to Windows event log using Win32 API's ReportEvent() [1], much like syslog() under *nix guests. In order to generate log message definitions we use a very basic message text file [2], so that every QGA's message gets ID 1. The tools "windmc" and "windres" respectively are used to generate ".rc" file and COFF object file, and then the COFF file is linked into qemu-ga.exe. [1] https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-= reporteventa [2] https://learn.microsoft.com/en-us/windows/win32/eventlog/message-text-f= iles Originally-by: Yuri Pudgorodskiy Signed-off-by: Andrey Drobyshev Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Konstantin Kostiuk Tested-by: Konstantin Kostiuk Signed-off-by: Konstantin Kostiuk --- configure | 3 +++ qga/installer/qemu-ga.wxs | 5 +++++ qga/main.c | 16 +++++++++++++--- qga/meson.build | 19 ++++++++++++++++++- qga/messages-win32.mc | 9 +++++++++ 5 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 qga/messages-win32.mc diff --git a/configure b/configure index 26c7bc5154..789a4f6cc9 100755 --- a/configure +++ b/configure @@ -372,6 +372,7 @@ smbd=3D"$SMBD" strip=3D"${STRIP-${cross_prefix}strip}" widl=3D"${WIDL-${cross_prefix}widl}" windres=3D"${WINDRES-${cross_prefix}windres}" +windmc=3D"${WINDMC-${cross_prefix}windmc}" pkg_config_exe=3D"${PKG_CONFIG-${cross_prefix}pkg-config}" query_pkg_config() { "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@" @@ -2561,6 +2562,7 @@ if test "$skip_meson" =3D no; then echo "strip =3D [$(meson_quote $strip)]" >> $cross echo "widl =3D [$(meson_quote $widl)]" >> $cross echo "windres =3D [$(meson_quote $windres)]" >> $cross + echo "windmc =3D [$(meson_quote $windmc)]" >> $cross if test "$cross_compile" =3D "yes"; then cross_arg=3D"--cross-file config-meson.cross" echo "[host_machine]" >> $cross @@ -2667,6 +2669,7 @@ preserve_env SMBD preserve_env STRIP preserve_env WIDL preserve_env WINDRES +preserve_env WINDMC =20 printf "exec" >>config.status for i in "$0" "$@"; do diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs index 447effdfe1..51340f7ecc 100644 --- a/qga/installer/qemu-ga.wxs +++ b/qga/installer/qemu-ga.wxs @@ -116,6 +116,11 @@ + + + + diff --git a/qga/main.c b/qga/main.c index 0865c992f0..1463a1c170 100644 --- a/qga/main.c +++ b/qga/main.c @@ -83,6 +83,7 @@ struct GAState { #ifdef _WIN32 GAService service; HANDLE wakeup_event; + HANDLE event_log; #endif bool delimit_response; bool frozen; @@ -324,13 +325,14 @@ static void ga_log(const gchar *domain, GLogLevelFlag= s level, } =20 level &=3D G_LOG_LEVEL_MASK; -#ifndef _WIN32 if (g_strcmp0(domain, "syslog") =3D=3D 0) { +#ifndef _WIN32 syslog(LOG_INFO, "%s: %s", level_str, msg); - } else if (level & s->log_level) { #else - if (level & s->log_level) { + ReportEvent(s->event_log, EVENTLOG_INFORMATION_TYPE, + 0, 1, NULL, 1, 0, &msg, NULL); #endif + } else if (level & s->log_level) { g_autoptr(GDateTime) now =3D g_date_time_new_now_utc(); g_autofree char *nowstr =3D g_date_time_format(now, "%s.%f"); fprintf(s->log_file, "%s: %s: %s\n", nowstr, level_str, msg); @@ -1286,6 +1288,13 @@ static GAState *initialize_agent(GAConfig *config, i= nt socket_activation) g_debug("Guest agent version %s started", QEMU_FULL_VERSION); =20 #ifdef _WIN32 + s->event_log =3D RegisterEventSource(NULL, "qemu-ga"); + if (!s->event_log) { + g_autofree gchar *errmsg =3D g_win32_error_message(GetLastError()); + g_critical("unable to register event source: %s", errmsg); + return NULL; + } + /* On win32 the state directory is application specific (be it the def= ault * or a user override). We got past the command line parsing; let's cr= eate * the directory (with any intermediate directories). If we run into an @@ -1377,6 +1386,7 @@ static void cleanup_agent(GAState *s) { #ifdef _WIN32 CloseHandle(s->wakeup_event); + CloseHandle(s->event_log); #endif if (s->command_state) { ga_command_state_cleanup_all(s->command_state); diff --git a/qga/meson.build b/qga/meson.build index d3b0f8bbd0..ad17dc7dca 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -98,7 +98,24 @@ if targetos =3D=3D 'windows' endif endif =20 -qga =3D executable('qemu-ga', qga_ss.sources(), +qga_objs =3D [] +if targetos =3D=3D 'windows' + windmc =3D find_program('windmc', required: true) + windres =3D find_program('windres', required: true) + + msgrc =3D custom_target('messages-win32.rc', + input: 'messages-win32.mc', + output: ['messages-win32.rc', 'MSG00409.bin', 'mes= sages-win32.h'], + command: [windmc, '-h', '@OUTDIR@', '-r', '@OUTDIR= @', '@INPUT@']) + msgobj =3D custom_target('messages-win32.o', + input: msgrc[0], + output: 'messages-win32.o', + command: [windres, '-I', '@OUTDIR@', '-o', '@OUTP= UT@', '@INPUT@']) + + qga_objs =3D [msgobj] +endif + +qga =3D executable('qemu-ga', qga_ss.sources() + qga_objs, link_args: qga_libs, dependencies: [qemuutil, libudev], install: true) diff --git a/qga/messages-win32.mc b/qga/messages-win32.mc new file mode 100644 index 0000000000..e21019cebe --- /dev/null +++ b/qga/messages-win32.mc @@ -0,0 +1,9 @@ +LanguageNames=3D( + English=3D0x409:MSG00409 +) + +MessageId=3D1 +SymbolicName=3DQEMU_GA_EVENTLOG_GENERAL +Language=3DEnglish +%1 +. --=20 2.25.1 From nobody Sat Feb 7 03:51:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1671199051; cv=none; d=zohomail.com; s=zohoarc; b=KxIo2vpzAZJeHyCue20X5qYDKzYAVqlx7yTgz7F8u4649+D7a7/gZZDuQPsn3PoRS/nHAeStfwvod+kn7lWJWGzwmSCesOiAO05gC9dhgG5G22NeOa1SrBLXz0eRXxKqP97LllNne1WRD5+vrSQnEpbroBjagv57pLRbQJhck2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671199051; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=H+jI9Ae1kOlyAm872IZ+HvpAvtNVj7WGf3+Zm313HZ4=; b=KtJ5EPeZXF3Ll8ip6yl6w4TOQBaKs6VaHSEjD18lh4jEquafxJgxobMHbKn87LMofHvUMdhbA3ObQ/EH6JdV1aZ7lbI7RIvgsv8z9zjjrJvcuF5IIbAqanmrDBkLujZVuuJaTpsr1Kdu5WwjYGDg1BPQntjsg5F4WQjCdWu6gLE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1671199051812981.4397418267115; Fri, 16 Dec 2022 05:57:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6BAy-0008Fq-HU; Fri, 16 Dec 2022 08:55:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAv-0008FW-Vl for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6BAu-0007mp-E9 for qemu-devel@nongnu.org; Fri, 16 Dec 2022 08:54:57 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-665-KcL7oxqdMeuMEwbqCgQGsw-1; Fri, 16 Dec 2022 08:54:54 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5AADC3814941; Fri, 16 Dec 2022 13:54:54 +0000 (UTC) Received: from kostyanf14nb.lan (ovpn-193-42.brq.redhat.com [10.40.193.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F6C840C2064; Fri, 16 Dec 2022 13:54:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671198895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H+jI9Ae1kOlyAm872IZ+HvpAvtNVj7WGf3+Zm313HZ4=; b=CnpvCA/stUesGMRLi/HFgQ/dK8HWDP7VJFLuGGoZdJK+pWAOZX7dsiBXudNViTyNTuWmtn zW9YaKl7WPJkNeHFfJXE11ihRG4cCKl0Ja5NFEjIqQPs3n4uOGz/HLXXO6Ce41xKcmv3Wg BTsxbyKwO9vDIEittVNQY+8NAD6I3Fc= X-MC-Unique: KcL7oxqdMeuMEwbqCgQGsw-1 From: Konstantin Kostiuk To: qemu-devel@nongnu.org, Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 8/8] qga: map GLib log levels to system levels Date: Fri, 16 Dec 2022 15:54:39 +0200 Message-Id: <20221216135439.465033-9-kkostiuk@redhat.com> In-Reply-To: <20221216135439.465033-1-kkostiuk@redhat.com> References: <20221216135439.465033-1-kkostiuk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kkostiuk@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1671199053432100007 From: Andrey Drobyshev via This patch translates GLib-specific log levels to system ones, so that they may be used by both *nix syslog() (as a "priority" argument) and Windows ReportEvent() (as a "wType" argument). Currently the only codepath to write to "syslog" domain is slog() function. However, this patch allows the interface to be extended. Note that since slog() is using G_LOG_LEVEL_INFO level, its behaviour doesn't change. Originally-by: Yuri Pudgorodskiy Signed-off-by: Andrey Drobyshev Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Konstantin Kostiuk Tested-by: Konstantin Kostiuk Signed-off-by: Konstantin Kostiuk --- qga/main.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/qga/main.c b/qga/main.c index 1463a1c170..85b7d6ced5 100644 --- a/qga/main.c +++ b/qga/main.c @@ -314,6 +314,38 @@ void ga_enable_logging(GAState *s) s->logging_enabled =3D true; } =20 +static int glib_log_level_to_system(int level) +{ + switch (level) { +#ifndef _WIN32 + case G_LOG_LEVEL_ERROR: + return LOG_ERR; + case G_LOG_LEVEL_CRITICAL: + return LOG_CRIT; + case G_LOG_LEVEL_WARNING: + return LOG_WARNING; + case G_LOG_LEVEL_MESSAGE: + return LOG_NOTICE; + case G_LOG_LEVEL_DEBUG: + return LOG_DEBUG; + case G_LOG_LEVEL_INFO: + default: + return LOG_INFO; +#else + case G_LOG_LEVEL_ERROR: + case G_LOG_LEVEL_CRITICAL: + return EVENTLOG_ERROR_TYPE; + case G_LOG_LEVEL_WARNING: + return EVENTLOG_WARNING_TYPE; + case G_LOG_LEVEL_MESSAGE: + case G_LOG_LEVEL_INFO: + case G_LOG_LEVEL_DEBUG: + default: + return EVENTLOG_INFORMATION_TYPE; +#endif + } +} + static void ga_log(const gchar *domain, GLogLevelFlags level, const gchar *msg, gpointer opaque) { @@ -327,9 +359,9 @@ static void ga_log(const gchar *domain, GLogLevelFlags = level, level &=3D G_LOG_LEVEL_MASK; if (g_strcmp0(domain, "syslog") =3D=3D 0) { #ifndef _WIN32 - syslog(LOG_INFO, "%s: %s", level_str, msg); + syslog(glib_log_level_to_system(level), "%s: %s", level_str, msg); #else - ReportEvent(s->event_log, EVENTLOG_INFORMATION_TYPE, + ReportEvent(s->event_log, glib_log_level_to_system(level), 0, 1, NULL, 1, 0, &msg, NULL); #endif } else if (level & s->log_level) { --=20 2.25.1