From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id A33645A0304 for ; Wed, 29 May 2024 12:19:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716977958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zvYHqf8TDGpVo6I90+hIZv6lFjSBtCDAYGfG5Cflod0=; b=YyB2W/vBoeb5ysSBXcbOY99RHKLVo+7PnfkGXPhdNZsJWchDkL3eaVZv/6KULnK8N0/hGC mmndwMgoUdybMwjC2HfSk4O56OgBXnLDfbFzNQlFRO/3mctVyrv/xsx4mpgkI7Iuh2Jk/3 6T4khrQTI0o5a9U1Jr11RL9aBtTRX4Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-88-eR4JuRcvMeutWbTJBL-lkQ-1; Wed, 29 May 2024 06:19:17 -0400 X-MC-Unique: eR4JuRcvMeutWbTJBL-lkQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 39818800CA5 for ; Wed, 29 May 2024 10:19:17 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.192.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id BEA6028E5; Wed, 29 May 2024 10:19:16 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v3 09/11] iov: remove iov_copy() Date: Wed, 29 May 2024 12:19:07 +0200 Message-ID: <20240529101909.1120078-10-lvivier@redhat.com> In-Reply-To: <20240529101909.1120078-1-lvivier@redhat.com> References: <20240529101909.1120078-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: 6SYNBUC7T6WIS4RFKGIOLGJFBSYEENC3 X-Message-ID-Hash: 6SYNBUC7T6WIS4RFKGIOLGJFBSYEENC3 X-MailFrom: lvivier@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: it was needed by a draft version of vhost-user, it is not needed anymore. Signed-off-by: Laurent Vivier --- iov.c | 39 --------------------------------------- iov.h | 3 --- 2 files changed, 42 deletions(-) diff --git a/iov.c b/iov.c index 52a7c014a171..3f9e229a305f 100644 --- a/iov.c +++ b/iov.c @@ -156,42 +156,3 @@ size_t iov_size(const struct iovec *iov, size_t iov_cnt) return len; } - -/** - * iov_copy - Copy data from one scatter/gather I/O vector (struct iovec) to - * another. - * - * @dst_iov: Pointer to the destination array of struct iovec describing - * the scatter/gather I/O vector to copy to. - * @dst_iov_cnt: Number of elements in the destination iov array. - * @iov: Pointer to the source array of struct iovec describing - * the scatter/gather I/O vector to copy from. - * @iov_cnt: Number of elements in the source iov array. - * @offset: Offset within the source iov from where copying should start. - * @bytes: Total number of bytes to copy from iov to dst_iov. - * - * Returns: The number of elements successfully copied to the destination - * iov array. - */ -/* cppcheck-suppress unusedFunction */ -unsigned iov_copy(struct iovec *dst_iov, size_t dst_iov_cnt, - const struct iovec *iov, size_t iov_cnt, - size_t offset, size_t bytes) -{ - unsigned int i, j; - - i = iov_skip_bytes(iov, iov_cnt, offset, &offset); - - /* copying data */ - for (j = 0; i < iov_cnt && j < dst_iov_cnt && bytes; i++) { - size_t len = MIN(bytes, iov[i].iov_len - offset); - - dst_iov[j].iov_base = (char *)iov[i].iov_base + offset; - dst_iov[j].iov_len = len; - j++; - bytes -= len; - offset = 0; - } - - return j; -} diff --git a/iov.h b/iov.h index 5668ca5f93bc..a9e1722713b3 100644 --- a/iov.h +++ b/iov.h @@ -28,7 +28,4 @@ size_t iov_from_buf(const struct iovec *iov, size_t iov_cnt, size_t iov_to_buf(const struct iovec *iov, size_t iov_cnt, size_t offset, void *buf, size_t bytes); size_t iov_size(const struct iovec *iov, size_t iov_cnt); -unsigned iov_copy(struct iovec *dst_iov, size_t dst_iov_cnt, - const struct iovec *iov, size_t iov_cnt, - size_t offset, size_t bytes); #endif /* IOVEC_H */ -- 2.44.0