]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Powerpc Fixes (part 1):
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 20 May 2009 19:23:24 +0000 (12:23 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 20 May 2009 19:23:24 +0000 (12:23 -0700)
- Enable builds for powerpc ISA type.
- Add DIV_ROUND_UP and roundup macros if unavailable.
- Cast 64-bit values for %lld format string to (long long) to
  quiet compile warning.

include/sys/isa_defs.h
include/sys/sysmacros.h
module/splat/splat-kobj.c

index 57a6d366e95b64ceb6cc64661ff2e82151bf3547..3b8fffe1e9c82d6289f5986163cd42e85999e938 100644 (file)
@@ -39,7 +39,22 @@ extern "C" {
 #define _ILP32
 #endif
 
-#else /* Currently only x86_64 and i386 arches supported */
+/* powerpc (ppc64) arch specific defines */
+#elif defined(__powerpc) || defined(__powerpc__)
+
+#if !defined(__powerpc)
+#define __powerpc
+#endif
+
+#if !defined(__powerpc__)
+#define __powerpc__
+#endif
+
+#if !defined(_LP64)
+#define _LP64
+#endif
+
+#else /* Currently only x86_64, i386, and powerpc arches supported */
 #error "Unsupported ISA type"
 #endif
 
index 923cc22e7ceed8ef9472c04cf152f0b061c5662e..67afbfeb04d5c40f4bb6e7650400e36f332646d8 100644 (file)
@@ -149,13 +149,19 @@ extern uint32_t zone_get_hostid(void *zone);
 
 /* common macros */
 #ifndef MIN
-#define MIN(a, b)       ((a) < (b) ? (a) : (b))
+#define MIN(a, b)              ((a) < (b) ? (a) : (b))
 #endif
 #ifndef MAX
-#define MAX(a, b)       ((a) < (b) ? (b) : (a))
+#define MAX(a, b)              ((a) < (b) ? (b) : (a))
 #endif
 #ifndef ABS
-#define ABS(a)          ((a) < 0 ? -(a) : (a))
+#define ABS(a)                 ((a) < 0 ? -(a) : (a))
+#endif
+#ifndef DIV_ROUND_UP
+#define DIV_ROUND_UP(n,d)      (((n) + (d) - 1) / (d))
+#endif
+#ifndef roundup
+#define roundup(x, y)          ((((x) + ((y) - 1)) / (y)) * (y))
 #endif
 
 /*
index 2137ab02a856fb5d3e28152365361704d2db0967..c646cce1b131a473b083564db063f0b20aaf240a 100644 (file)
@@ -85,7 +85,8 @@ splat_kobj_test2(struct file *file, void *arg)
        if (!buf) {
                rc = -ENOMEM;
                splat_vprint(file, SPLAT_KOBJ_TEST2_NAME, "Failed to alloc "
-                            "%lld bytes for tmp buffer (%d)\n", size, rc);
+                            "%lld bytes for tmp buffer (%d)\n",
+                            (long long)size, rc);
                goto out;
        }
 
@@ -104,7 +105,8 @@ splat_kobj_test2(struct file *file, void *arg)
                rc = -EFBIG;
                splat_vprint(file, SPLAT_KOBJ_TEST2_NAME, "Stat'ed size "
                             "(%lld) does not match number of bytes read "
-                            "(%lld)\n", size, (uint64_t)strlen(buf));
+                            "(%lld)\n", (long long)size,
+                            (long long)strlen(buf));
                goto out2;
        }
 
@@ -112,7 +114,7 @@ splat_kobj_test2(struct file *file, void *arg)
        splat_vprint(file, SPLAT_KOBJ_TEST2_NAME, "\n%s\n", buf);
        splat_vprint(file, SPLAT_KOBJ_TEST2_NAME, "Successfully stat'ed "
                     "and read expected number of bytes (%lld) from test "
-                    "file: %s\n", size, SPLAT_KOBJ_TEST_FILE);
+                    "file: %s\n", (long long)size, SPLAT_KOBJ_TEST_FILE);
 out2:
        kfree(buf);
 out: