]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Backport xfs_repair from the xfs-cmds tree to IRIX to aid parallel repair merging...
authorNathan Scott <nathans@sgi.com>
Thu, 27 Apr 2006 15:40:54 +0000 (15:40 +0000)
committerNathan Scott <nathans@sgi.com>
Thu, 27 Apr 2006 15:40:54 +0000 (15:40 +0000)
Merge of master-melb:xfs-cmds:25838a by kenmcd.

14 files changed:
doc/CHANGES
include/darwin.h
include/freebsd.h
include/irix.h
include/libxfs.h
include/libxlog.h
include/linux.h
libxfs/bit.c
libxfs/irix.c
libxfs/rdwr.c
libxfs/trans.c
libxfs/util.c
libxfs/xfs.h
libxlog/util.c

index 83317b105746d12b43fa1637a981d1ef0f3ac2f8..f31138781decc68d18148bb8f93faed590a1edea 100644 (file)
@@ -1,3 +1,9 @@
+[cvs]
+       - Fix a case where xfs_repair could incorrectly flag extent
+         b+tree nodes as corrupt.
+       - Portability changes, get xfs_repair compiling on IRIX.
+       - Parent pointer updates in xfs_io checker command.
+
 xfsprogs-2.7.17 (05 April 2006)
        - Fix libxfs access(2) check on /proc/mounts, which was
          causing issues when xfs_check/xfs_repair run on readonly
index e7ff3a8b32320a37a18a1b57afe4be8d8e9eb08d..993e6109d426c3db3dc8c81d2ba515106af51260 100644 (file)
@@ -61,6 +61,49 @@ static __inline__ void platform_getoptreset(void)
        optreset = 0;
 }
 
+static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
+{
+       return uuid_compare(uu1, uu2, NULL);
+}
+
+static __inline__ void platform_uuid_unparse(uuid_t *uu, char **buffer)
+{
+       uint32_t status;
+       char *str;
+       uuid_to_string(uu, &str, &status);
+       if (status == uuid_s_ok)
+               strcpy(buf, str);
+       else *buf = '\0';
+       free(str);
+}
+
+static __inline__ int platform_uuid_parse(char *buffer, uuid_t *uu)
+{
+       uint32_t status;
+       uuid_from_string(buffer, uu, &status);
+       return (status == uuid_s_ok);
+}
+
+static __inline__ int platform_uuid_is_null(uuid_t *uu)
+{
+       return uuid_is_nil(uu, NULL);
+}
+
+static __inline__ void platform_uuid_generate(uuid_t *uu)
+{
+       uuid_create(uu, NULL);
+}
+
+static __inline__ void platform_uuid_clear(uuid_t *uu)
+{
+       uuid_create_nil(uu, NULL);
+}
+
+static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
+{
+       memcpy(dst, src, sizeof(uuid_t));
+}
+
 #define __int8_t       int8_t
 #define __int16_t      int16_t
 #define __int32_t      int32_t
index 4e7de5baf700510008f5f1136c768e9dd1aae421..1697f72c9546915ca79b641f836a5070594fcdc1 100644 (file)
@@ -97,43 +97,47 @@ static __inline__ void platform_getoptreset(void)
        optind = 0;
 }
 
-/*
- * Implement Linux libuuid functions in terms of DEC DCE's uuid
- * functions from FreeBSD libc.
- */
-
-static __inline__ int gnu_uuid_compare(uuid_t a, uuid_t b)
+static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
 {
-       return uuid_compare(&a, &b, NULL);
+       return uuid_compare(uu1, uu2, NULL);
 }
-#define        uuid_compare    gnu_uuid_compare
 
-static __inline__ int uuid_is_null(uuid_t uid)
-{
-       return uuid_is_nil(&uid, NULL);
-}
-
-static __inline__ void uuid_unparse(uuid_t uid, char *buf)
+static __inline__ void platform_uuid_unparse(uuid_t *uu, char **buffer)
 {
        uint32_t status;
-       char *str;
-       uuid_to_string(&uid, &str, &status);
+       char *s;
+       uuid_to_string(uu, &s, &status);
        if (status == uuid_s_ok)
-               strcpy(buf, str);
-       else *buf = '\0';
-       free(str);
+               strcpy(*buffer, s);
+       else *buffer[0] = '\0';
+       free(s);
 }
 
