From nobody Sat Feb 7 10:08:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1596822280; cv=none; d=zohomail.com; s=zohoarc; b=GNcxkXpYhSeMP6QPyOFKwz5V2RMy6UXmP7oLUdWBkIhvCDDqx/G+UdEXCrVvoIRUK0B0oXaOrDDPlqzJQflYzRrrF97Nn4LV3kDbM0vXcLIct0AQ/5ZSHgYEP5kqcuSdiU3Y/jvSEsV4quttNkLh4JlcMbqNZ/ZWLgza1caa2us= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596822280; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=51rnCE45QbNnaoGmokqjLMZ9MUxmsJXKbo8zLYcyegI=; b=B00BgoxlR8NjjSIACPkKDwomBdE9kDUYRtwb+G+8Ok8FNdXZ8R7hVM7Pg9AcY2T0z4lfOYooOg5wvOnx2h7p3gREDGEnO/nf5VtF1zKESZ21r7OW7RXvKhIc9qCsiE0Xjy+L2HejD6ccsX7c92/gE/5I9ISPVI2c2t7vKYSwvlU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 15968222805431015.4487208828467; Fri, 7 Aug 2020 10:44:40 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-87-RDVLMK6DM5uTYYPSeUW4rQ-1; Fri, 07 Aug 2020 13:44:36 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 85CC2800474; Fri, 7 Aug 2020 17:44:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65E4987A6F; Fri, 7 Aug 2020 17:44:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 34C41A552E; Fri, 7 Aug 2020 17:44:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 077HfAao017680 for ; Fri, 7 Aug 2020 13:41:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C3A55D9E8; Fri, 7 Aug 2020 17:41:10 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58B0F5D9D5; Fri, 7 Aug 2020 17:41:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596822279; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=51rnCE45QbNnaoGmokqjLMZ9MUxmsJXKbo8zLYcyegI=; b=KDHUrhGXZB1VO+2/O8F6AFyrp2H0TB8XC9BRGfu5fhCxeOKPmPtnnODFFS3v96nCzGR7Sa geLUB+CVRrXF7TyGIE+3+l4mde/3O4S8uEmPTnBuiJglkPWmSs+xJQ12ArpCmzFFG7wDKV 3o7T9Q0K3C2WP1cCAqfLJuOLRzRlwco= X-MC-Unique: RDVLMK6DM5uTYYPSeUW4rQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v4 04/11] remote: split out function for parsing URI scheme Date: Fri, 7 Aug 2020 18:40:52 +0100 Message-Id: <20200807174059.312786-5-berrange@redhat.com> In-Reply-To: <20200807174059.312786-1-berrange@redhat.com> References: <20200807174059.312786-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The remoteSplitURISCheme method will be needed by source files beyond the remote driver client. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/remote/remote_driver.c | 25 ------------------------- src/remote/remote_sockets.c | 28 ++++++++++++++++++++++++++++ src/remote/remote_sockets.h | 6 ++++++ 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index b214632bdf..8952484b8e 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -165,31 +165,6 @@ static void make_nonnull_domain_snapshot(remote_nonnul= l_domain_snapshot *snapsho /*----------------------------------------------------------------------*/ =20 /* Helper functions for remoteOpen. */ -static int remoteSplitURIScheme(virURIPtr uri, - char **driver, - char **transport) -{ - char *p =3D strchr(uri->scheme, '+'); - - *driver =3D *transport =3D NULL; - - if (p) - *driver =3D g_strndup(uri->scheme, p - uri->scheme); - else - *driver =3D g_strdup(uri->scheme); - - if (p) { - *transport =3D g_strdup(p + 1); - - p =3D *transport; - while (*p) { - *p =3D g_ascii_tolower(*p); - p++; - } - } - - return 0; -} =20 =20 static int diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c index 0662cbad14..976124d0ed 100644 --- a/src/remote/remote_sockets.c +++ b/src/remote/remote_sockets.c @@ -37,3 +37,31 @@ VIR_ENUM_IMPL(remoteDriverMode, "auto", "legacy", "direct"); + + +int +remoteSplitURIScheme(virURIPtr uri, + char **driver, + char **transport) +{ + char *p =3D strchr(uri->scheme, '+'); + + *driver =3D *transport =3D NULL; + + if (p) + *driver =3D g_strndup(uri->scheme, p - uri->scheme); + else + *driver =3D g_strdup(uri->scheme); + + if (p) { + *transport =3D g_strdup(p + 1); + + p =3D *transport; + while (*p) { + *p =3D g_ascii_tolower(*p); + p++; + } + } + + return 0; +} diff --git a/src/remote/remote_sockets.h b/src/remote/remote_sockets.h index 1d4ae3f9c1..bef3cdada9 100644 --- a/src/remote/remote_sockets.h +++ b/src/remote/remote_sockets.h @@ -21,6 +21,7 @@ #pragma once =20 #include "virenum.h" +#include "viruri.h" =20 typedef enum { REMOTE_DRIVER_TRANSPORT_TLS, @@ -48,3 +49,8 @@ typedef enum { } remoteDriverMode; =20 VIR_ENUM_DECL(remoteDriverMode); + +int +remoteSplitURIScheme(virURIPtr uri, + char **driver, + char **transport); --=20 2.26.2