source: gpfs_3.1_ker2.6.20/lpp/mmfs/src/include/cxi/cxiCred.h @ 195

Last change on this file since 195 was 16, checked in by rock, 17 years ago
File size: 4.6 KB
Line 
1/***************************************************************************
2 *
3 * Copyright (C) 2001 International Business Machines
4 * All rights reserved.
5 *
6 * This file is part of the GPFS mmfslinux kernel module.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 *  1. Redistributions of source code must retain the above copyright notice,
13 *     this list of conditions and the following disclaimer.
14 *  2. Redistributions in binary form must reproduce the above copyright
15 *     notice, this list of conditions and the following disclaimer in the
16 *     documentation and/or other materials provided with the distribution.
17 *  3. The name of the author may not be used to endorse or promote products
18 *     derived from this software without specific prior written
19 *     permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 *************************************************************************** */
33/* @(#)38       1.10  src/avs/fs/mmfs/ts/kernext/ibm-kxi/cxiCred.h, mmfs, avs_rgpfs24, rgpfs240610b 11/10/03 08:36:38 */
34
35#ifndef _h_CXICRED
36#define _h_CXICRED
37
38#include <cxiSystem.h>
39#include <cxiTypes.h>
40
41/* Structures dealing with ext_id_t and ext_cred_t
42 * Equivalent to DCE uuid_t
43 */
44struct ext_id_t
45{
46  unsigned int            time_low;
47  unsigned short          time_mid;
48  unsigned short          time_hi_and_version;
49  unsigned char           clock_seq_hi_and_reserved;
50  unsigned char           clock_seq_low;
51  unsigned char           node[6];
52};
53typedef struct ext_id_t ext_id_t;
54
55
56/* Include platform-specific credential definitions */
57#include <cxiCred-plat.h>
58
59
60/* Compare a UUID to our (shortened) principal identifier
61 */
62#define PRINCIPAL_ID_COMPARE(idBlob1P, idBlob2P) \
63  (cxiMemcmp((char *)(idBlob1P), (char *)(idBlob2P), sizeof(cxiGid_t)))
64
65/* Compare as full length (128 bit) identifiers
66 */
67#define EXT_ID_COMPARE(idBlob1P, idBlob2P) \
68  (cxiMemcmp((char *)(idBlob1P), (char *)(idBlob2P), sizeof(ext_id_t)))
69
70
71/* We often compare the realm against a NIL identifier since
72 * the local realm has the well known identity of NIL.  We need
73 * a well known identity since a file may be accessed from a DFS
74 * client and a GPFS node.  The DFS server node can correctly
75 * tell us what a local realm identity is, but a normal GPFS
76 * node has no idea how to interpret a 128 bit DCE realm.  Hence
77 * we always store local realms as the well known NIL identity.
78 */
79#define NIL_EXT_ID(_IDP) \
80  ((_IDP)->time_low == 0 && \
81   (_IDP)->time_mid == 0 && \
82   (_IDP)->time_hi_and_version == 0 && \
83   (_IDP)->clock_seq_hi_and_reserved == 0 && \
84   (_IDP)->clock_seq_low == 0 && \
85   (_IDP)->node[0] == 0 && \
86   (_IDP)->node[1] == 0 && \
87   (_IDP)->node[2] == 0 && \
88   (_IDP)->node[3] == 0 && \
89   (_IDP)->node[4] == 0 && \
90   (_IDP)->node[5] == 0)
91
92/* Maximum character buffer size needed to represent a
93 * extended identifier as a string.  (See EXT_ID_SPRINTF)
94 */
95#define EXT_ID_STRING_SIZE 37
96
97#define EXT_ID_SPRINTF(_STRINGP, _IDP)                        \
98  sprintf((_STRINGP),                                         \
99          "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", \
100          (unsigned int)(_IDP)->time_low,                     \
101          (unsigned short)(_IDP)->time_mid,                   \
102          (unsigned short)(_IDP)->time_hi_and_version,        \
103          (unsigned char)(_IDP)->clock_seq_hi_and_reserved,   \
104          (unsigned char)(_IDP)->clock_seq_low,               \
105          (unsigned char)(_IDP)->node[0],                     \
106          (unsigned char)(_IDP)->node[1],                     \
107          (unsigned char)(_IDP)->node[2],                     \
108          (unsigned char)(_IDP)->node[3],                     \
109          (unsigned char)(_IDP)->node[4],                     \
110          (unsigned char)(_IDP)->node[5]);
111
112/* prototypes */
113char *ext_id_as_string(ext_id_t *, char *);
114
115#endif /* _h_CXICRED */
Note: See TracBrowser for help on using the repository browser.