diff options
Diffstat (limited to 'fs/xfs/support/uuid.c')
-rw-r--r-- | fs/xfs/support/uuid.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/xfs/support/uuid.c b/fs/xfs/support/uuid.c index 70ce40914c8a..a3d565a67734 100644 --- a/fs/xfs/support/uuid.c +++ b/fs/xfs/support/uuid.c | |||
@@ -24,9 +24,19 @@ static uuid_t *uuid_table; | |||
24 | void | 24 | void |
25 | uuid_init(void) | 25 | uuid_init(void) |
26 | { | 26 | { |
27 | mutex_init(&uuid_monitor, MUTEX_DEFAULT, "uuid_monitor"); | 27 | mutex_init(&uuid_monitor); |
28 | } | 28 | } |
29 | 29 | ||
30 | |||
31 | /* IRIX interpretation of an uuid_t */ | ||
32 | typedef struct { | ||
33 | __be32 uu_timelow; | ||
34 | __be16 uu_timemid; | ||
35 | __be16 uu_timehi; | ||
36 | __be16 uu_clockseq; | ||
37 | __be16 uu_node[3]; | ||
38 | } xfs_uu_t; | ||
39 | |||
30 | /* | 40 | /* |
31 | * uuid_getnodeuniq - obtain the node unique fields of a UUID. | 41 | * uuid_getnodeuniq - obtain the node unique fields of a UUID. |
32 | * | 42 | * |
@@ -36,16 +46,11 @@ uuid_init(void) | |||
36 | void | 46 | void |
37 | uuid_getnodeuniq(uuid_t *uuid, int fsid [2]) | 47 | uuid_getnodeuniq(uuid_t *uuid, int fsid [2]) |
38 | { | 48 | { |
39 | char *uu = (char *)uuid; | 49 | xfs_uu_t *uup = (xfs_uu_t *)uuid; |
40 | |||
41 | /* on IRIX, this function assumes big-endian fields within | ||
42 | * the uuid, so we use INT_GET to get the same result on | ||
43 | * little-endian systems | ||
44 | */ | ||
45 | 50 | ||
46 | fsid[0] = (INT_GET(*(u_int16_t*)(uu+8), ARCH_CONVERT) << 16) + | 51 | fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) | |
47 | INT_GET(*(u_int16_t*)(uu+4), ARCH_CONVERT); | 52 | be16_to_cpu(uup->uu_timemid); |
48 | fsid[1] = INT_GET(*(u_int32_t*)(uu ), ARCH_CONVERT); | 53 | fsid[1] = be16_to_cpu(uup->uu_timelow); |
49 | } | 54 | } |
50 | 55 | ||
51 | void | 56 | void |
@@ -94,7 +99,7 @@ uuid_table_insert(uuid_t *uuid) | |||
94 | { | 99 | { |
95 | int i, hole; | 100 | int i, hole; |
96 | 101 | ||
97 | mutex_lock(&uuid_monitor, PVFS); | 102 | mutex_lock(&uuid_monitor); |
98 | for (i = 0, hole = -1; i < uuid_table_size; i++) { | 103 | for (i = 0, hole = -1; i < uuid_table_size; i++) { |
99 | if (uuid_is_nil(&uuid_table[i])) { | 104 | if (uuid_is_nil(&uuid_table[i])) { |
100 | hole = i; | 105 | hole = i; |
@@ -122,7 +127,7 @@ uuid_table_remove(uuid_t *uuid) | |||
122 | { | 127 | { |
123 | int i; | 128 | int i; |
124 | 129 | ||
125 | mutex_lock(&uuid_monitor, PVFS); | 130 | mutex_lock(&uuid_monitor); |
126 | for (i = 0; i < uuid_table_size; i++) { | 131 | for (i = 0; i < uuid_table_size; i++) { |
127 | if (uuid_is_nil(&uuid_table[i])) | 132 | if (uuid_is_nil(&uuid_table[i])) |
128 | continue; | 133 | continue; |