On 12/06/2013 07:29 PM, Luis R. Rodriguez wrote:
> 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 <[email protected]>
> 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 <[email protected]>
> Signed-off-by: Trond Myklebust <[email protected]>
>
> Signed-off-by: Luis R. Rodriguez <[email protected]>
> ---
> 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)
Add this line here, otherwise we get problems with RHEL.
#define ktime_to_ms LINUX_BACKPORT(ktime_to_ms)
> +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
>
--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html