-static __inline__ int gnu_uuid_parse(const char *buf, uuid_t *uid)
+static __inline__ int platform_uuid_parse(char *buffer, uuid_t *uu)
 {
        uint32_t status;
-       uuid_from_string(buf, uid, &status);
+       uuid_from_string(buffer, uu, &status);
        return (status == uuid_s_ok);
 }
-#define        uuid_parse(s,u) gnu_uuid_parse((s), &(u))
 
-#define uuid_generate(uid)  uuid_create(&(uid), NULL)
-#define uuid_clear(uid)  uuid_create_nil(&(uid), NULL)
-#define uuid_copy(dst, src)  memcpy(&(dst), &(src), sizeof(uuid_t))
+static __inline__ int platform_uuid_is_null(uuid_t *uu)
+{
+       return uuid_is_nil(uu, NULL);
+}
+
+static __inline__ void platform_uuid_generate(uuid_t *uu)
+{
+       uuid_create(uu, NULL);
+}
+
+static __inline__ void platform_uuid_clear(uuid_t *uu)
+{
+       uuid_create_nil(uu, NULL);
+}
+
+static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
+{
+       memcpy(dst, src, sizeof(uuid_t));
+}
 
 #endif /* __XFS_FREEBSD_H__ */
index deca4bcd91d925e3739fbdf4fb096d016fd04b0d..30fd0e9a43f6dac7549069e805cb8516de40152f 100644 (file)
@@ -122,12 +122,15 @@ typedef struct xfs_fsop_attrmulti_handlereq {
 #define __BYTE_ORDER   BYTE_ORDER
 #define __BIG_ENDIAN   BIG_ENDIAN
 #define __LITTLE_ENDIAN        LITTLE_ENDIAN
-#define __fswab16(x)   (x)
-#define __fswab32(x)   (x)
-#define __fswab64(x)   (x)
+#define HAVE_SWABMACROS        1
+#define INT_SWAP16(type,var)   (var)
+#define INT_SWAP32(type,var)   (var)
+#define INT_SWAP64(type,var)   (var)
 
 /* Map some gcc macros for the MipsPRO compiler */
 #ifndef __GNUC__
+#define __builtin_constant_p(x)        (0)
+#define __FUNCTION__   "XFS"
 #define __sgi__                __sgi
 #define __inline__     __inline
 #define inline         __inline
@@ -249,6 +252,53 @@ static __inline__ void platform_getoptreset(void)
        getoptreset();
 }
 
