From patchwork Tue Oct 8 16:22:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 175521 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp5922008ill; Tue, 8 Oct 2019 09:26:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxqzSchXIeAvhMMoXISvCSw4jhkG9uYwQ3IAHiLtPipAg85brXbUUgBIAmJRns+iM9TSbm X-Received: by 2002:a92:874e:: with SMTP id d14mr35765244ilm.143.1570551979425; Tue, 08 Oct 2019 09:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570551979; cv=none; d=google.com; s=arc-20160816; b=HEaJ+X9Tf1+s+oaW/eiplPKs9A/lSx32qGZmorE7F+rRo9Z6yu6mK2oVBFOYDhsEjk EfarIhk2egSaa7QFGG4ubTcpmps0+5LeFnBhOR/QrDSisuzJBsHUlIURPIIu5BZ+b3z2 2O5ABA/Q5U238aJ9kJMNra2rv9dHlfAKqvNIbfHqKKXi0xT+VcuoEwlIYAUw4wCaQqG7 G2YelZgdUna+EK7AO7I2kSxI+bHfEvAR8QzSxaQLmE0qjnYz1zxR+whVqRPFKUVR8Agy rtqdpRREvZOwNGn756Say0pDKfxNoHg1znAkUPQ2Q1l9fSFO++9AcOZg+513mGJ1ENhk 1NNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=Dd8jK9a0djnug3cCApq9cS+sKMdt1Qm9VvtLBohWghA=; b=lMdcdYV4G9o/glKVRnea0qtIzYybeOYp5HF/tGOlj7u5rM5ioIAxnN1dp74afd2S5O EAM/0sdJrmrpoamZGIAsYy0a3WDpUZKXfQNjNNVNCvrVdFgjvxGB4Ljnyz+I2chAqsEo CgyvhUiCs9SVpOkNrXINcoP71VlyWt/QXwEk3ck+Rl5Qq0RDta99wwZ7Dl86ve5E+rum /Jf7U1pMFeoof0vRc5EG+O7P5SLeot8qrQ5z/wohBmGiGmx3l89x6p5qw1d194Ylfuxj 5i49HNQdpM7EUqymBXBfiH0YrifZUZTMm4E3DwhepQ4Jatg62CoQgBjA6hLi/4QWdMo4 aB9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id d7si20970538ilq.7.2019.10.08.09.26.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2019 09:26:19 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A18C300CB26; Tue, 8 Oct 2019 16:26:18 +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 0E7A660605; Tue, 8 Oct 2019 16:26:18 +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 B40AA180B536; Tue, 8 Oct 2019 16:26:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x98GM0wB008672 for ; Tue, 8 Oct 2019 12:22:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6434360606; Tue, 8 Oct 2019 16:22:00 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.bos.redhat.com (dhcp-17-175.bos.redhat.com [10.18.17.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id F026F60605; Tue, 8 Oct 2019 16:21:59 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 8 Oct 2019 12:22:23 -0400 Message-Id: <5089cd02580c6438fce7e6c1d731a2ca65d4221b.1570551720.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: christian.ehrhardt@canonical.com Subject: [libvirt] [PATCH 3/7] security: apparmor: Drop disk_foreach_iterator 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 08 Oct 2019 16:26:18 +0000 (UTC) There's only one caller, so open code the file_add_path behavior Signed-off-by: Cole Robinson --- src/security/virt-aa-helper.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) -- 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 511443dd3e..7148e3c760 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -914,9 +914,8 @@ static int add_file_path(virDomainDiskDefPtr disk, const char *path, size_t depth, - void *opaque) + virBufferPtr buf) { - virBufferPtr buf = opaque; int ret; if (depth == 0) { @@ -935,19 +934,9 @@ add_file_path(virDomainDiskDefPtr disk, } -typedef int (*disk_foreach_iterator)(virDomainDiskDefPtr disk, - const char *path, - size_t depth, - void *opaque); - - -/* Call iter(disk, name, depth, opaque) for each element of disk and - * its backing chain in the pre-populated disk->src.backingStore. - */ static int -disk_foreach_path(virDomainDiskDefPtr disk, - disk_foreach_iterator iter, - void *opaque) +disk_add_files(virDomainDiskDefPtr disk, + virBufferPtr buf) { size_t depth = 0; virStorageSourcePtr tmp; @@ -956,7 +945,7 @@ disk_foreach_path(virDomainDiskDefPtr disk, /* execute the callback only for local storage */ if (virStorageSourceIsLocalStorage(tmp) && tmp->path) { - if (iter(disk, tmp->path, depth, opaque) < 0) + if (add_file_path(disk, tmp->path, depth, buf) < 0) return -1; } @@ -1006,7 +995,7 @@ get_files(vahControl * ctl) /* XXX should handle open errors more careful than just ignoring them. */ - if (disk_foreach_path(disk, add_file_path, &buf) < 0) + if (disk_add_files(disk, &buf) < 0) goto cleanup; }