From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758219AbcH3LAl (ORCPT ); Tue, 30 Aug 2016 07:00:41 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36465 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758194AbcH3LAg (ORCPT ); Tue, 30 Aug 2016 07:00:36 -0400 From: wei.guo.simon@gmail.com To: linux-mm@kvack.org Cc: Alexey Klimov , Andrew Morton , Eric B Munson , Geert Uytterhoeven , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Mel Gorman , Michal Hocko , Shuah Khan , Simon Guo , Thierry Reding , Vlastimil Babka Subject: [PATCH 3/4] selftest: split mlock2_ funcs into separate mlock2.h Date: Tue, 30 Aug 2016 18:59:40 +0800 Message-Id: <1472554781-9835-4-git-send-email-wei.guo.simon@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1472554781-9835-1-git-send-email-wei.guo.simon@gmail.com> References: <1472554781-9835-1-git-send-email-wei.guo.simon@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Simon Guo To prepare mlock2.h whose functionality will be reused. Signed-off-by: Simon Guo --- tools/testing/selftests/vm/mlock2-tests.c | 21 +-------------------- tools/testing/selftests/vm/mlock2.h | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 20 deletions(-) create mode 100644 tools/testing/selftests/vm/mlock2.h diff --git a/tools/testing/selftests/vm/mlock2-tests.c b/tools/testing/selftests/vm/mlock2-tests.c index 02ca5e0..7cb13ce 100644 --- a/tools/testing/selftests/vm/mlock2-tests.c +++ b/tools/testing/selftests/vm/mlock2-tests.c @@ -7,27 +7,8 @@ #include #include #include -#include -#include #include - -#ifndef MLOCK_ONFAULT -#define MLOCK_ONFAULT 1 -#endif - -#ifndef MCL_ONFAULT -#define MCL_ONFAULT (MCL_FUTURE << 1) -#endif - -static int mlock2_(void *start, size_t len, int flags) -{ -#ifdef __NR_mlock2 - return syscall(__NR_mlock2, start, len, flags); -#else - errno = ENOSYS; - return -1; -#endif -} +#include "mlock2.h" struct vm_boundaries { unsigned long start; diff --git a/tools/testing/selftests/vm/mlock2.h b/tools/testing/selftests/vm/mlock2.h new file mode 100644 index 0000000..b9c6d9f --- /dev/null +++ b/tools/testing/selftests/vm/mlock2.h @@ -0,0 +1,20 @@ +#include +#include + +#ifndef MLOCK_ONFAULT +#define MLOCK_ONFAULT 1 +#endif + +#ifndef MCL_ONFAULT +#define MCL_ONFAULT (MCL_FUTURE << 1) +#endif + +static int mlock2_(void *start, size_t len, int flags) +{ +#ifdef __NR_mlock2 + return syscall(__NR_mlock2, start, len, flags); +#else + errno = ENOSYS; + return -1; +#endif +} -- 1.8.3.1