From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
To: backports@vger.kernel.org
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Subject: [PATCH 1/3] backports: backport ktime_to_ms()
Date: Fri, 6 Dec 2013 19:29:28 +0100 [thread overview]
Message-ID: <1386354570-23940-2-git-send-email-mcgrof@do-not-panic.com> (raw)
In-Reply-To: <1386354570-23940-1-git-send-email-mcgrof@do-not-panic.com>
This backports ktime_to_ms()
mcgrof@cerro ~/linux-next (git::master)$ git describe --contains f56916b9
v2.6.35-rc1~490^2~16
commit f56916b97fe2031761ca611f0a342efd913afb33
Author: Chuck Lever <chuck.lever@oracle.com>
Date: Fri May 7 13:34:37 2010 -0400
ktime: introduce ktime_to_ms()
To report ktime statistics to user space in milliseconds, a new helper
is required.
When considering how to do this conversion, I didn't immediately see
why the extra step of converting ktime to a timeval was needed. To
make that more clear, introduce a couple of large comments.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
backport/backport-include/linux/ktime.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 backport/backport-include/linux/ktime.h
diff --git a/backport/backport-include/linux/ktime.h b/backport/backport-include/linux/ktime.h
new file mode 100644
index 0000000..741be25
--- /dev/null
+++ b/backport/backport-include/linux/ktime.h
@@ -0,0 +1,14 @@
+#ifndef __BACKPORT_LINUX_KTIME_H
+#define __BACKPORT_LINUX_KTIME_H
+#include_next <linux/ktime.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
+static inline s64 ktime_to_ms(const ktime_t kt)
+{
+ struct timeval tv = ktime_to_timeval(kt);
+ return (s64) tv.tv_sec * MSEC_PER_SEC + tv.tv_usec / USEC_PER_MSEC;
+}
+#endif /* #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) */
+
+#endif
--
1.8.4.3
next prev parent reply other threads:[~2013-12-06 18:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-06 18:29 [PATCH 0/3] backports: synch up to next-20131206 Luis R. Rodriguez
2013-12-06 18:29 ` Luis R. Rodriguez [this message]
2013-12-08 14:46 ` [PATCH 1/3] backports: backport ktime_to_ms() Hauke Mehrtens
2013-12-08 14:54 ` Luis R. Rodriguez
2013-12-06 18:29 ` [PATCH 2/3] backports: backport getrawmonotonic() with do_posix_clock_monotonic_gettime() Luis R. Rodriguez
2013-12-06 18:29 ` [PATCH 3/3] backports: refresh patches for next-20131206 Luis R. Rodriguez
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=1386354570-23940-2-git-send-email-mcgrof@do-not-panic.com \
--to=mcgrof@do-not-panic.com \
--cc=backports@vger.kernel.org \
/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.