[PATCH 1/3] backports: backport ktime_to_ms()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
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@xxxxxxxxxx>
    Signed-off-by: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>

Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux