From patchwork Thu Nov 10 06:23:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13038309 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44742C4332F for ; Thu, 10 Nov 2022 06:25:47 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot10F-0001cy-2m; Thu, 10 Nov 2022 01:25:31 -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 1ot10E-0001b9-45 for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:30 -0500 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot10C-0008BK-Fe for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:29 -0500 Received: by mail-pf1-x42d.google.com with SMTP id 130so1010513pfu.8 for ; Wed, 09 Nov 2022 22:25:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S71uA1qqGC/6TbeUsoWwC8+Ke/IgKE6MHXg9S63X/NM=; b=SvdcrHY2llLs4WZ3DvA/ncziaTqbJB351OtwHnPQwOYmURQ8NlIRyreRtXb/DesUKz PdCHpes9TJ23o6WK6f/3o7tpq3e6NK1B9FM5nrdRbDhGOf+VvkFH5ZRAtH0HL5I8amaz OWuN8NeilWMFejjIupDvX4e6kyHQj9vS2Kjdu7u7VMC7PbOF7UbMUn7Y0aOeul9+oRcg HcjzOHQoOJJe5S6Ld0XRHyP2V4qeP6hfj04Q6ub0Zv+ge5R5uEl9DCP8bwgbji+dH+0h DZ+CqHbtgVrxDZDCwLKzimc6BUCC62u9+4r9wUuifusx8LO1kvdNzeMfBL50A7pUHhj1 i99Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S71uA1qqGC/6TbeUsoWwC8+Ke/IgKE6MHXg9S63X/NM=; b=EgwORPiO9NNrb/jBdaORG1xM9Ps4jea6ebEnKYoHg4ju0hpM8Ax6+i4c5eCJ/3f+W0 vSoc72aAH6mQHRDTHNw3SyvFT52Q6DUiwvxRW5o8FD50xM/e4twiEZRYLUqR2gI/YScK DM2/GB11i40viGe3VB/4d4V7ClM96YL6qsSAkSajP7N/7KM9baA5frzHH+6cHjfOtfal 4vhv539PYXsxke5F6FkHhdkxlfxpb3TF2qhd0uVhJnScwR60ZlwhhTECtbonW/Xj51dr WemodSPUpv+oRGnz4sfnEkaroVjw9/R74rK1FH98sVSKcsEsWgSFoOsxLf+8UzHhyoUA pzGg== X-Gm-Message-State: ACrzQf27kLyJewgz6oCbwr8qOjETJQ3GUFiIDu6fLxBLMjAt40YiLXpG tW7OrsASVrNIvANbxc7kO/0XDGrOT0I/CVPF X-Google-Smtp-Source: AMsMyM6JikEmRZQunYdpsOQwSF3vlcb2gC6ojlu0XzZCSxGcUG9fvpeiWNS66sanZjs3z05wwSomJA== X-Received: by 2002:a62:1544:0:b0:56d:6af0:c131 with SMTP id 65-20020a621544000000b0056d6af0c131mr54779410pfv.51.1668061525873; Wed, 09 Nov 2022 22:25:25 -0800 (PST) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id m4-20020a17090ade0400b002108cabbe31sm2289003pjv.9.2022.11.09.22.25.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 22:25:07 -0800 (PST) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, virtio-fs@redhat.com, Yuval Shaia , Marcel Apfelbaum , Konstantin Kostiuk , Michael Roth , Paolo Bonzini , Fam Zheng , "Dr. David Alan Gilbert" , Stefan Hajnoczi , Gerd Hoffmann , Stefan Weil , Yan Vugenfirer , Akihiko Odaki Subject: [PATCH 01/10] qga: Remove platform GUID definitions Date: Thu, 10 Nov 2022 15:23:20 +0900 Message-Id: <20221110062329.13363-2-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110062329.13363-1-akihiko.odaki@daynix.com> References: <20221110062329.13363-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42d; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org GUID_DEVINTERFACE_DISK and GUID_DEVINTERFACE_STORAGEPORT are already defined by MinGW-w64. They are not only unnecessary, but can lead to duplicate definition errors at link time with some unknown condition. Signed-off-by: Akihiko Odaki --- qga/commands-win32.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index ec9f55b453..dde5d401bb 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -506,13 +506,6 @@ static GuestDiskBusType find_bus_type(STORAGE_BUS_TYPE bus) return win2qemu[(int)bus]; } -DEFINE_GUID(GUID_DEVINTERFACE_DISK, - 0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, - 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b); -DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT, - 0x2accfe60L, 0xc130, 0x11d2, 0xb0, 0x82, - 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b); - static void get_pci_address_for_device(GuestPCIAddress *pci, HDEVINFO dev_info) { From patchwork Thu Nov 10 06:23:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13038316 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B5DD7C433FE for ; Thu, 10 Nov 2022 06:28:21 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot10J-0001mG-9E; Thu, 10 Nov 2022 01:25:35 -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 1ot10H-0001hQ-89 for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:33 -0500 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot10F-0008Su-Ep for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:32 -0500 Received: by mail-pf1-x433.google.com with SMTP id b185so1007130pfb.9 for ; Wed, 09 Nov 2022 22:25:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h/PRPd3/ZtVJ1S8SSoZJFlAuYT2tdPLmqj6DRdoumUU=; b=SeaUHngGpBgVsGY+WrbKqwVKXG5rMm+XvrWSHmA+qcypVnYRmSfpy83tkAnfiCjZzJ TmSIdf8hJFjCDDPXPB3GNbVzT37Q9DT3M7GhT2SoHKxGWnthFWDOz8F00UWNtYxXHfzc eY7tRxdGk2faz47BgiqLAJ/Ng22Vhz8KvBCOyPHX9Rs5ubGnyNoNbj7WvB+02U7ETIGz 8JUZBvMzQkhJTxL1omv3GTvRsGVHTvQ2vadmNfe1Liq0wCIBy9RFAzaW65ZCbYKdeBfO o9isn89+Xhl1JEykNrTYbK1AkeY8jjXYIUOP4i/YUlC0dITvDg3/0tAGkDwODo4tFvxh keGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h/PRPd3/ZtVJ1S8SSoZJFlAuYT2tdPLmqj6DRdoumUU=; b=Vif/LYxgwYCjzKuVQKcCMZDxhIakX7XJNE50cZRjmmOSFOSFSCrGkfemEsy7vnxcIG 5hXnvxyA5CUaqcY7bIPkH9XhcAWp6G+K3URhiVStCHZVcId2sUrpXtz8TuLF3mLmgpQU JP+oHVO/6442xNZAToxqoPHN3E5zHKoCEXpYcXaPULtiW8icjvrZ3A4PRIzDd7Zz3rFb lEgy4GlulMPSdjUqtgVW3YzvPxOwpu4I26iDhIyXeAPAYoI3HHmDRc6Pk1zlVVFiQoXS 3HPOPPWjodv0scGGlTkOSpg1j6EkaiKN2EKLEb+myXUVlHM7EH4rBOdqvw3RzW/1PLwB i0JQ== X-Gm-Message-State: ACrzQf0zyy2QIediCdjDKZKb1ND6TAWBzdRaaO2+uuLYzyK9ACjJ+0Rs FIeDksucqBBOT0cJ/0w0By4sclWg4UIve5fp X-Google-Smtp-Source: AMsMyM57SnoB1kJozV6hw/qslJWfYPCEbq2P9b2+eBrVtwqpgf4V073hvfeeDUWeKgBtkSOIisefQg== X-Received: by 2002:a63:cd42:0:b0:46f:9f49:9468 with SMTP id a2-20020a63cd42000000b0046f9f499468mr49681821pgj.361.1668061529665; Wed, 09 Nov 2022 22:25:29 -0800 (PST) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id m4-20020a17090ade0400b002108cabbe31sm2289003pjv.9.2022.11.09.22.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 22:25:29 -0800 (PST) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, virtio-fs@redhat.com, Yuval Shaia , Marcel Apfelbaum , Konstantin Kostiuk , Michael Roth , Paolo Bonzini , Fam Zheng , "Dr. David Alan Gilbert" , Stefan Hajnoczi , Gerd Hoffmann , Stefan Weil , Yan Vugenfirer , Akihiko Odaki Subject: [PATCH 02/10] util: Introduce qemu_get_runtime_dir() Date: Thu, 10 Nov 2022 15:23:21 +0900 Message-Id: <20221110062329.13363-3-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110062329.13363-1-akihiko.odaki@daynix.com> References: <20221110062329.13363-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::433; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x433.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org qemu_get_runtime_dir() returns a dynamically allocated directory path that is appropriate for storing runtime files. It corresponds to "run" directory in Unix. With a tree-wide search, it was found that there are several cases where such a functionality is implemented so let's have one as a common utlity function. A notable feature of qemu_get_runtime_dir() is that it uses $XDG_RUNTIME_DIR if available. While the function is often called by executables which requires root privileges, it is still possible that they are called from a user without privilege to write the system runtime directory. In fact, I decided to write this patch when I ran virtiofsd in a Linux namespace created by a normal user and realized it tries to write the system runtime directory, not writable in this case. $XDG_RUNTIME_DIR should provide a writable directory in such cases. This function does not use qemu_get_local_state_dir() or its logic for Windows. Actually the implementation of qemu_get_local_state_dir() for Windows seems not right as it calls g_get_system_data_dirs(), which refers to $XDG_DATA_DIRS. In Unix terminology, it is basically "/usr/share", not "/var", which qemu_get_local_state_dir() is intended to provide. Instead, this function try to use the following in order: - $XDG_RUNTIME_DIR - LocalAppData folder - get_relocated_path(CONFIG_QEMU_LOCALSTATEDIR "/run") This function does not use g_get_user_runtime_dir() either as it falls back to g_get_user_cache_dir() when $XDG_DATA_DIRS is not available. In the case, we rather use: get_relocated_path(CONFIG_QEMU_LOCALSTATEDIR "/run") Signed-off-by: Akihiko Odaki --- include/qemu/osdep.h | 12 ++++++++++++ util/oslib-posix.c | 11 +++++++++++ util/oslib-win32.c | 26 ++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index b9c4307779..86445aad25 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -565,6 +565,18 @@ void qemu_set_cloexec(int fd); */ char *qemu_get_local_state_dir(void); +/** + * qemu_get_runtime_dir: + * + * Return a dynamically allocated directory path that is appropriate for storing + * runtime files. It corresponds to "run" directory in Unix, and uses + * $XDG_RUNTIME_DIR if available. + * + * The caller is responsible for releasing the value returned with g_free() + * after use. + */ +char *qemu_get_runtime_dir(void); + /** * qemu_getauxval: * @type: the auxiliary vector key to lookup diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 59a891b6a8..9a0b3913ff 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -279,6 +279,17 @@ qemu_get_local_state_dir(void) return get_relocated_path(CONFIG_QEMU_LOCALSTATEDIR); } +char * +qemu_get_runtime_dir(void) +{ + char *env = getenv("XDG_RUNTIME_DIR"); + if (env) { + return g_strdup(env); + } + + return get_relocated_path(CONFIG_QEMU_LOCALSTATEDIR "/run"); +} + void qemu_set_tty_echo(int fd, bool echo) { struct termios tty; diff --git a/util/oslib-win32.c b/util/oslib-win32.c index a67cb3822e..6ad1bb4bac 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -31,6 +31,8 @@ */ #include "qemu/osdep.h" +#include +#include #include #include "qapi/error.h" #include "qemu/main-loop.h" @@ -241,6 +243,30 @@ qemu_get_local_state_dir(void) return g_strdup(data_dirs[0]); } +char * +qemu_get_runtime_dir(void) +{ + size_t size = GetEnvironmentVariableA("XDG_RUNTIME_DIR", NULL, 0); + if (size) { + char *env = g_malloc(size); + GetEnvironmentVariableA("XDG_RUNTIME_DIR", env, size); + return env; + } + + PWSTR wpath; + const wchar_t *cwpath; + if (!SHGetKnownFolderPath(&FOLDERID_LocalAppData, KF_FLAG_DEFAULT, NULL, &wpath)) { + cwpath = wpath; + size = wcsrtombs(NULL, &cwpath, 0, &(mbstate_t){0}) + 1; + char *path = g_malloc(size); + wcsrtombs(path, &cwpath, size, &(mbstate_t){0}); + CoTaskMemFree(wpath); + return path; + } + + return get_relocated_path(CONFIG_QEMU_LOCALSTATEDIR "/run"); +} + void qemu_set_tty_echo(int fd, bool echo) { HANDLE handle = (HANDLE)_get_osfhandle(fd); From patchwork Thu Nov 10 06:23:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13038318 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A965C433FE for ; Thu, 10 Nov 2022 06:29:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot10L-0001tL-Vc; Thu, 10 Nov 2022 01:25:38 -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 1ot10K-0001pd-ET for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:36 -0500 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot10I-0000K4-Pc for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:36 -0500 Received: by mail-pg1-x536.google.com with SMTP id v3so864967pgh.4 for ; Wed, 09 Nov 2022 22:25:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=imXo2IRrILpkxUDOjeir+V07IKls1TLJKB9c8zb1QFc=; b=vDkF5bL8SedL4u/8o+q2LoM2GA+YpMcjvsNQ9lUx7UUhm5ZR2Ezl52s+KhNoI1Bsdt 3Gx1jarUSeeUOuuXbLgD4yl5hD06grTo6QQuvzDIlzrv/nF5m5RO/WAGKeiwitNj4sJ+ 8Kf6VOnBcrEiufCS4B5l4fdMxyIG/8xW+6MnsSywYM6ww3sqGO77atU4lj5t0YVDZ+Il sngtwoWWxi92ngZJNr0HkacNPIGT6puDjcDldGTU2lyW/dOb6yQTHYOJDoTUNdwXvGIA VsMiAz21o++//2CpTgyk810Uy8kHNL83tWIF5cmYZqJJnOlnDgiNpA77U0eQ7VzBxUl3 gFww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=imXo2IRrILpkxUDOjeir+V07IKls1TLJKB9c8zb1QFc=; b=oAj5MWXt1/YuEC6A/K0dy+tmfO+ijSfFpbkeHlY9wqQYIkioEQIA/XjHWpWPGjXFqm B1t8MgoQCkncSw5LUHYR48kL9evsORn/DsybOaCG18iDSSV+U2/gPW2ZVTpEar2Pzhq7 LeUWYzRTGgbD9iny1Al7fmIuPsV6/g8iHQReLSBzc1I5sYwzUQ6uirwl5sJGxYR9wmjS eHpxI7OgZO70mTnv81FZ0hZNblqxfiDgowQCfQbjRV2Vkj+ZSZiKbFtCLKhKmmKC8gZX aoCDKhynL7AaDJjzuQTj5BiLfM0GBObv5iQ4UusciUZ/TtUSM7kOXfaMH9sCglASKdLO PuvQ== X-Gm-Message-State: ACrzQf1LIYl/iXs046wN4aGv/6Lize2CFTPDge5k/lrAKEavMwlghVVT I+68wIQltcdUj9VAYGJ7cNKdBXJQtJtKowJR X-Google-Smtp-Source: AMsMyM5iBA8Pow4hdHT7e8Nz4LEUjQRHsbnG2Rt/8n8r5YIO/jNr1Ty9U/uSBXD1SBVeG83VHtRwFw== X-Received: by 2002:a62:32c2:0:b0:56b:2cce:d46a with SMTP id y185-20020a6232c2000000b0056b2cced46amr63063500pfy.36.1668061533157; Wed, 09 Nov 2022 22:25:33 -0800 (PST) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id m4-20020a17090ade0400b002108cabbe31sm2289003pjv.9.2022.11.09.22.25.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 22:25:32 -0800 (PST) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, virtio-fs@redhat.com, Yuval Shaia , Marcel Apfelbaum , Konstantin Kostiuk , Michael Roth , Paolo Bonzini , Fam Zheng , "Dr. David Alan Gilbert" , Stefan Hajnoczi , Gerd Hoffmann , Stefan Weil , Yan Vugenfirer , Akihiko Odaki Subject: [PATCH 03/10] ivshmem-server: Use qemu_get_runtime_dir() Date: Thu, 10 Nov 2022 15:23:22 +0900 Message-Id: <20221110062329.13363-4-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110062329.13363-1-akihiko.odaki@daynix.com> References: <20221110062329.13363-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::536; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x536.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org qemu_get_runtime_dir() is used to construct the default PID file path. Signed-off-by: Akihiko Odaki --- contrib/ivshmem-server/main.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/contrib/ivshmem-server/main.c b/contrib/ivshmem-server/main.c index 224dbeb547..16abbe2f5a 100644 --- a/contrib/ivshmem-server/main.c +++ b/contrib/ivshmem-server/main.c @@ -14,7 +14,6 @@ #define IVSHMEM_SERVER_DEFAULT_VERBOSE 0 #define IVSHMEM_SERVER_DEFAULT_FOREGROUND 0 -#define IVSHMEM_SERVER_DEFAULT_PID_FILE "/var/run/ivshmem-server.pid" #define IVSHMEM_SERVER_DEFAULT_UNIX_SOCK_PATH "/tmp/ivshmem_socket" #define IVSHMEM_SERVER_DEFAULT_SHM_PATH "ivshmem" #define IVSHMEM_SERVER_DEFAULT_SHM_SIZE (4 * 1024 * 1024) @@ -35,15 +34,23 @@ typedef struct IvshmemServerArgs { unsigned n_vectors; } IvshmemServerArgs; +static char *ivshmem_server_get_default_pid_file(void) +{ + g_autofree char *run = qemu_get_runtime_dir(); + return g_build_filename(run, "ivshmem-server.pid", NULL); +} + static void ivshmem_server_usage(const char *progname) { + g_autofree char *pid_file = ivshmem_server_get_default_pid_file(); + printf("Usage: %s [OPTION]...\n" " -h: show this help\n" " -v: verbose mode\n" " -F: foreground mode (default is to daemonize)\n" " -p : path to the PID file (used in daemon mode only)\n" - " default " IVSHMEM_SERVER_DEFAULT_PID_FILE "\n" + " default %s\n" " -S : path to the unix socket to listen to\n" " default " IVSHMEM_SERVER_DEFAULT_UNIX_SOCK_PATH "\n" " -M : POSIX shared memory object to use\n" @@ -54,7 +61,7 @@ ivshmem_server_usage(const char *progname) " default %u\n" " -n : number of vectors\n" " default %u\n", - progname, IVSHMEM_SERVER_DEFAULT_SHM_SIZE, + progname, pid_file, IVSHMEM_SERVER_DEFAULT_SHM_SIZE, IVSHMEM_SERVER_DEFAULT_N_VECTORS); } @@ -189,10 +196,10 @@ main(int argc, char *argv[]) { IvshmemServer server; struct sigaction sa, sa_quit; + g_autofree char *default_pid_file = NULL; IvshmemServerArgs args = { .verbose = IVSHMEM_SERVER_DEFAULT_VERBOSE, .foreground = IVSHMEM_SERVER_DEFAULT_FOREGROUND, - .pid_file = IVSHMEM_SERVER_DEFAULT_PID_FILE, .unix_socket_path = IVSHMEM_SERVER_DEFAULT_UNIX_SOCK_PATH, .shm_path = IVSHMEM_SERVER_DEFAULT_SHM_PATH, .use_shm_open = true, @@ -207,6 +214,11 @@ main(int argc, char *argv[]) */ printf("*** Example code, do not use in production ***\n"); + qemu_init_exec_dir(argv[0]); + + default_pid_file = ivshmem_server_get_default_pid_file(); + args.pid_file = default_pid_file; + /* parse arguments, will exit on error */ ivshmem_server_parse_args(&args, argc, argv); From patchwork Thu Nov 10 06:23:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13038310 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F8E5C433FE for ; Thu, 10 Nov 2022 06:26:19 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot10Q-000211-8H; Thu, 10 Nov 2022 01:25:42 -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 1ot10N-0001uP-LH for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:39 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot10M-00071M-29 for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:39 -0500 Received: by mail-pf1-x42e.google.com with SMTP id m6so1064942pfb.0 for ; Wed, 09 Nov 2022 22:25:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dOiLOlAfXAvpXv8rTJ4eJkIEKy86OcSDloeAyKUiv/M=; b=p4O24nTxoZ3CUUSHTcoAO0Xc0JFtRN2ngOvoC8pJ2mXgk9QB3Yt/2TTTrfnQJMrarD stODQumgHD+q1i3wWdz+iychQ3TxTqT4h0T8b0nqo/4L/TBjcl6c6fNmCNXJl51zGaRD 3QDlaq7UfRWnH8UjtfLts9YldBsw5TzqumPHRULhZkyItw0A+Z21+yFiXXHR2jVH6o7d YhLwKcFydCyMBPypBBnumrUOmpoq62E3T+7QcjxCupf9+vlY2fVx2IZGl07S8GMSOF7w IXCHJUIjSG8+1qHjl78GBHw9pDDKwcuci2ZB1YaWMj3HmzW0GEdDFzh87BLdxw9o+IYv QtYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dOiLOlAfXAvpXv8rTJ4eJkIEKy86OcSDloeAyKUiv/M=; b=SPD/CqlazErQAzAJklCbHLQC1Xdp3PmNruZ3PzIsZC0TjOiz3w4u4hkiqp2raKvIF5 wFQKktbBGoempVr2AlYzS7Km5lw7mLbfVvllHnd3BH0OFOOs5GajDl1gjVtY4AOvVCnU aauCYv1syxORf0pVEsrhIRZqsQeiA9BLiu6gUgTiU2w9OdhnQ6n7CMS1z7jfzNAM09b4 Q30ViAxXXnlTOLJ5bRnbtxaBGorAsHYmcobiBLUYu38AW+OEptEDQL1V38lkAu1MW7dM IvgsqTF+GaWHL3a26SV7o+6eIWQZY2A8gYzGQp40i9f7wdARupo4SQhtbTw579OWROs6 u+NA== X-Gm-Message-State: ACrzQf2yRPN+SA+JV4pIArilRUL65ODbWh43hIcq4Ic3Sy5NkMH+prZO HPUCdmHPqvzKzp0cBUicrMogJDJZu6aKW03g X-Google-Smtp-Source: AMsMyM6YS+n7AMhBGguKIGqx7NRKI+u60HEIlLC9rV7yMHWX96Q68/u5z5tZffEV21NwZ+dQCmiFgg== X-Received: by 2002:a63:1765:0:b0:457:8091:1b6c with SMTP id 37-20020a631765000000b0045780911b6cmr53368587pgx.208.1668061536831; Wed, 09 Nov 2022 22:25:36 -0800 (PST) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id m4-20020a17090ade0400b002108cabbe31sm2289003pjv.9.2022.11.09.22.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 22:25:36 -0800 (PST) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, virtio-fs@redhat.com, Yuval Shaia , Marcel Apfelbaum , Konstantin Kostiuk , Michael Roth , Paolo Bonzini , Fam Zheng , "Dr. David Alan Gilbert" , Stefan Hajnoczi , Gerd Hoffmann , Stefan Weil , Yan Vugenfirer , Akihiko Odaki Subject: [PATCH 04/10] contrib/rdmacm-mux: Use qemu_get_runtime_dir() Date: Thu, 10 Nov 2022 15:23:23 +0900 Message-Id: <20221110062329.13363-5-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110062329.13363-1-akihiko.odaki@daynix.com> References: <20221110062329.13363-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42e; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org qemu_get_runtime_dir() is used to construct the default Unix socket path. Signed-off-by: Akihiko Odaki --- contrib/rdmacm-mux/main.c | 22 ++++++++++++++-------- contrib/rdmacm-mux/meson.build | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/contrib/rdmacm-mux/main.c b/contrib/rdmacm-mux/main.c index 771ca01e03..00c14031ca 100644 --- a/contrib/rdmacm-mux/main.c +++ b/contrib/rdmacm-mux/main.c @@ -14,6 +14,7 @@ */ #include "qemu/osdep.h" +#include "qemu/cutils.h" #include #include #include @@ -40,8 +41,6 @@ #define CM_REQ_DGID_POS 80 #define CM_SIDR_REQ_DGID_POS 44 -/* The below can be override by command line parameter */ -#define UNIX_SOCKET_PATH "/var/run/rdmacm-mux" /* Has format %s-%s-%d" -- */ #define SOCKET_PATH_MAX (PATH_MAX - NAME_MAX - sizeof(int) - 2) #define RDMA_PORT_NUM 1 @@ -77,7 +76,13 @@ typedef struct RdmaCmServer { static RdmaCMServer server = {0}; -static void usage(const char *progname) +static char *get_default_unix_socket_path(void) +{ + g_autofree char *run = qemu_get_runtime_dir(); + return g_build_filename(run, "rdmacm-mux", NULL); +} + +static void usage(const char *progname, const char *default_unix_socket_path) { printf("Usage: %s [OPTION]...\n" "Start a RDMA-CM multiplexer\n" @@ -86,7 +91,7 @@ static void usage(const char *progname) "\t-d rdma-device-name Name of RDMA device to register with\n" "\t-s unix-socket-path Path to unix socket to listen on (default %s)\n" "\t-p rdma-device-port Port number of RDMA device to register with (default %d)\n", - progname, UNIX_SOCKET_PATH, RDMA_PORT_NUM); + progname, default_unix_socket_path, RDMA_PORT_NUM); } static void help(const char *progname) @@ -97,16 +102,16 @@ static void help(const char *progname) static void parse_args(int argc, char *argv[]) { int c; - char unix_socket_path[SOCKET_PATH_MAX]; + g_autofree char *default_unix_socket_path = get_default_unix_socket_path(); + char *unix_socket_path = default_unix_socket_path; strcpy(server.args.rdma_dev_name, ""); - strcpy(unix_socket_path, UNIX_SOCKET_PATH); server.args.rdma_port_num = RDMA_PORT_NUM; while ((c = getopt(argc, argv, "hs:d:p:")) != -1) { switch (c) { case 'h': - usage(argv[0]); + usage(argv[0], default_unix_socket_path); exit(0); case 'd': @@ -115,7 +120,7 @@ static void parse_args(int argc, char *argv[]) case 's': /* This is temporary, final name will build below */ - strncpy(unix_socket_path, optarg, SOCKET_PATH_MAX - 1); + unix_socket_path = optarg; break; case 'p': @@ -811,6 +816,7 @@ int main(int argc, char *argv[]) { int rc; + qemu_init_exec_dir(argv[0]); memset(&server, 0, sizeof(server)); parse_args(argc, argv); diff --git a/contrib/rdmacm-mux/meson.build b/contrib/rdmacm-mux/meson.build index 36c9c89630..59f60f9cac 100644 --- a/contrib/rdmacm-mux/meson.build +++ b/contrib/rdmacm-mux/meson.build @@ -1,7 +1,7 @@ if have_pvrdma # FIXME: broken on big endian architectures executable('rdmacm-mux', files('main.c'), genh, - dependencies: [glib, libumad], + dependencies: [glib, libumad, qemuutil], build_by_default: false, install: false) endif From patchwork Thu Nov 10 06:23:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13038311 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8FCC1C4332F for ; Thu, 10 Nov 2022 06:26:21 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot10S-000252-Jh; Thu, 10 Nov 2022 01:25:44 -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 1ot10Q-000232-W2 for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:43 -0500 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot10P-0008Su-Hf for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:42 -0500 Received: by mail-pf1-x433.google.com with SMTP id b185so1007655pfb.9 for ; Wed, 09 Nov 2022 22:25:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=X2AW9NaqdulAEV6U7rG6cnfGeNB8asIOOIZhmyN9/Ug=; b=2Sk9AwSSjoJXhw7R+5QsY+j1MeYjLji0TJU2NWuw+LarU3pkAu6e3xJmpscrH3yoTF c6q7tGfc4JZpcdP38HoWDq1kDPg7qiFvWLR1iLDgMZlQnndAlI835b9iwidwNbvEW5yt R8osHiy3v2QGapQxRp1gyeeCgyJHAs6qDqo9A6ZmIA5cqaGmKGhxOSpyOWepxLPMAj8C tp5nsCg+RwaTKQgpH+bgeVKLVwJZZZFQrl5fTCdnM+sf9iANRcyxn8TKsumi2pJWOBcg bclkPzHBUhr5Yi0tqKbh7/K9qNP5gKWBsGzNR3drQ5SvDNrwzgpTximxES8AUE8mRmzu Kp7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X2AW9NaqdulAEV6U7rG6cnfGeNB8asIOOIZhmyN9/Ug=; b=eTdbz/y15JaprVfa4SnSd+JnHohSevpODXlJWuCcMCxGKlNp0wI/PgG17kmCjXz505 v0L/SXICnjXwxSWOEPBO4uJe3OuV5/PoH2aDqUxBCQGey1+NFHPTk15iL7VpE8A7rWpl oLTRNi4JQQFl32cYeMsZgnj2h6/uim4DQnHGLjgqARprTLJoL8bBCf1awMiXq9ADmCTI ghTqss/UVXLYj+9ZF5ALrqboYV1aVy28Xu8WuRb0kIyGNaU1eRulKHslpJfF8LV0jp99 XVEwxemAdCaPmi2zWeBFJmPVQNkCLZLgjlh+or+eX9lMeA/3rqSWxMff2XGXJxv3NY0E DZUQ== X-Gm-Message-State: ACrzQf2a404x/onGBWPJtkWj9yE9avnYMG1QmFirCRh92aufMhxEWAev 6KRSgDqHzFSi34kXltfpU8WmnroF9dm1i5ZX X-Google-Smtp-Source: AMsMyM4gjuN3Spi/5/tKLTmgjhUfJNjx2W2suDEJV/ukujpOOEryjPm0d+RFx/rG/yZjgtH2cwb8KA== X-Received: by 2002:a65:62c7:0:b0:463:9c67:5fe2 with SMTP id m7-20020a6562c7000000b004639c675fe2mr53818716pgv.443.1668061540387; Wed, 09 Nov 2022 22:25:40 -0800 (PST) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id m4-20020a17090ade0400b002108cabbe31sm2289003pjv.9.2022.11.09.22.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 22:25:40 -0800 (PST) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, virtio-fs@redhat.com, Yuval Shaia , Marcel Apfelbaum , Konstantin Kostiuk , Michael Roth , Paolo Bonzini , Fam Zheng , "Dr. David Alan Gilbert" , Stefan Hajnoczi , Gerd Hoffmann , Stefan Weil , Yan Vugenfirer , Akihiko Odaki Subject: [PATCH 05/10] qga: Use qemu_get_runtime_dir() Date: Thu, 10 Nov 2022 15:23:24 +0900 Message-Id: <20221110062329.13363-6-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110062329.13363-1-akihiko.odaki@daynix.com> References: <20221110062329.13363-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::433; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x433.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org qemu_get_runtime_dir() is used to construct the default state directory. Signed-off-by: Akihiko Odaki --- qga/main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/qga/main.c b/qga/main.c index b3580508fa..dc875079f0 100644 --- a/qga/main.c +++ b/qga/main.c @@ -46,12 +46,11 @@ #define QGA_VIRTIO_PATH_DEFAULT "/dev/virtio-ports/org.qemu.guest_agent.0" #endif /* __FreeBSD__ */ #define QGA_SERIAL_PATH_DEFAULT "/dev/ttyS0" -#define QGA_STATE_RELATIVE_DIR "run" #else #define QGA_VIRTIO_PATH_DEFAULT "\\\\.\\Global\\org.qemu.guest_agent.0" -#define QGA_STATE_RELATIVE_DIR "qemu-ga" #define QGA_SERIAL_PATH_DEFAULT "COM1" #endif +#define QGA_STATE_RELATIVE_DIR "qemu-ga" #ifdef CONFIG_FSFREEZE #define QGA_FSFREEZE_HOOK_DEFAULT CONFIG_QEMU_CONFDIR "/fsfreeze-hook" #endif @@ -128,12 +127,12 @@ static void stop_agent(GAState *s, bool requested); static void init_dfl_pathnames(void) { - g_autofree char *state = qemu_get_local_state_dir(); + g_autofree char *run = qemu_get_runtime_dir(); g_assert(dfl_pathnames.state_dir == NULL); g_assert(dfl_pathnames.pidfile == NULL); - dfl_pathnames.state_dir = g_build_filename(state, QGA_STATE_RELATIVE_DIR, NULL); - dfl_pathnames.pidfile = g_build_filename(state, QGA_STATE_RELATIVE_DIR, "qemu-ga.pid", NULL); + dfl_pathnames.state_dir = g_build_filename(run, QGA_STATE_RELATIVE_DIR, NULL); + dfl_pathnames.pidfile = g_build_filename(run, QGA_STATE_RELATIVE_DIR, "qemu-ga.pid", NULL); } static void quit_handler(int sig) From patchwork Thu Nov 10 06:23:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13038315 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 184F2C4332F for ; Thu, 10 Nov 2022 06:27:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot10a-00029E-Sc; Thu, 10 Nov 2022 01:25: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 1ot10U-000289-EM for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:46 -0500 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot10T-0008Qk-18 for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:46 -0500 Received: by mail-pf1-x433.google.com with SMTP id z26so1041599pff.1 for ; Wed, 09 Nov 2022 22:25:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=23qHkaFNj9aYRMMJ3RksdGA2UgOinYhFW/VeC2eRFU4=; b=enkwHh5XwmprXeoFG5ZTkA97g22aC3TeIvrWnPkyfWbxlxSwb333AV7Qm8AI5Hq4D8 iaRONlga+X58wqtYsCAB+exbOljuGEsZezGPgojcPvpxeLYQVfFpZLvVB23O/Kkz853n KEDv8p8zzyM7suwYvmi93NKflEiJgNkNRhb53IVbpCQxHLAqZ2EQn1OqJRFnnjFUoQQo pIHb8gUlddrQFd06Abzn9rF1e6d6U2Dkh0vHcdrJG0Frau+W0UcA8qHajMPfyESQTLsf 1JdPf91fBv4u+zwsGpnoj3J90uwGSJq77fYZACyD7ncevAVKmi57EoKCTtx34AkjMBBL Vqig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=23qHkaFNj9aYRMMJ3RksdGA2UgOinYhFW/VeC2eRFU4=; b=i+1mdckaYgAFfw7aQ9KHFVdylVmuFhFXD1/Q/FrnfgVfwiTULcSNhWuRBXGg7CkkeN 3Fpf+LdZfKnD5YTmWzA+Z5vg6YS+JGqU7lRQjAvMwBawZbO2/B5GcLLs/Rlqj3vSDTLC gYSGOwkRVdbxpcLY6RSVHeGhp3cQ8S0bCw+Uz42ukHDDAISJtdDhZkKYhiPW0V157MtF MwAGAgiRfgzsfQ0ZXXKXeXdh93dJ1N5XKo3Bc70PtztEbbBZDfvDiVKe3iki6UnYxATB BQ2MshGd8ICFfoSkg77ahgDvEbxKJv5QDQsIBMkUvsDfGee/X8H32woSDe6+pWLmTrnI Cxhw== X-Gm-Message-State: ACrzQf0RrriTFADqye6ngi7LjxIu4vM/ujhKLr0D4SmuU4v37GvPPeZq /+b9F/oBc/rVpWe6KMQKQA/eHUjB5kPYz2Ar X-Google-Smtp-Source: AMsMyM6Xzja4dgtYeVj3n4R9/1GtLGPYyFlXtwhGDffRGGHAtwdDtcoX3Aspwu2iEE4k6NUC8I7PoA== X-Received: by 2002:a63:a05:0:b0:46b:3ba2:3365 with SMTP id 5-20020a630a05000000b0046b3ba23365mr1874717pgk.425.1668061543892; Wed, 09 Nov 2022 22:25:43 -0800 (PST) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id m4-20020a17090ade0400b002108cabbe31sm2289003pjv.9.2022.11.09.22.25.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 22:25:43 -0800 (PST) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, virtio-fs@redhat.com, Yuval Shaia , Marcel Apfelbaum , Konstantin Kostiuk , Michael Roth , Paolo Bonzini , Fam Zheng , "Dr. David Alan Gilbert" , Stefan Hajnoczi , Gerd Hoffmann , Stefan Weil , Yan Vugenfirer , Akihiko Odaki Subject: [PATCH 06/10] scsi: Use qemu_get_runtime_dir() Date: Thu, 10 Nov 2022 15:23:25 +0900 Message-Id: <20221110062329.13363-7-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110062329.13363-1-akihiko.odaki@daynix.com> References: <20221110062329.13363-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::433; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x433.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org qemu_get_runtime_dir() is used to construct the default paths. Signed-off-by: Akihiko Odaki --- scsi/qemu-pr-helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index 196b78c00d..adb7baecaa 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -77,10 +77,10 @@ static int gid = -1; static void compute_default_paths(void) { - g_autofree char *state = qemu_get_local_state_dir(); + g_autofree char *run = qemu_get_runtime_dir(); - socket_path = g_build_filename(state, "run", "qemu-pr-helper.sock", NULL); - pidfile = g_build_filename(state, "run", "qemu-pr-helper.pid", NULL); + socket_path = g_build_filename(run, "qemu-pr-helper.sock", NULL); + pidfile = g_build_filename(run, "qemu-pr-helper.pid", NULL); } static void usage(const char *name) From patchwork Thu Nov 10 06:23:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13038322 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4256C4332F for ; Thu, 10 Nov 2022 06:32:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot10j-0002Ou-2a; Thu, 10 Nov 2022 01:26:01 -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 1ot10X-00029K-JC for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:50 -0500 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot10W-0000JT-9j for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:49 -0500 Received: by mail-pg1-x52a.google.com with SMTP id 130so859927pgc.5 for ; Wed, 09 Nov 2022 22:25:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yAOm4xAwUIMS3nIWuITf2mBCrb5XaCIFaM5bi4ZPZPo=; b=nowE1IAA3TGJ2TwAu946s1Mt5gRJ4WGCCeomIEZ2aw6iXrsh7KC7oG83L7z7jzy/NR YFglAZm/Cv/A1CBKViAsr0k5QuhF8zC8gWCXHenDZXkTE2auK3xvczb9WAt+iTbF5HSE blEk20WqLHxh1WNBY5guI8BTPR5RriHNsuu+lGzXqjuSMsAnJl/s+7DIiutcV7bhmJyG bG5KlZeOmoJUs9rZNXfPe/On20/9Ji9Ad7XMK82WhE+1X5AcdDKnU4kYFLn4lT8NVzh+ b8mbwdCH9XJI128sMewCCTNTza/khpSj32KMB6zNR1BMU7DXv3M2u3TL+Cv1BKcRfXA4 A0EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yAOm4xAwUIMS3nIWuITf2mBCrb5XaCIFaM5bi4ZPZPo=; b=nxK7aU0FX73+NgBmvm86LQu/3GoBgocYnRtX9ulsIwe16whtqu6juQLuarIc/h3T+N KiOZFm982kQsBIeIi38E97QVRx8vdwFN59GzH2uMPH9+13go2OwNhIq2wSbHsito0SZ1 oGtg63uOkfoxb6K7vz6QiDWkrA6DXzQTwxGZZg6SLQxEnLz6taRZq4/AEr9v62/ZfKPw Mlsz+kHzigTXD7VCIHxeSCi2ilU3P0CLpHVXrfmQjo0Z+ZO4FbPlgioVb4I0LrXM7/qH d41x+5eIVAw7pYDqGvl92KpJhrusRpMX3JAHlLn+5aqqZk1t90DHuh2lC2U9n4jX2P2P f3Yg== X-Gm-Message-State: ACrzQf2E4NJUrZQpNHxZQg3i39fxVcjkJRsKT5D2r/qS5ymrbtL1HXhw UyXzmfNBHvSQ3ZbYCEjAlRekx2xQybatvMm1 X-Google-Smtp-Source: AMsMyM5PTsKrxbLLp9LfQTSdR8AfANj1OgYxTAajCmDAVBnDihDZEGjkMEWxl0sP8w5hKE5y3fiYmw== X-Received: by 2002:a63:4b5f:0:b0:43c:428d:507c with SMTP id k31-20020a634b5f000000b0043c428d507cmr52328556pgl.607.1668061547445; Wed, 09 Nov 2022 22:25:47 -0800 (PST) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id m4-20020a17090ade0400b002108cabbe31sm2289003pjv.9.2022.11.09.22.25.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 22:25:47 -0800 (PST) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, virtio-fs@redhat.com, Yuval Shaia , Marcel Apfelbaum , Konstantin Kostiuk , Michael Roth , Paolo Bonzini , Fam Zheng , "Dr. David Alan Gilbert" , Stefan Hajnoczi , Gerd Hoffmann , Stefan Weil , Yan Vugenfirer , Akihiko Odaki Subject: [PATCH 07/10] virtiofsd: Use qemu_get_runtime_dir() Date: Thu, 10 Nov 2022 15:23:26 +0900 Message-Id: <20221110062329.13363-8-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110062329.13363-1-akihiko.odaki@daynix.com> References: <20221110062329.13363-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::52a; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org qemu_get_runtime_dir() is used to construct the path to a lock file. Signed-off-by: Akihiko Odaki --- tools/virtiofsd/fuse_virtio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c index 9368e292e4..b9eeed85e6 100644 --- a/tools/virtiofsd/fuse_virtio.c +++ b/tools/virtiofsd/fuse_virtio.c @@ -901,12 +901,12 @@ static bool fv_socket_lock(struct fuse_session *se) { g_autofree gchar *sk_name = NULL; g_autofree gchar *pidfile = NULL; - g_autofree gchar *state = NULL; + g_autofree gchar *run = NULL; g_autofree gchar *dir = NULL; Error *local_err = NULL; - state = qemu_get_local_state_dir(); - dir = g_build_filename(state, "run", "virtiofsd", NULL); + run = qemu_get_runtime_dir(); + dir = g_build_filename(run, "virtiofsd", NULL); if (g_mkdir_with_parents(dir, S_IRWXU) < 0) { fuse_log(FUSE_LOG_ERR, "%s: Failed to create directory %s: %s\n", From patchwork Thu Nov 10 06:23:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13038317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED149C433FE for ; Thu, 10 Nov 2022 06:28:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot10o-0002WB-AL; Thu, 10 Nov 2022 01:26:06 -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 1ot10c-0002MH-6l for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:54 -0500 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot10a-0001bI-LX for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:53 -0500 Received: by mail-pf1-x42f.google.com with SMTP id y203so1029496pfb.4 for ; Wed, 09 Nov 2022 22:25:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1uEBjaTElDdg0Zg5fYZb2Jay1kxJRBlw3oI5Sxs4u+Q=; b=D5xo8sPosWK2ntf5I3cR4vD2TXYL5XzKO9qL+N684tiwulV+W14CTiXN3dxv57sZvg O2Xre5SxtvF2IwBIPbL4hiJaLWMn8rOzNnFeXNBK19ey3sdVdI0l4LFY2jPwcfK+X3p8 T6gFow8JD7lhLHe1UVgg/J8eTtEHGKU5eME9rP6HvaAO9Z9NaYdcCJgXg5exBYeAHBRL 1LWD3PQkDNrUrv7qyaxsb39qojhggYRdmPBr0eh+luzmmkj3pto3aIr07w4HLycrwrau NUA+RN0CqJrGc6WrYso7a64w2VrfMRsn9626gT6tk8ZoTQUC3IQr6Cf77nT/lfrkNjEJ 0yeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1uEBjaTElDdg0Zg5fYZb2Jay1kxJRBlw3oI5Sxs4u+Q=; b=clWkjORXcUMQbWoeaNpY/Ue6sL1YK10RdvUPvfEnQnZfh3dgQ6VytGPE57KL6xOtwC BnW6cASLBmaNs81ccOrKmNpp2Vd/p4O03jdPtfsquVF+azmoWZNnJLjZzgr+yEsO3DFt YRT9CUj7iCVSZL5ieyavwfqAZkeAT4fEGEWpUgdhg9vsF/kV/aHbL7Shf/IXW8ulSlfC AuEdSwKnFCCS+60tg3LaaUsTpHspHiplvznppzeR65otQhhuCandsuFptBwY1RAhNDwE DbCFrDkzkVR9JIiBakMQDsVNATU7CWoKqQmCA4kW+MHS4zTWrZqUZ+a8j0OWHOT0RmJs p2Jg== X-Gm-Message-State: ACrzQf1gWFvrStRig4Fh3eK0qMk6poKHef6st+k4yN4jUcdtwXAcmN4j 2iRsSpB2CiUgkaYFpPCDYn6LPRS9XxENqmwR X-Google-Smtp-Source: AMsMyM7awpAt7muj1b0FeHEnEJupIioVE04BCWOQlgv2/+Gg0LRGcl3x+9pkaaS6UsrtOaogDSs5gQ== X-Received: by 2002:a63:d66:0:b0:46f:8979:30e2 with SMTP id 38-20020a630d66000000b0046f897930e2mr50248204pgn.348.1668061550947; Wed, 09 Nov 2022 22:25:50 -0800 (PST) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id m4-20020a17090ade0400b002108cabbe31sm2289003pjv.9.2022.11.09.22.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 22:25:50 -0800 (PST) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, virtio-fs@redhat.com, Yuval Shaia , Marcel Apfelbaum , Konstantin Kostiuk , Michael Roth , Paolo Bonzini , Fam Zheng , "Dr. David Alan Gilbert" , Stefan Hajnoczi , Gerd Hoffmann , Stefan Weil , Yan Vugenfirer , Akihiko Odaki Subject: [PATCH 08/10] module: Use qemu_get_runtime_dir() Date: Thu, 10 Nov 2022 15:23:27 +0900 Message-Id: <20221110062329.13363-9-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110062329.13363-1-akihiko.odaki@daynix.com> References: <20221110062329.13363-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::42f; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org qemu_get_runtime_dir() is used to construct the path to module upgrades. Signed-off-by: Akihiko Odaki --- util/module.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/module.c b/util/module.c index 8ddb0e18f5..50f52b7232 100644 --- a/util/module.c +++ b/util/module.c @@ -279,7 +279,8 @@ bool module_load_one(const char *prefix, const char *lib_name, bool mayfail) version_dir = g_strcanon(g_strdup(QEMU_PKGVERSION), G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "+-.~", '_'); - dirs[n_dirs++] = g_strdup_printf("/var/run/qemu/%s", version_dir); + g_autofree char *run = qemu_get_runtime_dir(); + dirs[n_dirs++] = g_build_filename(run, "qemu", version_dir, NULL); #endif assert(n_dirs <= ARRAY_SIZE(dirs)); From patchwork Thu Nov 10 06:23:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13038319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29B99C433FE for ; Thu, 10 Nov 2022 06:29:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot10n-0002Rm-71; Thu, 10 Nov 2022 01:26:05 -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 1ot10g-0002NO-Jk for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:59 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot10e-0001bk-W0 for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:25:58 -0500 Received: by mail-pj1-x1036.google.com with SMTP id k5so822684pjo.5 for ; Wed, 09 Nov 2022 22:25:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=djQvtbI+5ceah01/E9QXrKDRfdUAtdLN189JgwjzOBQ=; b=dxs3uNSNJO66VN/n0oFa/UNI60Ugn1Trsz2q1+NuHqy4eZMGW6DpgGBz/x1Ocy6uZV zQXs7zeXfARZRZh0kUJDAWvCuUojRH36v1/H3y3KuJmSPbX/azyfxAMry9B2679iTDK9 el0DC8PwKgwWgmgb1OXq/Y++nVFl/wtcxDnPiv7idKtEOPNI0YmBGp/0uNp3iZZmw7iz yvQ+2wBzy/lwA64vS216cv+3ORbsu/PE9FsFZ45SCPpkDUxrAIGhtqws7afeAqqJJgyT 6Vmak6US2jvVP/PP6CKVwFqbeC1F9+DGRsCC80tXaLHkPOJNI1KUyMINqLMcDPGpgLTo SR+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=djQvtbI+5ceah01/E9QXrKDRfdUAtdLN189JgwjzOBQ=; b=P3EJrFMs+a0WBmVcY/xietFqHKuMTKMV45gxLPojh8OpUUlYkOWkSiT7dQDGGTa0Kz aAXt7CWhObQBkw2JpHfeNoipka0n991+majkN4j2MvjVb78IPp2/Kvzau5H2WkLS5Nbe b6I2oo078uIpeisfUYaN4WGHDJpxKb19I0lI75EpJ4QB/2i92wQ0eekQOsfveDSgAH6g jNysK4dKnXbVfQA0zGNq+Ib42simCnBG2CYF3Ow/xNv8r0yEqrmj7uKbt9EdUr+NIlVE CVTyBgVZmSjaQKMyfOAhALQS4Mq7ABD2AKjeKY0gPkU9pqiBCHL4jUl2gb+MCqLRA6Fm ZPUw== X-Gm-Message-State: ACrzQf0Ss+DaxjetlxhRCSf2libX6ynqkVApl1qd+Eex6rkZqe1DSRBg mfTMaCeIfLVIeBI6mwXHDPOA8uZJhX4zgTaj X-Google-Smtp-Source: AMsMyM5TghrS/8nhttMh/cvsxPXWm0EWfRsVFpm6UrYNzQ/FoRwB6swBHjoBWEvzY96cZ4IrClbjzA== X-Received: by 2002:a17:90a:1b44:b0:213:1035:f913 with SMTP id q62-20020a17090a1b4400b002131035f913mr63785378pjq.133.1668061554410; Wed, 09 Nov 2022 22:25:54 -0800 (PST) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id m4-20020a17090ade0400b002108cabbe31sm2289003pjv.9.2022.11.09.22.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 22:25:54 -0800 (PST) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, virtio-fs@redhat.com, Yuval Shaia , Marcel Apfelbaum , Konstantin Kostiuk , Michael Roth , Paolo Bonzini , Fam Zheng , "Dr. David Alan Gilbert" , Stefan Hajnoczi , Gerd Hoffmann , Stefan Weil , Yan Vugenfirer , Akihiko Odaki Subject: [PATCH 09/10] util: Remove qemu_get_local_state_dir() Date: Thu, 10 Nov 2022 15:23:28 +0900 Message-Id: <20221110062329.13363-10-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110062329.13363-1-akihiko.odaki@daynix.com> References: <20221110062329.13363-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::1036; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x1036.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org There are no users of the function anymore. Signed-off-by: Akihiko Odaki --- include/qemu/osdep.h | 8 -------- util/oslib-posix.c | 6 ------ util/oslib-win32.c | 10 ---------- 3 files changed, 24 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 86445aad25..f21ebf2b27 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -557,14 +557,6 @@ ssize_t qemu_write_full(int fd, const void *buf, size_t count) void qemu_set_cloexec(int fd); -/* Return a dynamically allocated directory path that is appropriate for storing - * local state. - * - * The caller is responsible for releasing the value returned with g_free() - * after use. - */ -char *qemu_get_local_state_dir(void); - /** * qemu_get_runtime_dir: * diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 9a0b3913ff..b8d79876b2 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -273,12 +273,6 @@ int qemu_socketpair(int domain, int type, int protocol, int sv[2]) return ret; } -char * -qemu_get_local_state_dir(void) -{ - return get_relocated_path(CONFIG_QEMU_LOCALSTATEDIR); -} - char * qemu_get_runtime_dir(void) { diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 6ad1bb4bac..a32cc5b1be 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -233,16 +233,6 @@ int qemu_get_thread_id(void) return GetCurrentThreadId(); } -char * -qemu_get_local_state_dir(void) -{ - const char * const *data_dirs = g_get_system_data_dirs(); - - g_assert(data_dirs && data_dirs[0]); - - return g_strdup(data_dirs[0]); -} - char * qemu_get_runtime_dir(void) { From patchwork Thu Nov 10 06:23:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13038323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71C44C4332F for ; Thu, 10 Nov 2022 06:33:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot10p-0002YU-2K; Thu, 10 Nov 2022 01:26:07 -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 1ot10k-0002Rl-3k for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:26:03 -0500 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot10h-0001cM-Ho for qemu-devel@nongnu.org; Thu, 10 Nov 2022 01:26:01 -0500 Received: by mail-pg1-x52a.google.com with SMTP id b62so895230pgc.0 for ; Wed, 09 Nov 2022 22:25:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AC+ag6DjlMRVYIRoMVgQ7eyLCeIppVPRSyLkAkRwpvs=; b=kK/C+42LsThvwCQFrkDc/mlyygvLhVi9rXrMi4AupdNcFwIL30l3TblGgXUouT65zf kT43Tl9oVyUNICttiAsetLCSC+qT12RAG8HKz7jO7V75tfAIwLD+Re3JQ84qB/an3OtE aJOlIHjJDP/MqI7rlgkn4s2x19IWo1Qrpp26ypAWJMolq12i/gXCby/cUnxuFfBAP332 KOz4Ht378jQLub9/0AoTLxVjV8NdOY3CbQAwfPsDzuji/wvn0Hgr516LxD+OQDA616oN EdXwVq9uN1Utc3uH7hACMMEzvWciWyEJC2rVvLgxFTbRw9xaM9hQB6XqDHQ9wFmHlLVj iNwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AC+ag6DjlMRVYIRoMVgQ7eyLCeIppVPRSyLkAkRwpvs=; b=DzX/xk14nYIwx6M3C7lxdRI6syjFvMdm0Lfk2s64vfAjEMRK87QvSTCMO6UalxPrLs gmFsgH+2owl3HXu1X4C1ByrUDxV9U4NQ0krDmKdsKAEXHIL2zLrJiKsKo5n9cCF0AqDK MvO/TA+Lp0sxzGBrEvSlhiWK3Sdq7b7tx5pv5T++emK3csWWU3YWEC2yEh4wPs7GSX5U ddrHrLmdAPIlOWNA0d4jegR5Pt1yyiHzvxARqCY8ZlvWWNJ2GlICOz+a0ZlXdN3if5Xl hXWfU5MuzaP9mUSZi0RnSoEzOaQ7lu46ZMq6/Di7HWTSPlvSRMQbYLVvxU4gxAF98ir/ R6Bg== X-Gm-Message-State: ACrzQf3Z7o0qlZhNddnTbSoLKK1fIYqayN1ctJRdGns6fI3S7WqkmcdQ 2JIFWTSQ8YXfYZDYKXAxETr5JbgMFKrclsOj X-Google-Smtp-Source: AMsMyM6IAijeGYPaL6noQcBtDCehjnU2U/fk3DnEnRxCrtEsW2uCSqPhMn/t1VbJhcan3XAnB3FzKw== X-Received: by 2002:a63:4752:0:b0:439:5dcc:fd78 with SMTP id w18-20020a634752000000b004395dccfd78mr52947253pgk.104.1668061557966; Wed, 09 Nov 2022 22:25:57 -0800 (PST) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id m4-20020a17090ade0400b002108cabbe31sm2289003pjv.9.2022.11.09.22.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 22:25:57 -0800 (PST) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, virtio-fs@redhat.com, Yuval Shaia , Marcel Apfelbaum , Konstantin Kostiuk , Michael Roth , Paolo Bonzini , Fam Zheng , "Dr. David Alan Gilbert" , Stefan Hajnoczi , Gerd Hoffmann , Stefan Weil , Yan Vugenfirer , Akihiko Odaki Subject: [PATCH 10/10] spice-app: Use qemu_get_runtime_dir() Date: Thu, 10 Nov 2022 15:23:29 +0900 Message-Id: <20221110062329.13363-11-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110062329.13363-1-akihiko.odaki@daynix.com> References: <20221110062329.13363-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::52a; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org qemu_get_runtime_dir() provides QEMU-specific fallback of runtime directory. Signed-off-by: Akihiko Odaki --- ui/spice-app.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/spice-app.c b/ui/spice-app.c index 7e71e18da9..feb162baa7 100644 --- a/ui/spice-app.c +++ b/ui/spice-app.c @@ -145,8 +145,8 @@ static void spice_app_display_early_init(DisplayOptions *opts) atexit(spice_app_atexit); if (qemu_name) { - app_dir = g_build_filename(g_get_user_runtime_dir(), - "qemu", qemu_name, NULL); + g_autofree char *run = qemu_get_runtime_dir(); + app_dir = g_build_filename(run, "qemu", qemu_name, NULL); if (g_mkdir_with_parents(app_dir, S_IRWXU) < -1) { error_report("Failed to create directory %s: %s", app_dir, strerror(errno));