From patchwork Fri Jan 30 04:27:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 44017 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 64AF624128 for ; Fri, 30 Jan 2015 04:28:50 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id h11sf616139wiw.1 for ; Thu, 29 Jan 2015 20:28:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=+mQ7kTp78akC7RGJbKDmFQWdGyetZOaBXHyL6FWNsIw=; b=O8YuUEzD0iD2sJDvuLHxMdt70SB/kxaJs/R3eIK+jQEpQGacQXLdTyoyOB9GHVkkuu YoGzBnDQKMYhKEzeBrsQczJevKqlCFt0Lhjr5PuzOKoB6sJQjdsxdLtKm50yaK6d9X14 StrTZzQD8abwYtpjUJgtbxLIEZGSw8axSDq/AShOwTQEU+m7cxAy2pXlJTH1J403bApb spj1QjjpHFy4faVUYM1PIsSuaXzcFtn77YHlYjqWTMD1mWLeabgxerRyqhST0S/uTolw P2USMnSaR0+2J7XggARUdh/bfaLGXUTCK8ZPO5DGWXqbkayoWrjWxE6wk9ZSDNOZxqnf Vssg== X-Gm-Message-State: ALoCoQn4ywxX8MC9nNFmn0hYk5ELPXl1l4H8PwDzw0kWKvB7vTzYv5vL/5cf4F21b2KTjkOXGnug X-Received: by 10.180.105.228 with SMTP id gp4mr54959wib.6.1422592129715; Thu, 29 Jan 2015 20:28:49 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.6 with SMTP id 6ls389746lai.30.gmail; Thu, 29 Jan 2015 20:28:49 -0800 (PST) X-Received: by 10.152.181.168 with SMTP id dx8mr4607815lac.76.1422592129557; Thu, 29 Jan 2015 20:28:49 -0800 (PST) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id k1si9284325laf.21.2015.01.29.20.28.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Jan 2015 20:28:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by mail-lb0-f170.google.com with SMTP id w7so34518458lbi.1 for ; Thu, 29 Jan 2015 20:28:49 -0800 (PST) X-Received: by 10.152.219.37 with SMTP id pl5mr536342lac.6.1422592129109; Thu, 29 Jan 2015 20:28:49 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp159260lbj; Thu, 29 Jan 2015 20:28:48 -0800 (PST) X-Received: by 10.224.41.6 with SMTP id m6mr6755413qae.41.1422592127878; Thu, 29 Jan 2015 20:28:47 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id c75si13002984qge.26.2015.01.29.20.28.46 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Jan 2015 20:28:47 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YH3CG-0007VY-Kc; Fri, 30 Jan 2015 04:28:44 +0000 Received: from mail-ob0-f172.google.com ([209.85.214.172]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YH3Bm-0007Nc-K5 for lng-odp@lists.linaro.org; Fri, 30 Jan 2015 04:28:14 +0000 Received: by mail-ob0-f172.google.com with SMTP id nt9so893306obb.3 for ; Thu, 29 Jan 2015 20:28:09 -0800 (PST) X-Received: by 10.202.219.215 with SMTP id s206mr2460023oig.114.1422592089332; Thu, 29 Jan 2015 20:28:09 -0800 (PST) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id x21sm4737369oix.24.2015.01.29.20.28.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jan 2015 20:28:08 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 29 Jan 2015 22:27:45 -0600 Message-Id: <1422592065-15875-10-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422592065-15875-1-git-send-email-bill.fischofer@linaro.org> References: <1422592065-15875-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [patch 9/9] linux-generic: shm: add strong typing support X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bill.fischofer@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Bill Fischofer --- platform/linux-generic/include/odp/plat/shared_memory_types.h | 7 +++++-- platform/linux-generic/odp_shared_memory.c | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/platform/linux-generic/include/odp/plat/shared_memory_types.h b/platform/linux-generic/include/odp/plat/shared_memory_types.h index c044cb9..409eb8d 100644 --- a/platform/linux-generic/include/odp/plat/shared_memory_types.h +++ b/platform/linux-generic/include/odp/plat/shared_memory_types.h @@ -18,14 +18,17 @@ extern "C" { #endif +#include +#include + /** @addtogroup odp_shared_memory ODP SHARED MEMORY * Operations on shared memory. * @{ */ -typedef uint32_t odp_shm_t; +typedef odp_handle_t odp_shm_t; -#define ODP_SHM_INVALID 0 +#define ODP_SHM_INVALID _odp_cast_scalar(odp_shm_t, 0) #define ODP_SHM_NULL ODP_SHM_INVALID /** diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c index 96d10e8..dbaec22 100644 --- a/platform/linux-generic/odp_shared_memory.c +++ b/platform/linux-generic/odp_shared_memory.c @@ -64,13 +64,13 @@ static odp_shm_table_t *odp_shm_tbl; static inline uint32_t from_handle(odp_shm_t shm) { - return shm - 1; + return _odp_typeval(shm) - 1; } static inline odp_shm_t to_handle(uint32_t index) { - return index + 1; + return _odp_cast_scalar(odp_shm_t, index + 1); }