public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] module: Remove obsolete create_module(2) and query_module(2)
@ 2018-09-28  8:52 Xiao Yang
  2018-09-28  8:52 ` [LTP] [PATCH 2/2] delete_module*: Cleanup && Move to kernel/syscalls Xiao Yang
  2018-10-01 14:38 ` [LTP] [PATCH 1/2] module: Remove obsolete create_module(2) and query_module(2) Cyril Hrubis
  0 siblings, 2 replies; 3+ messages in thread
From: Xiao Yang @ 2018-09-28  8:52 UTC (permalink / raw)
  To: ltp

From manpage, create_module(2) or query_module(2) is only present
on Linux up until 2.4 and is removed in Linux 2.6, so we remove
these obsolete syscalls.

Fix: #380

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 include/lapi/syscalls/i386.in                      |   2 -
 include/lapi/syscalls/powerpc.in                   |   2 -
 include/lapi/syscalls/powerpc64.in                 |   2 -
 include/lapi/syscalls/s390.in                      |   2 -
 include/lapi/syscalls/s390x.in                     |   2 -
 include/lapi/syscalls/sh.in                        |   2 -
 include/lapi/syscalls/sparc.in                     |   2 -
 include/lapi/syscalls/sparc64.in                   |   2 -
 include/lapi/syscalls/x86_64.in                    |   2 -
 testcases/kernel/module/README                     |   3 -
 testcases/kernel/module/create_module/Makefile     |  36 --
 .../kernel/module/create_module/create_module01.c  | 162 ---------
 .../kernel/module/create_module/create_module02.c  | 279 ---------------
 testcases/kernel/module/query_module/Makefile      |  49 ---
 .../kernel/module/query_module/dummy_query_mod.c   |  53 ---
 .../module/query_module/dummy_query_mod_dep.c      |  52 ---
 .../kernel/module/query_module/query_module01.c    | 373 ---------------------
 .../kernel/module/query_module/query_module02.c    | 205 -----------
 .../kernel/module/query_module/query_module03.c    | 272 ---------------
 19 files changed, 1502 deletions(-)
 delete mode 100644 testcases/kernel/module/README
 delete mode 100644 testcases/kernel/module/create_module/Makefile
 delete mode 100644 testcases/kernel/module/create_module/create_module01.c
 delete mode 100644 testcases/kernel/module/create_module/create_module02.c
 delete mode 100644 testcases/kernel/module/query_module/Makefile
 delete mode 100644 testcases/kernel/module/query_module/dummy_query_mod.c
 delete mode 100644 testcases/kernel/module/query_module/dummy_query_mod_dep.c
 delete mode 100644 testcases/kernel/module/query_module/query_module01.c
 delete mode 100644 testcases/kernel/module/query_module/query_module02.c
 delete mode 100644 testcases/kernel/module/query_module/query_module03.c

diff --git a/include/lapi/syscalls/i386.in b/include/lapi/syscalls/i386.in
index a000564..5d7bc11 100644
--- a/include/lapi/syscalls/i386.in
+++ b/include/lapi/syscalls/i386.in
@@ -125,7 +125,6 @@ modify_ldt 123
 adjtimex 124
 mprotect 125
 sigprocmask 126
-create_module 127
 init_module 128
 delete_module 129
 get_kernel_syms 130
@@ -163,7 +162,6 @@ mremap 163
 setresuid 164
 getresuid 165
 vm86 166
-query_module 167
 poll 168
 nfsservctl 169
 setresgid 170
diff --git a/include/lapi/syscalls/powerpc.in b/include/lapi/syscalls/powerpc.in
index c0b4226..79d8f58 100644
--- a/include/lapi/syscalls/powerpc.in
+++ b/include/lapi/syscalls/powerpc.in
@@ -125,7 +125,6 @@ modify_ldt 123
 adjtimex 124
 mprotect 125
 sigprocmask 126
-create_module 127
 init_module 128
 delete_module 129
 get_kernel_syms 130
@@ -162,7 +161,6 @@ nanosleep 162
 mremap 163
 setresuid 164
 getresuid 165
-query_module 166
 poll 167
 nfsservctl 168
 setresgid 169
diff --git a/include/lapi/syscalls/powerpc64.in b/include/lapi/syscalls/powerpc64.in
index c0b4226..79d8f58 100644
--- a/include/lapi/syscalls/powerpc64.in
+++ b/include/lapi/syscalls/powerpc64.in
@@ -125,7 +125,6 @@ modify_ldt 123
 adjtimex 124
 mprotect 125
 sigprocmask 126
-create_module 127
 init_module 128
 delete_module 129
 get_kernel_syms 130
@@ -162,7 +161,6 @@ nanosleep 162
 mremap 163
 setresuid 164
 getresuid 165
-query_module 166
 poll 167
 nfsservctl 168
 setresgid 169
diff --git a/include/lapi/syscalls/s390.in b/include/lapi/syscalls/s390.in
index 47a04de..203cbe6 100644
--- a/include/lapi/syscalls/s390.in
+++ b/include/lapi/syscalls/s390.in
@@ -89,7 +89,6 @@ uname 122
 adjtimex 124
 mprotect 125
 sigprocmask 126
-create_module 127
 init_module 128
 delete_module 129
 get_kernel_syms 130
@@ -122,7 +121,6 @@ sched_get_priority_min 160
 sched_rr_get_interval 161
 nanosleep 162
 mremap 163
-query_module 167
 poll 168
 nfsservctl 169
 prctl 172
diff --git a/include/lapi/syscalls/s390x.in b/include/lapi/syscalls/s390x.in
index 83732ff..914d94f 100644
--- a/include/lapi/syscalls/s390x.in
+++ b/include/lapi/syscalls/s390x.in
@@ -89,7 +89,6 @@ uname 122
 adjtimex 124
 mprotect 125
 sigprocmask 126
-create_module 127
 init_module 128
 delete_module 129
 get_kernel_syms 130
@@ -122,7 +121,6 @@ sched_get_priority_min 160
 sched_rr_get_interval 161
 nanosleep 162
 mremap 163
-query_module 167
 poll 168
 nfsservctl 169
 prctl 172
diff --git a/include/lapi/syscalls/sh.in b/include/lapi/syscalls/sh.in
index 407be7a..e1de98c 100644
--- a/include/lapi/syscalls/sh.in
+++ b/include/lapi/syscalls/sh.in
@@ -125,7 +125,6 @@ cacheflush 123
 adjtimex 124
 mprotect 125
 sigprocmask 126
-create_module 127
 init_module 128
 delete_module 129
 get_kernel_syms 130
@@ -163,7 +162,6 @@ mremap 163
 setresuid 164
 getresuid 165
 vm86 166
-query_module 167
 poll 168
 nfsservctl 169
 setresgid 170
diff --git a/include/lapi/syscalls/sparc.in b/include/lapi/syscalls/sparc.in
index 2b06a79..06533d6 100644
--- a/include/lapi/syscalls/sparc.in
+++ b/include/lapi/syscalls/sparc.in
@@ -186,7 +186,6 @@ flistxattr 180
 removexattr 181
 lremovexattr 182
 sigpending 183
-query_module 184
 setpgid 185
 fremovexattr 186
 tkill 187
@@ -223,7 +222,6 @@ clone 217
 ioprio_get 218
 adjtimex 219
 sigprocmask 220
-create_module 221
 delete_module 222
 get_kernel_syms 223
 getpgid 224
diff --git a/include/lapi/syscalls/sparc64.in b/include/lapi/syscalls/sparc64.in
index 8c8a866..ce66c05 100644
--- a/include/lapi/syscalls/sparc64.in
+++ b/include/lapi/syscalls/sparc64.in
@@ -164,7 +164,6 @@ flistxattr 180
 removexattr 181
 lremovexattr 182
 sigpending 183
-query_module 184
 setpgid 185
 fremovexattr 186
 tkill 187
@@ -201,7 +200,6 @@ clone 217
 ioprio_get 218
 adjtimex 219
 sigprocmask 220
-create_module 221
 delete_module 222
 get_kernel_syms 223
 getpgid 224
diff --git a/include/lapi/syscalls/x86_64.in b/include/lapi/syscalls/x86_64.in
index 4ce8477..1726f84 100644
--- a/include/lapi/syscalls/x86_64.in
+++ b/include/lapi/syscalls/x86_64.in
@@ -172,11 +172,9 @@ sethostname 170
 setdomainname 171
 iopl 172
 ioperm 173
-create_module 174
 init_module 175
 delete_module 176
 get_kernel_syms 177
-query_module 178
 quotactl 179
 nfsservctl 180
 getpmsg 181
