From: Daniel Walker <dwalker@mvista.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, roland@redhat.com
Subject: [PATCH] posix-cpu-clocks: cleanup clock macros
Date: Thu, 26 Apr 2007 11:05:55 -0700 [thread overview]
Message-ID: <20070426180555.793133540@mvista.com> (raw)
These macros were a little confused looking, so I cleaned then up
a bit. I think this way it's a little clearer what's what ..
Signed-Off-By: Daniel Walker <dwalker@mvista.com>
---
include/linux/posix-timers.h | 38 +++++++++++++++++++++++++++-----------
1 file changed, 27 insertions(+), 11 deletions(-)
Index: linux-2.6.21/include/linux/posix-timers.h
===================================================================
--- linux-2.6.21.orig/include/linux/posix-timers.h
+++ linux-2.6.21/include/linux/posix-timers.h
@@ -17,22 +17,38 @@ struct cpu_timer_list {
int firing;
};
-#define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3))
-#define CPUCLOCK_PERTHREAD(clock) \
- (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)
-#define CPUCLOCK_PID_MASK 7
-#define CPUCLOCK_PERTHREAD_MASK 4
+
+/*
+ * CPU Clock types
+ */
+#define CPUCLOCK_PROF 0x0
+#define CPUCLOCK_VIRT 0x1
+#define CPUCLOCK_SCHED 0x2
+#define CPUCLOCK_MAX 0x3
+
+#define CPUCLOCK_CLOCK_MASK (CPUCLOCK_SCHED | CPUCLOCK_VIRT | CPUCLOCK_PROF)
+
#define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK)
-#define CPUCLOCK_CLOCK_MASK 3
-#define CPUCLOCK_PROF 0
-#define CPUCLOCK_VIRT 1
-#define CPUCLOCK_SCHED 2
-#define CPUCLOCK_MAX 3
+
+/*
+ * Per thread flag
+ */
+#define CPUCLOCK_PERTHREAD_FLAG 0x4
+#define CPUCLOCK_PERTHREAD(clock) \
+ (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_FLAG) != 0)
+
+/*
+ * Bits used for the PID within the clockid
+ */
+#define CPUCLOCK_PID_MASK 0x7
+#define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3))
+
#define MAKE_PROCESS_CPUCLOCK(pid, clock) \
((~(clockid_t) (pid) << 3) | (clockid_t) (clock))
#define MAKE_THREAD_CPUCLOCK(tid, clock) \
- MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK)
+ MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_FLAG)
+
/* POSIX.1b interval timer structure. */
struct k_itimer {
--
--
reply other threads:[~2007-04-26 18:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20070426180555.793133540@mvista.com \
--to=dwalker@mvista.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®