All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <aelder@sgi.com>
To: ltp-list <ltp-list@lists.sourceforge.net>
Subject: [LTP] [PATCH 5/6] ltp: use C function prototypes in "iogen.c"
Date: Mon, 04 Apr 2011 07:08:37 -0500	[thread overview]
Message-ID: <1301918917.3282.28.camel@doink> (raw)

Many functions in "iogen.c" are defined using old-style C
declarations.  Convert all functions so they follow standard C,
and include standard prototypes for each.

Every function (except main()) now has a standard C prototype, and
all prototypes are grouped in the same section of the file.  The
prototypes--as well as the function definitions themselves--now
follow a consistent formatting style.

Signed-off-by: Alex Elder <aelder@sgi.com>
---
 testcases/kernel/fs/doio/iogen.c |   61 +++++++++++++++-----------------------
 1 files changed, 24 insertions(+), 37 deletions(-)

diff --git a/testcases/kernel/fs/doio/iogen.c b/testcases/kernel/fs/doio/iogen.c
index 4f46099..167edbd 100644
--- a/testcases/kernel/fs/doio/iogen.c
+++ b/testcases/kernel/fs/doio/iogen.c
@@ -113,6 +113,18 @@ struct strmap {
 	int	m_flags;
 };
 
+void		startup_info(FILE *stream, int seed);
+int		init_output(void);
+int		form_iorequest(struct io_req *req);
+int		get_file_info(struct file_info *rec);
+int		create_file(char *path, int nbytes);
+int		str_to_value(struct strmap *map, char *str);
+struct strmap	*str_lookup(struct strmap *map, char *str);
+char		*value_to_string(struct strmap *map, int val);
+int		parse_cmdline(int argc, char **argv, char *opts);
+int		help(FILE *stream);
+int		usage(FILE *stream);
+
 /*
  * Declare cmdline option flags/variables initialized in parse_cmdline()
  */
@@ -165,8 +177,6 @@ int	Fileio = 0;		/* flag indicating that a file		    */
 int	Naio_Strat_Types = 0;	/* # async io completion types		    */
 struct	strmap *Aio_Strat_List[128]; /* Async io completion types	    */
 
-void	startup_info();
-
 /*
  * Map async io completion modes (-a args) names to values.  Macros are
  * defined in doio.h.
@@ -366,16 +376,8 @@ char	Byte_Patterns[26] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
 			      'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
 			      'Y', 'Z' };
 
-int form_iorequest(struct io_req *);
-int init_output();
-int parse_cmdline(int argc, char **argv, char *opts);
-int help(FILE *stream);
-int usage(FILE *stream);
-
 int
-main(argc, argv)
-int 	argc;
-char	**argv;
+main(int argc, char **argv)
 {
     int	    	    rseed, outfd, infinite;
     time_t  	    start_time;
@@ -533,7 +535,7 @@ startup_info(FILE *stream, int seed)
  * error code if this cannot be done.
  */
 int
-init_output()
+init_output(void)
 {
     int	 outfd;
     struct stat	    sbuf;
@@ -579,8 +581,7 @@ init_output()
  */
 
 int
-form_iorequest(req)
-struct io_req   *req;
+form_iorequest(struct io_req *req)
 {
     int	    	    	mult, offset=0, length=0, slength;
     int	    	    	minlength, maxlength, laststart, lastend;
@@ -926,8 +927,7 @@ struct io_req   *req;
  */
 
 int
-get_file_info(rec)
-struct file_info    *rec;
+get_file_info(struct file_info *rec)
 {
     struct stat			sbuf;
 #ifdef CRAY
@@ -1047,9 +1047,7 @@ struct file_info    *rec;
  */
 
 int
-create_file(path, nbytes)
-char	*path;
-int 	nbytes;
+create_file(char *path, int nbytes)
 {
     int	    	fd, rval;
     char    	c;
@@ -1298,9 +1296,7 @@ int 	nbytes;
  */
 
 int
-str_to_value(map, str)
-struct strmap	*map;
-char	    	*str;
+str_to_value(struct strmap *map, char *str)
 {
     struct strmap   *mp;
 
@@ -1317,9 +1313,7 @@ char	    	*str;
  */
 
 struct strmap *
-str_lookup(map, str)
-struct strmap	*map;
-char	    	*str;
+str_lookup(struct strmap *map, char *str)
 {
     struct strmap   *mp;
 
@@ -1336,9 +1330,7 @@ char	    	*str;
  */
 
 char *
-value_to_string(map, val)
-struct strmap   *map;
-int		val;
+value_to_string(struct strmap *map, int val)
 {
     struct strmap  *mp;
 
@@ -1355,10 +1347,7 @@ int		val;
  */
 
 int
-parse_cmdline(argc, argv, opts)
-int 	argc;
-char	**argv;
-char	*opts;
+parse_cmdline(int argc, char **argv, char *opts)
 {
     int	    	    	o, len, nb, format_error;
     struct strmap	*flgs, *sc;
@@ -1870,8 +1859,7 @@ char	*opts;
 }
 
 int
-help(stream)
-FILE	*stream;
+help(FILE *stream)
 {
     usage(stream);
     fprintf(stream, "\n");
@@ -1981,9 +1969,8 @@ FILE	*stream;
  */
 
 int
-usage(stream)
-FILE	*stream;
+usage(FILE *stream)
 {
     fprintf(stream, "usage%s:  iogen [-hoq] [-a aio_type,...] [-f flag[,flag...]] [-i iterations] [-p outpipe] [-m offset-mode] [-s syscall[,syscall...]] [-t mintrans] [-T maxtrans] [ -O file-create-flags ] [[len:]file ...]\n", TagName);
   return 0;
-}
\ No newline at end of file
+}
-- 
1.7.4




------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

             reply	other threads:[~2011-04-04 12:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04 12:08 Alex Elder [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-04-01 22:01 [LTP] [PATCH 0/6] ltp: kill off some compile warnings Alex Elder
2011-04-01 22:01 ` [LTP] [PATCH 1/6] ltp: fix databinchk() definition Alex Elder
2011-04-01 22:01   ` [LTP] [PATCH 5/6] ltp: use C function prototypes in "iogen.c" Alex Elder

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=1301918917.3282.28.camel@doink \
    --to=aelder@sgi.com \
    --cc=ltp-list@lists.sourceforge.net \
    /path/to/YOUR_REPLY

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

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