From patchwork Fri Oct 14 21:45:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric DeCosta X-Patchwork-Id: 13007369 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 EFB66C4332F for ; Fri, 14 Oct 2022 21:46:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229921AbiJNVqK (ORCPT ); Fri, 14 Oct 2022 17:46:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbiJNVp4 (ORCPT ); Fri, 14 Oct 2022 17:45:56 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27B7963843 for ; Fri, 14 Oct 2022 14:45:51 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id u10so9578697wrq.2 for ; Fri, 14 Oct 2022 14:45:51 -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 :message-id:reply-to; bh=Wcm8qpzJovNixZr4FfekgJCx0i3cU8b+4aQdred0fgg=; b=Ey85Ze5eJeiO4QUAKWWiwg5jepBHJs6Pu0k+Ml7NLqw3UETCuEDB6nwAWVs7lFNWtC qNFJNQQwhi2Sul2SGOnTHZI5zNFvzMeadmvd0KUao8ODAcWYVRj22hmE7wknlsXvR4RK KFqbREuN5Oje3EsLLHXNwwBFykYpEWZhggBSngDU1PPlu/cWXdbyuvYnyGnCepjiec+1 +SPNjKTRvhTrNHJkXQK7X3RFwRHNDyPG9DBWmjykKxGoaSzdhTV+Nx4fDIe6kcjO5vEn +OGrYbeUO6/nGN27h7o1VI2ceNipBIQMRXDYNggNl5wMYoKX50lPRFvlgTqNDi304Xpj tSTA== 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:message-id:reply-to; bh=Wcm8qpzJovNixZr4FfekgJCx0i3cU8b+4aQdred0fgg=; b=y4h95A2s4MaVh0WdbO4O8K1eHjA9g5cfpo0blxCs+9+38eCNnXeRNrkOYOGMhWFjKe OoqukIdZ8uvHhbdhXFvIMIEhayJuok5MZcLGUxM4+0gZg2OKtTOxjkUQxWdLC6AnZ3a9 QpTB1I9ry07cu5W2hp/yVhhZw6G2aGwC/z+8BFo5/IebII0PBJ1kuIL165aZm6XTdzC+ OTiUuCEk6LPXhocG7zY7BVtVzDYOocZ+LQmObBqJsDiJt5iUKMY04P6/ZrO0ZPh68CSg l3Q99EHab17sLAuEDIV3sfymXmTuVK8RhZuG7lEIwwUxY9sMvkVjychoB8c+owR1DU6L V03Q== X-Gm-Message-State: ACrzQf035Yj3B0cdMA41jh/yUp8Zvq1xgWuZCK6tEjC02W8RXVa+iKFG KS4g97gVAZd2Sv3YpvNrtSOIg0wLwAI= X-Google-Smtp-Source: AMsMyM72rQnKuvtoqB5kPeffd6w3LcsOAFd1eK46SKW/gAhyYcGr0r9k2K3VyCtbxZyBYLR+NwwDeA== X-Received: by 2002:a5d:4687:0:b0:22f:21c6:4b66 with SMTP id u7-20020a5d4687000000b0022f21c64b66mr4524900wrq.154.1665783950107; Fri, 14 Oct 2022 14:45:50 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p8-20020a05600c358800b003a541d893desm3229186wmq.38.2022.10.14.14.45.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 14:45:49 -0700 (PDT) Message-Id: <664259ed57a3b39af295ba87ce668cab4d364a9e.1665783944.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 14 Oct 2022 21:45:35 +0000 Subject: [PATCH v2 03/12] fsmonitor: avoid socket location check if using hook Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7A=?= Bjarmason , 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 7241c4c22c9..6abbc7af3ab 100644 --- a/compat/fsmonitor/fsm-settings-darwin.c +++ b/compat/fsmonitor/fsm-settings-darwin.c @@ -48,13 +48,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 */