From patchwork Mon Jul 1 11:02:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grigorii Nazarov X-Patchwork-Id: 1954596 X-Patchwork-Delegate: i.maximets@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=e7VoHN5T; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WCNSl4XYsz1xpf for ; Mon, 1 Jul 2024 21:03:35 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 55FAF40237; Mon, 1 Jul 2024 11:03:32 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id xBM_I6cJQ6pQ; Mon, 1 Jul 2024 11:03:31 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 399E6400F7 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=e7VoHN5T Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 399E6400F7; Mon, 1 Jul 2024 11:03:31 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0D629C002B; Mon, 1 Jul 2024 11:03:31 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 738C3C002B for ; Mon, 1 Jul 2024 11:03:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 48ECE4077D for ; Mon, 1 Jul 2024 11:03:29 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id wiJ8ePuR_70f for ; Mon, 1 Jul 2024 11:03:28 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::52f; helo=mail-pg1-x52f.google.com; envelope-from=whitecrowbar@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 69557406A0 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 69557406A0 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by smtp4.osuosl.org (Postfix) with ESMTPS id 69557406A0 for ; Mon, 1 Jul 2024 11:03:28 +0000 (UTC) Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-6eab07ae82bso1522422a12.3 for ; Mon, 01 Jul 2024 04:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719831807; x=1720436607; darn=openvswitch.org; 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=wODiokJ2BGT70Nmn/pihxQdFtiJV/UhKHRacylw3irA=; b=e7VoHN5TfdIxNo0Wa+DV39jNEjXCMrEXatxSk3GvRgC1Gp3BDGovg/Q78xM8njYb3y jiXefGkSANFQikZa7gRBjlkvK/YtA8cekEpRfG/Z63p9j2NM8mUkCHtYvuI6yOOOUCB7 oL4VcZCUZa4Gk2Xzs0e9gJYHHj/Bjb0/fgSEPIuKN5nZWdA9ez28WDPegazAAhBT08nv YswNSnyV8hBE4QGYl2powZcSZxXj1Zm+nhklkwIqs9Ko/k1/chH0IoMU2y1Kt3he8keZ nGlODM3u0NSvN01Ju8Z7mDcvoJyZWj+veSWV0AXETZ2TG9WZ7Jcq9P1D8ZH0OtpUJ0S2 5Ywg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719831807; x=1720436607; 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=wODiokJ2BGT70Nmn/pihxQdFtiJV/UhKHRacylw3irA=; b=Uo+ZBIBLG5yc8o7r/SqWcw4sad5E6uCfKMpyoR82JeqOLy200Z1mhi0RaQroBjA2wn SscpDRscB9O3TqHen9h1/0C9TQ61ycPtVv0D7batR4hPcPE5gLu/aI2+UHV+QWfKgq5l oPKrvZaeyP1n+IxZahigMp4lX9/k0YYo1k8n8j8+DCqB1JxRSfgiodXym0UnRw7OaEA4 DDglTuSFB5tb9Xey9Qzv9x2IunProR2iESv/03ggr0qJ6nxuHoL11kcoCQgDYjmTUlOG TjbhIiTdzw4N+dzkbq4KsXV53k5Ydomi82FES4x99vJmOVvf1m8ECBtPBzg5eZpWaB6F W9ZA== X-Gm-Message-State: AOJu0YzbTwtS9Q3UF27pLtcLnT1LVjHbgkRQpLxWX+F2DPywH04deSVE SJBc4fI1Ew2k/WVUFiU6+LBmRQt8nMF+blhUtLSWO8FR3mC81VuxfCmAJw== X-Google-Smtp-Source: AGHT+IFIthf2R2WXubvQb6BVuBS50H2tDBEjRuvxD+c6G+uqU/Ls0Gbhd2HUFVlwxYwdvFq4Z3w3ug== X-Received: by 2002:a05:6a20:2588:b0:1bd:2520:c595 with SMTP id adf61e73a8af0-1bef61254admr4376190637.31.1719831807083; Mon, 01 Jul 2024 04:03:27 -0700 (PDT) Received: from localhost.localdomain ([2800:a4:c085:3c00:fc5d:c1e4:e9f9:4262]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2c91ce433cbsm6567603a91.18.2024.07.01.04.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 04:03:26 -0700 (PDT) From: Grigorii Nazarov To: dev@openvswitch.org Date: Mon, 1 Jul 2024 14:02:46 +0300 Message-ID: <20240701110257.1052377-2-whitecrowbar@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240701110257.1052377-1-whitecrowbar@gmail.com> References: <20240620085906.153885-1-whitecrowbar@gmail.com> <20240701110257.1052377-1-whitecrowbar@gmail.com> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH v5 1/3] ovsdb: Simplify UUID formatting code. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Grigorii Nazarov Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Grigorii Nazarov --- v2: fixed title v4: changed patch number from 2/4 to 1/3 lib/ovsdb-data.c | 8 +------- lib/uuid.h | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/ovsdb-data.c b/lib/ovsdb-data.c index abb923ad8..defb048d7 100644 --- a/lib/ovsdb-data.c +++ b/lib/ovsdb-data.c @@ -2582,14 +2582,8 @@ char * ovsdb_data_row_name(const struct uuid *uuid) { char *name; - char *p; - name = xasprintf("row"UUID_FMT, UUID_ARGS(uuid)); - for (p = name; *p != '\0'; p++) { - if (*p == '-') { - *p = '_'; - } - } + name = xasprintf(UUID_ROW_FMT, UUID_ARGS(uuid)); return name; } diff --git a/lib/uuid.h b/lib/uuid.h index fa49354f6..6a8069f68 100644 --- a/lib/uuid.h +++ b/lib/uuid.h @@ -34,6 +34,7 @@ extern "C" { */ #define UUID_LEN 36 #define UUID_FMT "%08x-%04x-%04x-%04x-%04x%08x" +#define UUID_ROW_FMT "row%08x_%04x_%04x_%04x_%04x%08x" #define UUID_ARGS(UUID) \ ((unsigned int) ((UUID)->parts[0])), \ ((unsigned int) ((UUID)->parts[1] >> 16)), \