]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/xfs/support/uuid.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[linux-2.6-omap-h63xx.git] / fs / xfs / support / uuid.c
index 69ec4f540c3ac737f0759848ba8bf3fd372e1ea7..5830c040ea7ebba66274eeebbdab553c206ab981 100644 (file)
  */
 #include <xfs.h>
 
-static mutex_t uuid_monitor;
+static DEFINE_MUTEX(uuid_monitor);
 static int     uuid_table_size;
 static uuid_t  *uuid_table;
 
-void
-uuid_init(void)
-{
-       mutex_init(&uuid_monitor);
-}
+/* IRIX interpretation of an uuid_t */
+typedef struct {
+       __be32  uu_timelow;
+       __be16  uu_timemid;
+       __be16  uu_timehi;
+       __be16  uu_clockseq;
+       __be16  uu_node[3];
+} xfs_uu_t;
 
 /*
  * uuid_getnodeuniq - obtain the node unique fields of a UUID.
@@ -36,16 +39,11 @@ uuid_init(void)
 void
 uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
 {
-       char    *uu = (char *)uuid;
-
-       /* on IRIX, this function assumes big-endian fields within
-        * the uuid, so we use INT_GET to get the same result on
-        * little-endian systems
-        */
+       xfs_uu_t *uup = (xfs_uu_t *)uuid;
 
-       fsid[0] = (INT_GET(*(u_int16_t*)(uu+8), ARCH_CONVERT) << 16) +
-                  INT_GET(*(u_int16_t*)(uu+4), ARCH_CONVERT);
-       fsid[1] =  INT_GET(*(u_int32_t*)(uu  ), ARCH_CONVERT);
+       fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
+                  be16_to_cpu(uup->uu_timemid);
+       fsid[1] = be32_to_cpu(uup->uu_timelow);
 }
 
 void