Source-Changes-HG archive

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

[src/riastradh-drm2]: src/sys/external/bsd/drm2/include/linux More miscellane...



details:   https://anonhg.NetBSD.org/src/rev/fac2e90470b7
branches:  riastradh-drm2
changeset: 788514:fac2e90470b7
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Sep 08 15:38:04 2013 +0000

description:
More miscellaneous Linux header cruft.  See patch for details.

diffstat:

 sys/external/bsd/drm2/include/linux/jiffies.h |   8 ++-
 sys/external/bsd/drm2/include/linux/log2.h    |   8 ++-
 sys/external/bsd/drm2/include/linux/pagemap.h |  14 +++++-
 sys/external/bsd/drm2/include/linux/time.h    |  64 ++++++++++++++++++++++++++-
 sys/external/bsd/drm2/include/linux/timer.h   |   8 ++-
 sys/external/bsd/drm2/include/linux/types.h   |   5 +-
 6 files changed, 101 insertions(+), 6 deletions(-)

diffs (181 lines):

diff -r 8d945bb017b2 -r fac2e90470b7 sys/external/bsd/drm2/include/linux/jiffies.h
--- a/sys/external/bsd/drm2/include/linux/jiffies.h     Sun Sep 08 15:37:34 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/jiffies.h     Sun Sep 08 15:38:04 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: jiffies.h,v 1.1.2.3 2013/07/24 03:03:23 riastradh Exp $        */
+/*     $NetBSD: jiffies.h,v 1.1.2.4 2013/09/08 15:38:04 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -49,6 +49,12 @@
        return mstohz((usec + (1000 / hz) - 1) / (1000 / hz));
 }
 
+static inline unsigned int
+timespec_to_jiffies(const struct timespec *ts)
+{
+       return tstohz(ts);
+}
+
 /* XXX long is the wrong type here times...  */
 
 #define        __linux_time_compare(A, OP, B)  (((long)(A) - (long)(B)) OP 0)
diff -r 8d945bb017b2 -r fac2e90470b7 sys/external/bsd/drm2/include/linux/log2.h
--- a/sys/external/bsd/drm2/include/linux/log2.h        Sun Sep 08 15:37:34 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/log2.h        Sun Sep 08 15:38:04 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: log2.h,v 1.1.2.2 2013/07/24 02:03:00 riastradh Exp $   */
+/*     $NetBSD: log2.h,v 1.1.2.3 2013/09/08 15:38:04 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,4 +34,10 @@
 
 #include <sys/bitops.h>
 
+static inline bool
+is_power_of_2(unsigned long x)
+{
+       return ((x != 0) && (((x - 1) & x) == 0));
+}
+
 #endif  /* _LINUX_LOG2_H_ */
diff -r 8d945bb017b2 -r fac2e90470b7 sys/external/bsd/drm2/include/linux/pagemap.h
--- a/sys/external/bsd/drm2/include/linux/pagemap.h     Sun Sep 08 15:37:34 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/pagemap.h     Sun Sep 08 15:38:04 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pagemap.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $        */
+/*     $NetBSD: pagemap.h,v 1.1.2.2 2013/09/08 15:38:04 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,4 +32,16 @@
 #ifndef _LINUX_PAGEMAP_H_
 #define _LINUX_PAGEMAP_H_
 
+static inline int
+fault_in_multipages_readable(const char *uaddr __unused, size_t len __unused)
+{
+       return 0;
+}
+
+static inline int
+fault_in_multipages_writeable(char *uaddr __unused, size_t len __unused)
+{
+       return 0;
+}
+
 #endif  /* _LINUX_PAGEMAP_H_ */
diff -r 8d945bb017b2 -r fac2e90470b7 sys/external/bsd/drm2/include/linux/time.h
--- a/sys/external/bsd/drm2/include/linux/time.h        Sun Sep 08 15:37:34 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/time.h        Sun Sep 08 15:38:04 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: time.h,v 1.1.2.1 2013/07/24 03:18:46 riastradh Exp $   */
+/*     $NetBSD: time.h,v 1.1.2.2 2013/09/08 15:38:04 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -48,4 +48,66 @@
        return time_second;
 }
 
+static inline void
+getrawmonotonic(struct timespec *ts)
+{
+       getnanouptime(ts);
+}
+
+static inline bool
+timespec_valid(const struct timespec *ts)
+{
+       if (ts->tv_sec < 0)
+               return false;
+       if (1000000000L <= ts->tv_nsec)
+               return false;
+       return true;
+}
+
+static inline struct timespec
+ns_to_timespec(const int64_t nsec)
+{
+       struct timespec ts;
+
+       ts.tv_sec = (nsec / 1000000000L);
+       ts.tv_nsec = (nsec % 1000000000L);
+       if (ts.tv_nsec < 0) {
+               ts.tv_sec -= 1;
+               ts.tv_nsec += 1000000000L;
+       }
+
+       return ts;
+}
+
+static inline int64_t
+timespec_to_ns(const struct timespec *ts)
+{
+       return (((int64_t)ts->tv_sec * 1000000000LL) + ts->tv_nsec);
+}
+
+static inline struct timespec
+timespec_sub(struct timespec a, struct timespec b)
+{
+       struct timespec d;
+
+       timespecsub(&a, &b, &d);
+
+       return d;
+}
+
+static inline void
+set_normalized_timespec(struct timespec *ts, time_t sec, int64_t nsec)
+{
+       while (nsec >= 1000000000L) {
+               nsec -= 1000000000L;
+               sec += 1;
+       }
+       while (nsec < 0) {
+               nsec += 1000000000L;
+               sec -= 1;
+       }
+       ts->tv_sec = sec;
+       ts->tv_nsec = nsec;
+}
+
 #endif  /* _LINUX_TIME_H_ */
diff -r 8d945bb017b2 -r fac2e90470b7 sys/external/bsd/drm2/include/linux/timer.h
--- a/sys/external/bsd/drm2/include/linux/timer.h       Sun Sep 08 15:37:34 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/timer.h       Sun Sep 08 15:38:04 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: timer.h,v 1.1.2.3 2013/07/24 03:50:16 riastradh Exp $  */
+/*     $NetBSD: timer.h,v 1.1.2.4 2013/09/08 15:38:04 riastradh Exp $  */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -78,4 +78,10 @@
        return roundup(j, hz);
 }
 
+static inline unsigned long
+round_jiffies_up_relative(unsigned long j)
+{
+       return roundup(j, hz);
+}
+
 #endif  /* _LINUX_TIMER_H_ */
diff -r 8d945bb017b2 -r fac2e90470b7 sys/external/bsd/drm2/include/linux/types.h
--- a/sys/external/bsd/drm2/include/linux/types.h       Sun Sep 08 15:37:34 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/types.h       Sun Sep 08 15:38:04 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: types.h,v 1.1.2.7 2013/07/24 02:50:51 riastradh Exp $  */
+/*     $NetBSD: types.h,v 1.1.2.8 2013/09/08 15:38:04 riastradh Exp $  */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -60,4 +60,7 @@
 /* XXX Is this the right type?  */
 typedef unsigned long long cycles_t;
 
+/* XXX Not sure this is correct.  */
+typedef off_t loff_t;
+
 #endif  /* _LINUX_TYPES_H_ */



Home | Main Index | Thread Index | Old Index