From patchwork Fri Aug 23 13:48: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: 821719 Delivered-To: patch@linaro.org Received: by 2002:adf:e044:0:b0:367:895a:4699 with SMTP id w4csp387135wrh; Fri, 23 Aug 2024 06:51:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWZOxJTt8MOjrxFkoDk4GPBdwcmpypR8tyq35Iyl6m6NR7u99K5AP9uB2hWEV3Eb76y0MPzWg==@linaro.org X-Google-Smtp-Source: AGHT+IGzbXfgZrwFdX1doZidMFWtzQtQps0swTNqQ53QFZIGCyOmjap//8zADQmFJaos9njS0T9E X-Received: by 2002:a05:600c:3b89:b0:426:614b:1a72 with SMTP id 5b1f17b1804b1-42acc8e1392mr18593005e9.17.1724421099585; Fri, 23 Aug 2024 06:51:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724421099; cv=none; d=google.com; s=arc-20240605; b=e+n+HotX41icZKLEKqYEw2U1iUTBNk6baUxLw8GTxgIUMBiX+cUfY0T4KEomzxdB2W pBSg3GDrpBU5aCreCFdrzPmQARyiq3/X0Zc+8x7+FH3YXO+at5Bz0SjRjeKb1wjHVDHY yb/SySHbnZGSMgQff78C7cgVNw6pa9HnFayt3tTuCkH8wy6ofBOEG9jXFOGi7/44k50p 5qt1KCqMIEbDgxbUtxg8WVbDd0GhHRp5zfprPd6bncY5G8swXDeYOFE4HrJBdbGeKsUu LXd8955lMy0ESk24AKIBPe9TxGW4wRTzXMkXzpTKogtUZPv9EOGDOpbQFbnIUPB7RXgC aNeA== 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=XGz4U07JuHZb2y5jdBfc47mDP3MalPOz9Wfd8t01x2U=; fh=fsulFODMEPEOSLpWO3BriWzWBQgd8jC14ZsfD2Wjjn4=; b=WadtWo2E/2HnTVGYMCtp3ozytbt4VoREfMlyzEKWKDojXrvubV051w5oUesRkJjGed rf9BVyFP1qDnrEQKiSGoVLs+sN8QMBvHBZV+GU0JX/tgg1PO+mMvsxJoh7JW4lVghD/f bx4g5X+umGtUZ2ARcjE/k0nQB/9iWv8IHSsyPI6HiBuDU7smm4kezzmdaYdfnEDGQN2G ieDJR4KH1tfKMg0H5vI0DS+ndGNynRlEXq83qM8JobhfhjvgIwrxxtgroI3Acyhj1yKm 8cp8kDIQwHbGuDDPQkSXrCEu8gqDbfhOliWSJLyMKeaXkopTnwdiuRqH18P+eCmi4Sgf hGlQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xuGbDqVM; 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 5b1f17b1804b1-42ac517ab27si18811935e9.141.2024.08.23.06.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 06:51:39 -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=xuGbDqVM; 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 6EB5B888F0; Fri, 23 Aug 2024 15:49:49 +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="xuGbDqVM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6F77F88A0E; Fri, 23 Aug 2024 15:49:48 +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-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (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 8D1D488A0E for ; Fri, 23 Aug 2024 15:49:46 +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-x332.google.com with SMTP id 5b1f17b1804b1-428101fa30aso16371885e9.3 for ; Fri, 23 Aug 2024 06:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724420986; x=1725025786; 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=XGz4U07JuHZb2y5jdBfc47mDP3MalPOz9Wfd8t01x2U=; b=xuGbDqVMjThGDaTaMnb2VGE2x9hUZAvuTe/4zK56YAwipObO2UcZCqb/MFYcxtHQOZ p4BI+OR2oiVlniAQeYdnh0fQw5dOi8vYEc2VDHQPM0GxF1B5g13q7SXjeQ/ztJXhZAMJ TX8T9FHkBAV8lk3TzlluSRJdCzYwzP2Q7elMl5MahUPMMxWYycXYFUdkfToU0/rOhWrL TGQ4gBgSQHlHCov4PVS5U3eOWPZ96Rwv7gZ4nHNpiMsel1k4xqtd6pp5YFRYNxR6CHs0 Nr2HujsvOGpZSbgeyS3xeCqUPqDRdYNJVFMnWGrz9mObDB8jA66YekVFhN5Dff3r6Zl1 IFnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724420986; x=1725025786; 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=XGz4U07JuHZb2y5jdBfc47mDP3MalPOz9Wfd8t01x2U=; b=UH8cZLCWxBCHUqKPxvAplweLqCuYoAk4LmJWZ0QioitqZX/WtSd5UC2sM+xsWNUKZZ mPQLHS5PiaHCzRQipt9lAePKzvmoznLCW7sw5RvbBeNpPMNppD2oGCZBNdrgu79X4L5u Bsy0BnI3kZ/yrsoSEmSYVtJ9vN3ZwcPL7Ng7Y4L7Q3pApNElpPj9jI7ZCaQgqfqrbd6C hlgX4nw9XcQWMgI9/MvwoITEFTvfzACTWJoCWppEOBDJkhdFqk4ihYKHjZSj4X8l6Bok q97sQDCoC9WjlnFNhwLkFRbVLXeM0JVqxVip1wgTI+sNe5Gjgt8iaWLd9R7Rl5XT79k5 yrsA== X-Gm-Message-State: AOJu0YxIXA83SnqVIhJDE//qJIe8yysaDamtI+4GPmpmp49zRzO5I9CG zquiKn24eLE0xcVp5C5gdkklPadIxMzezRf0r/TcbVFdez484gmBoR0bAv77dlhIoZVCNbxwZOa Y317Z4H8c X-Received: by 2002:adf:ec12:0:b0:368:2f01:3053 with SMTP id ffacd0b85a97d-373118eeea2mr1675629f8f.55.1724420985829; Fri, 23 Aug 2024 06:49:45 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:e668:dc94:35c7:8064]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-373081ffb40sm4201665f8f.76.2024.08.23.06.49.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 06:49:45 -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 v9 17/37] net: move copy_filename() to new file net/net-common.c Date: Fri, 23 Aug 2024 15:48: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 d9bc9df643f..32629aa80ce 100644 --- a/net/net.c +++ b/net/net.c @@ -1684,18 +1684,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, ':');