From patchwork Thu Oct 3 15:22:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 832407 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp343509wra; Thu, 3 Oct 2024 08:25:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXSAgMTM8K8/xDqYb4uYh+iIRqOy5GFswNnZr1MWOcenuEgj1WScaUhnfEhe5BevZRD+bbhgw==@linaro.org X-Google-Smtp-Source: AGHT+IHvvbNTuCit5jIH5CaBOyYIxGgWLcDEWVcBSAeh+33AFBXbGF7+494+TGPu08jmjYuKH3Of X-Received: by 2002:a05:6e02:1389:b0:3a1:a243:c7a7 with SMTP id e9e14a558f8ab-3a3659133efmr66443645ab.2.1727969108069; Thu, 03 Oct 2024 08:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727969108; cv=none; d=google.com; s=arc-20240605; b=iZZTRl/m04wJO1JjXtLiNbnO8kyEKeQ03od46gY9Ho+DDypxqc0eWPPKzHJkRmQRqW h9B1/kr4BTmBoZpZwHI90JvqY4TZ5ZbsIktY7hJSc1vOdosoneAZTrTZo2xqWzahB2SW QGh+4F5SXGUdrl5tVlw3WuCxUUCM9vLGGh0pciPj/fAvYXhWF30nWGIhWlnOdlcaz3dT lee0nQlZFUhjMI3gGeJ4+gJpMuJTZhtZwcRzeZ3ec1c3Ayo5foa+zVRCUgKpYkuFMX+R IvYnuIJJs4h7Vs9Mwuxh6jP7l1LZvlTfRVaUd+lpJ50NDfhUOWGSvX0zznRwwRbH9bUc 5sfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nw/+cdQPG/ROM9iilfJJB8oj5oic8yJ+2SSNidMrUsc=; fh=N71yvI/Nz5UjFUcisPepCeU5xIdAepUnjOJlwzY1wVc=; b=TJyt+xCiTlJ/SDlGfTsRUS8lPeVCWEUgbIm1j+ojE3mBHk51tneluEq2W0STCXSeSJ I6WjSw+Bx3SAJiilUoXiR+VZHkTWrrwAmdoKTw8GbMNCvmkt1IOhCUDj5tAkKIwZMBfr uQORrT+nLdEHaE3ujrxUAUGc7cF2vi4f0gHLiF5MmsEs4Mr5YlutKQXtlFB1U0J6qYvS IsjuE17RIcfOmhQQIMxOYevm+ps3GM/QZ5pGRcotlm4K5SGKEjwawo6/eRBcNMmWQx0L rXKyLA//uCKRcfLsoeRy5vgZSd3xUe/LoJoKzAT8WCQVGWWw/OMNbjf4M+ry3hCxqHig MwtA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zdf4OVRh; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id e9e14a558f8ab-3a371391635si5998205ab.14.2024.10.03.08.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 08:25:08 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zdf4OVRh; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BD7D088F3A; Thu, 3 Oct 2024 17:24:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="zdf4OVRh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 72E7D88F07; Thu, 3 Oct 2024 17:24:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 81B1688E94 for ; Thu, 3 Oct 2024 17:24:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-37cd8972738so858281f8f.3 for ; Thu, 03 Oct 2024 08:24:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727969058; x=1728573858; darn=lists.denx.de; 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=nw/+cdQPG/ROM9iilfJJB8oj5oic8yJ+2SSNidMrUsc=; b=zdf4OVRhaoVoYKl4EB+cGuF9SN7P3rcd0Rk4BCS3o0J8OJ12gOspQZmwarFVMbgqjg uhu2cpycR7FxTMHoOAt0jMaObJLReeCredGux1fnbTi5tBwz0ta+EWdsRMkOiaY7iatq TanUQjP6EU91wNRfwX1b4c1g4N/QpGlkMdiuXJimFMaSJRNAjCP8LHwGNeKTesuIVZ17 aKCZspuwvCyZOXDnY/Jye1EvRuk7KZeepTDWUMkWt81jqc5DhoMPCZEfoqQ48sW3ZxFi geWGWUBCXFuxiEhvv+JWRccKqfEv7MrvsUb9mqmoTAH/viDSzd+gnWRI+HEppOtjSJHw 9Z4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727969058; x=1728573858; 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=nw/+cdQPG/ROM9iilfJJB8oj5oic8yJ+2SSNidMrUsc=; b=BrJQP4XwuefwR5DrJwfGwFPQZcxH3sKTVw34qgBsW6Y7hEqEvIasMhMZdFTeG057qP dcJ4t3Y2DCK7mcUsrz2NJSH+/uwqnkmiZ/PGJLd7rmQlYN4eJIRoA7UPiNRKycR98yUB YjJNhxuS3nJiQNW0FAqfHIDTT1DqIfJwE0I8idC0xCr0noOXcFOkWeAjVkpHLTA1U7Qm /TVNookXYrst1vCBmho3iXHt7rjoATuiV2R8d56p82Wy3ulsSby2AcW3ZioDlMdIAYy9 hO2E3uQNVGdRdgAohMPH64Cdbg7SQov5pN6rRd0x8FPE35FD2yNpY4BW88flL6AuEGvv 1NgQ== X-Gm-Message-State: AOJu0Yx7jq0Tv0FLvfjOBzRkprWhqSnXCCYfAXbXhR0MGDxfNQg5azEb PKIm3Re4Jz2+A0w57gMZSnlCBKQhzcpxqEx8JuwNlFtdSjtpJ1SCHiaqGYXHKkImkGBjZqzKm55 ClJ1EzkiP X-Received: by 2002:a05:6000:a84:b0:374:cd96:f73 with SMTP id ffacd0b85a97d-37cfb8b6405mr3844807f8f.3.1727969058241; Thu, 03 Oct 2024 08:24:18 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:d888:7a58:deed:47d6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d081f7482sm1506220f8f.8.2024.10.03.08.24.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 08:24:16 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Javier Tia , Raymond Mao , Maxim Uvarov , Tim Harvey , Anton Antonov , Jerome Forissier , Tom Rini , Joe Hershberger , Ramon Fried , Simon Glass , Sean Anderson , Marek Vasut Subject: [PATCH v11 10/29] net: move copy_filename() to new file net/net-common.c Date: Thu, 3 Oct 2024 17:22:56 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean copy_filename() can be useful when NET_LWIP is enabled, therefore move it out of net/net.c which is built only when networking choice is NET. Signed-off-by: Jerome Forissier Reviewed-by: Ilias Apalodimas --- net/Makefile | 2 ++ net/net-common.c | 13 +++++++++++++ net/net.c | 12 ------------ 3 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 net/net-common.c diff --git a/net/Makefile b/net/Makefile index 70eec8caf0d..a9cecee637a 100644 --- a/net/Makefile +++ b/net/Makefile @@ -42,3 +42,5 @@ obj-$(CONFIG_CMD_WGET) += wget.o CFLAGS_eth_common.o += -Wno-format-extra-args endif + +obj-y += net-common.o diff --git a/net/net-common.c b/net/net-common.c new file mode 100644 index 00000000000..a7f767d5e9c --- /dev/null +++ b/net/net-common.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +void copy_filename(char *dst, const char *src, int size) +{ + if (src && *src && (*src == '"')) { + ++src; + --size; + } + + while ((--size > 0) && src && *src && (*src != '"')) + *dst++ = *src++; + *dst = '\0'; +} diff --git a/net/net.c b/net/net.c index 1e0b7c85624..c1d10a77b9e 100644 --- a/net/net.c +++ b/net/net.c @@ -1689,18 +1689,6 @@ void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, int sport, ip->udp_xsum = 0; } -void copy_filename(char *dst, const char *src, int size) -{ - if (src && *src && (*src == '"')) { - ++src; - --size; - } - - while ((--size > 0) && src && *src && (*src != '"')) - *dst++ = *src++; - *dst = '\0'; -} - int is_serverip_in_cmd(void) { return !!strchr(net_boot_file_name, ':');