public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V2 06/14] mem/hugetlb: convert to new API
Date: Mon, 10 Apr 2017 18:05:48 +0800	[thread overview]
Message-ID: <20170410100556.4465-7-liwang@redhat.com> (raw)
In-Reply-To: <20170410100556.4465-1-liwang@redhat.com>

Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/mem/hugetlb/lib/hugetlb.c | 19 ++++++++++---------
 testcases/kernel/mem/hugetlb/lib/hugetlb.h |  9 +++++----
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.c b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
index 4a9d489..7afc7d4 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.c
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
@@ -32,6 +32,7 @@
  *	rm_shm()
  */
 
+#define TST_NO_DEFAULT_MAIN
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
@@ -42,14 +43,14 @@
 void check_hugepage(void)
 {
 	if (access(PATH_HUGEPAGES, F_OK))
-		tst_brkm(TCONF, NULL, "Huge page is not supported.");
+		tst_brk(TCONF, "Huge page is not supported.");
 }
 
 /*
  * getipckey() - generates and returns a message key used by the "get"
  *		 calls to create an IPC resource.
  */
-int getipckey(void (*cleanup_fn) (void))
+int getipckey(void)
 {
 	const char a = 'a';
 	int ascii_a = (int)a;
@@ -60,7 +61,7 @@ int getipckey(void (*cleanup_fn) (void))
 
 	curdir = getcwd(curdir, size);
 	if (curdir == NULL)
-		tst_brkm(TBROK | TERRNO, cleanup_fn, "getcwd(curdir)");
+		tst_brk(TBROK | TERRNO, "getcwd(curdir)");
 
 	/*
 	 * Get a Sys V IPC key
@@ -79,7 +80,7 @@ int getipckey(void (*cleanup_fn) (void))
 
 	ipc_key = ftok(curdir, ascii_a + random() % 26);
 	if (ipc_key == -1)
-		tst_brkm(TBROK | TERRNO, cleanup_fn, "ftok");
+		tst_brk(TBROK | TERRNO, __func__);
 
 	return ipc_key;
 }
@@ -87,13 +88,13 @@ int getipckey(void (*cleanup_fn) (void))
 /*
  * getuserid() - return the integer value for the "user" id
  */
-int getuserid(void (*cleanup_fn) (void), char *user)
+int getuserid(char *user)
 {
 	struct passwd *ent;
 
 	ent = getpwnam(user);
 	if (ent == NULL)
-		tst_brkm(TBROK | TERRNO, cleanup_fn, "getpwnam");
+		tst_brk(TBROK | TERRNO, "getpwnam");
 
 	return ent->pw_uid;
 }
@@ -110,8 +111,8 @@ void rm_shm(int shm_id)
 	 * check for # of attaches ?
 	 */
 	if (shmctl(shm_id, IPC_RMID, NULL) == -1) {
-		tst_resm(TINFO, "WARNING: shared memory deletion failed.");
-		tst_resm(TINFO, "This could lead to IPC resource problems.");
-		tst_resm(TINFO, "id = %d", shm_id);
+		tst_res(TINFO, "WARNING: shared memory deletion failed.");
+		tst_res(TINFO, "This could lead to IPC resource problems.");
+		tst_res(TINFO, "id = %d", shm_id);
 	}
 }
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.h b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
index 6b5c61e..1b5cc73 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.h
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
@@ -24,11 +24,12 @@
 #ifndef __HUGETLB_H
 #define __HUGETLB_H
 
+#include <stdlib.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include <errno.h>
 #include <sys/wait.h>
-#include "test.h"
+#include "tst_test.h"
 
 #define SHM_RD	0400
 #define SHM_WR	0200
@@ -49,12 +50,12 @@ key_t shmkey;			/* an IPC key generated by ftok() */
 
 void check_hugepage(void);
 
-int getipckey(void (*cleanup_fn) (void));
-int getuserid(void (*cleanup_fn) (void), char *user);
+int getipckey(void);
+int getuserid(char *user);
 void rm_shm(int shm_id);
 
 char *nr_opt;
-int sflag;
+char *Hopt;
 long orig_hugepages;
 
 #endif /* hugetlb.h */
-- 
2.9.3


  parent reply	other threads:[~2017-04-10 10:05 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10 10:05 [LTP] [PATCH V2 00/14] Convert LTP kernel/mem/testcase to New API Li Wang
2017-04-10 10:05 ` [LTP] [PATCH V2 01/14] mem/lib: convert to new API Li Wang
2017-04-10 10:05 ` [LTP] [PATCH V2 02/14] mem/oom: " Li Wang
2017-04-10 10:05 ` [LTP] [PATCH V2 03/14] mem/oom: fix the timeout issue Li Wang
2017-07-07 15:11   ` Cyril Hrubis
2017-07-10  7:01     ` Li Wang
2017-07-13  9:06       ` Richard Palethorpe
2017-07-14  3:16         ` Li Wang
2017-07-10  7:38     ` Jan Stancek
2017-04-10 10:05 ` [LTP] [PATCH V2 04/14] mem/ksm: convert to new API Li Wang
2017-07-07 14:49   ` Cyril Hrubis
2017-07-07 15:29     ` Cyril Hrubis
2017-07-10  7:33     ` Li Wang
2017-04-10 10:05 ` [LTP] [PATCH V2 05/14] mem/thp: " Li Wang
2017-07-07 15:27   ` Cyril Hrubis
2017-07-11  4:32     ` Li Wang
2017-04-10 10:05 ` Li Wang [this message]
2017-04-10 10:05 ` [LTP] [PATCH V2 07/14] mem/hugemmap: " Li Wang
2017-04-10 10:05 ` [LTP] [PATCH V2 08/14] mem/hugeshmat: " Li Wang
2017-04-10 10:05 ` [LTP] [PATCH V2 09/14] mem/hugeshmctl: " Li Wang
2017-04-10 10:05 ` [LTP] [PATCH V2 10/14] mm/hugeshmdt: " Li Wang
2017-04-10 10:05 ` [LTP] [PATCH V2 11/14] mem/hugeshmget: " Li Wang
2017-04-10 10:05 ` [LTP] [PATCH V2 12/14] mem/cpuset: " Li Wang
2017-04-10 10:05 ` [LTP] [PATCH V2 13/14] mem/swapping: " Li Wang
2017-04-10 10:05 ` [LTP] [PATCH V2 14/14] mem/tunable: " Li Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170410100556.4465-7-liwang@redhat.com \
    --to=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox