* Re: [LTP] [PATCH 1/3] Indentation and coding style fixes on /lib/str_to_bytes.c as well as /include/str_to_bytes.h
[not found] <1336655089-26941-1-git-send-email-marios.makris@gmail.com>
@ 2012-05-14 7:15 ` Wanlong Gao
2012-05-16 14:23 ` Cyril Hrubis
[not found] ` <1336655089-26941-2-git-send-email-marios.makris@gmail.com>
[not found] ` <1336655089-26941-3-git-send-email-marios.makris@gmail.com>
2 siblings, 1 reply; 9+ messages in thread
From: Wanlong Gao @ 2012-05-14 7:15 UTC (permalink / raw)
To: Marios Makris; +Cc: ltp-list
On 05/10/2012 09:04 PM, Marios Makris wrote:
> Fixed broken identation as well as replaced the old K&R
> function declarations.
>
> Signed-off-by: Marios Makris <marios.makris@gmail.com>
Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
> include/str_to_bytes.h | 6 +-
> lib/str_to_bytes.c | 162 +++++++++++++++++++++++-------------------------
> 2 files changed, 80 insertions(+), 88 deletions(-)
>
> diff --git a/include/str_to_bytes.h b/include/str_to_bytes.h
> index 977a6b1..314eb88 100644
> --- a/include/str_to_bytes.h
> +++ b/include/str_to_bytes.h
> @@ -32,8 +32,8 @@
> #ifndef _STR_TO_BYTES_
> #define _STR_TO_BYTES_
>
> -int str_to_bytes ( char * );
> -long str_to_lbytes ( char * );
> -long long str_to_llbytes( char * );
> +int str_to_bytes(char *);
> +long str_to_lbytes(char *);
> +long long str_to_llbytes(char *);
>
> #endif
> diff --git a/lib/str_to_bytes.c b/lib/str_to_bytes.c
> index 26e4897..f18291c 100644
> --- a/lib/str_to_bytes.c
> +++ b/lib/str_to_bytes.c
> @@ -67,144 +67,136 @@
> #define B_MULT UBSIZE
> #endif
>
> -
> #define K_MULT 1024 /* Kilo or 2^10 */
> #define M_MULT 1048576 /* Mega or 2^20 */
> #define G_MULT 1073741824 /* Giga or 2^30 */
> #define T_MULT 1099511627776 /* tera or 2^40 */
>
> -int
> -str_to_bytes(s)
> -char *s;
> +int str_to_bytes(char *s)
> {
> - char mult, junk;
> - int nconv;
> - float num;
> + char mult, junk;
> + int nconv;
> + float num;
>
> - nconv = sscanf(s, "%f%c%c", &num, &mult, &junk);
> - if (nconv == 0 || nconv == 3)
> - return -1;
> + nconv = sscanf(s, "%f%c%c", &num, &mult, &junk);
> + if (nconv == 0 || nconv == 3)
> + return -1;
>
> - if (nconv == 1)
> - return num;
> + if (nconv == 1)
> + return num;
>
> - switch (mult) {
> - case 'b':
> + switch (mult) {
> + case 'b':
> return (int)(num * (float)B_MULT);
> - case 'k':
> + case 'k':
> return (int)(num * (float)K_MULT);
> - case 'K':
> + case 'K':
> return (int)((num * (float)K_MULT) * sizeof(long));
> - case 'm':
> + case 'm':
> return (int)(num * (float)M_MULT);
> - case 'M':
> + case 'M':
> return (int)((num * (float)M_MULT) * sizeof(long));
> - case 'g':
> + case 'g':
> return (int)(num * (float)G_MULT);
> - case 'G':
> - return (int)((num * (float)G_MULT) * sizeof(long));
> - default:
> - return -1;
> - }
> + case 'G':
> + return (int)((num * (float)G_MULT) * sizeof(long));
> + default:
> + return -1;
> + }
> }
>
> -long
> -str_to_lbytes(s)
> -char *s;
> +long str_to_lbytes(char *s)
> {
> - char mult, junk;
> - long nconv;
> - float num;
> + char mult, junk;
> + long nconv;
> + float num;
>
> - nconv = sscanf(s, "%f%c%c", &num, &mult, &junk);
> - if (nconv == 0 || nconv == 3)
> - return -1;
> + nconv = sscanf(s, "%f%c%c", &num, &mult, &junk);
> + if (nconv == 0 || nconv == 3)
> + return -1;
>
> - if (nconv == 1)
> - return (long)num;
> + if (nconv == 1)
> + return (long)num;
>
> - switch (mult) {
> - case 'b':
> + switch (mult) {
> + case 'b':
> return (long)(num * (float)B_MULT);
> - case 'k':
> + case 'k':
> return (long)(num * (float)K_MULT);
> - case 'K':
> + case 'K':
> return (long)((num * (float)K_MULT) * sizeof(long));
> - case 'm':
> + case 'm':
> return (long)(num * (float)M_MULT);
> - case 'M':
> + case 'M':
> return (long)((num * (float)M_MULT) * sizeof(long));
> - case 'g':
> + case 'g':
> return (long)(num * (float)G_MULT);
> - case 'G':
> - return (long)((num * (float)G_MULT) * sizeof(long));
> - default:
> - return -1;
> - }
> + case 'G':
> + return (long)((num * (float)G_MULT) * sizeof(long));
> + default:
> + return -1;
> + }
> }
>
> /*
> * Force 64 bits number when compiled as 32 IRIX binary.
> * This allows for a number bigger than 2G.
> */
> -
> -long long
> -str_to_llbytes(s)
> -char *s;
> +long long str_to_llbytes(char *s)
> {
> - char mult, junk;
> - long nconv;
> - double num;
> + char mult, junk;
> + long nconv;
> + double num;
>
> - nconv = sscanf(s, "%lf%c%c", &num, &mult, &junk);
> - if (nconv == 0 || nconv == 3)
> - return -1;
> + nconv = sscanf(s, "%lf%c%c", &num, &mult, &junk);
> + if (nconv == 0 || nconv == 3)
> + return -1;
>
> - if (nconv == 1)
> - return (long long)num;
> + if (nconv == 1)
> + return (long long)num;
>
> - switch (mult) {
> - case 'b':
> + switch (mult) {
> + case 'b':
> return (long long)(num * (float)B_MULT);
> - case 'k':
> + case 'k':
> return (long long)(num * (float)K_MULT);
> - case 'K':
> + case 'K':
> return (long long)((num * (float)K_MULT) * sizeof(long long));
> - case 'm':
> + case 'm':
> return (long long)(num * (float)M_MULT);
> - case 'M':
> + case 'M':
> return (long long)((num * (float)M_MULT) * sizeof(long long));
> - case 'g':
> + case 'g':
> return (long long)(num * (float)G_MULT);
> - case 'G':
> - return (long long)((num * (float)G_MULT) * sizeof(long long));
> - default:
> - return -1;
> - }
> + case 'G':
> + return (long long)((num * (float)G_MULT) * sizeof(long long));
> + default:
> + return -1;
> + }
> }
>
> #ifdef UNIT_TEST
>
> main(int argc, char **argv)
> {
> - int ind;
> + int ind;
>
> - if (argc == 1) {
> - fprintf(stderr, "missing str_to_bytes() parameteres\n");
> - exit(1);
> - }
> + if (argc == 1) {
> + fprintf(stderr, "missing str_to_bytes() parameteres\n");
> + exit(1);
> + }
>
> - for (ind=1; ind<argc; ind++) {
> + for (ind = 1; ind < argc; ind++) {
>
> - printf("str_to_bytes(%s) returned %d\n",
> - argv[ind], str_to_bytes(argv[ind]));
> + printf("str_to_bytes(%s) returned %d\n",
> + argv[ind], str_to_bytes(argv[ind]));
>
> - printf("str_to_lbytes(%s) returned %ld\n",
> - argv[ind], str_to_lbytes(argv[ind]));
> + printf("str_to_lbytes(%s) returned %ld\n",
> + argv[ind], str_to_lbytes(argv[ind]));
>
> - printf("str_to_llbytes(%s) returned %lld\n",
> - argv[ind], str_to_llbytes(argv[ind]));
> - }
> + printf("str_to_llbytes(%s) returned %lld\n",
> + argv[ind], str_to_llbytes(argv[ind]));
> + }
> }
>
> -#endif
> \ No newline at end of file
> +#endif
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 2/3] Renamed /lib/str_to_bytes.c and /include str_to bytes.h
[not found] ` <1336655089-26941-2-git-send-email-marios.makris@gmail.com>
@ 2012-05-14 7:16 ` Wanlong Gao
0 siblings, 0 replies; 9+ messages in thread
From: Wanlong Gao @ 2012-05-14 7:16 UTC (permalink / raw)
To: Marios Makris; +Cc: ltp-list
On 05/10/2012 09:04 PM, Marios Makris wrote:
> The str_to_bytes files have been renamed to bytes_by_prefix in order
> to make it easier for anyone to understand the purpose of the file,
> the functions of the file have also been ranmed accordingly.
>
> Furthermore any call to the file or its functions by other functions,
> manpages etc. have been modified to comply with the new names.
>
> Signed-off-by: Marios Makris <marios.makris@gmail.com>
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
> README.ltp-devel.in | 2 +-
> doc/man3/{str_to_bytes.3 => bytes_by_prefix.3} | 32 ++++++++++++------------
> doc/man3/parse_ranges.3 | 2 +-
> include/{str_to_bytes.h => bytes_by_prefix.h} | 10 +++---
> lib/{str_to_bytes.c => bytes_by_prefix.c} | 26 +++++++++---------
> ltp-devel.spec.in | 4 +-
> testcases/kernel/fs/doio/iogen.c | 10 +++---
> 7 files changed, 43 insertions(+), 43 deletions(-)
> rename doc/man3/{str_to_bytes.3 => bytes_by_prefix.3} (76%)
> rename include/{str_to_bytes.h => bytes_by_prefix.h} (89%)
> rename lib/{str_to_bytes.c => bytes_by_prefix.c} (89%)
>
> diff --git a/README.ltp-devel.in b/README.ltp-devel.in
> index 5538997..50c377e 100644
> --- a/README.ltp-devel.in
> +++ b/README.ltp-devel.in
> @@ -44,5 +44,5 @@ To read manual pages, then the developer would type:
> man parse_ranges
> man random_range
> man rmobj
> - man str_to_bytes
> + man bytes_by_prefix
> man write_log
> diff --git a/doc/man3/str_to_bytes.3 b/doc/man3/bytes_by_prefix.3
> similarity index 76%
> rename from doc/man3/str_to_bytes.3
> rename to doc/man3/bytes_by_prefix.3
> index 0c5d2fc..ae20b60 100644
> --- a/doc/man3/str_to_bytes.3
> +++ b/doc/man3/bytes_by_prefix.3
> @@ -1,5 +1,5 @@
> .\"
> -.\" $Id: str_to_bytes.3,v 1.1 2000/07/27 16:59:03 alaffin Exp $
> +.\" $Id: bytes_by_prefix.3,v 1.1 2000/07/27 16:59:03 alaffin Exp $
> .\"
> .\" Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
> .\"
> @@ -31,19 +31,19 @@
> .\"
> .\" http://oss.sgi.com/projects/GenInfo/NoticeExplan/
> .\"
> -.TH STR_TO_BYTES 3 07/25/2000 "Linux Test Project"
> +.TH BYTES_BY_PREFIX 3 07/25/2000 "Linux Test Project"
> .SH NAME
> -str_to_bytes \- convert a string to a int byte count
> -str_to_lbytes \- convert a string to a long byte count
> -str_to_llbytes \- convert a string to a long long byte count
> +bytes_by_prefix \- convert a string to a int byte count
> +lbytes_by_prefix \- convert a string to a long byte count
> +llbytes_by_prefix \- convert a string to a long long byte count
> .SH SYNOPSIS
> -int str_to_byte(char *\fIstr\fR);
> +int bytes_by_prefix(char *\fIstr\fR);
> .br
> -long str_to_lbyte(char *\fIstr\fR);
> +long lbytes_by_prefix(char *\fIstr\fR);
> .br
> -long long str_to_llbyte(char *\fIstr\fR);
> +long long llbytes_by_prefix(char *\fIstr\fR);
> .SH DESCRIPTION
> -\fBstr_to_bytes()\fR, \fBstr_to_lbytes()\fR, and \fBstr_to_llbytes()\fR converts
> +\fBbytes_by_prefix()\fR, \fBlbytes_by_prefix()\fR, and \fBllbytes_by_prefix()\fR converts
> \fIstr\fR to an integer, long, or long long byte count. \fIstr\fR is an
> floating point number optionally followed by a single character multiplier.
> Currently the following multipliers are supported:
> @@ -61,7 +61,7 @@ Currently the following multipliers are supported:
> .fi
> .sp
> \fIstr\fR is interpreted as floating point number (base 10).
> -When using \fBstr_to_llbytes()\fR, the uppercase suffix will result
> +When using \fBllbytes_by_prefix()\fR, the uppercase suffix will result
> in multiplying by the size of a (long long) or 8.
> .SH RETURNS
> -1 if the integer portion of \fIstr\fR is invalid, if an unsupported
> @@ -69,18 +69,18 @@ multiplier is supplied, or if \fIstr\fR has extra leading or trailing
> characters. If \fIstr\fR contains a negative number, the return
> value will be negative.
> .SH EXAMPLES
> -\fBstr_to_bytes("1000")\fR
> +\fBbytes_by_prefix("1000")\fR
> .br
> .RS 8
> Returns 1000
> .RE
> .br
> -\fBstr_to_bytes("5b")\fR
> +\fBbytes_by_prefix("5b")\fR
> .br
> .RS 8
> Returns 5 * BSIZE.
> .RE
> -\fBstr_to_bytes("1.5m")\fR
> +\fBbytes_by_prefix("1.5m")\fR
> .br
> .RS 8
> Returns 1.5 * 1048576 or 1572864
> @@ -88,10 +88,10 @@ Returns 1.5 * 1048576 or 1572864
>
> .SH LIMITATIONS
>
> -\fBstr_to_bytes()\fR and \fBstr_to_lbytes()\fR when compiled as
> +\fBbytes_by_prefix()\fR and \fBlbytes_by_prefix()\fR when compiled as
> a 32 bit IRIX binary can only return a max number of 2g (2147483647).
> -However, \fBstr_to_lbytes()\fR is not limited by the 2g limit when
> -compiled as 64 bit binary, where \fBstr_to_bytes()\fR still is limited.
> +However, \fBlbytes_by_prefix()\fR is not limited by the 2g limit when
> +compiled as 64 bit binary, where \fBbytes_by_prefix()\fR still is limited.
>
> Note that the size of long will vary depending how if compiled as
> a 32 or 64 bit binary. The size of a long long is always 8.
> diff --git a/doc/man3/parse_ranges.3 b/doc/man3/parse_ranges.3
> index 9259317..d7830a3 100644
> --- a/doc/man3/parse_ranges.3
> +++ b/doc/man3/parse_ranges.3
> @@ -161,7 +161,7 @@ main()
> .SH "SEE ALSO"
> random_range(3),
> random_range_seed(3),
> -str_to_bytes(3).
> +bytes_by_prefix(3).
> .SH DIAGNOSTICS
> parse_ranges() returns -1 on error or the number of ranges parsed. No space
> will be malloc'd if parse_ranges() fails. Error
> diff --git a/include/str_to_bytes.h b/include/bytes_by_prefix.h
> similarity index 89%
> rename from include/str_to_bytes.h
> rename to include/bytes_by_prefix.h
> index 314eb88..f3465fa 100644
> --- a/include/str_to_bytes.h
> +++ b/include/bytes_by_prefix.h
> @@ -29,11 +29,11 @@
> *
> * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
> */
> -#ifndef _STR_TO_BYTES_
> -#define _STR_TO_BYTES_
> +#ifndef _BYTES_BY_PREFIX_
> +#define _BYTES_BY_PREFIX_
>
> -int str_to_bytes(char *);
> -long str_to_lbytes(char *);
> -long long str_to_llbytes(char *);
> +int bytes_by_prefix(char *);
> +long lbytes_by_prefix(char *);
> +long long llbytes_by_prefix(char *);
>
> #endif
> diff --git a/lib/str_to_bytes.c b/lib/bytes_by_prefix.c
> similarity index 89%
> rename from lib/str_to_bytes.c
> rename to lib/bytes_by_prefix.c
> index f18291c..b9ac565 100644
> --- a/lib/str_to_bytes.c
> +++ b/lib/bytes_by_prefix.c
> @@ -31,10 +31,10 @@
> */
> #include <stdio.h>
> #include <sys/param.h>
> -#include "str_to_bytes.h"
> +#include "bytes_by_prefix.h"
>
> /****************************************************************************
> - * str_to_bytes(s)
> + * bytes_by_prefix(s)
> *
> * Computes the number of bytes described by string s. s is assumed to be
> * a base 10 positive (ie. >= 0) number followed by an optional single
> @@ -50,7 +50,7 @@
> * g 2^30 (1073741824)
> * G 2^30 (1073741824) * sizeof(long)
> *
> - * for instance, "1k" and "1024" would both cause str_to_bytes to return 1024.
> + * for instance, "1k" and "1024" would both cause bytes_by_prefix to return 1024
> *
> * Returns -1 if mult is an invalid character, or if the integer portion of
> * s is not a positive integer.
> @@ -72,7 +72,7 @@
> #define G_MULT 1073741824 /* Giga or 2^30 */
> #define T_MULT 1099511627776 /* tera or 2^40 */
>
> -int str_to_bytes(char *s)
> +int bytes_by_prefix(char *s)
> {
> char mult, junk;
> int nconv;
> @@ -105,7 +105,7 @@ int str_to_bytes(char *s)
> }
> }
>
> -long str_to_lbytes(char *s)
> +long lbytes_by_prefix(char *s)
> {
> char mult, junk;
> long nconv;
> @@ -142,7 +142,7 @@ long str_to_lbytes(char *s)
> * Force 64 bits number when compiled as 32 IRIX binary.
> * This allows for a number bigger than 2G.
> */
> -long long str_to_llbytes(char *s)
> +long long llbytes_by_prefix(char *s)
> {
> char mult, junk;
> long nconv;
> @@ -182,20 +182,20 @@ main(int argc, char **argv)
> int ind;
>
> if (argc == 1) {
> - fprintf(stderr, "missing str_to_bytes() parameteres\n");
> + fprintf(stderr, "missing bytes_by_prefix() parameteres\n");
> exit(1);
> }
>
> for (ind = 1; ind < argc; ind++) {
>
> - printf("str_to_bytes(%s) returned %d\n",
> - argv[ind], str_to_bytes(argv[ind]));
> + printf("bytes_by_prefix(%s) returned %d\n",
> + argv[ind], bytes_by_prefix(argv[ind]));
>
> - printf("str_to_lbytes(%s) returned %ld\n",
> - argv[ind], str_to_lbytes(argv[ind]));
> + printf("lbytes_by_prefix(%s) returned %ld\n",
> + argv[ind], lbytes_by_prefix(argv[ind]));
>
> - printf("str_to_llbytes(%s) returned %lld\n",
> - argv[ind], str_to_llbytes(argv[ind]));
> + printf("llbytes_by_prefix(%s) returned %lld\n",
> + argv[ind], llbytes_by_prefix(argv[ind]));
> }
> }
>
> diff --git a/ltp-devel.spec.in b/ltp-devel.spec.in
> index 83d0942..8205723 100644
> --- a/ltp-devel.spec.in
> +++ b/ltp-devel.spec.in
> @@ -28,7 +28,7 @@ It is intended to be used to build testcases using the provided API.
> @prefix@/include/libtestsuite.h
> @prefix@/include/usctest.h
> @prefix@/include/string_to_tokens.h
> -@prefix@/include/str_to_bytes.h
> +@prefix@/include/bytes_by_prefix.h
> @prefix@/include/databin.h
> @prefix@/include/open_flags.h
> @prefix@/include/write_log.h
> @@ -53,7 +53,7 @@ It is intended to be used to build testcases using the provided API.
> @mandir@/man3/parse_open_flags.3
> @mandir@/man3/tst_res.3
> @mandir@/man3/write_log.3
> -@mandir@/man3/str_to_bytes.3
> +@mandir@/man3/bytes_by_prefix.3
> @mandir@/man3/tst_set_error.3
> @mandir@/man3/parse_opts.3
> @mandir@/man3/string_to_tokens.3
> diff --git a/testcases/kernel/fs/doio/iogen.c b/testcases/kernel/fs/doio/iogen.c
> index 167edbd..f594007 100644
> --- a/testcases/kernel/fs/doio/iogen.c
> +++ b/testcases/kernel/fs/doio/iogen.c
> @@ -61,7 +61,7 @@
> #include "libkern.h"
> #endif
> #include "doio.h"
> -#include "str_to_bytes.h"
> +#include "bytes_by_prefix.h"
> #include "string_to_tokens.h"
> #include "open_flags.h"
> #include "random_range.h"
> @@ -1555,7 +1555,7 @@ parse_cmdline(int argc, char **argv, char *opts)
> break;
>
> case 'r':
> - if ((Rawmult = str_to_bytes(optarg)) == -1 ||
> + if ((Rawmult = bytes_by_prefix(optarg)) == -1 ||
> Rawmult < 11 || Rawmult % BSIZE) {
> fprintf(stderr, "iogen%s: Illegal -r arg (%s). Must be > 0 and multipe of BSIZE (%d)\n",
> TagName, optarg, BSIZE);
> @@ -1587,7 +1587,7 @@ parse_cmdline(int argc, char **argv, char *opts)
> break;
>
> case 't':
> - if ((Mintrans = str_to_bytes(optarg)) == -1) {
> + if ((Mintrans = bytes_by_prefix(optarg)) == -1) {
> fprintf(stderr, "iogen%s: Illegal -t arg (%s): Must have the form num[bkm]\n", TagName, optarg);
> exit(1);
> }
> @@ -1595,7 +1595,7 @@ parse_cmdline(int argc, char **argv, char *opts)
> break;
>
> case 'T':
> - if ((Maxtrans = str_to_bytes(optarg)) == -1) {
> + if ((Maxtrans = bytes_by_prefix(optarg)) == -1) {
> fprintf(stderr, "iogen%s: Illegal -T arg (%s): Must have the form num[bkm]\n", TagName, optarg);
> exit(1);
> }
> @@ -1740,7 +1740,7 @@ parse_cmdline(int argc, char **argv, char *opts)
>
> if ((cp = strchr(argv[optind], ':')) != NULL) {
> *cp = '\0';
> - if ((len = str_to_bytes(argv[optind])) == -1) {
> + if ((len = bytes_by_prefix(argv[optind])) == -1) {
> fprintf(stderr,
> "iogen%s: illegal file length (%s) for file %s\n",
> TagName, argv[optind], cp+1);
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 3/3] Changed nconv variable from long to int in /lib/bytes_by_prefix.c
[not found] ` <1336655089-26941-3-git-send-email-marios.makris@gmail.com>
@ 2012-05-14 7:24 ` Wanlong Gao
2012-05-15 11:51 ` Marioh mrs
0 siblings, 1 reply; 9+ messages in thread
From: Wanlong Gao @ 2012-05-14 7:24 UTC (permalink / raw)
To: Marios Makris; +Cc: ltp-list
On 05/10/2012 09:04 PM, Marios Makris wrote:
> According to sscanf man page the return value is int
> therefore the holding variable should be int as well.
>
> Also changed the loop variable name of the main method
> from ind to i in order to better represent that it is
> just a loop variable.
>
> Signed-off-by: Marios Makris <marios.makris@gmail.com>
But Marios,
In the previous patch, you changed the library function
from str_to_bytes to bytes_by_prefix, if you'd prefer
the latter name, please also replace the using of str_to_bytes
with the new name, if not, it'll not be compiled.
Thanks,
Wanlong Gao
> ---
> lib/bytes_by_prefix.c | 14 +++++++-------
> 1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/lib/bytes_by_prefix.c b/lib/bytes_by_prefix.c
> index b9ac565..eebff83 100644
> --- a/lib/bytes_by_prefix.c
> +++ b/lib/bytes_by_prefix.c
> @@ -108,7 +108,7 @@ int bytes_by_prefix(char *s)
> long lbytes_by_prefix(char *s)
> {
> char mult, junk;
> - long nconv;
> + int nconv;
> float num;
>
> nconv = sscanf(s, "%f%c%c", &num, &mult, &junk);
> @@ -145,7 +145,7 @@ long lbytes_by_prefix(char *s)
> long long llbytes_by_prefix(char *s)
> {
> char mult, junk;
> - long nconv;
> + int nconv;
> double num;
>
> nconv = sscanf(s, "%lf%c%c", &num, &mult, &junk);
> @@ -179,23 +179,23 @@ long long llbytes_by_prefix(char *s)
>
> main(int argc, char **argv)
> {
> - int ind;
> + int i;
>
> if (argc == 1) {
> fprintf(stderr, "missing bytes_by_prefix() parameteres\n");
> exit(1);
> }
>
> - for (ind = 1; ind < argc; ind++) {
> + for (i = 1; i < argc; i++) {
>
> printf("bytes_by_prefix(%s) returned %d\n",
> - argv[ind], bytes_by_prefix(argv[ind]));
> + argv[i], bytes_by_prefix(argv[i]));
>
> printf("lbytes_by_prefix(%s) returned %ld\n",
> - argv[ind], lbytes_by_prefix(argv[ind]));
> + argv[i], lbytes_by_prefix(argv[i]));
>
> printf("llbytes_by_prefix(%s) returned %lld\n",
> - argv[ind], llbytes_by_prefix(argv[ind]));
> + argv[i], llbytes_by_prefix(argv[i]));
> }
> }
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 3/3] Changed nconv variable from long to int in /lib/bytes_by_prefix.c
2012-05-14 7:24 ` [LTP] [PATCH 3/3] Changed nconv variable from long to int in /lib/bytes_by_prefix.c Wanlong Gao
@ 2012-05-15 11:51 ` Marioh mrs
2012-05-15 12:02 ` Wanlong Gao
0 siblings, 1 reply; 9+ messages in thread
From: Marioh mrs @ 2012-05-15 11:51 UTC (permalink / raw)
To: ltp-list
On 14 May 2012 10:24, Wanlong Gao <gaowanlong@cn.fujitsu.com> wrote:
>
>
> But Marios,
>
> In the previous patch, you changed the library function
> from str_to_bytes to bytes_by_prefix, if you'd prefer
> the latter name, please also replace the using of str_to_bytes
> with the new name, if not, it'll not be compiled.
>
> Thanks,
> Wanlong Gao
>
Hello Wanlong,
The replacement of usages of the str_to_bytes (now bytes_by_prefix)
is already done and are part of the previous patch as well.
Quoting that part from the previous patch:
> Furthermore any call to the file or its functions by other functions,
> manpages etc. have been modified to comply with the new names.
Furthermore i have tested compiling it (clean compile of the repo and then
applying the patches and recompiling as well as clean compilation with
my commits) on two computers and it compiled well.
I hope i didn't misunderstand your comment, please tell me where i am
wrong if that is the case.
Thanks a lot for reviewing.
--
Marios Makris
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 3/3] Changed nconv variable from long to int in /lib/bytes_by_prefix.c
2012-05-15 11:51 ` Marioh mrs
@ 2012-05-15 12:02 ` Wanlong Gao
2012-05-15 12:36 ` Marioh mrs
0 siblings, 1 reply; 9+ messages in thread
From: Wanlong Gao @ 2012-05-15 12:02 UTC (permalink / raw)
To: Marioh mrs; +Cc: ltp-list
On 05/15/2012 07:51 PM, Marioh mrs wrote:
> On 14 May 2012 10:24, Wanlong Gao <gaowanlong@cn.fujitsu.com> wrote:
>>
>>
>> But Marios,
>>
>> In the previous patch, you changed the library function
>> from str_to_bytes to bytes_by_prefix, if you'd prefer
>> the latter name, please also replace the using of str_to_bytes
>> with the new name, if not, it'll not be compiled.
>>
>> Thanks,
>> Wanlong Gao
>>
>
> Hello Wanlong,
>
> The replacement of usages of the str_to_bytes (now bytes_by_prefix)
> is already done and are part of the previous patch as well.
>
> Quoting that part from the previous patch:
>> Furthermore any call to the file or its functions by other functions,
>> manpages etc. have been modified to comply with the new names.
>
> Furthermore i have tested compiling it (clean compile of the repo and then
> applying the patches and recompiling as well as clean compilation with
> my commits) on two computers and it compiled well.
>
> I hope i didn't misunderstand your comment, please tell me where i am
> wrong if that is the case.
>
> Thanks a lot for reviewing.
At least you can take a look at here ./testcases/kernel/fs/doio/iogen.c
Thanks,
Wanlong Gao
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 3/3] Changed nconv variable from long to int in /lib/bytes_by_prefix.c
2012-05-15 12:02 ` Wanlong Gao
@ 2012-05-15 12:36 ` Marioh mrs
2012-05-15 12:50 ` Wanlong Gao
0 siblings, 1 reply; 9+ messages in thread
From: Marioh mrs @ 2012-05-15 12:36 UTC (permalink / raw)
To: ltp-list
>
> At least you can take a look at here ./testcases/kernel/fs/doio/iogen.c
>
> Thanks,
> Wanlong Gao
>
Hello again,
This file usages have been replaced in the 2nd patch:
[PATCH 2/3] Renamed /lib/str_to_bytes.c and /include str_to bytes.h
Below i have pasted the diff from the patch only for that particular file
from the contents of the patch as sent in the list.
Thanks again :)
diff --git a/testcases/kernel/fs/doio/iogen.c b/testcases/kernel/fs/doio/iogen.c
index 167edbd..f594007 100644
--- a/testcases/kernel/fs/doio/iogen.c
+++ b/testcases/kernel/fs/doio/iogen.c
@@ -61,7 +61,7 @@
#include "libkern.h"
#endif
#include "doio.h"
-#include "str_to_bytes.h"
+#include "bytes_by_prefix.h"
#include "string_to_tokens.h"
#include "open_flags.h"
#include "random_range.h"
@@ -1555,7 +1555,7 @@ parse_cmdline(int argc, char **argv, char *opts)
break;
case 'r':
- if ((Rawmult = str_to_bytes(optarg)) == -1 ||
+ if ((Rawmult = bytes_by_prefix(optarg)) == -1 ||
Rawmult < 11 || Rawmult % BSIZE) {
fprintf(stderr, "iogen%s: Illegal -r arg (%s). Must
be > 0 and multipe of BSIZE (%d)\n",
TagName, optarg, BSIZE);
@@ -1587,7 +1587,7 @@ parse_cmdline(int argc, char **argv, char *opts)
break;
case 't':
- if ((Mintrans = str_to_bytes(optarg)) == -1) {
+ if ((Mintrans = bytes_by_prefix(optarg)) == -1) {
fprintf(stderr, "iogen%s: Illegal -t arg (%s): Must
have the form num[bkm]\n", TagName, optarg);
exit(1);
}
@@ -1595,7 +1595,7 @@ parse_cmdline(int argc, char **argv, char *opts)
break;
case 'T':
- if ((Maxtrans = str_to_bytes(optarg)) == -1) {
+ if ((Maxtrans = bytes_by_prefix(optarg)) == -1) {
fprintf(stderr, "iogen%s: Illegal -T arg (%s): Must
have the form num[bkm]\n", TagName, optarg);
exit(1);
}
@@ -1740,7 +1740,7 @@ parse_cmdline(int argc, char **argv, char *opts)
if ((cp = strchr(argv[optind], ':')) != NULL) {
*cp = '\0';
- if ((len = str_to_bytes(argv[optind])) == -1) {
+ if ((len = bytes_by_prefix(argv[optind])) == -1) {
fprintf(stderr,
"iogen%s: illegal file length (%s) for file %s\n",
TagName, argv[optind], cp+1);
--
Marios Makris
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 3/3] Changed nconv variable from long to int in /lib/bytes_by_prefix.c
2012-05-15 12:36 ` Marioh mrs
@ 2012-05-15 12:50 ` Wanlong Gao
2012-05-15 12:58 ` Marioh mrs
0 siblings, 1 reply; 9+ messages in thread
From: Wanlong Gao @ 2012-05-15 12:50 UTC (permalink / raw)
To: Marioh mrs; +Cc: ltp-list
On 05/15/2012 08:36 PM, Marioh mrs wrote:
>>
>> At least you can take a look at here ./testcases/kernel/fs/doio/iogen.c
>>
>> Thanks,
>> Wanlong Gao
>>
>
> Hello again,
>
> This file usages have been replaced in the 2nd patch:
> [PATCH 2/3] Renamed /lib/str_to_bytes.c and /include str_to bytes.h
>
> Below i have pasted the diff from the patch only for that particular file
> from the contents of the patch as sent in the list.
>
> Thanks again :)
Oh, sorry I missed.
Any other comments?
Thanks,
Wanlong Gao
>
>
> diff --git a/testcases/kernel/fs/doio/iogen.c b/testcases/kernel/fs/doio/iogen.c
> index 167edbd..f594007 100644
> --- a/testcases/kernel/fs/doio/iogen.c
> +++ b/testcases/kernel/fs/doio/iogen.c
> @@ -61,7 +61,7 @@
> #include "libkern.h"
> #endif
> #include "doio.h"
> -#include "str_to_bytes.h"
> +#include "bytes_by_prefix.h"
> #include "string_to_tokens.h"
> #include "open_flags.h"
> #include "random_range.h"
> @@ -1555,7 +1555,7 @@ parse_cmdline(int argc, char **argv, char *opts)
> break;
>
> case 'r':
> - if ((Rawmult = str_to_bytes(optarg)) == -1 ||
> + if ((Rawmult = bytes_by_prefix(optarg)) == -1 ||
> Rawmult < 11 || Rawmult % BSIZE) {
> fprintf(stderr, "iogen%s: Illegal -r arg (%s). Must
> be > 0 and multipe of BSIZE (%d)\n",
> TagName, optarg, BSIZE);
> @@ -1587,7 +1587,7 @@ parse_cmdline(int argc, char **argv, char *opts)
> break;
>
> case 't':
> - if ((Mintrans = str_to_bytes(optarg)) == -1) {
> + if ((Mintrans = bytes_by_prefix(optarg)) == -1) {
> fprintf(stderr, "iogen%s: Illegal -t arg (%s): Must
> have the form num[bkm]\n", TagName, optarg);
> exit(1);
> }
> @@ -1595,7 +1595,7 @@ parse_cmdline(int argc, char **argv, char *opts)
> break;
>
> case 'T':
> - if ((Maxtrans = str_to_bytes(optarg)) == -1) {
> + if ((Maxtrans = bytes_by_prefix(optarg)) == -1) {
> fprintf(stderr, "iogen%s: Illegal -T arg (%s): Must
> have the form num[bkm]\n", TagName, optarg);
> exit(1);
> }
> @@ -1740,7 +1740,7 @@ parse_cmdline(int argc, char **argv, char *opts)
>
> if ((cp = strchr(argv[optind], ':')) != NULL) {
> *cp = '\0';
> - if ((len = str_to_bytes(argv[optind])) == -1) {
> + if ((len = bytes_by_prefix(argv[optind])) == -1) {
> fprintf(stderr,
> "iogen%s: illegal file length (%s) for file %s\n",
> TagName, argv[optind], cp+1);
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 3/3] Changed nconv variable from long to int in /lib/bytes_by_prefix.c
2012-05-15 12:50 ` Wanlong Gao
@ 2012-05-15 12:58 ` Marioh mrs
0 siblings, 0 replies; 9+ messages in thread
From: Marioh mrs @ 2012-05-15 12:58 UTC (permalink / raw)
To: ltp-list
>
> Oh, sorry I missed.
>
> Any other comments?
>
>
> Thanks,
> Wanlong Gao
>
Well it's totally ok so long the misunderstanding is solved :)
Well that's all for now i think, unless there is some other
problem with the current patches?
Thanks for your patience.
--
Marios Makris
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 1/3] Indentation and coding style fixes on /lib/str_to_bytes.c as well as /include/str_to_bytes.h
2012-05-14 7:15 ` [LTP] [PATCH 1/3] Indentation and coding style fixes on /lib/str_to_bytes.c as well as /include/str_to_bytes.h Wanlong Gao
@ 2012-05-16 14:23 ` Cyril Hrubis
0 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2012-05-16 14:23 UTC (permalink / raw)
To: Wanlong Gao; +Cc: ltp-list, Marios Makris
Hi!
FYI: patchset commited.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-05-16 14:26 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1336655089-26941-1-git-send-email-marios.makris@gmail.com>
2012-05-14 7:15 ` [LTP] [PATCH 1/3] Indentation and coding style fixes on /lib/str_to_bytes.c as well as /include/str_to_bytes.h Wanlong Gao
2012-05-16 14:23 ` Cyril Hrubis
[not found] ` <1336655089-26941-2-git-send-email-marios.makris@gmail.com>
2012-05-14 7:16 ` [LTP] [PATCH 2/3] Renamed /lib/str_to_bytes.c and /include str_to bytes.h Wanlong Gao
[not found] ` <1336655089-26941-3-git-send-email-marios.makris@gmail.com>
2012-05-14 7:24 ` [LTP] [PATCH 3/3] Changed nconv variable from long to int in /lib/bytes_by_prefix.c Wanlong Gao
2012-05-15 11:51 ` Marioh mrs
2012-05-15 12:02 ` Wanlong Gao
2012-05-15 12:36 ` Marioh mrs
2012-05-15 12:50 ` Wanlong Gao
2012-05-15 12:58 ` Marioh mrs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox