From nobody Sat Sep 26 20:01:52 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=comstyle.com ARC-Seal: i=1; a=rsa-sha256; t=1789765420; cv=none; d=zohomail.com; s=zohoarc; b=def8jKARMbvUaTs5RMYpp6gVgRzUVPnEbTy7f8KAKhkGIBpZYHDq8pWFuyhzCAN+qeu4RpDm3BCkiURHP9vQ7HMVPBBkT2m9l1mYOkZqk1ENy6O7dmC9KqcnAPoCD7mmzQZHGJIsG8dAX0k0iuig8UzG4z1w5EaZRxuXSW9unKU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789765420; h=Content-Type:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Mi1aU5FoHA6mYwLMeqvlmbu5boXEmyThfQJjKaS/eSE=; b=HuTtNVUOb7CgJupSGahMRc1BpWvfQfxYorsdYqHJ9QOn1ODfmz8/twPh/wxXat+xY3ilsBCJrsODzzbIPVjVvUjTRX2L9vo9DqUyIZ3tE/DKn6PybK9zGmF9kpaTFwV0DOJ4coeDgGnx6UuowjwLysCdOJ/egTx19sMxuA+N5fA= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789765420741146.075342926806; Fri, 18 Sep 2026 14:03:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x7fjf-0006xl-BR; Fri, 18 Sep 2026 17:03:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x7fjc-0006xK-Gx for qemu-devel@nongnu.org; Fri, 18 Sep 2026 17:03:04 -0400 Received: from speedy.comstyle.com ([2607:f938:3000:8::2] helo=mail.comstyle.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1x7fjW-000296-5P for qemu-devel@nongnu.org; Fri, 18 Sep 2026 17:03:01 -0400 Received: from mail.comstyle.com (localhost [127.0.0.1]) by mail.comstyle.com (Postfix) with ESMTP id 4hmlSm3Dcgz8PbR; Fri, 18 Sep 2026 17:02:48 -0400 (EDT) Received: from humpty.home.comstyle.com (unknown [IPv6:2001:470:b050:3:855b:b772:3733:23e1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (No client certificate requested) (Authenticated sender: brad) by mail.comstyle.com (Postfix) with ESMTPSA id 4hmlSm236kz8PbQ; Fri, 18 Sep 2026 17:02:48 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=comstyle.com; h=date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=BShrA4pzR3oXbQSU5TrSUAV7Gpc8OTMZBKlE1MjipzI=; b=bMhf u2QvWll7gjXcTy9H3TM+NgkLUB0yhdV4r7AMYZTvyAEQTvU9K4n/Blf3LOLw4xit kQNEmyh+lI6ux12JeQc7Jp02tq3umivuP88JQVZf5CobCrn11q7uVyEqUN5RbneH mogh/eGswC6VYpaRcLKWniAQINg/4vdccmOqaOI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=comstyle.com; h=date:from:to :cc:subject:message-id:mime-version:content-type; q=dns; s= default; b=olrJNQmTXop0jqpJO1+dwARbGnmyU7v4AxpnyzDOmfZkbQlB7TE3T p8nE93RImifMB7W+FwGcMup6kHDV4VcAGxMI5kh85VK0lFowpWYIde2jOmANTxnU jDeT5aVAmLnl2v/icDVNeJXA+eOlFtwTFlKOMmTi9AS74rZB4jBj3k= Date: Fri, 18 Sep 2026 17:02:47 -0400 From: Brad Smith To: Michael Roth , Kostiantyn Kostiuk , Eric Blake , Markus Armbruster Cc: qemu-devel@nongnu.org Subject: [PATCH] qga: implement 'guest-get-fsinfo' for NetBSD and OpenBSD Message-ID: MIME-Version: 1.0 Content-Disposition: inline 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f938:3000:8::2; envelope-from=brad@comstyle.com; helo=mail.comstyle.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: qemu development 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-Zoho-Virus-Status: 1 X-Zoho-AV-Stamp: zmail-av-0.2.13.1.5.4/289.755.0 X-ZohoMail-DKIM: pass (identity @comstyle.com) X-ZM-MESSAGEID: 1789765422411158500 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" qga: implement 'guest-get-fsinfo' for NetBSD and OpenBSD Signed-off-by: Brad Smith Reviewed-by: Roman Bogorodskiy --- qga/commands-bsd.c | 19 +++++++++++++------ qga/commands-common.h | 12 +++++++----- qga/commands-posix.c | 4 ++-- qga/qapi-schema.json | 12 ++++++------ 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/qga/commands-bsd.c b/qga/commands-bsd.c index 1c51d099eb..0c6caec4a3 100644 --- a/qga/commands-bsd.c +++ b/qga/commands-bsd.c @@ -28,12 +28,20 @@ #include #endif #include +#ifdef __FreeBSD__ +#include +#endif + +#ifdef __NetBSD__ +typedef struct statvfs bsd_fsinfo_t; +#else +typedef struct statfs bsd_fsinfo_t; +#endif =20 -#if defined(CONFIG_FSFREEZE) || defined(CONFIG_FSTRIM) || defined(__FreeBS= D__) bool build_fs_mount_list(FsMountList *mounts, Error **errp) { FsMount *mount; - struct statfs *mntbuf, *mntp; + bsd_fsinfo_t *mntbuf, *mntp; struct stat statbuf; int i, count, ret; =20 @@ -57,16 +65,17 @@ bool build_fs_mount_list(FsMountList *mounts, Error **e= rrp) mount->dirname =3D g_strdup(mntp->f_mntonname); mount->devtype =3D g_strdup(mntp->f_fstypename); mount->fromname =3D g_strdup(mntp->f_mntfromname); + mount->dev =3D statbuf.st_dev; mount->devmajor =3D major(mount->dev); mount->devminor =3D minor(mount->dev); +#ifdef CONFIG_FSFREEZE mount->fsid =3D mntp->f_fsid; - mount->dev =3D statbuf.st_dev; +#endif =20 QTAILQ_INSERT_TAIL(mounts, mount, next); } return true; } -#endif /* CONFIG_FSFREEZE || CONFIG_FSTRIM */ =20 #if defined(CONFIG_FSFREEZE) static int ufssuspend_fd =3D -1; @@ -181,7 +190,6 @@ bool guest_get_hw_addr(struct ifaddrs *ifa, unsigned ch= ar *buf, } #endif /* HAVE_GETIFADDRS */ =20 -#if defined(__FreeBSD__) static GuestFilesystemInfo *build_guest_fsinfo(struct FsMount *mount) { GuestFilesystemInfo *fs =3D g_new0(GuestFilesystemInfo, 1); @@ -228,4 +236,3 @@ GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **e= rrp) free_fs_mount_list(&mounts); return ret; } -#endif /* __FreeBSD__ */ diff --git a/qga/commands-common.h b/qga/commands-common.h index a07d0885f5..0d3c69b480 100644 --- a/qga/commands-common.h +++ b/qga/commands-common.h @@ -18,17 +18,19 @@ #endif /* __linux__ */ =20 #ifdef __FreeBSD__ -#include +#include #endif /* __FreeBSD__ */ =20 -#if defined(CONFIG_FSFREEZE) || defined(CONFIG_FSTRIM) +#if defined(CONFIG_FSFREEZE) || defined(CONFIG_FSTRIM) || defined(CONFIG_B= SD) typedef struct FsMount { char *dirname; char *devtype; unsigned int devmajor, devminor; -#if defined(__FreeBSD__) - dev_t dev; +#ifdef __FreeBSD__ fsid_t fsid; +#endif +#ifdef CONFIG_BSD + dev_t dev; char *fromname; #endif QTAILQ_ENTRY(FsMount) next; @@ -38,7 +40,7 @@ typedef QTAILQ_HEAD(FsMountList, FsMount) FsMountList; =20 bool build_fs_mount_list(FsMountList *mounts, Error **errp); void free_fs_mount_list(FsMountList *mounts); -#endif /* CONFIG_FSFREEZE || CONFIG_FSTRIM */ +#endif /* CONFIG_FSFREEZE || CONFIG_FSTRIM || CONFIG_BSD */ =20 #if defined(CONFIG_FSFREEZE) int64_t qmp_guest_fsfreeze_do_freeze_list(bool has_mountpoints, diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 837e285b6d..dcc683f6c9 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -718,7 +718,7 @@ void qmp_guest_file_flush(int64_t handle, Error **errp) } } =20 -#if defined(CONFIG_FSFREEZE) || defined(CONFIG_FSTRIM) +#if defined(CONFIG_FSFREEZE) || defined(CONFIG_FSTRIM) || defined(CONFIG_B= SD) void free_fs_mount_list(FsMountList *mounts) { FsMount *mount, *temp; @@ -731,7 +731,7 @@ void free_fs_mount_list(FsMountList *mounts) QTAILQ_REMOVE(mounts, mount, next); g_free(mount->dirname); g_free(mount->devtype); -#if defined(__FreeBSD__) +#ifdef CONFIG_BSD g_free(mount->fromname); #endif g_free(mount); diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index 8cd0ba048b..fb640ea1bc 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -874,7 +874,7 @@ 'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata', 'sd', 'unknown', 'ieee1394', 'ssa', 'fibre', 'raid', 'iscsi', 'sas', 'mmc', 'virtual', 'file-backed-virtual', 'nvme' ], - 'if': { 'any': [ 'CONFIG_WIN32', 'CONFIG_LINUX', 'CONFIG_FREEBSD' ] } } + 'if': { 'any': [ 'CONFIG_WIN32', 'CONFIG_LINUX', 'CONFIG_BSD' ] } } =20 ## # @GuestPCIAddress: @@ -892,7 +892,7 @@ { 'struct': 'GuestPCIAddress', 'data': {'domain': 'int', 'bus': 'int', 'slot': 'int', 'function': 'int'}, - 'if': { 'any': [ 'CONFIG_WIN32', 'CONFIG_LINUX', 'CONFIG_FREEBSD' ] } } + 'if': { 'any': [ 'CONFIG_WIN32', 'CONFIG_LINUX', 'CONFIG_BSD' ] } } =20 ## # @GuestCCWAddress: @@ -912,7 +912,7 @@ 'ssid': 'int', 'subchno': 'int', 'devno': 'int'}, - 'if': { 'any': [ 'CONFIG_WIN32', 'CONFIG_LINUX', 'CONFIG_FREEBSD' ] } } + 'if': { 'any': [ 'CONFIG_WIN32', 'CONFIG_LINUX', 'CONFIG_BSD' ] } } =20 ## # @GuestDiskAddress: @@ -942,7 +942,7 @@ 'bus': 'int', 'target': 'int', 'unit': 'int', '*serial': 'str', '*dev': 'str', '*ccw-address': 'GuestCCWAddress'}, - 'if': { 'any': [ 'CONFIG_WIN32', 'CONFIG_LINUX', 'CONFIG_FREEBSD' ] } } + 'if': { 'any': [ 'CONFIG_WIN32', 'CONFIG_LINUX', 'CONFIG_BSD' ] } } =20 ## # @GuestNVMeSmart: @@ -1063,7 +1063,7 @@ 'data': {'name': 'str', 'mountpoint': 'str', 'type': 'str', '*used-bytes': 'uint64', '*total-bytes': 'uint64', '*total-bytes-privileged': 'uint64', 'disk': ['GuestDiskAddress= ']}, - 'if': { 'any': [ 'CONFIG_WIN32', 'CONFIG_LINUX', 'CONFIG_FREEBSD' ] } } + 'if': { 'any': [ 'CONFIG_WIN32', 'CONFIG_LINUX', 'CONFIG_BSD' ] } } =20 ## # @guest-get-fsinfo: @@ -1077,7 +1077,7 @@ ## { 'command': 'guest-get-fsinfo', 'returns': ['GuestFilesystemInfo'], - 'if': { 'any': [ 'CONFIG_WIN32', 'CONFIG_LINUX', 'CONFIG_FREEBSD' ] } } + 'if': { 'any': [ 'CONFIG_WIN32', 'CONFIG_LINUX', 'CONFIG_BSD' ] } } =20 ## # @guest-set-user-password: --=20 2.55.0