diff --git a/block/block.h b/block/block.h
index b07e797..cb5a360 100644
--- a/block/block.h
+++ b/block/block.h
@@ -61,13 +61,14 @@
 #define dbgl_blk(l,fmt...) do {} while(0)
 #endif
 
-
 #if LINUX_VERSION_25_ABOVE // 2.5.x or above
 #define DRIVER_MASK        0xf0
+#ifndef PARTN_BITS 	// 2.6.27 defines this already
 #define PARTN_BITS        4
+#endif
 #else
 #define DRIVER_MASK        0xf8
-#define PARTN_BITS        3    
+#define PARTN_BITS        3
 #endif
 #define NR_PARTITION    (1U << PARTN_BITS)    
 #define PARTN_MASK        (NR_PARTITION -1)
diff --git a/block/block26.c b/block/block26.c
index 8c82b2e..cd9e574 100644
--- a/block/block26.c
+++ b/block/block26.c
@@ -37,12 +37,13 @@
 #include <sal/debug.h>
 #include <ndasdev.h>
 #include <procfs.h>
-#include "block.h"
-#include "ops.h"
 
 #if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) )
 #include <linux/ide.h>
 #endif
+
+#include "block.h"
+#include "ops.h"
 //
 // IDE command code
 //
@@ -479,6 +480,7 @@ void nblk_request_proc(struct request_queue *q)
     }
 }
 
+#if 0
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16))
 void nblk_prepare_flush(request_queue_t *q, struct request *req)
 {
@@ -503,6 +505,7 @@ void nblk_prepare_flush(request_queue_t *q, struct request *req)
     req->buffer = req->cmd;
 }
 #endif
+#endif
 
 int blk_init(void) 
 {    
diff --git a/block/ctrldev.c b/block/ctrldev.c
index e9e291d..1863dbc 100644
--- a/block/ctrldev.c
+++ b/block/ctrldev.c
@@ -127,7 +127,7 @@ NDAS_CALL void ndcmd_dev_changed(const char* serial, const char *name, NDAS_DEV_
 #if LINUX_VERSION_25_ABOVE
 extern void nblk_request_proc(struct request_queue *q);
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16))
-extern void nblk_prepare_flush(request_queue_t *q, struct request *rq);
+// extern void nblk_prepare_flush(request_queue_t *q, struct request *rq);
 #endif
 #endif
 
diff --git a/block/procfs.c b/block/procfs.c
index 63d3160..447b17b 100644
--- a/block/procfs.c
+++ b/block/procfs.c
@@ -153,9 +153,9 @@ static int proc_ndas_devs_file_read(char *page, char **start, off_t off,
         pos += sprintf(pos, "%-10s\t", reg[i].name);
         err = ndas_get_ndas_dev_info(reg[i].name, &info);
         if (!NDAS_SUCCESS(err)) {
-            char buf[64];
+            char buf[65];
             ndas_get_string_error(err, buf, 64);
-            buf[64]=0;
+            buf[65]=0;
             pos+= sprintf(pos, "%s\n", buf);
             continue;
         }            
diff --git a/inc/linux_ver.h b/inc/linux_ver.h
index cb94870..22115ac 100644
--- a/inc/linux_ver.h
+++ b/inc/linux_ver.h
@@ -88,14 +88,18 @@
 #define REQUEST_FLAGS(req) ((req)->flags)
 #endif
 
+/* utsname is not available in 2.6.27 */
+#define LINUX_NO_UTSNAME (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+#if !LINUX_NO_UTSNAME
 #define LINUX_VERSION_NEW_UTSNAME \
 	((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) || defined(NDAS_KERNEL_2_6_19))
 #if LINUX_VERSION_NEW_UTSNAME
 #define GET_UTS_NODENAME() (utsname()->nodename)
 #else
 #define GET_UTS_NODENAME() (system_utsname.nodename)
-#endif	
-/* 
+#endif
+#endif
+/*
  * From 2.6.12, sk_alloc signature changed from
  *
  *  struct sock	*sk_alloc(int family, gfp_t priority, int zero_it, kmem_cache_t *slab);
diff --git a/sal/io.c b/sal/io.c
index e992b0d..4157407 100644
--- a/sal/io.c
+++ b/sal/io.c
@@ -33,7 +33,7 @@
 #include <linux/module.h> // EXPORT_SYMBOL
 #include <linux/spinlock.h> // spinklock_t
 #include <linux/sched.h> // jiffies
-#include <asm/semaphore.h> // struct semaphore
+#include <linux/semaphore.h> // struct semaphore
 #include <asm/atomic.h> // atomic
 #include <linux/mm.h> //
 #include <linux/slab.h> // 2.4 kmalloc/kfree
diff --git a/sal/sal.c b/sal/sal.c
index 4555986..0542316 100644
--- a/sal/sal.c
+++ b/sal/sal.c
@@ -29,12 +29,10 @@
  and fitness for purpose.
  -------------------------------------------------------------------------
 */
-#include <linux/utsname.h>
+#include <linux/uts.h> //  UTS_NODENAME
 #include <linux/kernel.h>
 #include <linux/module.h> // EXPORT_SYMBOL
-//#include <linux/rwsem.h>
 #include <linux/string.h>
-#include <asm/semaphore.h> // up_read, down_read
 #include "linux_ver.h"
 #include "sal/sal.h"
 #include "sal/net.h"
@@ -62,17 +60,16 @@ EXPORT_SYMBOL(sal_cleanup);
 NDAS_SAL_API ndas_error_t sal_gethostname(char* name, int size)
 {
     int i;
-    ndas_error_t err;
+    ndas_error_t err = NDAS_OK;
 
-    if (size < 0)
+    if (size <= 0)
         return NDAS_ERROR_INVALID_PARAMETER;
-    down_read(&uts_sem);
-    i = 1 + strlen(GET_UTS_NODENAME());
-    if (i > size)
-        i = size;
-    err = NDAS_OK;
-    memcpy(name, GET_UTS_NODENAME(), i);
-    up_read(&uts_sem);
+    i = strlen(UTS_NODENAME);
+    if (i >= size) {
+        i = size - 1;
+        name[i] = 0;
+    }
+    memcpy(name, UTS_NODENAME, i);
     return err;
 }
 EXPORT_SYMBOL(sal_gethostname);
diff --git a/sal/sync.c b/sal/sync.c
index 4456e97..a951bdc 100644
--- a/sal/sync.c
+++ b/sal/sync.c
@@ -33,7 +33,7 @@
 #include <linux/module.h> // EXPORT_SYMBOL
 #include <linux/spinlock.h> // spinklock_t
 #include <linux/sched.h> // jiffies
-#include <asm/semaphore.h> // struct semaphore
+#include <linux/semaphore.h> // struct semaphore
 #include <asm/atomic.h> // atomic
 #include <linux/mm.h> //
 #include <linux/slab.h> // 2.4 kmalloc/kfree
