Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3974555rwd; Tue, 23 May 2023 00:55:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7VgM5wUru1NLHTYkr2HtFcQZW2+LGRJBfFkiYZvpjkAXdb12BmSYUP6ze1U/ZpD7TLpTOC X-Received: by 2002:a17:90b:3798:b0:253:74f8:1e31 with SMTP id mz24-20020a17090b379800b0025374f81e31mr12366820pjb.39.1684828549022; Tue, 23 May 2023 00:55:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684828549; cv=none; d=google.com; s=arc-20160816; b=Efu1uXbw5W8QdMrBzCqhlwc7TKgpoMx+epxt7qIBR4VWszQ2PDyvAHjXkrNKbnzbDQ 3dEZ6XmOJv4nj/B8QD+TWBC+xJOpf/ewAMcA2KfXHHhpqeJLjDcHWkhjFhDsru4wkakb hjG/VwzXeBeQyvgGac0zIt5TOUjqOnr7w54Kv5sKpCVGcvcHsBpHnkUErPSAPLd10uKi cCY+wZMRsSfEG0e3awLlqOj5niR1zuoos3K40r0zGGNegxy5J1rj/Md+tXUHKeCCMFQ1 GSqHHvNi0VvihHb4BeHZ4pkZ05Q3OEk2GwvZ5/tKFEQhO78Y46lLppnEIEHCxMcKJDnk mOEA== 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:from :dkim-signature; bh=6jd70DMemk8ZckghMl9CiFecycutXCrZ5EOvBFmSYmY=; b=qfgBWTPk4QJhCgpIZxad8DwlPnG+CARn7N1Jd9tavTk7E4arQAvVusNShBz8U27tV2 Ik8fwEVSUSjdg+TmAEiGMIlmo94CW6WkWhaPK4KQVcor7rreW45FBE8RWtPCwRtiZFHu C8lrM1t50R/E9sMes2lwawo82AB8wxUJtIhthJV18WAhT0yZ7OGgotb1Bne3JmND2QWS Fz/9PVasYesQGKOv7ghyLjaV1grxMRnftOiW5fpoe5OjMPjzffa7Yd1WcEmwzappvCFa kRW+B9DHTzRI4Su7WawhP65fFJOoZM/S700xjWc0C5bwDMoehKTR917p1JHWdLpmS+U7 Lmyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=SlbXJ9Zj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p3-20020a639503000000b0053486a1950esi1706760pgd.431.2023.05.23.00.55.36; Tue, 23 May 2023 00:55:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=SlbXJ9Zj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235594AbjEWHqv (ORCPT + 99 others); Tue, 23 May 2023 03:46:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235604AbjEWHqS (ORCPT ); Tue, 23 May 2023 03:46:18 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 215D8119; Tue, 23 May 2023 00:46:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=6jd70DMemk8ZckghMl9CiFecycutXCrZ5EOvBFmSYmY=; b=SlbXJ9ZjegvwC5j/ePHUyQlPMO 10fGoUAfAUa2294Yk8GJ/5hXIc8QkHAr8iH0CH9IfsltCmCAkRDyo0tkeYvtcN+sFFebcilXnZ04i D8MSXRiSHOtUrnsk15xhBXZkUlim/0Dy2qHZ5lquLt+0gu2J93iXsnFMIveQ5eLIaREfT3xMalFtK cpaDkDjm+tqNDuy2Zoj1oZg4zuMH0I39KBfwyIp4mMVLoS/MhnvBzVzkVFrzBTIhExJTAVRYNWFOG eFOtxHK3Bw5bmENBrXUgt9Ds+KADqvDpzOxaPDU4J9T3ivnwTQagSZsAzzJtSs0mDB6NPPNdcsUwj 9vusgheQ==; Received: from [2001:4bb8:188:23b2:6ade:85c9:530f:6eb0] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q1Mig-009Gou-1r; Tue, 23 May 2023 07:46:11 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Mike Snitzer , Joern Engel , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Pavel Machek , dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-mtd@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH 12/24] init: move the nfs/cifs/ram special cases out of name_to_dev_t Date: Tue, 23 May 2023 09:45:23 +0200 Message-Id: <20230523074535.249802-13-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230523074535.249802-1-hch@lst.de> References: <20230523074535.249802-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nfs/cifs/ram special cass only need to be parsed once, and only in the boot code. Move them out of name_to_dev_t and into prepare_namespace. Signed-off-by: Christoph Hellwig --- init/do_mounts.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/init/do_mounts.c b/init/do_mounts.c index d5c06c1546e82c..86599faf2bf8a1 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -248,7 +248,6 @@ static dev_t devt_from_devnum(const char *name) * * 1) device number in hexadecimal represents itself * no leading 0x, for example b302. - * 2) /dev/nfs represents Root_NFS (0xff) * 3) /dev/ represents the device number of disk * 4) /dev/ represents the device number * of partition - device number of disk plus the partition number @@ -266,7 +265,6 @@ static dev_t devt_from_devnum(const char *name) * a colon. * 9) PARTLABEL= with name being the GPT partition label. * MSDOS partitions do not support labels! - * 10) /dev/cifs represents Root_CIFS (0xfe) * * If name doesn't have fall into the categories above, we return (0,0). * block_class is used to check if something is a disk name. If the disk @@ -275,12 +273,6 @@ static dev_t devt_from_devnum(const char *name) */ dev_t name_to_dev_t(const char *name) { - if (strcmp(name, "/dev/nfs") == 0) - return Root_NFS; - if (strcmp(name, "/dev/cifs") == 0) - return Root_CIFS; - if (strcmp(name, "/dev/ram") == 0) - return Root_RAM0; #ifdef CONFIG_BLOCK if (strncmp(name, "PARTUUID=", 9) == 0) return devt_from_partuuid(name + 9); @@ -631,6 +623,12 @@ static dev_t __init parse_root_device(char *root_device_name) if (!strncmp(root_device_name, "mtd", 3) || !strncmp(root_device_name, "ubi", 3)) return Root_Generic; + if (strcmp(root_device_name, "/dev/nfs") == 0) + return Root_NFS; + if (strcmp(root_device_name, "/dev/cifs") == 0) + return Root_CIFS; + if (strcmp(root_device_name, "/dev/ram") == 0) + return Root_RAM0; return name_to_dev_t(root_device_name); } -- 2.39.2