Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp804500pxb; Wed, 3 Nov 2021 12:41:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaAryMr4xBMijyKhj/76S94OxiaSb51nSVcMeqydLi+vVilVg1cszkm3GQ3DXkoEislm4+ X-Received: by 2002:a17:907:3e0c:: with SMTP id hp12mr24800690ejc.293.1635968471257; Wed, 03 Nov 2021 12:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635968471; cv=none; d=google.com; s=arc-20160816; b=ohRFLr6UeLTo9PDC+DVW/9+PJs+pDrcCYaoXq9j6thXXK+QP+qTA7HIWDL0BlSosdi +184pD8QSM24XS34d55m1ew5ShLJ1Mmis64sD65FI260Z6byNwBBAcGuTe9Tqe98myy8 qvoo+Qcsp4WIA+BZ77EEzrsWMY7y2ywjwu8BlYRpLt2+IGZnkINxuJQ6Zy/B5iv+ePYX u5KQkZbEXjIxtx/2fQsGbxiJwzYNwBRYyctT87ay3pMnqk7oIaEjLor1P2miFoxQTVSq v0/LlfWgHMPcN023JSj9RXSBUjxDJBjI/KFcGQR2rXBDVumObhXtwo4MNUPbTiDsSdWm zJdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :from; bh=tk+jKOhXLIhXZ4vOdlp9BZ0XWPMf0bilvx+y615sNfI=; b=vKa+dRmoutYsnfM27c1HJVWl9VQgQ8b6H0R0+Jygv4AhuTIk6NdaPQF+rnlNhSlkLd OAldZlzA9QuX+7HI0PGCAvWULog8Ic7Cm2PUJKxym2TAmodKdQK03sRTJmvvhxZviel1 mrisQcZlMow9FaAioW9+zomYuTQwZ/4ugT4Sb1ou9ZWtNwn6a0nD04h8tjBo7IbN4x7E JCofwHEMQfEPJeFPe6Z8eViY7mL3mn2UbXaVRCvCkTmZpqRJHz0w/X290S5vgN2WvqkW 2cM0HDc2brekm9jq6+BUhQq4V0jA36YPvswvzHvGGon6ho7jpepdbHY9fDg503FI72YU 1L7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=rGlqzH+S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cs11si6079202ejc.468.2021.11.03.12.40.47; Wed, 03 Nov 2021 12:41:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=rGlqzH+S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231328AbhKCTlQ (ORCPT + 99 others); Wed, 3 Nov 2021 15:41:16 -0400 Received: from todd.t-8ch.de ([159.69.126.157]:38537 "EHLO todd.t-8ch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230460AbhKCTlI (ORCPT ); Wed, 3 Nov 2021 15:41:08 -0400 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1635968309; bh=bXuf1Fnll4HQ6OApxVeazk1FgKp+3wfoq7NhsxXZiy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rGlqzH+SLKMzu7H/ocY4KlIzi9xr/EW2+zV2jo1HuMmI6hVkMiNmbnK/dli9tn3/7 yDnUaYKiQvxgt/NufZd+gnBOZRqtOLHHMVo7F6a9KMuzqMS0pmuzhPW/yGiMVL1Ui/ pENNVyqQ09IBrFLfZrMYcx3010GPJoByx5oRzXc4= To: v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Dominique Martinet , Eric Van Hensbergen , Latchesar Ionkov , "David S. Miller" , Jakub Kicinski , Stefano Stabellini , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] net/p9: load default transports Date: Wed, 3 Nov 2021 20:38:23 +0100 Message-Id: <20211103193823.111007-5-linux@weissschuh.net> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211103193823.111007-1-linux@weissschuh.net> References: <20211103193823.111007-1-linux@weissschuh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that all transports are split into modules it may happen that no transports are registered when v9fs_get_default_trans() is called. When that is the case try to load more transports from modules. Signed-off-by: Thomas Weißschuh --- net/9p/mod.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/9p/mod.c b/net/9p/mod.c index 8f1d067b272e..7bb875cd279f 100644 --- a/net/9p/mod.c +++ b/net/9p/mod.c @@ -128,6 +128,10 @@ struct p9_trans_module *v9fs_get_trans_by_name(const char *s) } EXPORT_SYMBOL(v9fs_get_trans_by_name); +static const char * const v9fs_default_transports[] = { + "virtio", "tcp", "fd", "unix", "xen", "rdma", +}; + /** * v9fs_get_default_trans - get the default transport * @@ -136,6 +140,7 @@ EXPORT_SYMBOL(v9fs_get_trans_by_name); struct p9_trans_module *v9fs_get_default_trans(void) { struct p9_trans_module *t, *found = NULL; + int i; spin_lock(&v9fs_trans_lock); @@ -153,6 +158,10 @@ struct p9_trans_module *v9fs_get_default_trans(void) } spin_unlock(&v9fs_trans_lock); + + for (i = 0; !found && i < ARRAY_SIZE(v9fs_default_transports); i++) + found = v9fs_get_trans_by_name(v9fs_default_transports[i]); + return found; } EXPORT_SYMBOL(v9fs_get_default_trans); -- 2.33.1