diff --git a/testcases/kernel/module/README b/testcases/kernel/module/README
deleted file mode 100644
index 95938a0..0000000
--- a/testcases/kernel/module/README
+++ /dev/null
@@ -1,3 +0,0 @@
-Many of these tests have requirements on the test machine.  To ensure proper
-build and execution, the kernel must be build on the test machine and you
-must also do a 'make modules' and 'make modules_install'.
diff --git a/testcases/kernel/module/create_module/Makefile b/testcases/kernel/module/create_module/Makefile
deleted file mode 100644
index af2c873..0000000
--- a/testcases/kernel/module/create_module/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-#  Copyright (c) International Business Machines  Corp., 2001
-#
-#  This program is free software;  you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#  the GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program;  if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-
-###########################################################################
-# name of file	: Makefile						  #
-###########################################################################
-CFLAGS+=	-Wall -O -g -I../../../../include
-LOADLIBES+=	-L../../../../lib -lltp
-
-SRCS=$(wildcard *.c)
-TARGETS=$(patsubst %.c,%,$(SRCS))
-
-all: $(TARGETS)
-
-install:
-	@set -e; for i in $(TARGETS); do ln -f $$i ../../../bin/$$i ; done
-
-clean:
-	rm -f $(TARGETS)
-
-
diff --git a/testcases/kernel/module/create_module/create_module01.c b/testcases/kernel/module/create_module/create_module01.c
deleted file mode 100644
index 2c72297..0000000
--- a/testcases/kernel/module/create_module/create_module01.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**********************************************************
- *
- *    TEST IDENTIFIER   : create_module01
- *
- *    EXECUTED BY       : root / superuser
- *
- *    TEST TITLE        : Basic tests for create_module(2)
- *
- *    TEST CASE TOTAL   : 1
- *
- *    AUTHOR            : Madhu T L <madhu.tarikere@wipro.com>
- *
- *    SIGNALS
- *	Uses SIGUSR1 to pause before test if option set.
- *	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	This is a Phase I test for the create_module(2) system call.
- *	It is intended to provide a limited exposure of the system call.
- *
- *	Setup:
- *	  Setup signal handling.
- *	  Test caller is superuser
- *	  Pause for SIGUSR1 if option specified.
- *	  Initialize modname for each child process
- *
- *	Test:
- *	 Loop if the proper options are given.
- *	  Execute system call
- *	  Check return code, if system call failed (return=-1)
- *		Issue FAIL message with errno.
- *	  Otherwise, Issue PASS message and delete the module entry.
- *
- *	Cleanup:
- *	  Call delete_module system call to remove module entry if exists.
- *	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- *  create_module01 [-c n] [-e] [-f] [-h] [-i n] [-I x] [-p] [-P x] [-t]
- *		where,  -c n : Run n copies concurrently.
- *			-e   : Turn on errno logging.
- *			-f   : Turn off functional testing
- *			-h   : Show help screen
- *			-i n : Execute test n times.
- *			-I x : Execute test for x seconds.
- *			-p   : Pause for SIGUSR1 before starting
- *			-P x : Pause for x seconds between iterations.
- *			-t   : Turn on syscall timing.
- *
- ****************************************************************/
-#include <errno.h>
-#include <asm/atomic.h>
-#include <linux/module.h>
-#include "test.h"
-
-#define MODSIZE 10000		/* Arbitrarily selected MODSIZE */
-#define BASEMODNAME "dummy"
-
-static void setup(void);
-static void cleanup(void);
-
-char *TCID = "create_module01";	/* Test program identifier.    */
-int TST_TOTAL = 1;		/* Total number of test cases. */
-static char modname[20];	/* Name of the module */
-
-int main(int argc, char **argv)
-{
-	int lc;
-
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		/* reset tst_count in case we are looping */
-		tst_count = 0;
-
-		/* Test the system call */
-		TEST(create_module(modname, MODSIZE));
-
-		/* check return code */
-		if (TEST_RETURN == -1) {
-			tst_resm(TFAIL, "create_module() failed errno=%d : %s",
-				 TEST_ERRNO, strerror(TEST_ERRNO));
-		} else {
-			tst_resm(TPASS, "create_module() returned 0x%x",
-				 TEST_RETURN);
-			if (delete_module(modname) != 0) {
-				tst_brkm(TBROK, NULL, "Failed to delete"
-					 "loadable module entry for %s",
-					 modname);
-			}
-		}
-	}
-
-	/* perform global cleanup and exit */
-	cleanup();
-
-}
-
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
-{
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	tst_require_root();
-
-	if (tst_kvercmp(2, 5, 48) >= 0)
-		tst_brkm(TCONF, NULL, "This test will not work on "
-			 "kernels after 2.5.48");
-
-	/* Pause if that option was specified
-	 * TEST_PAUSE contains the code to fork the test with the -c option.
-	 */
-	TEST_PAUSE;
-
-	/* Initialize unique module name for each child process */
-	if (sprintf(modname, "%s_%d", BASEMODNAME, getpid()) == -1) {
-		tst_brkm(TBROK, NULL, "Failed to initialize module name");
-	}
-}
-
-/*
- * cleanup()
- *	performs all ONE TIME cleanup for this test at
- *	completion or premature exit
- */
-void cleanup(void)
-{
-	/*
-	 * If module entry is not removed (possible if create_module()
-	 * succeeds and signal is caught before execution of delete_module())
-	 * attempt to remove it here
-	 */
-	if (delete_module(modname) == -1) {
-		/* With errno, check module exists, if so send msg */
-		if (errno != ENOENT) {
-			tst_resm(TWARN, "Failed to delete loadable module"
-				 "entry for %s errno returned %d", modname,
-				 errno);
-		}
-	}
-
-}
diff --git a/testcases/kernel/module/create_module/create_module02.c b/testcases/kernel/module/create_module/create_module02.c
deleted file mode 100644
index f275adf..0000000
--- a/testcases/kernel/module/create_module/create_module02.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**********************************************************
- *
- *    TEST IDENTIFIER   : create_module02
- *
- *    EXECUTED BY       : root / superuser
- *
- *    TEST TITLE        : Checking error conditions for create_module(2)
- *
- *    TEST CASE TOTAL   : 8
- *
- *    AUTHOR            : Madhu T L <madhu.tarikere@wipro.com>
- *
- *    SIGNALS
- *      Uses SIGUSR1 to pause before test if option set.
- *      (See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *      Verify that,
- *      1. create_module(2) returns -1 and sets errno to EPERM, if effective
- *         user id of the caller is not superuser.
- *      2. create_module(2) returns -1 and sets errno to EFAULT, if module
- *         name is outside the  program's  accessible  address space.
- *      3. create_module(2) returns -1 and sets errno to EFAULT, if module
- *         name parameter is NULL.
- *      4. create_module(2) returns -1 and sets errno to EINVAL, if module
- *         name parameter is null terminated (zero length) string.
- *      5. create_module(2) returns -1 and sets errno to EEXIST, if module
- *         entry with the same name already exists.
- *      6. create_module(2) returns -1 and sets errno to EINVAL, if module
- *         size parameter is too small.
- *      7. create_module(2) returns -1 and sets errno to ENAMETOOLONG, if
- *         module name parameter is too long.
- *      8. create_module(2) returns -1 and sets errno to ENOMEM, if module
- *         size parameter is too large.
- *
- *      Setup:
- *        Setup signal handling.
- *        Test caller is super user
- *        Check existances of "nobody" user id.
- *        Initialize  long module name
- *        Set expected errnos for logging
- *        Pause for SIGUSR1 if option specified.
- *	  Initialize modname for each child process
- *
- *      Test:
- *       Loop if the proper options are given.
- *        Execute system call
- *        Check return code and error number, if matching,
- *                   Issue PASS message
- *        Otherwise,
- *                   Issue FAIL message
- *
- *      Cleanup:
- *        Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- *  create_module02 [-c n] [-e] [-f] [-h] [-i n] [-I x] [-p] [-P x] [-t]
- *		where,  -c n : Run n copies concurrently.
- *			-e   : Turn on errno logging.
- *			-f   : Turn off functional testing
- *			-h   : Show help screen
- *			-i n : Execute test n times.
- *			-I x : Execute test for x seconds.
- *			-p   : Pause for SIGUSR1 before starting
- *			-P x : Pause for x seconds between iterations.
- *			-t   : Turn on syscall timing.
- *
- ****************************************************************/
-
-#include <errno.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <limits.h>
-#include <asm/atomic.h>
-#include <linux/module.h>
-#include "test.h"
-#include "safe_macros.h"
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
-#endif
-
-#define MODSIZE 10000		/* Arbitrarily selected MODSIZE */
-#define NULLMODNAME ""
-#define MAXMODSIZE  0xffffffffffffffff	/* Max size of size_t */
-#define SMALLMODSIZE  1		/* Arbitrarily selected SMALLMODSIZE */
-#define BASEMODNAME "dummy"
-#define LONGMODNAMECHAR 'm'	/* Arbitrarily selected the alphabet */
-#define MODNAMEMAX (PAGE_SIZE + 1)
-
-struct test_case_t {		/* test case structure */
-	char *modname;
-	size_t size;
-	caddr_t retval;		/* syscall return value */
-	int experrno;		/* expected errno */
-	char *desc;
-	int (*setup) (void);	/* Individual setup routine */
-	void (*cleanup) (void);	/* Individual cleanup routine */
-};
-
-char *TCID = "create_module02";
-static char nobody_uid[] = "nobody";
-struct passwd *ltpuser;
-static char longmodname[MODNAMEMAX];
-static int testno;
-static char modname[20];	/* Name of the module */
-
-static void setup(void);
-static void cleanup(void);
-static int setup1(void);
-static void cleanup1(void);
-static int setup2(void);
-static void cleanup2(void);
-
-static struct test_case_t tdat[] = {
-	{modname, MODSIZE, (caddr_t) - 1, EPERM,
-	 "non-superuser", setup1, cleanup1},
-	{(char *)-1, MODSIZE, (caddr_t) - 1, EFAULT,
-	 "module name outside the  program's  accessible  address space", NULL,
-	 NULL},
-	{NULL, MODSIZE, (caddr_t) - 1, EFAULT,
-	 "NULL module name", NULL, NULL},
-	{NULLMODNAME, MODSIZE, (caddr_t) - 1, EINVAL,
-	 "null terminated module name", NULL, NULL},
-	{modname, MODSIZE, (caddr_t) - 1, EEXIST,
-	 "already existing module", setup2, cleanup2},
-	{modname, SMALLMODSIZE, (caddr_t) - 1, EINVAL,
-	 "insufficient module size", NULL, NULL},
-	{longmodname, MODSIZE, (caddr_t) - 1, ENAMETOOLONG,
-	 "long module name", NULL, NULL},
-
-	/*
-	 *This test case is giving segmentation fault on
-	 * 2.4.* series, but works as expected with 2.5.* series of kernel.
-	 */
-	{modname, MAXMODSIZE, (caddr_t) - 1, ENOMEM,
-	 "large module size", NULL, NULL},
-};
-
-int TST_TOTAL = sizeof(tdat) / sizeof(tdat[0]);
-
-int main(int argc, char **argv)
-{
-	int lc;
-
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		/* reset tst_count in case we are looping */
-		tst_count = 0;
-
-		for (testno = 0; testno < TST_TOTAL; ++testno) {
-			if ((tdat[testno].setup) && (tdat[testno].setup())) {
-				/* setup() failed, skip this test */
-				continue;
-			}
-
-			TEST(create_module(tdat[testno].modname,
-					   tdat[testno].size));
-			if ((TEST_RETURN == (int)tdat[testno].retval) &&
-			    (TEST_ERRNO == tdat[testno].experrno)) {
-				tst_resm(TPASS, "Expected results for %s, "
-					 "errno: %d",
-					 tdat[testno].desc, TEST_ERRNO);
-			} else {
-				tst_resm(TFAIL, "Unexpected results for %s ; "
-					 "returned %d (expected %d), errno %d "
-					 "(expected %d)", tdat[testno].desc,
-					 TEST_RETURN, tdat[testno].retval,
-					 TEST_ERRNO, tdat[testno].experrno);
-			}
-			if (tdat[testno].cleanup) {
-				tdat[testno].cleanup();
-			}
-		}
-	}
-	cleanup();
-	tst_exit();
-}
-
-int setup1(void)
-{
-	/* Change effective user id to nodody */
-	if (seteuid(ltpuser->pw_uid) == -1) {
-		tst_resm(TBROK, "seteuid failed to set the effective"
-			 " uid to %d", ltpuser->pw_uid);
-		return 1;
-	}
-	return 0;
-}
-
-void cleanup1(void)
-{
-	/* Change effective user id to root */
-	SAFE_SETEUID(NULL, 0);
-}
-
-int setup2(void)
-{
-	/* Create a loadable module entry */
-	if (create_module(modname, MODSIZE) == -1) {
-		tst_resm(TBROK, "Failed to create module entry"
-			 " for %s", modname);
-		return 1;
-	}
-	return 0;
-}
-
-void cleanup2(void)
-{
-	/* Remove loadable module entry */
-	if (delete_module(modname) == -1) {
-		tst_brkm(TBROK, NULL, "Failed to delete module entry"
-			 " for %s", modname);
-	}
-}
-
-/*
- * setup()
- *	performs all ONE TIME setup for this test
- */
-void setup(void)
-{
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	tst_require_root();
-
-	if (tst_kvercmp(2, 5, 48) >= 0)
-		tst_brkm(TCONF, NULL, "This test will not work on "
-			 "kernels after 2.5.48");
-
-	/* Check for nobody_uid user id */
-	if ((ltpuser = getpwnam(nobody_uid)) == NULL) {
-		tst_brkm(TBROK, NULL, "Required user %s doesn't exists",
-			 nobody_uid);
-	}
-
-	/* Initialize longmodname to LONGMODNAMECHAR character */
-	memset(longmodname, LONGMODNAMECHAR, MODNAMEMAX - 1);
-
-	/* Pause if that option was specified
-	 * TEST_PAUSE contains the code to fork the test with the -c option.
-	 */
-	TEST_PAUSE;
-
-	/* Get unique module name for each child process */
-	if (sprintf(modname, "%s_%d", BASEMODNAME, getpid()) == -1) {
-		tst_brkm(TBROK, NULL, "Failed to initialize module name");
-	}
-}
-
-/*
- * cleanup()
- *	performs all ONE TIME cleanup for this test at
- *	completion or premature exit
- */
-void cleanup(void)
-{
-}
diff --git a/testcases/kernel/module/query_module/Makefile b/testcases/kernel/module/query_module/Makefile
deleted file mode 100644
index 88323b4..0000000
--- a/testcases/kernel/module/query_module/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-###########################################################################
-# name of file	: Makefile						  #
-# description	: make file for the query_module(2) testcases		  #
-###########################################################################
-
-CFLAGS+=	-I../../../../include -Wall
-MODCFLAGS+=	-I/lib/modules/$(shell uname -r)/build/include -Wall
-LOADLIBES+=	-L../../../../lib -lltp
-
-SRC1=dummy_query_mod.c dummy_query_mod_dep.c
-OBJS=$(SRC1:.c=.o)
-TARGETS=query_module01 query_module02 query_module03 $(OBJS)
-
-all: $(TARGETS)
-	chmod 755 $(OBJS)
-
-$(OBJS): $(SRC1)
-	$(CC) -DEXPORT_SYMTAB $(MODCFLAGS) -c $(SRC1) -Wall
-
-query_module01: query_module01.c
-	$(CC) $(CFLAGS) query_module01.c $(LOADLIBES) -o $@
-
-query_module02: query_module02.c
-	$(CC) $(CFLAGS) query_module02.c $(LOADLIBES) -o $@
-
-query_module03: query_module03.c
-	$(CC) $(CFLAGS) query_module03.c $(LOADLIBES) -o $@
-
-install:
-	@set -e; for i in $(TARGETS); do ln -f $$i ../../../bin/$$i ; done
-
-clean:
-	rm -f $(TARGETS)
-
diff --git a/testcases/kernel/module/query_module/dummy_query_mod.c b/testcases/kernel/module/query_module/dummy_query_mod.c
deleted file mode 100644
index 27f7408..0000000
--- a/testcases/kernel/module/query_module/dummy_query_mod.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/*************************************************************************
- * Description: This is a kernel loadable module programme used by
- *		testcases of query_module(2)
- *************************************************************************/
-
-#define MODULE
-/* #define __KERNEL__    Commented this line out b/c it causes errors with
- *                       module.h when it calls /usr/include/linux/version.h
- *                       -12/03/02 Robbie Williamson <robbiew@us.ibm.com>
- */
-
-#include <asm/atomic.h>
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-
-void dummy_func_test(void);
-
-/* Initialization routine of module */
-int init_module(void)
-{
-	return 0;
-}
-
-/* Cleanup routine of module */
-void cleanup_module(void)
-{
-	return;
-}
-
-/* Dummy function used by dependent module */
-void dummy_func_test(void)
-{
-	return;
-}
-
-EXPORT_SYMBOL(dummy_func_test);
diff --git a/testcases/kernel/module/query_module/dummy_query_mod_dep.c b/testcases/kernel/module/query_module/dummy_query_mod_dep.c
deleted file mode 100644
index 31c0293..0000000
--- a/testcases/kernel/module/query_module/dummy_query_mod_dep.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/*************************************************************************
- * Description: This is a kernel loadable module programme used by
- *		testcases of query_module(2). This module has dependency
- *		on dummy_query_mod module (calls function of dummy_del_mod
- *		during initialization).
- *************************************************************************/
-
-#define MODULE
-/* #define __KERNEL__    Commented this line out b/c it causes errors with
- *                       module.h when it calls /usr/include/linux/version.h
- *                       -12/03/02 Robbie Williamson <robbiew@us.ibm.com>
- */
-
-#include <linux/config.h>
-#include <asm/atomic.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-
-extern void dummy_func_test(void);
-
-/* Initialization routine of module */
-int init_module(void)
-{
-	/*
-	 * Call function of other module, does nothing, used to create
-	 * dependency with other module
-	 */
-	dummy_func_test();
-	return 0;
-}
-
-/* Cleanup routine of module */
-void cleanup_module(void)
-{
-	return;
-}
diff --git a/testcases/kernel/module/query_module/query_module01.c b/testcases/kernel/module/query_module/query_module01.c
deleted file mode 100644
index 29f61a8..0000000
--- a/testcases/kernel/module/query_module/query_module01.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**********************************************************
- *
- *    TEST IDENTIFIER   : query_module01
- *
- *    EXECUTED BY       : root / superuser
- *
- *    TEST TITLE        : Checking functionality of query_module(2)
- *
- *    TEST CASE TOTAL   : 6
- *
- *    AUTHOR            : Madhu T L <madhu.tarikere@wipro.com>
- *
- *    SIGNALS
- *      Uses SIGUSR1 to pause before test if option set.
- *      (See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *      Verify that,
- *	1. query_module(2) is successful for NULL module name, which argument
- *	   set to 0.
- *	2. query_module(2) is successful for NULL module name, which argument
- *	   set to QM_MODULES.
- *	3. query_module(2) is successful for valid module name, which argument
- *	   set to QM_DEPS.
- *	4. query_module(2) is successful for valid module name, which argument
- *	   set to QM_REFS.
- *	5. query_module(2) is successful for valid module name, which argument
- *	   set to QM_INFO.
- *	6. query_module(2) is successful for valid module name, which argument
- *	   set to QM_SYMBOLS.
- *
- *      Setup:
- *	  Setup signal handling.
- *	  Test caller is superuser
- *	  Initialize  long module name
- *	  Pause for SIGUSR1 if option specified.
- *
- *	Test:
- *	 Loop if the proper options are given.
- *	  Execute system call
- *	  Check return value and functionality, if success,
- *		 Issue PASS message
- *	Otherwise,
- *		Issue FAIL message
- *
- *	Cleanup:
- *	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- *  query_module01 [-c n] [-e] [-f] [-h] [-i n] [-I x] [-p] [-P x] [-t]
- *		where,  -c n : Run n copies concurrently.
- *			-e   : Turn on errno logging.
- *			-f   : Turn off functional testing
- *			-h   : Show help screen
- *			-i n : Execute test n times.
- *			-I x : Execute test for x seconds.
- *			-p   : Pause for SIGUSR1 before starting
- *			-P x : Pause for x seconds between iterations.
- *			-t   : Turn on syscall timing.
- *
- * RESTRICTIONS
- *	-c option has no effect for this testcase, even if used allows only
- *	one instance to run at a time.
- *
- * CHANGES
- *
- * 12/03/02 Added "force" to insmod to ignore kernel version.
- *          -Robbie Williamson <robbiew@us.ibm.com>
- *
- ****************************************************************/
-
-#include <errno.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <limits.h>
-#include <asm/atomic.h>
-#include <linux/module.h>
-#include "test.h"
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
-#endif
-
-#define LONGMODNAMECHAR	'm'	/* Arbitrarily selected */
-#define MODNAMEMAX	(PAGE_SIZE + 1)
-#define EXP_RET_VAL	0
-#define DUMMY_MOD	"dummy_query_mod"
-#define DUMMY_MOD_DEP	"dummy_query_mod_dep"
-#define QM_INVALID	(QM_INFO + 100)
-
-/* Name of exported function in DUMMY_MOD */
-#define EXP_FUNC_NAME	"dummy_func_test"
-
-struct test_case_t {		/* test case structure */
-	char *modname;
-	int which;
-	char *desc;
-	int (*setup) (void);	/* Individual setup routine */
-	void (*cleanup) (void);	/* Individual cleanup routine */
-};
-
-char *TCID = "query_module01";
-static char longmodname[MODNAMEMAX];
-static int testno;
-static char out_buf[PAGE_SIZE];
-static size_t ret;
-
-static int test_functionality(int, char *, size_t, size_t);
-static void setup(void);
-static void cleanup(void);
-static int setup1(void);
-static void cleanup1(void);
-static int setup2(void);
-static void cleanup2(void);
-
-static struct test_case_t tdat[] = {
-	{NULL, 0, "module name: NULL, which: 0", NULL, NULL},
-
-	{NULL, QM_MODULES, "NULL module name, which: QM_MODULES",
-	 setup1, cleanup1},
-
-	{DUMMY_MOD_DEP, QM_DEPS, "valid module name, which: QM_DEPS",
-	 setup2, cleanup2},
-
-	{DUMMY_MOD, QM_REFS, "valid module name, which: QM_REFS",
-	 setup2, cleanup2},
-
-	{DUMMY_MOD, QM_INFO, "valid module name, which: QM_INFO",
-	 setup1, cleanup1},
-
-	{DUMMY_MOD, QM_SYMBOLS, "valid module name, which: QM_SYMBOLS",
-	 setup1, cleanup1},
-};
-
-int TST_TOTAL = sizeof(tdat) / sizeof(tdat[0]);
-
-int main(int argc, char **argv)
-{
-	int lc;
-	size_t buflen = sizeof(out_buf);
-
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	tst_tmpdir();
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		/* reset tst_count in case we are looping */
-		tst_count = 0;
-
-		for (testno = 0; testno < TST_TOTAL; ++testno) {
-			if ((tdat[testno].setup) && (tdat[testno].setup())) {
-				/* setup() failed, skip this test */
-				continue;
-			}
-
-			TEST(query_module(tdat[testno].modname,
-					  tdat[testno].which, (void *)out_buf,
-					  buflen, &ret));
-
-			if ((TEST_RETURN == EXP_RET_VAL) &&
-			    !test_functionality(tdat[testno].which,
-						out_buf, buflen, ret)) {
-				tst_resm(TPASS, "query_module() successful "
-					 "for %s", tdat[testno].desc);
-			} else {
-				tst_resm(TFAIL, "query_module() failed for "
-					 "%s ; returned"
-					 " %d (expected %d), errno %d (expected"
-					 " 0)", tdat[testno].desc,
-					 TEST_RETURN, EXP_RET_VAL, TEST_ERRNO);
-			}
-			if (tdat[testno].cleanup) {
-				tdat[testno].cleanup();
-			}
-		}
-	}
-	cleanup();
-	tst_exit();
-}
-
-int test_functionality(int which, char *buf, size_t bufsize, size_t ret)
-{
-	int i = 0;
-	char *modname;
-	unsigned long *vals;
-
-	switch (which) {
-	case 0:
-		/* Always return SUCCESS */
-		return 0;
-
-	case QM_MODULES:
-	case QM_DEPS:
-		/* Return SUCCESS if found DUMMY_MOD entry */
-		modname = DUMMY_MOD;
-		break;
-
-	case QM_REFS:
-		/* Return SUCCESS if found DUMMY_MOD_DEP entry */
-		modname = DUMMY_MOD_DEP;
-		break;
-
-	case QM_INFO:
-		/*
-		 * Since module is already loaded, flags should show
-		 * MOD_RUNNING
-		 */
-		if (((struct module_info *)buf)->flags & MOD_RUNNING) {
-			return 0;
-		}
-		return 1;
-
-	case QM_SYMBOLS:
-		vals = (unsigned long *)buf;
-
-		/*
-		 * Find entry for atleast one symbol, checking for
-		 * EXP_FUNC_NAME symbol, if found return SUCCESS.
-		 */
-		for (i = 0; i < ret; i++, vals += 2) {
-
-			/* buf + vals[1] - address of symbol name */
-			if (!strcmp(buf + vals[1], EXP_FUNC_NAME)) {
-				return 0;
-			}
-		}
-		return 1;
-
-	default:
-		/* Unknown which type */
-		return 1;
-	}
-
-	/* Return SUCCESS if found entry */
-	for (i = 0; i != ret; i++) {
-		if (strcmp(buf, modname)) {
-			buf += strlen(buf) + 1;
-		} else {
-			return 0;
-		}
-	}
-	return 1;
-
-}
-
-/* Insert a module of name mod */
-int insert_mod(char *mod)
-{
-	char cmd[80];
-
-	if (sprintf(cmd, "cp `which %s.o` ./", mod) == -1) {
-		tst_resm(TBROK, "sprintf failed");
-		return 1;
-	}
-	if (system(cmd) != 0) {
-		tst_resm(TBROK, "Failed to copy %s module", mod);
-		return 1;
-	}
-
-	/* Should use force to ignore kernel version & insure loading  */
-	/* -RW                                                         */
-	/* if (sprintf(cmd, "insmod %s.o", mod) == -1) {               */
-	if (sprintf(cmd, "insmod --force -q %s.o >/dev/null 2>&1", mod) == -1) {
-		tst_resm(TBROK, "sprintf failed");
-		return 1;
-	}
-	if (system(cmd) != 0) {
-		tst_resm(TBROK, "Failed to load %s module", mod);
-		return 1;
-	}
-	return 0;
-}
-
-int setup1(void)
-{
-	if (insert_mod(DUMMY_MOD)) {
-		/* Failed */
-		return 1;
-	} else {
-		return 0;
-	}
-}
-
-int setup2(void)
-{
-	if (insert_mod(DUMMY_MOD)) {
-		/* Failed */
-		return 1;
-	}
-	if (insert_mod(DUMMY_MOD_DEP)) {
-		/* Falied to load DUMMY_MOD_DEP, unload DUMMY_MOD */
-		cleanup1();
-		return 1;
-	}
-	return 0;
-}
-
-void cleanup1(void)
-{
-	/* Remove the loadable module - DUMMY_MOD */
-	if (system("rmmod " DUMMY_MOD) != 0) {
-		tst_brkm(TBROK, cleanup, "Failed to unload module %s",
-			 DUMMY_MOD);
-	}
-}
-
-void cleanup2(void)
-{
-	/* Remove the loadable module - DUMMY_MOD_DEP */
-	if (system("rmmod " DUMMY_MOD_DEP) != 0) {
-		tst_brkm(TBROK, cleanup, "Failed to unload module %s",
-			 DUMMY_MOD_DEP);
-	}
-	/* Remove the loadable module - DUMMY_MOD */
-	cleanup1();
-}
-
-/*
- * setup()
- *	performs all ONE TIME setup for this test
- */
-void setup(void)
-{
-
-	tst_sig(FORK, DEF_HANDLER, cleanup);
-
-	tst_require_root();
-
-	if (tst_kvercmp(2, 5, 48) >= 0)
-		tst_brkm(TCONF, NULL, "This test will not work on "
-			 "kernels after 2.5.48");
-
-	/* Initialize longmodname to LONGMODNAMECHAR character */
-	memset(longmodname, LONGMODNAMECHAR, MODNAMEMAX - 1);
-
-	/* Pause if that option was specified
-	 * TEST_PAUSE contains the code to fork the test with the -c option.
-	 */
-	TEST_PAUSE;
-}
-
-/*
- * cleanup()
- *	performs all ONE TIME cleanup for this test at
- *	completion or premature exit
- */
-void cleanup(void)
-{
-	/*
-	 * print timing stats if that option was specified.
-	 * print errno log if that option was specified.
-	 */
-
-	tst_rmdir();
-}
diff --git a/testcases/kernel/module/query_module/query_module02.c b/testcases/kernel/module/query_module/query_module02.c
deleted file mode 100644
index fcae25d..0000000
--- a/testcases/kernel/module/query_module/query_module02.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**********************************************************
- *
- *    TEST IDENTIFIER   : query_module02
- *
- *    EXECUTED BY       : anyone
- *
- *    TEST TITLE        : Checking error conditions for query_module(2)
- *
- *    TEST CASE TOTAL   : 5
- *
- *    AUTHOR            : Madhu T L <madhu.tarikere@wipro.com>
- *
- *    SIGNALS
- *	Uses SIGUSR1 to pause before test if option set.
- *	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	Verify that,
- *	1. query_module(2) returns -1 and sets errno to ENOENT for non-existing
- *	   module.
- *	2. query_module(2) returns -1 and sets errno to EINVAL for invalid
- *	   which argument.
- *	3. query_module(2) returns -1 and sets errno to EINVAL for NULL
- *	   module name and valid which argument.
- *      4. query_module(2) returns -1 and sets errno to EINVAL, if module
- *         name parameter is null terminated (zero length) string.
- *	5. query_module(2) returns -1 and sets errno to ENAMETOOLONG for long
- *	   module name.
- *
- *	Setup:
- *	  Setup signal handling.
- *	  Initialize  long module name
- *	  Set expected errnos for logging
- *	  Pause for SIGUSR1 if option specified.
- *
- *	Test:
- *	 Loop if the proper options are given.
- *	  Execute system call
- *	  Check return code and error number, if matching,
- *		Issue PASS message
- *	  Otherwise,
- *		Issue FAIL message
- *
- *	Cleanup:
- *	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- *  query_module02 [-c n] [-e] [-f] [-h] [-i n] [-I x] [-p] [-P x] [-t]
- *		where,  -c n : Run n copies concurrently.
- *			-e   : Turn on errno logging.
- *			-f   : Turn off functional testing
- *			-h   : Show help screen
- *			-i n : Execute test n times.
- *			-I x : Execute test for x seconds.
- *			-p   : Pause for SIGUSR1 before starting
- *			-P x : Pause for x seconds between iterations.
- *			-t   : Turn on syscall timing.
- *
- ****************************************************************/
-
-#include <errno.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <limits.h>
-#include <asm/atomic.h>
-#include <linux/module.h>
-#include "test.h"
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
-#endif
-
-#define NULLMODNAME	""
-#define LONGMODNAMECHAR	'm'	/* Arbitrarily selected */
-#define MODNAMEMAX	(PAGE_SIZE + 1)
-#define EXP_RET_VAL	-1
-#define QM_INVALID	(QM_INFO + 100)
-
-struct test_case_t {		/* test case structure */
-	char *modname;
-	int which;
-	void *buf;
-	size_t bufsize;
-	int experrno;		/* expected errno */
-	char *desc;
-};
-
-char *TCID = "query_module02";
-
-static char longmodname[MODNAMEMAX];
-static int testno;
-static char out_buf[PAGE_SIZE];
-static size_t ret_size;
-
-static void setup(void);
-static void cleanup(void);
-
-static struct test_case_t tdat[] = {
-
-	{"dummy_mod", QM_REFS, (void *)out_buf, sizeof(out_buf), ENOENT,
-	 "results for non-existing module"}
-	,
-
-	{NULL, QM_INVALID, (void *)out_buf, sizeof(out_buf), EINVAL,
-	 "results for invalid which argument"}
-	,
-
-	{NULL, QM_REFS, (void *)out_buf, sizeof(out_buf), EINVAL,
-	 "results for NULL module name and valid which argument"}
-	,
-
-	{NULLMODNAME, QM_REFS, (void *)out_buf, sizeof(out_buf), EINVAL,
-	 "results for null terminated (zero lenght) module name"}
-	,
-
-	{longmodname, QM_REFS, (void *)out_buf, sizeof(out_buf), ENAMETOOLONG,
-	 "results for long module name"}
-	,
-};
-
-int TST_TOTAL = sizeof(tdat) / sizeof(tdat[0]);
-
-int main(int argc, char **argv)
-{
-	int lc;
-
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		/* reset tst_count in case we are looping */
-		tst_count = 0;
-
-		for (testno = 0; testno < TST_TOTAL; ++testno) {
-
-			TEST(query_module(tdat[testno].modname,
-					  tdat[testno].which, tdat[testno].buf,
-					  tdat[testno].bufsize, &ret_size));
-			if ((TEST_RETURN == EXP_RET_VAL) &&
-			    (TEST_ERRNO == tdat[testno].experrno)) {
-				tst_resm(TPASS, "Expected %s, errno: %d",
-					 tdat[testno].desc, TEST_ERRNO);
-			} else {
-				tst_resm(TFAIL, "Unexpected %s ; returned"
-					 " %d (expected %d), errno %d (expected"
-					 " %d)", tdat[testno].desc,
-					 TEST_RETURN, EXP_RET_VAL,
-					 TEST_ERRNO, tdat[testno].experrno);
-			}
-		}
-	}
-	cleanup();
-
-	tst_exit();
-}
-
-/*
- * setup()
- *	performs all ONE TIME setup for this test
- */
-void setup(void)
-{
-
-	tst_sig(FORK, DEF_HANDLER, cleanup);
-
-	if (tst_kvercmp(2, 5, 48) >= 0)
-		tst_brkm(TCONF, NULL, "This test will not work on "
-			 "kernels after 2.5.48");
-
-	/* Initialize longmodname to LONGMODNAMECHAR character */
-	memset(longmodname, LONGMODNAMECHAR, MODNAMEMAX - 1);
-
-	/* Pause if that option was specified
-	 * TEST_PAUSE contains the code to fork the test with the -c option.
-	 */
-	TEST_PAUSE;
-}
-
-/*
- * cleanup()
- *	performs all ONE TIME cleanup for this test at
- *	completion or premature exit
- */
-void cleanup(void)
-{
-
-}
diff --git a/testcases/kernel/module/query_module/query_module03.c b/testcases/kernel/module/query_module/query_module03.c
deleted file mode 100644
index cdb0494..0000000
--- a/testcases/kernel/module/query_module/query_module03.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**********************************************************
- *
- *    TEST IDENTIFIER   : query_module03
- *
- *    EXECUTED BY       : root / superuser
- *
- *    TEST TITLE        : Checking error conditions for query_module(2)
- *
- *    TEST CASE TOTAL   : 4
- *
- *    AUTHOR            : Madhu T L <madhu.tarikere@wipro.com>
- *
- *    SIGNALS
- *	Uses SIGUSR1 to pause before test if option set.
- *	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	Verify that,
- *	1. query_module(2) returns -1 and sets errno to EFAULT for module name
- *	   argument outside program's accessible address space.
- *	2. query_module(2) returns -1 and sets errno to EFAULT for return size
- *	   argument outside program's accessible address space.
- *	3. query_module(2) returns -1 and sets errno to EFAULT for output buffer
- *	   argument outside program's accessible address space.
- *	4. query_module(2) returns -1 and sets errno to ENOSPC for too small
- *	   buffer size.
- *
- *	Setup:
- *	  Setup signal handling.
- *	  Test caller is superuser
- *	  Set expected errnos for logging
- *	  Pause for SIGUSR1 if option specified.
- *
- *	Test:
- *	 Loop if the proper options are given.
- *	  Execute system call
- *	  Check return code and error number, if matching,
- *		Issue PASS message
- *	  Otherwise,
- *		Issue FAIL message
- *
- *	Cleanup:
- *	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- *  query_module03 [-c n] [-e] [-f] [-h] [-i n] [-I x] [-p] [-P x] [-t]
- *		where,  -c n : Run n copies concurrently.
- *			-e   : Turn on errno logging.
- *			-f   : Turn off functional testing
- *			-h   : Show help screen
- *			-i n : Execute test n times.
- *			-I x : Execute test for x seconds.
- *			-p   : Pause for SIGUSR1 before starting
- *			-P x : Pause for x seconds between iterations.
- *			-t   : Turn on syscall timing.
- *
- * RESTRICTIONS
- *	-c option has no effect for this testcase, even if used allows only
- *	one instance to run at a time.
- *
- * CHANGES
- *
- * 12/03/02 Added "force" to insmod to ignore kernel version.
- *          -Robbie Williamson <robbiew@us.ibm.com>
- *
- ****************************************************************/
-
-#include <unistd.h>
-#include <errno.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <limits.h>
-#include <asm/atomic.h>
-#include <linux/module.h>
-#include <sys/mman.h>
-#include "test.h"
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
-#endif
-
-#define EXP_RET_VAL	-1
-#define DUMMY_MOD	"dummy_query_mod"
-#define SMALLBUFSIZE	1
-
-struct test_case_t {		/* test case structure */
-	char *modname;
-	int which;
-	void *buf;
-	size_t bufsize;
-	size_t *ret_size;
-	int experrno;		/* expected errno */
-	char *desc;
-	int (*setup) (void);
-	void (*cleanup) (void);
-};
-
-char *TCID = "query_module03";
-
-static int testno;
-static char out_buf[PAGE_SIZE];
-static size_t ret_size;
-
-char *bad_addr = 0;
-
-static void setup(void);
-static void cleanup(void);
-static int setup1(void);
-static void cleanup1(void);
-
-static struct test_case_t tdat[] = {
-
-	{(char *)-1, QM_MODULES, (void *)out_buf, sizeof(out_buf), &ret_size,
-	 EFAULT, "results for module name argument outside program's "
-	 "accessible address space", NULL, NULL}
-	,
-
-	{NULL, QM_MODULES, (void *)out_buf, sizeof(out_buf), (size_t *) - 1,
-	 EFAULT, "results for return size argument outside program's "
-	 "accessible address space", NULL, NULL}
-	,
-
-	{NULL, QM_MODULES, (void *)-1, sizeof(out_buf), &ret_size, EFAULT,
-	 "results for output buffer argument outside program's "
-	 "accessible address space", setup1, cleanup1}
-	,
-
-	{NULL, QM_MODULES, (void *)out_buf, SMALLBUFSIZE, &ret_size, ENOSPC,
-	 "results for too small buffer size", setup1, cleanup1},
-};
-
-int TST_TOTAL = sizeof(tdat) / sizeof(tdat[0]);
-
-int main(int argc, char **argv)
-{
-	int lc;
-
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	tst_tmpdir();
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		/* reset tst_count in case we are looping */
-		tst_count = 0;
-
-		for (testno = 0; testno < TST_TOTAL; ++testno) {
-
-			if ((tdat[testno].setup) && (tdat[testno].setup())) {
-				/* setup() failed, skip this test */
-				continue;
-			}
-			TEST(query_module(tdat[testno].modname,
-					  tdat[testno].which, tdat[testno].buf,
-					  tdat[testno].bufsize,
-					  tdat[testno].ret_size));
-			if ((TEST_RETURN == EXP_RET_VAL) &&
-			    (TEST_ERRNO == tdat[testno].experrno)) {
-				tst_resm(TPASS, "Expected %s, errno: %d",
-					 tdat[testno].desc, TEST_ERRNO);
-			} else {
-				tst_resm(TFAIL, "Unexpected %s ; returned"
-					 " %d (expected %d), errno %d (expected"
-					 " %d)", tdat[testno].desc,
-					 TEST_RETURN, EXP_RET_VAL,
-					 TEST_ERRNO, tdat[testno].experrno);
-			}
-			if (tdat[testno].cleanup) {
-				tdat[testno].cleanup();
-			}
-		}
-	}
-	cleanup();
-	tst_exit();
-}
-
-int setup1(void)
-{
-	char cmd[80];
-
-	if (sprintf(cmd, "cp `which %s.o` ./", DUMMY_MOD) == -1) {
-		tst_resm(TBROK, "sprintf failed");
-		return 1;
-	}
-	if (system(cmd) != 0) {
-		tst_resm(TBROK, "Failed to copy %s module", DUMMY_MOD);
-		return 1;
-	}
-
-	/* Should use force to ignore kernel version & insure loading  */
-	/* -RW                                                         */
-	/* if (sprintf(cmd, "insmod %s.o", DUMMY_MOD) == -1) {         */
-	if (sprintf(cmd, "insmod --force -q %s.o >/dev/null 2>&1", DUMMY_MOD) ==
-	    -1) {
-		tst_resm(TBROK, "sprintf failed");
-		return 1;
-	}
-	if (system(cmd) != 0) {
-		tst_resm(TBROK, "Failed to load %s module", DUMMY_MOD);
-		return 1;
-	}
-	return 0;
-}
-
-void cleanup1(void)
-{
-	/* Remove the loadable module - DUMMY_MOD */
-	if (system("rmmod " DUMMY_MOD) != 0) {
-		tst_brkm(TBROK, cleanup, "Failed to unload module %s",
-			 DUMMY_MOD);
-	}
-}
-
-/*
- * setup()
- *	performs all ONE TIME setup for this test
- */
-void setup(void)
-{
-
-	tst_sig(FORK, DEF_HANDLER, cleanup);
-
-	tst_require_root();
-
-	if (tst_kvercmp(2, 5, 48) >= 0)
-		tst_brkm(TCONF, NULL, "This test will not work on "
-			 "kernels after 2.5.48");
-
-	/* Pause if that option was specified
-	 * TEST_PAUSE contains the code to fork the test with the -c option.
-	 */
-	TEST_PAUSE;
-
-	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
-	if (bad_addr == MAP_FAILED) {
-		tst_brkm(TBROK, cleanup, "mmap failed");
-	}
-	tdat[0].modname = bad_addr;
-	tdat[2].buf = (void *)bad_addr;
-
-}
-
-/*
- * cleanup()
- *	performs all ONE TIME cleanup for this test at
- *	completion or premature exit
- */
-void cleanup(void)
-{
-	/*
-	 * print timing stats if that option was specified.
-	 * print errno log if that option was specified.
-	 */
-	tst_rmdir();
-}
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH 2/2] delete_module*: Cleanup && Move to kernel/syscalls
  2018-09-28  8:52 [LTP] [PATCH 1/2] module: Remove obsolete create_module(2) and query_module(2) Xiao Yang
@ 2018-09-28  8:52 ` Xiao Yang
  2018-10-01 14:38 ` [LTP] [PATCH 1/2] module: Remove obsolete create_module(2) and query_module(2) Cyril Hrubis
  1 sibling, 0 replies; 3+ messages in thread
From: Xiao Yang @ 2018-09-28  8:52 UTC (permalink / raw)
  To: ltp

1) Convert to new API && Cleanup
2) Move delete_module* tests to kernel/syscalls

Fix: #380

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 runtest/modules                                    |   5 -
 runtest/syscalls                                   |   4 +
 scenario_groups/default                            |   1 -
 testcases/kernel/Makefile                          |   1 -
 testcases/kernel/module/Makefile                   |  30 ----
 testcases/kernel/module/delete_module/.gitignore   |   5 -
 testcases/kernel/module/delete_module/Makefile     |  40 ------
 .../kernel/module/delete_module/delete_module01.c  |  89 ------------
 .../kernel/module/delete_module/delete_module02.c  | 155 ---------------------
 .../kernel/module/delete_module/delete_module03.c  | 118 ----------------
 .../kernel/module/delete_module/dummy_del_mod.c    |  64 ---------
 .../module/delete_module/dummy_del_mod_dep.c       |  56 --------
 testcases/kernel/syscalls/delete_module/.gitignore |   5 +
 testcases/kernel/syscalls/delete_module/Makefile   |  25 ++++
 .../syscalls/delete_module/delete_module01.c       |  54 +++++++
 .../syscalls/delete_module/delete_module02.c       |  96 +++++++++++++
 .../syscalls/delete_module/delete_module03.c       |  78 +++++++++++
 .../kernel/syscalls/delete_module/dummy_del_mod.c  |  41 ++++++
 .../syscalls/delete_module/dummy_del_mod_dep.c     |  37 +++++
 19 files changed, 340 insertions(+), 564 deletions(-)
 delete mode 100644 runtest/modules
 delete mode 100644 testcases/kernel/module/Makefile
 delete mode 100644 testcases/kernel/module/delete_module/.gitignore
 delete mode 100644 testcases/kernel/module/delete_module/Makefile
 delete mode 100644 testcases/kernel/module/delete_module/delete_module01.c
 delete mode 100644 testcases/kernel/module/delete_module/delete_module02.c
 delete mode 100644 testcases/kernel/module/delete_module/delete_module03.c
 delete mode 100644 testcases/kernel/module/delete_module/dummy_del_mod.c
 delete mode 100644 testcases/kernel/module/delete_module/dummy_del_mod_dep.c
 create mode 100644 testcases/kernel/syscalls/delete_module/.gitignore
 create mode 100644 testcases/kernel/syscalls/delete_module/Makefile
 create mode 100644 testcases/kernel/syscalls/delete_module/delete_module01.c
 create mode 100644 testcases/kernel/syscalls/delete_module/delete_module02.c
 create mode 100644 testcases/kernel/syscalls/delete_module/delete_module03.c
 create mode 100644 testcases/kernel/syscalls/delete_module/dummy_del_mod.c
 create mode 100644 testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c