+static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
+{
+       uint_t status;
+       return uuid_compare(uu1, uu2, &status);
+}
+
+static __inline__ void platform_uuid_unparse(uuid_t *uu, char **buffer)
+{
+       uint_t status;
+       char *s;
+       uuid_to_string(uu, &s, &status);
+       if (status == uuid_s_ok)
+               strcpy(*buffer, s);
+       else *buffer[0] = '\0';
+       free(s);
+}
+
+static __inline__ int platform_uuid_parse(char *buffer, uuid_t *uu)
+{
+       uint_t status;
+       uuid_from_string(buffer, uu, &status);
+       return (status == uuid_s_ok);
+}
+
+static __inline__ int platform_uuid_is_null(uuid_t *uu)
+{
+       uint status;
+       return uuid_is_nil(uu, &status);
+}
+
+static __inline__ void platform_uuid_generate(uuid_t *uu)
+{
+       uint_t status;
+       uuid_create(uu, &status);
+}
+
+static __inline__ void platform_uuid_clear(uuid_t *uu)
+{
+       uint_t status;
+       uuid_create_nil(uu, &status);
+}
+
+static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
+{
+       memcpy(dst, src, sizeof(uuid_t));
+}
+
 static __inline__ char * strsep(char **s, const char *ct)
 {
        char *sbegin = *s, *end;
index 5df8b0d90cde808309b9ef1245947c19e8d2a717..24d0173024b806603d395c7613e184864d46e806 100644 (file)
@@ -505,6 +505,8 @@ extern void libxfs_dir2_free_log_bests (xfs_trans_t *, xfs_dabuf_t *,
 /* Shared utility routines */
 extern unsigned int    libxfs_log2_roundup(unsigned int i);
 
+extern void cmn_err(int, char *, ...);
+enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC };
 
 #include <xfs/xfs_ialloc.h>
 #include <xfs/xfs_rtalloc.h>
index efea07053a52f3291b4aa450cb189e23698ba701..fcdbadcd9893acaa784cdf1660e6895bdf1636db 100644 (file)
@@ -75,25 +75,9 @@ typedef union {
 #define unlikely(x)                    (x)
 #define min(a,b)                       ((a) < (b) ? (a) : (b))
 
-#if (__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 95))
-# define xlog_warn(fmt,args...) \
-       ( fprintf(stderr,fmt,## args), fputc('\n', stderr) )
-# define cmn_err(sev,fmt,args...) \
-       xlog_warn(fmt,## args)
-# define xlog_exit(fmt,args...) \
-       ( xlog_warn(fmt,## args), exit(1) )
-# define xlog_panic(fmt,args...) \
-       xlog_exit(fmt,## args)
-#else
-# define xlog_warn(...) \
-       ( fprintf(stderr,__VA_ARGS__), fputc('\n', stderr) )
-# define cmn_err(sev,...) \
-       xlog_warn(__VA_ARGS__)
-# define xlog_exit(...) \
-       ( xlog_warn(__VA_ARGS__), exit(1) )
-# define xlog_panic(...) \
-       xlog_exit(__VA_ARGS__)
-#endif
+extern void xlog_warn(char *fmt,...);
+extern void xlog_exit(char *fmt,...);
+extern void xlog_panic(char *fmt,...);
 
 #define xlog_get_bp(log,bbs)   libxfs_getbuf(x.logdev, 0, (bbs))
 #define xlog_put_bp(bp)                libxfs_putbuf(bp)
index fa60050986bf88251a3a5d1875fb75f5078ccf9a..bc9ad4bf6272dfdb65d659101492789ec3725c44 100644 (file)
@@ -58,13 +58,20 @@ static __inline__ void platform_getoptreset(void)
        optind = 0;
 }
 
-#ifndef O_DIRECT
-# if defined (__powerpc__)
-#  define O_DIRECT     0400000
-# elif defined (__sparc__)
-#  define O_DIRECT     0x100000
-# endif
-#endif
+static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
+{
+       return uuid_compare(*uu1, *uu2);
+}
+
+static __inline__ void platform_uuid_unparse(uuid_t *uu, char **buffer)
+{
+       uuid_unparse(*uu, *buffer);
+}
+
+static __inline__ int platform_uuid_is_null(uuid_t *uu)
+{
+       return uuid_is_null(*uu);
+}
 
 #if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1))
 # define constpp       const char * const *
@@ -73,7 +80,7 @@ static __inline__ void platform_getoptreset(void)
 #endif
 
 #define ENOATTR                ENODATA /* Attribute not found */
-#define EFSCORRUPTED   990     /* Filesystem is corrupted */
+#define EFSCORRUPTED   EUCLEAN /* Filesystem is corrupted */
 
 typedef loff_t         xfs_off_t;
 typedef __uint64_t     xfs_ino_t;
index f75b6631a30f9bb0dd46d620a3b4e814f67b98f1..f7c8d597613f20c054b8241a3ff6de78da5e633f 100644 (file)
@@ -98,44 +98,6 @@ static const char xfs_highbit[256] = {
        7, 7, 7, 7, 7, 7, 7, 7,                 /* f8 .. ff */
 };
 
-/*
- * Count of bits set in byte, 0..8.
- */
-static const char xfs_countbit[256] = {
-       0, 1, 1, 2, 1, 2, 2, 3,                 /* 00 .. 07 */
-       1, 2, 2, 3, 2, 3, 3, 4,                 /* 08 .. 0f */
-       1, 2, 2, 3, 2, 3, 3, 4,                 /* 10 .. 17 */
-       2, 3, 3, 4, 3, 4, 4, 5,                 /* 18 .. 1f */
-       1, 2, 2, 3, 2, 3, 3, 4,                 /* 20 .. 27 */
-       2, 3, 3, 4, 3, 4, 4, 5,                 /* 28 .. 2f */
-       2, 3, 3, 4, 3, 4, 4, 5,                 /* 30 .. 37 */
-       3, 4, 4, 5, 4, 5, 5, 6,                 /* 38 .. 3f */
-       1, 2, 2, 3, 2, 3, 3, 4,                 /* 40 .. 47 */
-       2, 3, 3, 4, 3, 4, 4, 5,                 /* 48 .. 4f */
-       2, 3, 3, 4, 3, 4, 4, 5,                 /* 50 .. 57 */
-       3, 4, 4, 5, 4, 5, 5, 6,                 /* 58 .. 5f */
-       2, 3, 3, 4, 3, 4, 4, 5,                 /* 60 .. 67 */
-       3, 4, 4, 5, 4, 5, 5, 6,                 /* 68 .. 6f */
-       3, 4, 4, 5, 4, 5, 5, 6,                 /* 70 .. 77 */
-       4, 5, 5, 6, 5, 6, 6, 7,                 /* 78 .. 7f */
-       1, 2, 2, 3, 2, 3, 3, 4,                 /* 80 .. 87 */
-       2, 3, 3, 4, 3, 4, 4, 5,                 /* 88 .. 8f */
-       2, 3, 3, 4, 3, 4, 4, 5,                 /* 90 .. 97 */
-       3, 4, 4, 5, 4, 5, 5, 6,                 /* 98 .. 9f */
-       2, 3, 3, 4, 3, 4, 4, 5,                 /* a0 .. a7 */
-       3, 4, 4, 5, 4, 5, 5, 6,                 /* a8 .. af */
-       3, 4, 4, 5, 4, 5, 5, 6,                 /* b0 .. b7 */
-       4, 5, 5, 6, 5, 6, 6, 7,                 /* b8 .. bf */
-       2, 3, 3, 4, 3, 4, 4, 5,                 /* c0 .. c7 */
-       3, 4, 4, 5, 4, 5, 5, 6,                 /* c8 .. cf */
-       3, 4, 4, 5, 4, 5, 5, 6,                 /* d0 .. d7 */
-       4, 5, 5, 6, 5, 6, 6, 7,                 /* d8 .. df */
-       3, 4, 4, 5, 4, 5, 5, 6,                 /* e0 .. e7 */
-       4, 5, 5, 6, 5, 6, 6, 7,                 /* e8 .. ef */
-       4, 5, 5, 6, 5, 6, 6, 7,                 /* f0 .. f7 */
-       5, 6, 6, 7, 6, 7, 7, 8,                 /* f8 .. ff */
-};
-
 /*
  * xfs_lowbit32: get low bit set out of 32-bit argument, -1 if none set.
  */
index b060976a60e996f0f88583c51703f6a6b4dded94..4371ab5d523f9c7f3b372ef90ef221af791f912b 100644 (file)
@@ -39,12 +39,6 @@ platform_set_blocksize(int fd, char *path, int blocksize)
        return;
 }
 
-void
-platform_get_blocksize(int fd, char *path)
-{
-       return BBSIZE;
-}
-
 void
 platform_flush_device(int fd, dev_t device)
 {
index 06d26d2ff83c3b9f6e87e60f97408ab16fe94fe8..2b26ccbdf4e8c4f3daf5682908ea11ec1bc4d396 100644 (file)
@@ -86,7 +86,7 @@ static void unmount_record(void *p)
        INT_SET(op->oh_res2,            ARCH_CONVERT, 0);
 
        /* and the data for this op */
-       memcpy(p + sizeof(xlog_op_header_t), &magic, sizeof(magic));
+       memcpy((char *)p + sizeof(xlog_op_header_t), &magic, sizeof(magic));
 }
 
 static xfs_caddr_t next(xfs_caddr_t ptr, int offset, void *private)
index 18ec865ac765c04e327af8481914313b81ac8e6d..c72497877743a615387d482c3c44dd1e97ec0ec5 100644 (file)
@@ -391,11 +391,12 @@ libxfs_trans_get_buf(
 {
        xfs_buf_t               *bp;
        xfs_buf_log_item_t      *bip;
-       xfs_buftarg_t           bdev = { dev };
+       xfs_buftarg_t           bdev;
 
        if (tp == NULL)
                return libxfs_getbuf(dev, d, len);
 
+       bdev.dev = dev;
        if (tp->t_items.lic_next == NULL)
                bp = xfs_trans_buf_item_match(tp, &bdev, d, len);
        else
@@ -438,7 +439,7 @@ libxfs_trans_read_buf(
        xfs_buf_t               *bp;
        xfs_buf_log_item_t      *bip;
        int                     error;
-       xfs_buftarg_t           bdev = { dev };
+       xfs_buftarg_t           bdev;
 
        if (tp == NULL) {
                bp = libxfs_getbuf(mp->m_dev, blkno, len);
@@ -447,6 +448,7 @@ libxfs_trans_read_buf(
                return error;
        }
 
+       bdev.dev = dev;
        if (tp->t_items.lic_next == NULL)
                bp = xfs_trans_buf_item_match(tp, &bdev, blkno, len);
        else
index 5f7d277cf78667508f97e4807fae3be73a082779..8d55b87990d23fdcca6292f17452b9fb4f76fa3b 100644 (file)
@@ -18,6 +18,8 @@
 
 #include <xfs.h>
 #include <time.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 /*
  * Change the requested timestamp in the given inode.
@@ -737,7 +739,7 @@ libxfs_inode_alloc(
                *tp = ntp;
                if ((i = xfs_trans_reserve(*tp, 0, 0, 0, 0, 0))) {
                        fprintf(stderr, _("%s: cannot reserve space: %s\n"),
-                               progname, strerror(errno));
+                               progname, strerror(i));
                        exit(1);
                }
                xfs_trans_bjoin(*tp, ialloc_context);
@@ -755,3 +757,40 @@ libxfs_inode_alloc(
        *ipp = ip;
        return error;
 }
+
+/*
+ * Userspace versions of common diagnostic routines (varargs fun).
+ */
+void
+xfs_fs_repair_cmn_err(int level, xfs_mount_t *mp, char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+       fprintf(stderr, "  This is a bug.\n");
+       fprintf(stderr, "Please report it to xfs@oss.sgi.com.\n");
+       va_end(ap);
+}
+
+void
+xfs_fs_cmn_err(int level, xfs_mount_t *mp, char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+       fputs("\n", stderr);
+       va_end(ap);
+}
+
+void
+cmn_err(int level, char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+       fputs("\n", stderr);
+       va_end(ap);
+}
index 8b32a18be9f52795d07820afc565cb997c0878bd..39a363803c5d51772f359c78e5b89018c8829c58 100644 (file)
@@ -294,7 +294,6 @@ typedef struct { dev_t dev; } xfs_buftarg_t;
 #define spinlock_init(a,b)             ((void) 0)
 #define spin_lock(a)                   ((void) 0)
 #define spin_unlock(a)                 ((void) 0)
-#define __return_address               __builtin_return_address(0)
 #define xfs_btree_reada_bufl(m,fsb,c)  ((void) 0)
 #define xfs_btree_reada_bufs(m,fsb,c,x)        ((void) 0)
 #define XFS_SB_LOCK(mp)                        0
@@ -308,47 +307,32 @@ typedef struct { dev_t dev; } xfs_buftarg_t;
 #define XFS_TRANS_RESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl) 0
 #define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl)       0
 
-/* These are lifted from the kernel */
+#ifdef __GNUC__
+#define __return_address       __builtin_return_address(0)
 #define get_unaligned(ptr) \
   ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
-
 #define put_unaligned(val, ptr)                        \
   ({ __typeof__(*(ptr)) __tmp = (val);         \
      memmove((ptr), &__tmp, sizeof(*(ptr)));   \
      (void)0; })
-
-#define REPAIR_MESSAGE _("  This is a bug.\n"  \
-                        "Please report it to linux-xfs@oss.sgi.com.\n")
-#if (__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 95))
-# define xfs_fs_repair_cmn_err(a,b,msg,args...)        \
-       ( fprintf(stderr, msg, ## args), fprintf(stderr, REPAIR_MESSAGE) )
-# define xfs_fs_cmn_err(a,b,msg,args...)( fprintf(stderr, msg, ## args) )
-# define cmn_err(a,msg,args...)                ( fprintf(stderr, msg, ## args) )
-# define printk(msg,args...)           ( fprintf(stderr, msg, ## args) )
 #else
-# define xfs_fs_repair_cmn_err(a,b,...)        \
-       ( fprintf(stderr, __VA_ARGS__), fprintf(stderr, REPAIR_MESSAGE) )
-# define xfs_fs_cmn_err(a,b,...)       ( fprintf(stderr, __VA_ARGS__) )
-# define cmn_err(a,...)                        ( fprintf(stderr, __VA_ARGS__) )
-# define printk(...)                   ( fprintf(stderr, __VA_ARGS__) )
+#define get_unaligned(ptr)     (*(ptr))
+#define put_unaligned(val, ptr)        (*(ptr) = (val))
 #endif
 
-#define rol32(x,y)     (((x) << (y)) | ((x) >> (32 - (y))))
-#define do_mod(a, b)   ((a) % (b))
-#define do_div(n,base) ({ \
-       int __res; \
-       __res = ((unsigned long) n) % (unsigned) base; \
-       n = ((unsigned long) n) / (unsigned) base; \
-       __res; })
+extern void xfs_fs_repair_cmn_err(int, struct xfs_mount *, char *, ...);
+extern void xfs_fs_cmn_err(int, struct xfs_mount *, char *, ...);
 
-static inline int atomicIncWithWrap(int *a, int b)
+static inline int __do_div(unsigned long long *n, unsigned base)
 {
-       int r = *a;
-       (*a)++;
-       if (*a == b)
-               *a = 0;
-       return r;
+       int __res;
+       __res = (int)(((unsigned long) *n) % (unsigned) base);
+       *n = ((unsigned long) *n) / (unsigned) base;
+       return __res;
 }
+#define do_div(n,base) (__do_div(&(n), (base)))
+#define do_mod(a, b)   ((a) % (b))
+#define rol32(x,y)     (((x) << (y)) | ((x) >> (32 - (y))))
 
 
 /*
index 694e954c4f557395c14a33bc1bf5c22a9d29ffcf..e08f9f069e9e1723e50fd19ed6ce12fc1e62f1e1 100644 (file)
@@ -26,13 +26,13 @@ libxfs_init_t x;
 static int
 header_check_uuid(xfs_mount_t *mp, xlog_rec_header_t *head)
 {
-    char uu_log[64], uu_sb[64];
+    char uu_log[64], uu_sb[64], *uup_log = &uu_log[0], *uup_sb = &uu_sb[0];
 
     if (print_skip_uuid) return 0;
-    if (!uuid_compare(mp->m_sb.sb_uuid, head->h_fs_uuid)) return 0;
+    if (!platform_uuid_compare(&mp->m_sb.sb_uuid, &head->h_fs_uuid)) return 0;
 
-    uuid_unparse(mp->m_sb.sb_uuid, uu_sb);
-    uuid_unparse(head->h_fs_uuid, uu_log);
+    platform_uuid_unparse(&mp->m_sb.sb_uuid, &uup_sb);
+    platform_uuid_unparse(&head->h_fs_uuid, &uup_log);
 
     printf(_("* ERROR: mismatched uuid in log\n"
             "*            SB : %s\n*            log: %s\n"),
@@ -82,7 +82,7 @@ xlog_header_check_recover(xfs_mount_t *mp, xlog_rec_header_t *head)
 int
 xlog_header_check_mount(xfs_mount_t *mp, xlog_rec_header_t *head)
 {
-    if (uuid_is_null(head->h_fs_uuid)) return 0;
+    if (platform_uuid_is_null(&head->h_fs_uuid)) return 0;
     if (header_check_uuid(mp, head)) {
        /* bail out now or just carry on regardless */
        if (print_exit)
@@ -90,3 +90,41 @@ xlog_header_check_mount(xfs_mount_t *mp, xlog_rec_header_t *head)
     }
     return 0;
 }
+
+/*
+ * Userspace versions of common diagnostic routines (varargs fun).
+ */
+void
+xlog_warn(char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+       fputs("\n", stderr);
+       va_end(ap);
+}
+
+void
+xlog_exit(char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+       fputs("\n", stderr);
+       va_end(ap);
+       exit(1);
+}
+
+void
+xlog_panic(char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+       fputs("\n", stderr);
+       va_end(ap);
+       abort();
+}