From patchwork Fri Sep 6 12:33:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 825956 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp777963wrb; Fri, 6 Sep 2024 05:35:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVQteR5yvtKJe8d2JP2Te+2jZie2d0q7lvDq0lqSuARnSYzZofgUlTl/9uAWTlG3p2Nd3TXEA==@linaro.org X-Google-Smtp-Source: AGHT+IG1W5R6FM+D3GJAQKJ/6jVqjGTJEBaZxMuX4QuAiFBl/r02JUNL4SQGVaS3VE7ZmJogIwbD X-Received: by 2002:a05:6402:2755:b0:5b9:df62:15cd with SMTP id 4fb4d7f45d1cf-5c3dc7c4442mr1934675a12.32.1725626109757; Fri, 06 Sep 2024 05:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725626109; cv=none; d=google.com; s=arc-20240605; b=aSC2fj3FMXyFnTvNjqgaPGXUqWzacooGLtMCd/p+eohKhiiMfyCHhiSaZ1cTAasewq exZDL2AcndTzOM2fOOp5QIS0B+lj0xDkZdOLY2jrx1LKc9fDbMODChqBQEoBvRWc4vlL vwkVr018Q9ovPD7wk4fUj+1R0J2Nvjn6p5967y5t0PNCFnr4cvLL7N/dh2bf2Cc9i6VZ FLGPKdZoQQl1Wy3us779e3kPbDitFlsBAd/zTe0VkJsWYAnoWX4N0lTAblKRNrBRxwmX OXMQsMWhPI/2mCRnjt+N/Bk+tuF4d4uL65rDd535VohsISAK/qdLdzkRUvk+GKwaWDq/ tbaw== 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=fsulFODMEPEOSLpWO3BriWzWBQgd8jC14ZsfD2Wjjn4=; b=YFqcgSyWI2o1zMMBs73iD9vWlJDXMVsEaxCd9g48/1YjzoQHiPo6yj1IleYSyM9Kui jbTklB7Ada2bfsv6KNYJ09uQ/paYZW8ulHisP+IxBklFHVBhrJ13igyXbJt5KMMW1Unu ZhlpTSpeJKjSylXJJlgo4+3loA3srH3Zxn9XNEgojIqF8MKN5sjLv/+U8wK144nP23m6 PuozOmnd/o4N390PFB3wc3Hw+oUblRhMwcXlN9lChEDQOMk9iQJfVIExD7idJmMdfCdL bPAczFlA+tbwNl2Nu0iQX0w4LfdTfw5TXtw5DmjgK30cRZmpk3vLLAHg4OGyHdLu1FEn hGow==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FeOHI5cE; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5c3cc6b16a2si3029907a12.591.2024.09.06.05.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 05:35:09 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FeOHI5cE; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 2C6CC88CD8; Fri, 6 Sep 2024 14:35:00 +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="FeOHI5cE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 30ADE888C1; Fri, 6 Sep 2024 14:34:59 +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,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (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 1E4D088C9F for ; Fri, 6 Sep 2024 14:34:55 +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-wm1-x330.google.com with SMTP id 5b1f17b1804b1-42ca573fd5aso3422715e9.3 for ; Fri, 06 Sep 2024 05:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725626094; x=1726230894; 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=FeOHI5cEUYsYinJpO+Rm3XgJtW2ikNGZM+6Kzs3tUypmHmnMfAPq2iDVFQs/r9UWDf kthvol+170eVnqF5Uq5AQBAumcYIFKOuLb9Qtg4UXt0Nd5NtWqIL9v2D6nDs8HvE9JH7 Nr4awF0Po8xUNwx+AUXRq0POqJd/EtTLkq0uw+iYsXEYqVQIM6LgP6qWMXvnsSpNQM0K S0YlZM0SKEO9T9IhLIaObzc0T4hMKNWytAdNMgAYAzcqN1J+6iMQ6hJQ7gtDzI5VLOEH NBg8MCGVYinNTev3RcGYZR5rkeQn9+WJuW5/rgtolSF1xTXEjx0H+ndhrgl5KxLQygx6 7XmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725626094; x=1726230894; 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=LYhHcqX6S0tI3YBgz53wfyjAvxUXFvobk9Np9lKjICV8icYuG8tp6AQfZFI2dlpcza iD3Zp6HTZBCmX4kj9ldgca1jFOQXSDZ3YBdB1cK/jr4WUUYUmcxHTENvOp+bgemoJhxK ki2+hBiA5H6ahfGG71yJ0ejp4Idlm1EOl9mB+uO+sZEXBYUHMy0EPcC418AQJRlL1Dul k0W6fMt65PPxk/uUwvfoRqGLe5EXqEB3H7nwmdCZGzHbNQaByKMAG9xi+Sd64/0AfuuU 2hQjLrXTHHvqQm6EFqGtJyYGnyxUksfdCp893yDTYL8Dy0GFibZ+iKlGAU3pGU2ItoYQ LCag== X-Gm-Message-State: AOJu0YzgUVd3mPgDRN0lX1Ed+kcxF/ZsJbkAxa7qhSVAQqNYUIJF9uuY 3eFxJmFAlZd3klzKIiZsPx7CyPbtYA7MAvc4E34bOJKGtWw/Mu/sAI9lUivvMPJaZHS378T9D89 qqdfhiJW3 X-Received: by 2002:a05:600c:1c21:b0:426:647b:1bfa with SMTP id 5b1f17b1804b1-42c9f983745mr16838265e9.8.1725626094298; Fri, 06 Sep 2024 05:34:54 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:1ff1:215c:d8a4:9f99]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ca05cf0e8sm19640125e9.27.2024.09.06.05.34.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 05:34:54 -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 , Sean Anderson , Simon Glass , Marek Vasut Subject: [PATCH v10 05/25] net: move copy_filename() to new file net/net-common.c Date: Fri, 6 Sep 2024 14:33:21 +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 --- 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, ':');