diff options
author | Michael Brown <mcb30@ipxe.org> | 2013-11-01 02:22:12 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2013-11-01 02:26:19 +0000 |
commit | 5e1fa5cd4090f229a40903f13abf328e86271717 (patch) | |
tree | 77a6302aeeb86f6c86fe95fb757a952a4ef7490e /src/usr/pingmgmt.c | |
parent | b15dbc9cc65e8385a30513554129d7640bc8a0f9 (diff) | |
download | ipxe-5e1fa5cd4090f229a40903f13abf328e86271717.tar.gz |
[parseopt] Add parse_timeout()
Parsing a timeout value (specified in milliseconds) into an internal
timeout value measured in timer ticks is a common operation. Provide
a parse_timeout() value to carry out this conversion automatically.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/usr/pingmgmt.c')
-rw-r--r-- | src/usr/pingmgmt.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/usr/pingmgmt.c b/src/usr/pingmgmt.c index e45593828..0db10c219 100644 --- a/src/usr/pingmgmt.c +++ b/src/usr/pingmgmt.c @@ -56,16 +56,15 @@ static void ping_callback ( struct sockaddr *peer, unsigned int sequence, * Ping a host * * @v hostname Hostname - * @v timeout_ms Timeout between pings, in ms + * @v timeout Timeout between pings, in ticks * @v len Payload length * @ret rc Return status code */ -int ping ( const char *hostname, unsigned long timeout_ms, size_t len ) { +int ping ( const char *hostname, unsigned long timeout, size_t len ) { int rc; /* Create pinger */ - if ( ( rc = create_pinger ( &monojob, hostname, - ( ( timeout_ms * TICKS_PER_SEC ) / 1000 ), + if ( ( rc = create_pinger ( &monojob, hostname, timeout, len, ping_callback ) ) != 0 ) { printf ( "Could not start ping: %s\n", strerror ( rc ) ); return rc; |