From patchwork Mon Jun 22 00:44:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1314028 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49qrKx0sLgz9sRR for ; Mon, 22 Jun 2020 10:45:25 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=Vdx71poP; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49qrKw6xdhzDqbv for ; Mon, 22 Jun 2020 10:45:24 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49qrKh05wFzDqbY for ; Mon, 22 Jun 2020 10:45:12 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=Vdx71poP; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 49qrKg5Hnzz9sRN; Mon, 22 Jun 2020 10:45:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1592786711; bh=X7q3Ye6fLUTox/dicmjA+AcM+m/Q8YavK+A2itHznUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vdx71poPIQB1DiQmvVS2wD/gdqWqMBR8T9apMppNR7qKM5TTKNy8+KL4M4kc5CGLO 7NMLueaqfdWjBl/E/Oc/0OiRty49qqu6/LFGLrJx92gEBWZsZBx5EJNXh9gp1G12I2 +AMYbmwkXGKM5WFMlrfo66yINbLYBGh67F/QfOEhgXdA1BLTaDncWUHnBdVgzWVvo6 4sxBj6a3/PkHdaqOpwVlsHB9OjNT9hVXzZtnn18gCZZfNstvrVZ4dCRJpzyHQTb7Li w/IzDC5HjbjiPEq8gX+O4BoGM5r7G/8THHuh3t6Qny1XGZ8bvOIV+OIYRpG8V3nPVZ rZ1706SHxclkQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Mon, 22 Jun 2020 10:44:55 +1000 Message-Id: <20200622004501.12889-4-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200622004501.12889-1-amitay@ozlabs.org> References: <20200622004501.12889-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 3/9] libpdbg: Avoid direct access of class in pdbg_target X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- libpdbg/adu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libpdbg/adu.c b/libpdbg/adu.c index fe60118..6600caa 100644 --- a/libpdbg/adu.c +++ b/libpdbg/adu.c @@ -166,7 +166,7 @@ int adu_getmem(struct pdbg_target *adu_target, uint64_t start_addr, { struct mem *adu; - assert(!strcmp(adu_target->class, "mem")); + assert(pdbg_target_is_class(adu_target, "mem")); adu = target_to_mem(adu_target); return adu_read(adu, start_addr, output, size, 8, false); @@ -177,7 +177,7 @@ int adu_getmem_ci(struct pdbg_target *adu_target, uint64_t start_addr, { struct mem *adu; - assert(!strcmp(adu_target->class, "mem")); + assert(pdbg_target_is_class(adu_target, "mem")); adu = target_to_mem(adu_target); return adu_read(adu, start_addr, output, size, 8, true); @@ -188,7 +188,7 @@ int adu_getmem_io(struct pdbg_target *adu_target, uint64_t start_addr, { struct mem *adu; - assert(!strcmp(adu_target->class, "mem")); + assert(pdbg_target_is_class(adu_target, "mem")); adu = target_to_mem(adu_target); /* There is no equivalent for cachable memory as blocksize @@ -201,7 +201,7 @@ int __adu_getmem(struct pdbg_target *adu_target, uint64_t start_addr, { struct mem *adu; - assert(!strcmp(adu_target->class, "mem")); + assert(pdbg_target_is_class(adu_target, "mem")); adu = target_to_mem(adu_target); return adu_read(adu, start_addr, output, size, 8, ci); @@ -250,7 +250,7 @@ int adu_putmem(struct pdbg_target *adu_target, uint64_t start_addr, { struct mem *adu; - assert(!strcmp(adu_target->class, "mem")); + assert(pdbg_target_is_class(adu_target, "mem")); adu = target_to_mem(adu_target); return adu_write(adu, start_addr, input, size, 8, false); @@ -261,7 +261,7 @@ int adu_putmem_ci(struct pdbg_target *adu_target, uint64_t start_addr, { struct mem *adu; - assert(!strcmp(adu_target->class, "mem")); + assert(pdbg_target_is_class(adu_target, "mem")); adu = target_to_mem(adu_target); return adu_write(adu, start_addr, input, size, 8, true); @@ -272,7 +272,7 @@ int adu_putmem_io(struct pdbg_target *adu_target, uint64_t start_addr, { struct mem *adu; - assert(!strcmp(adu_target->class, "mem")); + assert(pdbg_target_is_class(adu_target, "mem")); adu = target_to_mem(adu_target); return adu_write(adu, start_addr, input, size, block_size, true); @@ -283,7 +283,7 @@ int __adu_putmem(struct pdbg_target *adu_target, uint64_t start_addr, { struct mem *adu; - assert(!strcmp(adu_target->class, "mem")); + assert(pdbg_target_is_class(adu_target, "mem")); adu = target_to_mem(adu_target); return adu_write(adu, start_addr, input, size, 8, ci);