From nobody Sat Feb 7 11:04:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1594319827; cv=none; d=zohomail.com; s=zohoarc; b=hgA/B2yFwNlaswSDPeCk64RKz8L2syCb5gEH+QoGxPqBkzYewg/ebN3Xio7DBGEmjLYjNWb8mkS/1CcCRhA3RdjWOgyoPMPVkzqINa6LDDowCoH8Y9gKwvGLNN3tYi88tRzqTKG63BULLFxkppW2kUOMzR0XP3u+J47eZcuEoV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594319827; 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=q6/6RsA3gbymAXH23aQbdE0S3FBHTl785yagJbDm+vQ=; b=iZS2AAaDitGcNwSr35YuDbmq7vLty4N14qJaovp++aK09WhQSYuHFv35YLiAOjd5QKJb5tFFTZ5TE15s44DcST+Kgja0n8Hj5Tq4PdCWXVZChbz4o4TpqSozWkgO9gzih53BAyxuv4/TLWw5OTIje8WJpa14iVdnw57bjrLqEJ0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594319827983337.65260522165624; Thu, 9 Jul 2020 11:37:07 -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-102-JmhxLHJDPnWNmYAYR8Wt4g-1; Thu, 09 Jul 2020 14:37:04 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91852107B7EB; Thu, 9 Jul 2020 18:36:58 +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 6F0EB19D7E; Thu, 9 Jul 2020 18:36:58 +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 3C1C084343; Thu, 9 Jul 2020 18:36:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 069Iauca023353 for ; Thu, 9 Jul 2020 14:36:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id A70D060C80; Thu, 9 Jul 2020 18:36:56 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6CF5560F8D; Thu, 9 Jul 2020 18:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594319826; 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=q6/6RsA3gbymAXH23aQbdE0S3FBHTl785yagJbDm+vQ=; b=fHzCUfQAQfmL8bbMx+KZKR3riCH0/qSce8KBfGCn6VoCuLEYO5qLoJ+bkxZZ2+cG1RCr2Y YbtevBG5hxX+AVZyep1iS0iyB/jGbac1W4DZLpr7JHHnU6LAccQ17B8GRTXLnK26QCELyZ P5hMXzpLCcGXP+YY/awBTRIkAxRdELI= X-MC-Unique: JmhxLHJDPnWNmYAYR8Wt4g-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/9] remote: split out function for parsing URI scheme Date: Thu, 9 Jul 2020 19:36:40 +0100 Message-Id: <20200709183646.4016586-4-berrange@redhat.com> In-Reply-To: <20200709183646.4016586-1-berrange@redhat.com> References: <20200709183646.4016586-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.84 on 10.5.11.23 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 880fce6e62..b84b72522a 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