From patchwork Thu Oct 17 18:07:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Maguire X-Patchwork-Id: 11196797 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 579011575 for ; Thu, 17 Oct 2019 18:09:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36FAE21925 for ; Thu, 17 Oct 2019 18:09:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="q1nmY7kg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437997AbfJQSJ0 (ORCPT ); Thu, 17 Oct 2019 14:09:26 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:58382 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395417AbfJQSJZ (ORCPT ); Thu, 17 Oct 2019 14:09:25 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9HI4A6o143655; Thu, 17 Oct 2019 18:08:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2019-08-05; bh=R7ga5CIYQVpUkfRKUAEufFb82t96tNzBlSD59pwtVOo=; b=q1nmY7kgncqSrJdGS/gSa00vifHZBQhk0fZ8oUVWKM+kfp8EvWeKVNqFNQ9lu+i0RJpu QxcmB7rieEhAC0kpMBuDvRnJjRvKF0BxcamuIrwluSP+/Xdh0uCjqtP2xYHg0uwGh3iy 450envKAK+HrXueDLwtkoY1FzjnDXYkzw0k4JLOsyY86DAP0ewjPGB+GkolMMq903DEZ 2I2NHisWyV/wlbHvn9HNv3iGZWW80Kmb3KWPX2N5AZAZ/OYRrPQgw3liteNGx7+MjfWE lWUMaQ3JejjYhfJpZtNkKF/xmhNB/D4dyFarfIH+cfPpsn3BC9VFmvQOkY46ixBzZxiQ kQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2vk6sr051p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2019 18:08:03 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9HI80kh178282; Thu, 17 Oct 2019 18:08:02 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 2vpcm3bvpx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2019 18:08:02 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x9HI7mWV021886; Thu, 17 Oct 2019 18:07:48 GMT Received: from dhcp-10-175-161-223.vpn.oracle.com (/10.175.161.223) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 17 Oct 2019 18:07:44 +0000 From: Alan Maguire To: brendanhiggins@google.com, linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, keescook@chromium.org, yzaikin@google.com, akpm@linux-foundation.org, yamada.masahiro@socionext.com, catalin.marinas@arm.com, joe.lawrence@redhat.com, penguin-kernel@i-love.sakura.ne.jp, schowdary@nvidia.com, urezki@gmail.com, andriy.shevchenko@linux.intel.com, corbet@lwn.net, linux-doc@vger.kernel.org, Alan Maguire Subject: [PATCH v3 linux-kselftest-test 2/6] kunit: hide unexported try-catch interface in try-catch-impl.h Date: Thu, 17 Oct 2019 19:07:15 +0100 Message-Id: <1571335639-21675-3-git-send-email-alan.maguire@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1571335639-21675-1-git-send-email-alan.maguire@oracle.com> References: <1571335639-21675-1-git-send-email-alan.maguire@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9413 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910170164 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9413 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910170163 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org also remove unused kunit_generic_try_catch Signed-off-by: Alan Maguire Reviewed-by: Brendan Higgins --- include/kunit/try-catch.h | 10 ---------- lib/kunit/test-test.c | 1 + lib/kunit/test.c | 1 + lib/kunit/try-catch-impl.h | 23 +++++++++++++++++++++++ lib/kunit/try-catch.c | 1 + 5 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 lib/kunit/try-catch-impl.h diff --git a/include/kunit/try-catch.h b/include/kunit/try-catch.h index 404f336..c507dd4 100644 --- a/include/kunit/try-catch.h +++ b/include/kunit/try-catch.h @@ -53,11 +53,6 @@ struct kunit_try_catch { void *context; }; -void kunit_try_catch_init(struct kunit_try_catch *try_catch, - struct kunit *test, - kunit_try_catch_func_t try, - kunit_try_catch_func_t catch); - void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context); void __noreturn kunit_try_catch_throw(struct kunit_try_catch *try_catch); @@ -67,9 +62,4 @@ static inline int kunit_try_catch_get_result(struct kunit_try_catch *try_catch) return try_catch->try_result; } -/* - * Exposed for testing only. - */ -void kunit_generic_try_catch_init(struct kunit_try_catch *try_catch); - #endif /* _KUNIT_TRY_CATCH_H */ diff --git a/lib/kunit/test-test.c b/lib/kunit/test-test.c index 5ebe059..c4162a9 100644 --- a/lib/kunit/test-test.c +++ b/lib/kunit/test-test.c @@ -6,6 +6,7 @@ * Author: Brendan Higgins */ #include +#include "try-catch-impl.h" struct kunit_try_catch_test_context { struct kunit_try_catch *try_catch; diff --git a/lib/kunit/test.c b/lib/kunit/test.c index 017d4fb..49ac5fe 100644 --- a/lib/kunit/test.c +++ b/lib/kunit/test.c @@ -11,6 +11,7 @@ #include #include #include "string-stream-impl.h" +#include "try-catch-impl.h" static void kunit_set_failure(struct kunit *test) { diff --git a/lib/kunit/try-catch-impl.h b/lib/kunit/try-catch-impl.h new file mode 100644 index 0000000..aa11e46 --- /dev/null +++ b/lib/kunit/try-catch-impl.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * An API to allow a function, that may fail, to be executed, and recover in a + * controlled manner. + * + * Copyright (C) 2019, Google LLC. + * Author: Brendan Higgins + */ + +#ifndef _KUNIT_TRY_CATCH_IMPL_H +#define _KUNIT_TRY_CATCH_IMPL_H + +#include +#include + +struct kunit; + +void kunit_try_catch_init(struct kunit_try_catch *try_catch, + struct kunit *test, + kunit_try_catch_func_t try, + kunit_try_catch_func_t catch); + +#endif /* _KUNIT_TRY_CATCH_IMPL_H */ diff --git a/lib/kunit/try-catch.c b/lib/kunit/try-catch.c index 55686839..0c4c90c 100644 --- a/lib/kunit/try-catch.c +++ b/lib/kunit/try-catch.c @@ -13,6 +13,7 @@ #include #include #include +#include "try-catch-impl.h" void __noreturn kunit_try_catch_throw(struct kunit_try_catch *try_catch) {