public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP]  [PATCH 1/2] syscalls/fstatfs: Cleanup
@ 2014-04-30  9:26 shuang.qiu
  2014-04-30 10:27 ` Stanislav Kholmanskikh
  0 siblings, 1 reply; 3+ messages in thread
From: shuang.qiu @ 2014-04-30  9:26 UTC (permalink / raw)
  To: ltp-list

From: Shuang Qiu <shuang.qiu@oracle.com>

* Delete some useless comments

* Make variables and functions static

Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
---
 testcases/kernel/syscalls/fstatfs/fstatfs01.c |  102 ++++---------------------
 testcases/kernel/syscalls/fstatfs/fstatfs02.c |   77 +++++--------------
 2 files changed, 34 insertions(+), 145 deletions(-)

diff --git a/testcases/kernel/syscalls/fstatfs/fstatfs01.c b/testcases/kernel/syscalls/fstatfs/fstatfs01.c
index 66b014f..2714fa0 100644
--- a/testcases/kernel/syscalls/fstatfs/fstatfs01.c
+++ b/testcases/kernel/syscalls/fstatfs/fstatfs01.c
@@ -31,83 +31,13 @@
  *
  */
 /* $Id: fstatfs01.c,v 1.7 2009/10/26 14:55:47 subrata_modak Exp $ */
-/**********************************************************
- *
- *    OS Test - Silicon Graphics, Inc.
- *
- *    TEST IDENTIFIER	: fstatfs01
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Basic test for fstatfs(2)
- *
- *    PARENT DOCUMENT	: usctpl01
- *
- *    TEST CASE TOTAL	: 1
- *
- *    WALL CLOCK TIME	: 1
- *
- *    CPU TYPES		: ALL
- *
- *    AUTHOR		: William Roske
- *
- *    CO-PILOT		: Dave Fenner
- *
- *    DATE STARTED	: 03/30/92
- *
- *    INITIAL RELEASE	: UNICOS 7.0
- *
- *    TEST CASES
- *
- * 	1.) fstatfs(2) returns...(See Description)
- *
- *    INPUT SPECIFICATIONS
- * 	The standard options for system call tests are accepted.
- *	(See the parse_opts(3) man page).
- *
- *    OUTPUT SPECIFICATIONS
- *$
- *    DURATION
- * 	Terminates - with frequency and infinite modes.
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    RESOURCES
- * 	None
- *
- *    ENVIRONMENTAL NEEDS
- *      No run-time environmental needs.
- *
- *    SPECIAL PROCEDURAL REQUIREMENTS
- * 	None
- *
- *    INTERCASE DEPENDENCIES
- * 	None
- *
- *    DETAILED DESCRIPTION
- *	This is a Phase I test for the fstatfs(2) system call.  It is intended
- *	to provide a limited exposure of the system call, for now.  It
- *	should/will be extended when full functional tests are written for
- *	fstatfs(2).
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- * 	  Execute system call
- *	  Check return code, if system call failed (return=-1)
- *		Log the errno and Issue a FAIL message.
- *	  Otherwise, Issue a PASS message.
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
+/*
+ * DETAILED DESCRIPTION
+ *   This is a Phase I test for the fstatfs(2) system call.  It is intended
+ *   to provide a limited exposure of the system call, for now.  It
+ *   should/will be extended when full functional tests are written for
+ *   fstatfs(2).
+ */
 
 #include <sys/types.h>
 #include <sys/fcntl.h>
@@ -118,17 +48,17 @@
 #include "test.h"
 #include "usctest.h"
 
-void setup();
-void cleanup();
+static void setup(void);
+static void cleanup(void);
 
 char *TCID = "fstatfs01";
 int TST_TOTAL = 1;
 
-int exp_enos[] = { 0, 0 };
+static int exp_enos[] = { 0, 0 };
 
-char fname[255];
-int fd;
-struct statfs stats;
+static char fname[255];
+static int fd;
+static struct statfs stats;
 
 int main(int ac, char **av)
 {
@@ -169,9 +99,8 @@ int main(int ac, char **av)
 	tst_exit();
 }
 
-void setup(void)
+static void setup(void)
 {
-
 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
 
 	TEST_PAUSE;
@@ -183,7 +112,7 @@ void setup(void)
 		tst_brkm(TBROK | TERRNO, cleanup, "open failed");
 }
 
-void cleanup(void)
+static void cleanup(void)
 {
 	TEST_CLEANUP;
 
@@ -191,5 +120,4 @@ void cleanup(void)
 		tst_resm(TWARN | TERRNO, "close failed");
 
 	tst_rmdir();
-
 }
diff --git a/testcases/kernel/syscalls/fstatfs/fstatfs02.c b/testcases/kernel/syscalls/fstatfs/fstatfs02.c
index cee234f..b243af3 100644
--- a/testcases/kernel/syscalls/fstatfs/fstatfs02.c
+++ b/testcases/kernel/syscalls/fstatfs/fstatfs02.c
@@ -1,48 +1,24 @@
 /*
+ * Copyright (c) International Business Machines  Corp., 2001
  *
- *   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 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.
  *
- *   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
+ * 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
- *	fstatfs02.c
- *
  * DESCRIPTION
  *	Testcase to check fstatfs() sets errno correctly.
- *
- * ALGORITHM
- *	1. Pass -1 as the "fd" parameter for fstatfs(), and expect EBADF.
- *	2. Pass an invalid address (outside the address space of the process),
- *	   as the buf paramter of fstatfs(), and expect EFAULT.
- *
- * USAGE:  <for command-line>
- *  fstatfs02 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -e   : Turn on errno logging.
- *             -i n : Execute test n times.
- *             -I x : Execute test for x seconds.
- *             -P x : Pause for x seconds between iterations.
- *             -t   : Turn on syscall timing.
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS
- *	NONE
  */
 
 #include <sys/vfs.h>
@@ -52,16 +28,16 @@
 #include "test.h"
 #include "usctest.h"
 
-void setup(void);
-void cleanup(void);
+static void setup(void);
+static void cleanup(void);
 
 char *TCID = "fstatfs02";
 
-int exp_enos[] = { EBADF, EFAULT, 0 };
+static int exp_enos[] = { EBADF, EFAULT, 0 };
 
-struct statfs buf;
+static struct statfs buf;
 
-struct test_case_t {
+static struct test_case_t {
 	int fd;
 	struct statfs *sbuf;
 	int error;
@@ -126,33 +102,18 @@ int main(int ac, char **av)
 	tst_exit();
 }
 
-/*
- * setup() - performs all ONE TIME setup for this test.
- */
-void setup(void)
+static void setup(void)
 {
-
 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
 
 	TEST_PAUSE;
 
-	/* make a temporary directory and cd to it */
 	tst_tmpdir();
 }
 
-/*
- * cleanup() - performs all ONE TIME cleanup for this test at
- *	       completion or premature exit.
- */
-void cleanup(void)
+static void cleanup(void)
 {
-	/*
-	 * print timing stats if that option was specified.
-	 * print errno log if that option was specified.
-	 */
 	TEST_CLEANUP;
 
-	/* delete the test directory created in setup() */
 	tst_rmdir();
-
 }
-- 
1.7.7


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2014-05-15 12:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-30  9:26 [LTP] [PATCH 1/2] syscalls/fstatfs: Cleanup shuang.qiu
2014-04-30 10:27 ` Stanislav Kholmanskikh
2014-05-15 12:51   ` chrubis

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