diff --git a/runtest/modules b/runtest/modules
deleted file mode 100644
index 0f1ba52..0000000
--- a/runtest/modules
+++ /dev/null
@@ -1,5 +0,0 @@
-#DESCRIPTION:2.6.x kernel module tests
-delete_module01 delete_module01
-delete_module02 delete_module02
-delete_module03 delete_module03
-
diff --git a/runtest/syscalls b/runtest/syscalls
index 0d0be77..2416f80 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -105,6 +105,10 @@ creat06 creat06
 creat07 creat07
 creat08 creat08
 
+delete_module01 delete_module01
+delete_module02 delete_module02
+delete_module03 delete_module03
+
 dup01 dup01
 dup02 dup02
 dup03 dup03
diff --git a/scenario_groups/default b/scenario_groups/default
index 5658a61..9d7d3c3 100644
--- a/scenario_groups/default
+++ b/scenario_groups/default
@@ -25,7 +25,6 @@ hugetlb
 commands
 hyperthreading
 kernel_misc
-modules
 fs_ext4
 pipes
 can
diff --git a/testcases/kernel/Makefile b/testcases/kernel/Makefile
index 5acc9b8..39d79c7 100644
--- a/testcases/kernel/Makefile
+++ b/testcases/kernel/Makefile
@@ -54,7 +54,6 @@ SUBDIRS			+= connectors \
 			   security \
 			   timers \
 			   tracing \
-			   module \
 
 ifeq ($(WITH_POWER_MANAGEMENT_TESTSUITE),yes)
 SUBDIRS			+= power_management
diff --git a/testcases/kernel/module/Makefile b/testcases/kernel/module/Makefile
deleted file mode 100644
index cc2a0e0..0000000
--- a/testcases/kernel/module/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-#    kernel/module test suite Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems Inc.
-#
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License along
-#    with this program; if not, write to the Free Software Foundation, Inc.,
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, July 2009
-#
-
-top_srcdir	?= ../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-# Only delete_module works at this time...
-SUBDIRS		:= delete_module
-
-include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/kernel/module/delete_module/.gitignore b/testcases/kernel/module/delete_module/.gitignore
deleted file mode 100644
index 8ffd425..0000000
--- a/testcases/kernel/module/delete_module/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/delete_module01
-/delete_module02
-/delete_module03
-/dummy_del_mod.ko
-/dummy_del_mod_dep.ko
diff --git a/testcases/kernel/module/delete_module/Makefile b/testcases/kernel/module/delete_module/Makefile
deleted file mode 100644
index 95693b1..0000000
--- a/testcases/kernel/module/delete_module/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-###########################################################################
-# name of file		 : Makefile		 		 	  #
-# description		 : make file for the delete_module(2) testcases	  #
-###########################################################################
-
-ifneq ($(KERNELRELEASE),)
-
-obj-m := dummy_del_mod.o dummy_del_mod_dep.o
-
-else
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-REQ_VERSION_MAJOR	:= 2
-REQ_VERSION_PATCH	:= 6
-
-MAKE_TARGETS		:= delete_module01 delete_module02 delete_module03 \
-			   dummy_del_mod.ko dummy_del_mod_dep.ko
-
-include $(top_srcdir)/include/mk/module.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
-
-endif
diff --git a/testcases/kernel/module/delete_module/delete_module01.c b/testcases/kernel/module/delete_module/delete_module01.c
deleted file mode 100644
index a159de8..0000000
--- a/testcases/kernel/module/delete_module/delete_module01.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-/*
- *    AUTHOR: Madhu T L <madhu.tarikere@wipro.com>
- *
- *    DESCRIPTION:
- *    	Basic tests for delete_module(2)
- *    	1) insmod dummy_del_mod.ko
- *    	2) call delete_module(2) to remove dummy_del_mod.ko
- */
-
-#include <errno.h>
-#include "test.h"
-#include "old_module.h"
-#include "safe_macros.h"
-#include "lapi/syscalls.h"
-
-#define MODULE_NAME	"dummy_del_mod"
-#define MODULE_NAME_KO	"dummy_del_mod.ko"
-
-static void setup(void);
-static void cleanup(void);
-
-
-char *TCID = "delete_module01";
-int TST_TOTAL = 1;
-static int module_loaded;
-
-int main(int argc, char **argv)
-{
-	int lc;
-
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-
-		/* insert dummy_del_mod.ko */
-		if (module_loaded == 0) {
-			tst_module_load(NULL, MODULE_NAME_KO, NULL);
-			module_loaded = 1;
-		}
-
-		TEST(ltp_syscall(__NR_delete_module, MODULE_NAME, 0));
-		if (TEST_RETURN == -1) {
-			tst_resm(TFAIL | TTERRNO, "delete_module() failed to "
-				 "remove module entry for %s ", MODULE_NAME);
-		} else {
-			tst_resm(TPASS, "delete_module() successful");
-			module_loaded = 0;
-		}
-
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-static void setup(void)
-{
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	tst_require_root();
-
-	TEST_PAUSE;
-}
-
-static void cleanup(void)
-{
-	if (module_loaded == 1)
-		tst_module_unload(NULL, MODULE_NAME_KO);
-}
diff --git a/testcases/kernel/module/delete_module/delete_module02.c b/testcases/kernel/module/delete_module/delete_module02.c
deleted file mode 100644
index f92639e..0000000
--- a/testcases/kernel/module/delete_module/delete_module02.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-/*
- *    AUTHOR: Madhu T L <madhu.tarikere@wipro.com>
- *
- *    DESCRIPTION
- *      Verify that,
- *      1. delete_module(2) returns -1 and sets errno to ENOENT for nonexistent
- *	   module entry.
- *      2. delete_module(2) returns -1 and sets errno to EFAULT, if
- *         module name parameter is outside program's accessible address space.
- *      3. delete_module(2) returns -1 and sets errno to EPERM, if effective
- *         user id of the caller is not superuser.
- */
-
-#include <errno.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <limits.h>
-
-#include <sys/mman.h>
-#include "test.h"
-#include "safe_macros.h"
-#include "lapi/syscalls.h"
-
-#define NULLMODNAME	""
-#define BASEMODNAME	"dummy"
-#define LONGMODNAMECHAR	'm'	/* Arbitrarily selected */
-
-/*
- * From kernel internal headers: include/linux/module.h
- * include/linux/moduleparam.h
- */
-#define MODULE_NAME_LEN	( 64 - sizeof(unsigned long) )
-
-char *TCID = "delete_module02";
-
-static char nobody_uid[] = "nobody";
-struct passwd *ltpuser;
-static char longmodname[MODULE_NAME_LEN];
-static char modname[20];
-
-static void setup(void);
-static void cleanup(void);
-static void setup1(void);
-static void cleanup1(void);
-
-static struct test_case_t {
-	char *modname;
-	int experrno;
-	char *desc;
-	void (*setup) (void);
-	void (*cleanup) (void);
-} tdat[] = {
-	{ modname, ENOENT, "nonexistent module", NULL, NULL},
-	{ NULLMODNAME, ENOENT, "null terminated module name", NULL, NULL},
-	{ (char *)-1, EFAULT, "module name outside program's "
-	  "accessible address space", NULL, NULL},
-	{ longmodname, ENOENT, "long module name", NULL, NULL},
-	{ modname, EPERM, "non-superuser", setup1, cleanup1},
-};
-
-int TST_TOTAL = ARRAY_SIZE(tdat);
-
-int main(int argc, char **argv)
-{
-	int lc;
-	int i;
-
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; ++i) {
-			if (tdat[i].setup)
-				tdat[i].setup();
-
-			tst_resm(TINFO, "test %s", tdat[i].desc);
-			TEST(ltp_syscall(__NR_delete_module,
-			     tdat[i].modname, 0));
-
-			if (TEST_RETURN != -1) {
-				tst_resm(TFAIL, "delete_module() "
-					 "succeeded unexpectedly");
-			} else if (TEST_ERRNO == tdat[i].experrno) {
-				tst_resm(TPASS | TTERRNO,
-					 "delete_module() failed as expected");
-			} else {
-				tst_resm(TFAIL | TTERRNO, "delete_module() "
-					 "failed unexpectedly; expected: "
-					 "%d - %s", tdat[i].experrno,
-					 strerror(tdat[i].experrno));
-			}
-			if (tdat[i].cleanup)
-				tdat[i].cleanup();
-		}
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-static void setup1(void)
-{
-	SAFE_SETEUID(cleanup, ltpuser->pw_uid);
-}
-
-static void cleanup1(void)
-{
-	SAFE_SETEUID(cleanup, 0);
-}
-
-static void setup(void)
-{
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	tst_require_root();
-
-	ltpuser = SAFE_GETPWNAM(cleanup, nobody_uid);
-
-	TEST_PAUSE;
-
-	/* Initialize longmodname to LONGMODNAMECHAR character */
-	memset(longmodname, LONGMODNAMECHAR, MODULE_NAME_LEN - 1);
-
-	/* Get unique module name for each child process */
-	if (sprintf(modname, "%s_%d", BASEMODNAME, getpid()) <= 0)
-		tst_brkm(TBROK, NULL, "Failed to initialize module name");
-
-	tdat[2].modname = SAFE_MMAP(cleanup, 0, 1, PROT_NONE,
-				    MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
-}
-
-void cleanup(void)
-{
-}
diff --git a/testcases/kernel/module/delete_module/delete_module03.c b/testcases/kernel/module/delete_module/delete_module03.c
deleted file mode 100644
index cbf9ff6..0000000
--- a/testcases/kernel/module/delete_module/delete_module03.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-/*
- *    AUTHOR: Madhu T L <madhu.tarikere@wipro.com>
- *
- *    DESCRIPTION
- *      Verify that, delete_module(2) returns -1 and sets errno to EWOULDBLOCK,
- *      if tried to remove a module while other modules depend on this module.
- *
- */
-
-#include <errno.h>
-#include "test.h"
-#include "old_module.h"
-#include "safe_macros.h"
-#include "lapi/syscalls.h"
-
-#define DUMMY_MOD		"dummy_del_mod"
-#define DUMMY_MOD_KO		"dummy_del_mod.ko"
-#define DUMMY_MOD_DEP		"dummy_del_mod_dep"
-#define DUMMY_MOD_DEP_KO	"dummy_del_mod_dep.ko"
-
-static int dummy_mod_loaded;
-static int dummy_mod_dep_loaded;
-
-char *TCID = "delete_module03";
-
-int TST_TOTAL = 1;
-
-static void setup();
-static void cleanup(void);
-
-int main(int argc, char **argv)
-{
-	int lc;
-
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-
-		TEST(ltp_syscall(__NR_delete_module, DUMMY_MOD, 0));
-
-		if (TEST_RETURN < 0) {
-			switch (errno) {
-			case EWOULDBLOCK:
-				tst_resm(TPASS | TTERRNO,
-					 "delete_module() failed as expected");
-			break;
-			default:
-				tst_resm(TFAIL | TTERRNO, "delete_module() "
-					 "failed unexpectedly; expected: "
-					 "%d - %s", EWOULDBLOCK,
-					 strerror(EWOULDBLOCK));
-			break;
-			}
-		} else {
-			tst_resm(TFAIL, "delete_module()"
-				 "succeeded unexpectedly");
-			dummy_mod_loaded = 0;
-			/*
-			 * insmod DUMMY_MOD_KO again in case running
-			 * with -i option
-			 */
-			tst_module_load(cleanup, DUMMY_MOD_KO, NULL);
-			dummy_mod_loaded = 1;
-		}
-	}
-
-	cleanup();
-	tst_exit();
-
-}
-
-static void setup(void)
-{
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	tst_require_root();
-
-	/* Load first kernel module */
-	tst_module_load(cleanup, DUMMY_MOD_KO, NULL);
-	dummy_mod_loaded = 1;
-
-	/* Load dependant kernel module */
-	tst_module_load(cleanup, DUMMY_MOD_DEP_KO, NULL);
-	dummy_mod_dep_loaded = 1;
-
-	TEST_PAUSE;
-}
-
-static void cleanup(void)
-{
-	/* Unload dependent kernel module */
-	if (dummy_mod_dep_loaded == 1)
-		tst_module_unload(NULL, DUMMY_MOD_DEP_KO);
-
-	/* Unload first kernel module */
-	if (dummy_mod_loaded == 1)
-		tst_module_unload(NULL, DUMMY_MOD_KO);
-}
diff --git a/testcases/kernel/module/delete_module/dummy_del_mod.c b/testcases/kernel/module/delete_module/dummy_del_mod.c
deleted file mode 100644
index 10932d0..0000000
--- a/testcases/kernel/module/delete_module/dummy_del_mod.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/*************************************************************************
- * Description: This is a kernel loadable module programme used by
- *		delete_module03 testcase which inserts this module as part
- *		setup.
- *************************************************************************/
-
-#ifndef MODULE
-#define MODULE
-#endif
-
-/* #define __KERNEL__    Commented this line out b/c it causes errors with
- *			 module.h when it calls /usr/include/linux/version.h
- *			 -11/22/02 Robbie Williamson <robbiew@us.ibm.com>
- */
-
-#include <asm/atomic.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/proc_fs.h>
-#include <linux/kernel.h>
-
-static int dummy_func_test(void);
-
-/* Dummy function called by dependent module */
-
-static int dummy_func_test()
-{
-	return 0;
-}
-
-static int __init dummy_init(void)
-{
-	struct proc_dir_entry *proc_dummy;
-
-	proc_dummy = proc_mkdir("dummy", 0);
-	return 0;
-}
-
-static void __exit dummy_exit(void)
-{
-
-	remove_proc_entry("dummy", 0);
-}
-
-module_init(dummy_init);
-module_exit(dummy_exit);
-EXPORT_SYMBOL(dummy_func_test);
-MODULE_LICENSE("GPL");
diff --git a/testcases/kernel/module/delete_module/dummy_del_mod_dep.c b/testcases/kernel/module/delete_module/dummy_del_mod_dep.c
deleted file mode 100644
index c9f60e3..0000000
--- a/testcases/kernel/module/delete_module/dummy_del_mod_dep.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/*************************************************************************
- * Description: This is a kernel loadable module programme used by
- *		delete_module03 testcase which inserts this module as part
- *		of setup. This module has dependency on dummy_del_mod module
- *		(calls function of dummy_del_mod during initialization).
- *************************************************************************/
-
-#ifndef MODULE
-#define MODULE
-#endif
-/* #define __KERNEL__    Commented this line out b/c it causes errors with
- *                       module.h when it calls /usr/include/linux/version.h
- *                       -11/22/02 Robbie Williamson <robbiew@us.ibm.com>
- */
-
-#include <asm/atomic.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/proc_fs.h>
-#include <linux/kernel.h>
-
-extern int dummy_func_test(void);
-
-static int __init dummy_init(void)
-{
-	struct proc_dir_entry *proc_dummy;
-
-	proc_dummy = proc_mkdir("dummy_dep", 0);
-	dummy_func_test();
-	return 0;
-}
-
-static void __exit dummy_exit(void)
-{
-	remove_proc_entry("dummy_dep", 0);
-}
-
-module_init(dummy_init);
-module_exit(dummy_exit);
-MODULE_LICENSE("GPL");
diff --git a/testcases/kernel/syscalls/delete_module/.gitignore b/testcases/kernel/syscalls/delete_module/.gitignore
new file mode 100644
index 0000000..8ffd425
--- /dev/null
+++ b/testcases/kernel/syscalls/delete_module/.gitignore
@@ -0,0 +1,5 @@
+/delete_module01
+/delete_module02
+/delete_module03
+/dummy_del_mod.ko
+/dummy_del_mod_dep.ko
diff --git a/testcases/kernel/syscalls/delete_module/Makefile b/testcases/kernel/syscalls/delete_module/Makefile
new file mode 100644
index 0000000..b98dcd3
--- /dev/null
+++ b/testcases/kernel/syscalls/delete_module/Makefile
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+# Copyright (c) 2018 Xiao Yang <yangx.jy@cn.fujitsu.com>
+#
+
+ifneq ($(KERNELRELEASE),)
+
+obj-m := dummy_del_mod.o dummy_del_mod_dep.o
+
+else
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+REQ_VERSION_MAJOR	:= 2
+REQ_VERSION_PATCH	:= 6
+
+MAKE_TARGETS		:= delete_module01 delete_module02 delete_module03 \
+			   dummy_del_mod.ko dummy_del_mod_dep.ko
+
+include $(top_srcdir)/include/mk/module.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
+
+endif
diff --git a/testcases/kernel/syscalls/delete_module/delete_module01.c b/testcases/kernel/syscalls/delete_module/delete_module01.c
new file mode 100644
index 0000000..e5cb53c
--- /dev/null
+++ b/testcases/kernel/syscalls/delete_module/delete_module01.c
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Copyright (c) 2018 Xiao Yang <yangx.jy@cn.fujitsu.com>
+ */
+
+/*
+ * AUTHOR: Madhu T L <madhu.tarikere@wipro.com>
+ *
+ * DESCRIPTION:
+ * Basic tests for delete_module(2)
+ * 1) insmod dummy_del_mod.ko
+ * 2) call delete_module(2) to remove dummy_del_mod.ko
+ */
+
+#include <errno.h>
+#include "old_module.h"
+#include "lapi/syscalls.h"
+#include "tst_test.h"
+
+#define MODULE_NAME	"dummy_del_mod"
+#define MODULE_NAME_KO	"dummy_del_mod.ko"
+
+static int module_loaded;
+
+static void do_delete_module(void)
+{
+	if (module_loaded == 0) {
+		tst_module_load(NULL, MODULE_NAME_KO, NULL);
+		module_loaded = 1;
+	}
+
+	TEST(tst_syscall(__NR_delete_module, MODULE_NAME, 0));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "delete_module() failed to "
+			"remove module entry for %s ", MODULE_NAME);
+		return;
+	}
+
+	tst_res(TPASS, "delete_module() successful");
+	module_loaded = 0;
+}
+
+static void cleanup(void)
+{
+	if (module_loaded == 1)
+		tst_module_unload(NULL, MODULE_NAME_KO);
+}
+
+static struct tst_test test = {
+	.needs_root = 1,
+	.cleanup = cleanup,
+	.test_all = do_delete_module,
+};
diff --git a/testcases/kernel/syscalls/delete_module/delete_module02.c b/testcases/kernel/syscalls/delete_module/delete_module02.c
new file mode 100644
index 0000000..f52239f
--- /dev/null
+++ b/testcases/kernel/syscalls/delete_module/delete_module02.c
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Copyright (c) 2018 Xiao Yang <yangx.jy@cn.fujitsu.com>
+ */
+
+/*
+ * AUTHOR: Madhu T L <madhu.tarikere@wipro.com>
+ *
+ * DESCRIPTION
+ * Verify that,
+ * 1. delete_module(2) returns -1 and sets errno to ENOENT for nonexistent
+ *    module entry.
+ * 2. delete_module(2) returns -1 and sets errno to EFAULT, if
+ *    module name parameter is outside program's accessible address space.
+ * 3. delete_module(2) returns -1 and sets errno to EPERM, if effective
+ *    user id of the caller is not superuser.
+ */
+
+#include <errno.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+
+#define BASEMODNAME	"dummy"
+#define LONGMODNAMECHAR	'm'
+
+/*
+ * From kernel internal headers: include/linux/module.h
+ * include/linux/moduleparam.h
+ */
+#define MODULE_NAME_LEN	(64 - sizeof(unsigned long))
+
+static struct passwd *ltpuser;
+static char longmodname[MODULE_NAME_LEN];
+static char modname[20];
+
+static struct test_case_t {
+	char *modname;
+	int experrno;
+	char *desc;
+	/* 1: nobody_user 0: root_user */
+	int nobody_user;
+} tdat[] = {
+	{ modname, ENOENT, "nonexistent module", 0},
+	{ "", ENOENT, "null terminated module name", 0},
+	{ NULL, EFAULT, "module name outside program's accessible address space", 0},
+	{ longmodname, ENOENT, "long module name", 0},
+	{ modname, EPERM, "non-superuser", 1},
+};
+
+static void do_delete_module(unsigned int n)
+{
+	struct test_case_t *tc = &tdat[n];
+
+	if (!tc->modname)
+		tc->modname = tst_get_bad_addr(NULL);
+
+	if (tc->nobody_user)
+		SAFE_SETEUID(ltpuser->pw_uid);
+
+	tst_res(TINFO, "test %s", tc->desc);
+	TEST(tst_syscall(__NR_delete_module, tc->modname, 0));
+	if (TST_RET != -1) {
+		tst_res(TFAIL, "delete_module() succeeded unexpectedly");
+	} else if (TST_ERR == tc->experrno) {
+		tst_res(TPASS | TTERRNO, "delete_module() failed as expected");
+	} else {
+		tst_res(TFAIL | TTERRNO, "delete_module() failed unexpectedly;"
+			" expected: %s", tst_strerrno(tc->experrno));
+	}
+
+	if (tc->nobody_user)
+		SAFE_SETEUID(0);
+}
+
+static void setup(void)
+{
+	ltpuser = SAFE_GETPWNAM("nobody");
+
+	/* Initialize longmodname to LONGMODNAMECHAR character */
+	memset(longmodname, LONGMODNAMECHAR, MODULE_NAME_LEN - 1);
+
+	/* Get unique module name for each child process */
+	sprintf(modname, "%s_%d", BASEMODNAME, getpid());
+}
+
+static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(tdat),
+	.needs_root = 1,
+	.setup = setup,
+	.test = do_delete_module,
+};
diff --git a/testcases/kernel/syscalls/delete_module/delete_module03.c b/testcases/kernel/syscalls/delete_module/delete_module03.c
new file mode 100644
index 0000000..8bd51be
--- /dev/null
+++ b/testcases/kernel/syscalls/delete_module/delete_module03.c
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Copyright (c) 2018 Xiao Yang <yangx.jy@cn.fujitsu.com>
+ */
+
+/*
+ * AUTHOR: Madhu T L <madhu.tarikere@wipro.com>
+ *
+ * DESCRIPTION
+ * Verify that, delete_module(2) returns -1 and sets errno to EWOULDBLOCK,
+ * if tried to remove a module while other modules depend on this module.
+ */
+
+#include <errno.h>
+#include "tst_test.h"
+#include "old_module.h"
+#include "lapi/syscalls.h"
+
+#define DUMMY_MOD		"dummy_del_mod"
+#define DUMMY_MOD_KO		"dummy_del_mod.ko"
+#define DUMMY_MOD_DEP_KO	"dummy_del_mod_dep.ko"
+
+static int dummy_mod_loaded;
+static int dummy_mod_dep_loaded;
+
+static void do_delete_module(void)
+{
+	TEST(tst_syscall(__NR_delete_module, DUMMY_MOD, 0));
+	if (TST_RET < 0) {
+		if (TST_ERR == EWOULDBLOCK) {
+			tst_res(TPASS | TTERRNO,
+				"delete_module() failed as expected");
+		} else {
+			tst_res(TFAIL | TTERRNO, "delete_module() failed "
+			"unexpectedly; expected: %s",
+			tst_strerrno(EWOULDBLOCK));
+		}
+	} else {
+		tst_res(TFAIL, "delete_module() succeeded unexpectedly");
+		dummy_mod_loaded = 0;
+		/*
+		 * insmod DUMMY_MOD_KO again in case running
+		 * with -i option
+		 */
+		tst_module_load(NULL, DUMMY_MOD_KO, NULL);
+		dummy_mod_loaded = 1;
+	}
+}
+
+static void setup(void)
+{
+	/* Load first kernel module */
+	tst_module_load(NULL, DUMMY_MOD_KO, NULL);
+	dummy_mod_loaded = 1;
+
+	/* Load dependant kernel module */
+	tst_module_load(NULL, DUMMY_MOD_DEP_KO, NULL);
+	dummy_mod_dep_loaded = 1;
+}
+
+static void cleanup(void)
+{
+	/* Unload dependent kernel module */
+	if (dummy_mod_dep_loaded == 1)
+		tst_module_unload(NULL, DUMMY_MOD_DEP_KO);
+
+	/* Unload first kernel module */
+	if (dummy_mod_loaded == 1)
+		tst_module_unload(NULL, DUMMY_MOD_KO);
+}
+
+static struct tst_test test = {
+	.needs_root = 1,
+	.setup = setup,
+	.cleanup = cleanup,
+	.test_all = do_delete_module,
+};
diff --git a/testcases/kernel/syscalls/delete_module/dummy_del_mod.c b/testcases/kernel/syscalls/delete_module/dummy_del_mod.c
new file mode 100644
index 0000000..04a0b32
--- /dev/null
+++ b/testcases/kernel/syscalls/delete_module/dummy_del_mod.c
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Copyright (c) 2018 Xiao Yang <yangx.jy@cn.fujitsu.com>
+ */
+/*
+ * Description:
+ * This is a kernel loadable module programme used by delete_module*
+ * testcases which insert this module as part setup.
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/proc_fs.h>
+#include <linux/kernel.h>
+
+static int dummy_func_test(void);
+
+/* Dummy function called by dependent module */
+int dummy_func_test(void)
+{
+	return 0;
+}
+EXPORT_SYMBOL(dummy_func_test);
+
+static int __init dummy_init(void)
+{
+	struct proc_dir_entry *proc_dummy;
+
+	proc_dummy = proc_mkdir("dummy", 0);
+	return 0;
+}
+
+static void __exit dummy_exit(void)
+{
+	remove_proc_entry("dummy", 0);
+}
+
+module_init(dummy_init);
+module_exit(dummy_exit);
+MODULE_LICENSE("GPL");
diff --git a/testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c b/testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c
new file mode 100644
index 0000000..85b3279
--- /dev/null
+++ b/testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Copyright (c) 2018 Xiao Yang <yangx.jy@cn.fujitsu.com>
+ */
+/*
+ * Description:
+ * This is a kernel loadable module programme used by delete_module03
+ * testcase which inserts this module as part of setup. This module
+ * has dependency on dummy_del_mod module (calls function of dummy_del_mod
+ * during initialization).
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/proc_fs.h>
+#include <linux/kernel.h>
+
+extern int dummy_func_test(void);
+
+static int __init dummy_init(void)
+{
+	struct proc_dir_entry *proc_dummy;
+
+	proc_dummy = proc_mkdir("dummy_dep", 0);
+	dummy_func_test();
+	return 0;
+}
+
+static void __exit dummy_exit(void)
+{
+	remove_proc_entry("dummy_dep", 0);
+}
+
+module_init(dummy_init);
+module_exit(dummy_exit);
+MODULE_LICENSE("GPL");
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH 1/2] module: Remove obsolete create_module(2) and query_module(2)
  2018-09-28  8:52 [LTP] [PATCH 1/2] module: Remove obsolete create_module(2) and query_module(2) Xiao Yang
  2018-09-28  8:52 ` [LTP] [PATCH 2/2] delete_module*: Cleanup && Move to kernel/syscalls Xiao Yang
@ 2018-10-01 14:38 ` Cyril Hrubis
  1 sibling, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2018-10-01 14:38 UTC (permalink / raw)
  To: ltp

Hi!
Both pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-01 14:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-28  8:52 [LTP] [PATCH 1/2] module: Remove obsolete create_module(2) and query_module(2) Xiao Yang
2018-09-28  8:52 ` [LTP] [PATCH 2/2] delete_module*: Cleanup && Move to kernel/syscalls Xiao Yang
2018-10-01 14:38 ` [LTP] [PATCH 1/2] module: Remove obsolete create_module(2) and query_module(2) Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox