]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Complete uuid platform abstractions, fix do_div for 64 bit platforms.
authorNathan Scott <nathans@sgi.com>
Fri, 28 Apr 2006 04:02:55 +0000 (04:02 +0000)
committerNathan Scott <nathans@sgi.com>
Fri, 28 Apr 2006 04:02:55 +0000 (04:02 +0000)
Merge of master-melb:xfs-cmds:25844a by kenmcd.

14 files changed:
copy/xfs_copy.c
db/fprint.c
db/sb.c
doc/CHANGES
include/builddefs.in
include/buildmacros
include/darwin.h
include/freebsd.h
include/irix.h
include/linux.h
libxfs/xfs.h
libxlog/util.c
logprint/log_misc.c
mkfs/xfs_mkfs.c

index a11be521c6fc74e404a238f0e2917a058fe95d1e..81cd1c6411afbfc3f0e4f1a7f5b2724e66de00d2 100644 (file)
@@ -854,9 +854,9 @@ main(int argc, char **argv)
 
        for (i = 0, tcarg = targ; i < num_targets; i++, tcarg++)  {
                if (!duplicate)
-                       uuid_generate(tcarg->uuid);
+                       platform_uuid_generate(&tcarg->uuid);
                else
-                       uuid_copy(tcarg->uuid, mp->m_sb.sb_uuid);
+                       platform_uuid_copy(&tcarg->uuid, &mp->m_sb.sb_uuid);
 
                if (pthread_mutex_init(&tcarg->wait, NULL) != 0)  {
                        do_log(_("Error creating thread mutex %d\n"), i);
@@ -1146,7 +1146,8 @@ main(int argc, char **argv)
                        /* do each thread in turn, each has its own UUID */
 
                        for (j = 0, tcarg = targ; j < num_targets; j++)  {
-                               uuid_copy(ag_hdr.xfs_sb->sb_uuid, tcarg->uuid);
+                               platform_uuid_copy(&ag_hdr.xfs_sb->sb_uuid,
+                                                       &tcarg->uuid);
                                do_write(tcarg);
                                tcarg++;
                        }
index df8d607d668fc9f4fd511b474ee3f48228cd085b..b6738555d8057da9f84dbc199f6fea5b75af9adc 100644 (file)
@@ -177,7 +177,7 @@ fp_uuid(
             i++, p++) {
                if (array)
                        dbprintf("%d:", i + base);
-               uuid_unparse(*p, bp);
+               platform_uuid_unparse(p, bp);
                dbprintf("%s", bp);
                if (i < count - 1)
                        dbprintf(" ");
diff --git a/db/sb.c b/db/sb.c
index 08de3f3efc65b04b40ff5dbaf168fa6eb9946b14..746a72f4d0f81c58addeb55220464a18d34c1216 100644 (file)
--- a/db/sb.c
+++ b/db/sb.c
@@ -345,9 +345,9 @@ uuid_f(
                }
 
                if (!strcasecmp(argv[1], "generate")) {
-                       uuid_generate(uu);
+                       platform_uuid_generate(&uu);
                } else if (!strcasecmp(argv[1], "nil")) {
-                       uuid_clear(uu);
+                       platform_uuid_clear(&uu);
                } else if (!strcasecmp(argv[1], "rewrite")) {
                        uup = do_uuid(0, NULL);
                        if (!uup) {
@@ -355,10 +355,10 @@ uuid_f(
                                return 0;
                        }
                        memcpy(&uu, uup, sizeof(uuid_t));
-                       uuid_unparse(uu, bp);
+                       platform_uuid_unparse(&uu, bp);
                        dbprintf("old UUID = %s\n", bp);
                } else {
-                       if (uuid_parse(argv[1], uu)) {
+                       if (platform_uuid_parse(argv[1], &uu)) {
                                dbprintf("invalid UUID\n");
                                return 0;
                        }
@@ -375,7 +375,7 @@ uuid_f(
                                break;
                        }
 
-               uuid_unparse(uu, bp);
+               platform_uuid_unparse(&uu, bp);
                dbprintf("new UUID = %s\n", bp);
                return 0;
 
@@ -408,7 +408,7 @@ uuid_f(
                                 "for FS with an external log\n");
                }
 
-               uuid_unparse(uu, bp);
+               platform_uuid_unparse(&uu, bp);
                dbprintf("UUID = %s\n", bp);
        }
 
index f31138781decc68d18148bb8f93faed590a1edea..e89eec0dac31e206c625a0f6efe2af0cd9209c54 100644 (file)
@@ -3,6 +3,7 @@
          b+tree nodes as corrupt.
        - Portability changes, get xfs_repair compiling on IRIX.
        - Parent pointer updates in xfs_io checker command.
+       - Allow LDFLAGS to be overridden, for Gentoo punters.
 
 xfsprogs-2.7.17 (05 April 2006)
        - Fix libxfs access(2) check on /proc/mounts, which was
index 2f19afb5374f540797c873c326cb7fc4e7db5dae..50f7b652b75c5c09a6343d9225b3d08967d3884c 100644 (file)
@@ -23,6 +23,7 @@ _BUILDDEFS_INCLUDED_ = 1
 DEBUG = @debug_build@
 OPTIMIZER = @opt_build@
 MALLOCLIB = @malloc_lib@
+LOADERFLAGS = @LDFLAGS@
 
 LIBUUID = @libuuid@
 LIBPTHREAD = @libpthread@
index 928f24f719c41eb02f85c06480090f0bb1a989f0..0c81aaaaa151edc47dfd124d55c44ff11cae4c1a 100644 (file)
@@ -9,7 +9,7 @@ BUILDRULES = $(TOPDIR)/include/buildrules
 # $(CXXFILES), or $(HFILES) and is used to construct the manifest list
 # during the "dist" phase (packaging).
 
-LDFLAGS = $(LLDFLAGS)
+LDFLAGS += $(LOADERFLAGS) $(LLDFLAGS)
 LDLIBS = $(LLDLIBS) $(PLDLIBS) $(MALLOCLIB)
 
 MAKEOPTS = --no-print-directory
index 993e6109d426c3db3dc8c81d2ba515106af51260..e0164a5964cdfac91f65b507cd5746efe717e9df 100644 (file)
@@ -66,15 +66,15 @@ 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)
+static __inline__ void platform_uuid_unparse(uuid_t *uu, char *buffer)
 {
        uint32_t status;
-       char *str;
-       uuid_to_string(uu, &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 platform_uuid_parse(char *buffer, uuid_t *uu)
index 1697f72c9546915ca79b641f836a5070594fcdc1..b68f17d41f914c316791d7edbafd6545592be8ae 100644 (file)
@@ -102,14 +102,14 @@ 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)
+static __inline__ void platform_uuid_unparse(uuid_t *uu, char *buffer)
 {
        uint32_t status;
        char *s;
        uuid_to_string(uu, &s, &status);
        if (status == uuid_s_ok)
-               strcpy(*buffer, s);
-       else *buffer[0] = '\0';
+               strcpy(buffer, s);
+       else buffer[0] = '\0';
        free(s);
 }
 
index 30fd0e9a43f6dac7549069e805cb8516de40152f..edca008bac643b8bc954a4cf273781d5b005b740 100644 (file)
@@ -258,14 +258,14 @@ static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
        return uuid_compare(uu1, uu2, &status);
 }
 
-static __inline__ void platform_uuid_unparse(uuid_t *uu, char **buffer)
+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';
+               strcpy(buffer, s);
+       else buffer[0] = '\0';
        free(s);
 }
 
index bc9ad4bf6272dfdb65d659101492789ec3725c44..e6dc58ff0ba685adf268e45814e514ebf51c73b1 100644 (file)
@@ -63,9 +63,14 @@ 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)
+static __inline__ void platform_uuid_unparse(uuid_t *uu, char *buffer)
 {
-       uuid_unparse(*uu, *buffer);
+       uuid_unparse(*uu, buffer);
+}
+
+static __inline__ int platform_uuid_parse(char *buffer, uuid_t *uu)
+{
+       return uuid_parse(buffer, *uu);
 }
 
 static __inline__ int platform_uuid_is_null(uuid_t *uu)
@@ -73,6 +78,21 @@ static __inline__ int platform_uuid_is_null(uuid_t *uu)
        return uuid_is_null(*uu);
 }
 
+static __inline__ void platform_uuid_generate(uuid_t *uu)
+{
+       uuid_generate(*uu);
+}
+
+static __inline__ void platform_uuid_clear(uuid_t *uu)
+{
+       uuid_clear(*uu);
+}
+
+static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
+{
+       uuid_copy(*dst, *src);
+}
+
 #if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1))
 # define constpp       const char * const *
 #else
index 39a363803c5d51772f359c78e5b89018c8829c58..5b3f6aa024dfadff366f3fc61b4f71a05313cf95 100644 (file)
@@ -330,7 +330,7 @@ static inline int __do_div(unsigned long long *n, unsigned base)
        *n = ((unsigned long) *n) / (unsigned) base;
        return __res;
 }
-#define do_div(n,base) (__do_div(&(n), (base)))
+#define do_div(n,base) (__do_div((unsigned long long *)&(n), (base)))
 #define do_mod(a, b)   ((a) % (b))
 #define rol32(x,y)     (((x) << (y)) | ((x) >> (32 - (y))))
 
index e08f9f069e9e1723e50fd19ed6ce12fc1e62f1e1..1410d0581bbe58070847a234ca3b567e32d77731 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], *uup_log = &uu_log[0], *uup_sb = &uu_sb[0];
+    char uu_log[64], uu_sb[64];
 
     if (print_skip_uuid) return 0;
     if (!platform_uuid_compare(&mp->m_sb.sb_uuid, &head->h_fs_uuid)) return 0;
 
-    platform_uuid_unparse(&mp->m_sb.sb_uuid, &uup_sb);
-    platform_uuid_unparse(&head->h_fs_uuid, &uup_log);
+    platform_uuid_unparse(&mp->m_sb.sb_uuid, uu_sb);
+    platform_uuid_unparse(&head->h_fs_uuid, uu_log);
 
     printf(_("* ERROR: mismatched uuid in log\n"
             "*            SB : %s\n*            log: %s\n"),
index fed4dbb80ccf3b0e2645f3fffc4f42fc06b63588..35fcfc58275f1051cf7f7198fdac1d238386b459 100644 (file)
@@ -1124,7 +1124,7 @@ xlog_print_rec_head(xlog_rec_header_t *head, int *len)
        printf("\n");
     }
 
-    uuid_unparse(head->h_fs_uuid, uub);
+    platform_uuid_unparse(&head->h_fs_uuid, uub);
     printf("uuid: %s   format: ", uub);
     switch (INT_GET(head->h_fmt, ARCH_CONVERT)) {
        case XLOG_FMT_UNKNOWN:
index 5bfad6a994ed885457dd754a8615ec232510860d..6b4594e030e62cdc304d46237256a31e529780c1 100644 (file)
@@ -1966,8 +1966,8 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),
        sbp->sb_dblocks = dblocks;
        sbp->sb_rblocks = rtblocks;
        sbp->sb_rextents = rtextents;
-       uuid_generate(uuid);
-       uuid_copy(sbp->sb_uuid, uuid);
+       platform_uuid_generate(&uuid);
+       platform_uuid_copy(&sbp->sb_uuid, &uuid);
        sbp->sb_logstart = logstart;
        sbp->sb_rootino = sbp->sb_rbmino = sbp->sb_rsumino = NULLFSINO;
        sbp->sb_rextsize = rtextblocks;