Discussion:
[Linuxptp-devel] [PATCH 0/4] miscellaneous cleanups
Richard Cochran
2013-06-14 11:03:05 UTC
Permalink
Here are a few cleanups that I have ready to go. Please holler if you
find any issues with them.

Thanks,
Richard


Richard Cochran (4):
Silence grep error during build.
trivial: break the very long lines of the get_ functions.
Bring the readme file up to date with the equipment donations.
uClinux: Add another missing system call wrapper.

README.org | 4 ++--
makefile | 2 +-
missing.h | 7 +++++++
util.c | 15 ++++++++++-----
util.h | 16 +++++++++++-----
5 files changed, 31 insertions(+), 13 deletions(-)
--
1.7.10.4
Richard Cochran
2013-06-14 11:03:06 UTC
Permalink
Ever since upgrading to Debian 7.0, building linuxptp results in an
annoying error message. This is due to the fact that the directory
/usr/include/bits is no longer present, but our makefile expects it
to exist. This patch fixes the issue by telling grep not to complain
about missing files.

Signed-off-by: Richard Cochran <***@gmail.com>
---
makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/makefile b/makefile
index 058bdb2..71dcf0c 100644
--- a/makefile
+++ b/makefile
@@ -18,7 +18,7 @@
KBUILD_OUTPUT ?= /lib/modules/$(shell uname -r)/build

FEAT_CFLAGS :=
-ifneq ($(shell grep clock_adjtime /usr/include/bits/time.h),)
+ifneq ($(shell grep --no-messages clock_adjtime /usr/include/bits/time.h),)
FEAT_CFLAGS += -D_GNU_SOURCE -DHAVE_CLOCK_ADJTIME
endif
--
1.7.10.4
Richard Cochran
2013-06-14 11:03:07 UTC
Permalink
The get_ranged_ and get_arg_ declarations and definitions are just a wee
bit much too long. This patch breaks the overly long lines into two.

Signed-off-by: Richard Cochran <***@gmail.com>
---
util.c | 15 ++++++++++-----
util.h | 16 +++++++++++-----
2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/util.c b/util.c
index 8e8d5a5..30bd8a1 100644
--- a/util.c
+++ b/util.c
@@ -193,7 +193,8 @@ int leap_second_status(uint64_t ts, int leap_set, int *leap, int *utc_offset)
return leap_status;
}

