From patchwork Wed Sep 28 20:12:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeCosta X-Patchwork-Id: 12992878 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1435BC32771 for ; Wed, 28 Sep 2022 20:12:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233724AbiI1UM1 (ORCPT ); Wed, 28 Sep 2022 16:12:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232558AbiI1UMT (ORCPT ); Wed, 28 Sep 2022 16:12:19 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57E07A2A97 for ; Wed, 28 Sep 2022 13:12:18 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id bq9so21467909wrb.4 for ; Wed, 28 Sep 2022 13:12:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date; bh=Sn7vsF8saTSOV85OIZnrqZlKAyOg5t4JuZwq78TkGgc=; b=gGxpHLOQeOrY3LaRG/9gs9LJ1MyPJjBvOkoYfQ5MOH6KqR72zMDW6V7UaX+QGZ/R/v hl/WywU1aR3MM1hE1F2rpIEbHdb1v8hAaeBt4wNY1TH/ieLhyytqyZVQJnTzF+OdQk5+ 8P47NrOxyDTr7Vjt+hrKdtvjmYyqkAyitvLi1fLNXciZdDv44SUHJIvVAlcm9g4qmyAZ O6IXTcBfXeQ6JEaXpucXePBPEsHOBd9Z1gZXHiCVIWLfjqaoVW3eTua/Err4TaJoRgju bXWw4/wu49PVi51Pvxwm6TpatP76FukHFnN2bCWaWWYHQ92+GS93AskZyiyFk/1Hbfbl WhwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date; bh=Sn7vsF8saTSOV85OIZnrqZlKAyOg5t4JuZwq78TkGgc=; b=IuiMaqbMWQrt7ex0iKRn+1hDFwsfNgjb71OzWS+IFgftVjE0GZdZR96/Ahj/4XB6g0 CiYpx5vtvIgS8idn+fKg6hNtOBTQfA3LqaCa2M5/n/DBUvTN4UwHxFMt6r1Cj5J15byH dx7r6oLS4mV0l/2A9RK5LAB8sTrr9mZqHUY85/ZBoaYY9QofFA6jp/3qd4+wt/zVXpao urYMCliW0YJQ5VxTwnMrc9Oz7hmaw33EiSpNJlKY9Wpawp+EuKDS+l6+dC3wJQXANFaq ZGFN13p0lkrmzTFx+6KP2P6ctcMUNWtfgoS6LDPggUm2mylaAwjJpgqLGCnigEy/ncyu t5aA== X-Gm-Message-State: ACrzQf0tuJU8tY1Rx3oWIHVWek3yxlgpiIyvlc4hC+rlt1lARMmzZBIr AOl9JpksBLB27/+nIVqJdIGCGmEhpBQ= X-Google-Smtp-Source: AMsMyM7QbfJIIf9bJpPFhIqzWf9/Bht6i/HRsOpETX/VA9EdjrCKYuNcAp0/3mUZ+0IhoUfgSz912g== X-Received: by 2002:a5d:6483:0:b0:226:db59:2f94 with SMTP id o3-20020a5d6483000000b00226db592f94mr21715544wri.200.1664395936708; Wed, 28 Sep 2022 13:12:16 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m17-20020a05600c3b1100b003b476cabf1csm3639129wms.26.2022.09.28.13.12.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 13:12:16 -0700 (PDT) Message-Id: <7987d0c1f33da7cdd62f2ffbaccd1cda281a7305.1664395931.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 28 Sep 2022 20:12:08 +0000 Subject: [PATCH v14 3/6] fsmonitor: avoid socket location check if using hook Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Jeff Hostetler , Eric Sunshine , Torsten =?utf-8?q?B=C3=B6gershause?= =?utf-8?q?n?= , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Ramsay Jones , Johannes Schindelin , Eric DeCosta , Eric DeCosta Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Eric DeCosta From: Eric DeCosta If monitoring is done via fsmonitor hook rather than IPC there is no need to check if the location of the Unix Domain socket (UDS) file is on a remote filesystem. Signed-off-by: Eric DeCosta --- compat/fsmonitor/fsm-settings-darwin.c | 10 ++++++---- compat/fsmonitor/fsm-settings-win32.c | 2 +- fsmonitor-settings.c | 8 ++++---- fsmonitor-settings.h | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/compat/fsmonitor/fsm-settings-darwin.c b/compat/fsmonitor/fsm-settings-darwin.c index 681d8bf963e..40da2d3b533 100644 --- a/compat/fsmonitor/fsm-settings-darwin.c +++ b/compat/fsmonitor/fsm-settings-darwin.c @@ -49,13 +49,15 @@ static enum fsmonitor_reason check_uds_volume(struct repository *r) return FSMONITOR_REASON_OK; } -enum fsmonitor_reason fsm_os__incompatible(struct repository *r) +enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc) { enum fsmonitor_reason reason; - reason = check_uds_volume(r); - if (reason != FSMONITOR_REASON_OK) - return reason; + if (ipc) { + reason = check_uds_volume(r); + if (reason != FSMONITOR_REASON_OK) + return reason; + } return FSMONITOR_REASON_OK; } diff --git a/compat/fsmonitor/fsm-settings-win32.c b/compat/fsmonitor/fsm-settings-win32.c index d88b06ae610..a8af31b71de 100644 --- a/compat/fsmonitor/fsm-settings-win32.c +++ b/compat/fsmonitor/fsm-settings-win32.c @@ -25,7 +25,7 @@ static enum fsmonitor_reason check_vfs4git(struct repository *r) return FSMONITOR_REASON_OK; } -enum fsmonitor_reason fsm_os__incompatible(struct repository *r) +enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc) { enum fsmonitor_reason reason; diff --git a/fsmonitor-settings.c b/fsmonitor-settings.c index d288cbad479..531a1b6f956 100644 --- a/fsmonitor-settings.c +++ b/fsmonitor-settings.c @@ -60,7 +60,7 @@ static enum fsmonitor_reason check_remote(struct repository *r) } #endif -static enum fsmonitor_reason check_for_incompatible(struct repository *r) +static enum fsmonitor_reason check_for_incompatible(struct repository *r, int ipc) { if (!r->worktree) { /* @@ -77,7 +77,7 @@ static enum fsmonitor_reason check_for_incompatible(struct repository *r) reason = check_remote(r); if (reason != FSMONITOR_REASON_OK) return reason; - reason = fsm_os__incompatible(r); + reason = fsm_os__incompatible(r, ipc); if (reason != FSMONITOR_REASON_OK) return reason; } @@ -162,7 +162,7 @@ const char *fsm_settings__get_hook_path(struct repository *r) void fsm_settings__set_ipc(struct repository *r) { - enum fsmonitor_reason reason = check_for_incompatible(r); + enum fsmonitor_reason reason = check_for_incompatible(r, 1); if (reason != FSMONITOR_REASON_OK) { fsm_settings__set_incompatible(r, reason); @@ -185,7 +185,7 @@ void fsm_settings__set_ipc(struct repository *r) void fsm_settings__set_hook(struct repository *r, const char *path) { - enum fsmonitor_reason reason = check_for_incompatible(r); + enum fsmonitor_reason reason = check_for_incompatible(r, 0); if (reason != FSMONITOR_REASON_OK) { fsm_settings__set_incompatible(r, reason); diff --git a/fsmonitor-settings.h b/fsmonitor-settings.h index d9c2605197f..0721617b95a 100644 --- a/fsmonitor-settings.h +++ b/fsmonitor-settings.h @@ -48,7 +48,7 @@ struct fsmonitor_settings; * fsm_os__* routines should considered private to fsm_settings__ * routines. */ -enum fsmonitor_reason fsm_os__incompatible(struct repository *r); +enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc); #endif /* HAVE_FSMONITOR_OS_SETTINGS */ #endif /* FSMONITOR_SETTINGS_H */