From nobody Mon May 13 23:54:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1621146230; cv=none; d=zohomail.com; s=zohoarc; b=FLN6MoHWIwKQlpmDhgEOjnPviGwkMGSlRWXm9dI/7h9oFaC5kcdD9YQrQ/sTorV4Ib0MHtSSZqbKkwbrWelELVLriyjyIHtRsi7QnQ/djQ9ZVpAsyhJDYhEna6khGi04fKWJcKYiFxrW9dLvmb2m0Zuqz6mJy3zlZX9eiAAlYFU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621146230; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=jVm5J5W8apYPXwmjXROAZ7dgvkNcjpDki0mL/YyJe/w=; b=O58B5322jMlah5YA8l78s9jZWsQVuQYfBsVkF5pH3AxUgErpVtY5lRLBH+6RVoZKS4vnA9SexqOiz+R32dOtfVCOqzHJF1MhhWVhifunRPMXxm/2tcF1lqYaKpsawUe96/Sjm/pjuK3NM1lbzSfu4/SwiBorl9pyDWUpej8ZTGs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1621146230890651.3437042460798; Sat, 15 May 2021 23:23:50 -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-297-EtKpad84OiSFDg2vbKPx1A-1; Sun, 16 May 2021 02:23:47 -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 76FE01007476; Sun, 16 May 2021 06:23:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F6DB18A9E; Sun, 16 May 2021 06:23:39 +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 32F531800BBE; Sun, 16 May 2021 06:23:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14G6NWER005887 for ; Sun, 16 May 2021 02:23:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9808B21602A4; Sun, 16 May 2021 06:23:32 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9365B215744E for ; Sun, 16 May 2021 06:23:29 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C25FE833942 for ; Sun, 16 May 2021 06:23:29 +0000 (UTC) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-108-Nf3WaV_TOQmENSMcIxvQmg-1; Sun, 16 May 2021 02:23:27 -0400 Received: by mail-pl1-f169.google.com with SMTP id h20so1512328plr.4 for ; Sat, 15 May 2021 23:23:26 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.246]) by smtp.gmail.com with ESMTPSA id i5sm7034935pfd.159.2021.05.15.23.23.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 May 2021 23:23:25 -0700 (PDT) X-MC-Unique: EtKpad84OiSFDg2vbKPx1A-1 X-MC-Unique: Nf3WaV_TOQmENSMcIxvQmg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jVm5J5W8apYPXwmjXROAZ7dgvkNcjpDki0mL/YyJe/w=; b=X1MjKzpxCDvSlkjuSG5iVHSj5VSngqCtu4cJhNv+e60DtPz491HDEoHcswOvoG+GaT p97c1Kphh9gSJu0so4lwTRMTvh3vvXfAdBWcvY3O+CbmjhC3KSz6LEUl2K11qI+/dWqk EbN9kRupY/tppSvc0cRp8XcNVlL+JHqKb2ArAvQ1BkANorLv8X9roWD1rv9Q/8Clv1Ls //MoC/+ih4SXpIv9CMOTzmHyyQa7+rInPbCxYQfTW5hiVgRVyOi25j+l2YY10adF545b nMUrKkIbRqmA9SCNYEcp8Ezfs/02oac6cpPZ/LBPqDXWUd8U431T3mtPmra95Cm7+Nt9 yahQ== X-Gm-Message-State: AOAM532uAa8ZYIWi+ve6xfJr8G6WsoNn2PXe/IMcZdAmAJIZ8hWPhyW/ DQbmiJaz1L0UTq+Jrggv/Y/Hj6WUiOeOZA== X-Google-Smtp-Source: ABdhPJycDC1KnhwrZioBbsHFWTJ4Jco+NkAWabl+e896DNTYR3M+IvJZ+6GKAtnCbAO6Hf2FrsD1CA== X-Received: by 2002:a17:90a:4404:: with SMTP id s4mr20125496pjg.218.1621146205583; Sat, 15 May 2021 23:23:25 -0700 (PDT) From: peili X-Google-Original-From: peili To: libvir-list@redhat.com Subject: [PATCH] Delete forward declaration in storage_backend_sheepdog.c. Date: Sun, 16 May 2021 14:23:07 +0800 Message-Id: <20210516062307.83106-1-peili@andrew.cmu.edu> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: peili 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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" --- src/storage/storage_backend_sheepdog.c | 99 +++++++++++++------------- 1 file changed, 48 insertions(+), 51 deletions(-) diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_b= ackend_sheepdog.c index 6490dfae52..6b000ff9b8 100644 --- a/src/storage/storage_backend_sheepdog.c +++ b/src/storage/storage_backend_sheepdog.c @@ -35,11 +35,54 @@ =20 #define VIR_FROM_THIS VIR_FROM_STORAGE =20 -static int virStorageBackendSheepdogRefreshVol(virStoragePoolObj *pool, - virStorageVolDef *vol); +static void +virStorageBackendSheepdogAddHostArg(virCommand *cmd, + virStoragePoolObj *pool) +{ + virStoragePoolDef *def =3D virStoragePoolObjGetDef(pool); + const char *address =3D "localhost"; + int port =3D 7000; + if (def->source.nhost > 0) { + if (def->source.hosts[0].name !=3D NULL) + address =3D def->source.hosts[0].name; + if (def->source.hosts[0].port) + port =3D def->source.hosts[0].port; + } + virCommandAddArg(cmd, "-a"); + virCommandAddArgFormat(cmd, "%s", address); + virCommandAddArg(cmd, "-p"); + virCommandAddArgFormat(cmd, "%d", port); +} + + +static int +virStorageBackendSheepdogRefreshVol(virStoragePoolObj *pool, + virStorageVolDef *vol) +{ + char *output =3D NULL; + virStoragePoolDef *def =3D virStoragePoolObjGetDef(pool); + g_autoptr(virCommand) cmd =3D NULL; + + cmd =3D virCommandNewArgList(SHEEPDOGCLI, "vdi", "list", vol->name, "-= r", NULL); + virStorageBackendSheepdogAddHostArg(cmd, pool); + virCommandSetOutputBuffer(cmd, &output); + if (virCommandRun(cmd, NULL) < 0) + return -1; + + if (virStorageBackendSheepdogParseVdiList(vol, output) < 0) + return -1; + + vol->type =3D VIR_STORAGE_VOL_NETWORK; + + VIR_FREE(vol->key); + vol->key =3D g_strdup_printf("%s/%s", def->source.name, vol->name); + + VIR_FREE(vol->target.path); + vol->target.path =3D g_strdup(vol->name); + + return 0; +} =20 -void virStorageBackendSheepdogAddHostArg(virCommand *cmd, - virStoragePoolObj *pool); =20 int virStorageBackendSheepdogParseNodeInfo(virStoragePoolDef *pool, @@ -88,24 +131,6 @@ virStorageBackendSheepdogParseNodeInfo(virStoragePoolDe= f *pool, return -1; } =20 -void -virStorageBackendSheepdogAddHostArg(virCommand *cmd, - virStoragePoolObj *pool) -{ - virStoragePoolDef *def =3D virStoragePoolObjGetDef(pool); - const char *address =3D "localhost"; - int port =3D 7000; - if (def->source.nhost > 0) { - if (def->source.hosts[0].name !=3D NULL) - address =3D def->source.hosts[0].name; - if (def->source.hosts[0].port) - port =3D def->source.hosts[0].port; - } - virCommandAddArg(cmd, "-a"); - virCommandAddArgFormat(cmd, "%s", address); - virCommandAddArg(cmd, "-p"); - virCommandAddArgFormat(cmd, "%d", port); -} =20 static int virStorageBackendSheepdogAddVolume(virStoragePoolObj *pool, const char *di= skInfo) @@ -134,6 +159,7 @@ virStorageBackendSheepdogAddVolume(virStoragePoolObj *p= ool, const char *diskInfo return 0; } =20 + static int virStorageBackendSheepdogRefreshAllVol(virStoragePoolObj *pool) { @@ -310,34 +336,6 @@ virStorageBackendSheepdogParseVdiList(virStorageVolDef= *vol, return -1; } =20 -static int -virStorageBackendSheepdogRefreshVol(virStoragePoolObj *pool, - virStorageVolDef *vol) -{ - char *output =3D NULL; - virStoragePoolDef *def =3D virStoragePoolObjGetDef(pool); - g_autoptr(virCommand) cmd =3D NULL; - - cmd =3D virCommandNewArgList(SHEEPDOGCLI, "vdi", "list", vol->name, "-= r", NULL); - virStorageBackendSheepdogAddHostArg(cmd, pool); - virCommandSetOutputBuffer(cmd, &output); - if (virCommandRun(cmd, NULL) < 0) - return -1; - - if (virStorageBackendSheepdogParseVdiList(vol, output) < 0) - return -1; - - vol->type =3D VIR_STORAGE_VOL_NETWORK; - - VIR_FREE(vol->key); - vol->key =3D g_strdup_printf("%s/%s", def->source.name, vol->name); - - VIR_FREE(vol->target.path); - vol->target.path =3D g_strdup(vol->name); - - return 0; -} - =20 static int virStorageBackendSheepdogResizeVol(virStoragePoolObj *pool, @@ -356,7 +354,6 @@ virStorageBackendSheepdogResizeVol(virStoragePoolObj *p= ool, } =20 =20 - virStorageBackend virStorageBackendSheepdog =3D { .type =3D VIR_STORAGE_POOL_SHEEPDOG, =20 --=20 2.20.1