-enum parser_result get_ranged_int(const char *str_val, int *result, int min, int max)
+enum parser_result get_ranged_int(const char *str_val, int *result,
+ int min, int max)
{
long parsed_val;
char *endptr = NULL;
@@ -207,7 +208,8 @@ enum parser_result get_ranged_int(const char *str_val, int *result, int min, int
return PARSED_OK;
}

-enum parser_result get_ranged_uint(const char *str_val, unsigned int *result, unsigned int min, unsigned int max)
+enum parser_result get_ranged_uint(const char *str_val, unsigned int *result,
+ unsigned int min, unsigned int max)
{
unsigned long parsed_val;
char *endptr = NULL;
@@ -221,7 +223,8 @@ enum parser_result get_ranged_uint(const char *str_val, unsigned int *result, un
return PARSED_OK;
}

-enum parser_result get_ranged_double(const char *str_val, double *result, double min, double max)
+enum parser_result get_ranged_double(const char *str_val, double *result,
+ double min, double max)
{
double parsed_val;
char *endptr = NULL;
@@ -253,7 +256,8 @@ int get_arg_val_i(int op, const char *optarg, int *val, int min, int max)
return 0;
}

-int get_arg_val_ui(int op, const char *optarg, unsigned int *val, unsigned int min, unsigned int max)
+int get_arg_val_ui(int op, const char *optarg, unsigned int *val,
+ unsigned int min, unsigned int max)
{
enum parser_result r;
r = get_ranged_uint(optarg, val, min, max);
@@ -271,7 +275,8 @@ int get_arg_val_ui(int op, const char *optarg, unsigned int *val, unsigned int m
return 0;
}

-int get_arg_val_d(int op, const char *optarg, double *val, double min, double max)
+int get_arg_val_d(int op, const char *optarg, double *val,
+ double min, double max)
{
enum parser_result r;
r = get_ranged_double(optarg, val, min, max);
diff --git a/util.h b/util.h
index 62a56de..52c4bcb 100644
--- a/util.h
+++ b/util.h
@@ -129,7 +129,8 @@ int leap_second_status(uint64_t ts, int leap_set, int *leap, int *utc_offset);
* @return PARSED_OK on success, MALFORMED if str_val is malformed,
* OUT_OF_RANGE if str_val is out of range.
*/
-enum parser_result get_ranged_int(const char *str_val, int *result, int min, int max);
+enum parser_result get_ranged_int(const char *str_val, int *result,
+ int min, int max);

/**
* Get an unsigned integer value from string with error checking and range
@@ -144,7 +145,8 @@ enum parser_result get_ranged_int(const char *str_val, int *result, int min, int
* @return PARSED_OK on success, MALFORMED if str_val is malformed,
* OUT_OF_RANGE if str_val is out of range.
*/
-enum parser_result get_ranged_uint(const char *str_val, unsigned int *result, unsigned int min, unsigned int max);
+enum parser_result get_ranged_uint(const char *str_val, unsigned int *result,
+ unsigned int min, unsigned int max);

/**
* Get a double value from string with error checking and range
@@ -159,7 +161,8 @@ enum parser_result get_ranged_uint(const char *str_val, unsigned int *result, un
* @return PARSED_OK on success, MALFORMED if str_val is malformed,
* OUT_OF_RANGE if str_val is out of range.
*/
-enum parser_result get_ranged_double(const char *str_val, double *result, double min, double max);
+enum parser_result get_ranged_double(const char *str_val, double *result,
+ double min, double max);

/**
* Common procedure to get an int value from argument for ptp4l and phc2sys.
@@ -184,7 +187,8 @@ int get_arg_val_i(int op, const char *optarg, int *val, int min, int max);
* @param max Upper limit. Return -1 if parsed value is bigger than max.
* @return 0 on success, -1 if some error occurs.
*/
-int get_arg_val_ui(int op, const char *optarg, unsigned int *val, unsigned int min, unsigned int max);
+int get_arg_val_ui(int op, const char *optarg, unsigned int *val,
+ unsigned int min, unsigned int max);

/**
* Common procedure to get a double value from argument for ptp4l and phc2sys.
@@ -196,5 +200,7 @@ int get_arg_val_ui(int op, const char *optarg, unsigned int *val, unsigned int m
* @param max Upper limit. Return -1 if parsed value is bigger than max.
* @return 0 on success, -1 if some error occurs.
*/
-int get_arg_val_d(int op, const char *optarg, double *val, double min, double max);
+int get_arg_val_d(int op, const char *optarg, double *val,
+ double min, double max);
+
#endif
--
1.7.10.4
Richard Cochran
2013-06-14 11:03:08 UTC
Permalink
Signed-off-by: Richard Cochran <***@gmail.com>
---
README.org | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.org b/README.org
index 9e064b9..c2ce647 100644
--- a/README.org
+++ b/README.org
@@ -239,8 +239,8 @@

- http://www.audioscience.com

- Thanks to Intel Corporation for donating three NICs, the 82574,
- 82580, and the 82599.
+ Thanks to Intel Corporation for donating four NICs, the 82574,
+ 82580, 82599, and the i210.

- http://www.intel.com
- http://e1000.sourceforge.net
--
1.7.10.4
Richard Cochran
2013-06-14 11:03:09 UTC
Permalink
Signed-off-by: Richard Cochran <***@gmail.com>
---
missing.h | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/missing.h b/missing.h
index fbd57d4..3c2b9d8 100644
--- a/missing.h
+++ b/missing.h
@@ -57,6 +57,13 @@ static inline int clock_adjtime(clockid_t id, struct timex *tx)

#else

+static inline int clock_nanosleep(clockid_t clock_id, int flags,
+ const struct timespec *request,
+ struct timespec *remain)
+{
+ return syscall(__NR_clock_nanosleep, clock_id, flags, request, remain);
+}
+
static inline int timerfd_create(int clockid, int flags)
{
return syscall(__NR_timerfd_create, clockid, flags);
--
1.7.10.4
Keller, Jacob E
2013-06-14 15:37:56 UTC
Permalink
-----Original Message-----
Sent: Friday, June 14, 2013 4:03 AM
Subject: [Linuxptp-devel] [PATCH 0/4] miscellaneous cleanups
Here are a few cleanups that I have ready to go. Please holler if you
find any issues with them.
Thanks,
Richard
Silence grep error during build.
trivial: break the very long lines of the get_ functions.
Bring the readme file up to date with the equipment donations.
uClinux: Add another missing system call wrapper.
README.org | 4 ++--
makefile | 2 +-
missing.h | 7 +++++++
util.c | 15 ++++++++++-----
util.h | 16 +++++++++++-----
5 files changed, 31 insertions(+), 13 deletions(-)
--
1.7.10.4
It all looks good to me! :)

- Jake
Libor Pechacek
2013-06-17 15:17:36 UTC
Permalink
Post by Keller, Jacob E
-----Original Message-----
Sent: Friday, June 14, 2013 4:03 AM
Subject: [Linuxptp-devel] [PATCH 0/4] miscellaneous cleanups
Here are a few cleanups that I have ready to go. Please holler if you
find any issues with them.
Thanks,
Richard
Silence grep error during build.
trivial: break the very long lines of the get_ functions.
Bring the readme file up to date with the equipment donations.
uClinux: Add another missing system call wrapper.
README.org | 4 ++--
makefile | 2 +-
missing.h | 7 +++++++
util.c | 15 ++++++++++-----
util.h | 16 +++++++++++-----
5 files changed, 31 insertions(+), 13 deletions(-)
--
1.7.10.4
It all looks good to me! :)
+1 Looks good to me as well.

Libor

Loading...