[syslinux:lwip] core: declare jiffies_t and mstime_t and use them.

syslinux-bot for Eric W. Biederman ebiederm at xmission.com
Fri Apr 22 20:05:04 PDT 2011


Commit-ID:  87fa53c543531231cd54ab4857d5e21f76555265
Gitweb:     http://syslinux.zytor.com/commit/87fa53c543531231cd54ab4857d5e21f76555265
Author:     Eric W. Biederman <ebiederm at xmission.com>
AuthorDate: Thu, 7 Apr 2011 22:52:57 -0700
Committer:  Eric W. Biederman <ebiederm at xmission.com>
CommitDate: Fri, 8 Apr 2011 14:38:25 -0700

core: declare jiffies_t and mstime_t and use them.

Create specific types for jiffies and for the output of the
millisecond timer and use them where appropriate in the code
base.

Signed-off-by: Eric W. Biederman <ebiederm at xmission.com>


---
 core/fs/pxe/dnsresolv.c |    2 +-
 core/fs/pxe/pxe.c       |   10 +++++-----
 core/idle.c             |    2 +-
 core/include/core.h     |    9 ++++++---
 4 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/core/fs/pxe/dnsresolv.c b/core/fs/pxe/dnsresolv.c
index 641ea38..06d5a73 100644
--- a/core/fs/pxe/dnsresolv.c
+++ b/core/fs/pxe/dnsresolv.c
@@ -182,7 +182,7 @@ uint32_t dns_resolv(const char *name)
     int ques, reps;    /* number of questions and replies */
     uint8_t timeout;
     const uint8_t *timeout_ptr = TimeoutTable;
-    uint32_t oldtime;
+    jiffies_t oldtime;
     uint32_t srv;
     uint32_t *srv_ptr;
     struct dnshdr *hd1 = (struct dnshdr *)DNSSendBuf;
diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c
index 21d27e5..262b38e 100644
--- a/core/fs/pxe/pxe.c
+++ b/core/fs/pxe/pxe.c
@@ -485,7 +485,7 @@ static void fill_buffer(struct inode *inode)
     const uint8_t *timeout_ptr;
     uint8_t timeout;
     uint16_t buffersize;
-    uint32_t oldtime;
+    jiffies_t oldtime;
     void *data = NULL;
     static __lowmem struct s_PXENV_UDP_READ udp_read;
     struct pxe_pvt_inode *socket = PVT(inode);
@@ -520,7 +520,7 @@ static void fill_buffer(struct inode *inode)
         udp_read.d_port      = socket->tftp_localport;
         err = pxe_call(PXENV_UDP_READ, &udp_read);
         if (err) {
-	    uint32_t now = jiffies();
+	    jiffies_t now = jiffies();
 
 	    if (now-oldtime >= timeout) {
 		oldtime = now;
@@ -678,8 +678,8 @@ static void __pxe_searchdir(const char *filename, struct file *file)
     int buffersize;
     int rrq_len;
     const uint8_t  *timeout_ptr;
-    uint32_t timeout;
-    uint32_t oldtime;
+    jiffies_t timeout;
+    jiffies_t oldtime;
     uint16_t tid;
     uint16_t opcode;
     uint16_t blk_num;
@@ -822,7 +822,7 @@ wait_pkt:
         udp_read.d_port      = tid;
         err = pxe_call(PXENV_UDP_READ, &udp_read);
         if (err || udp_read.status) {
-	    uint32_t now = jiffies();
+	    jiffies_t now = jiffies();
 	    if (now - oldtime >= timeout)
 		goto sendreq;
         } else {
diff --git a/core/idle.c b/core/idle.c
index 3f57393..dfdc77a 100644
--- a/core/idle.c
+++ b/core/idle.c
@@ -24,7 +24,7 @@
 
 #define TICKS_TO_IDLE	4	/* Also in idle.inc */
 
-extern uint32_t _IdleTimer;
+extern jiffies_t _IdleTimer;
 extern uint16_t NoHalt;
 
 int (*idle_hook_func)(void);
diff --git a/core/include/core.h b/core/include/core.h
index 114b049..a593c26 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -65,12 +65,15 @@ __noreturn _kaboom(void);
 /*
  * Basic timer function...
  */
-extern volatile uint32_t __jiffies, __ms_timer;
-static inline uint32_t jiffies(void)
+typedef uint32_t jiffies_t;
+extern volatile jiffies_t __jiffies, __ms_timer;
+static inline jiffies_t jiffies(void)
 {
     return __jiffies;
 }
-static inline uint32_t ms_timer(void)
+typedef uint32_t mstime_t;
+typedef int32_t  mstimediff_t;
+static inline mstime_t ms_timer(void)
 {
     return __ms_timer;
 }



More information about the Syslinux-commits mailing list