OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 * Copyright 2000, International Business Machines Corporation and others. 00003 * All Rights Reserved. 00004 * 00005 * This software has been released under the terms of the IBM Public 00006 * License. For details, see the LICENSE file in the top-level source 00007 * directory or online at http://www.openafs.org/dl/license10.html 00008 */ 00009 00010 #ifndef OPENAFS_WINNT_AFSD_CM_UTILS_H 00011 #define OPENAFS_WINNT_AFSD_CM_UTILS_H 1 00012 00013 #define CM_UTILS_SPACESIZE 8192 /* space to allocate */ 00014 typedef struct cm_space { 00015 union { 00016 clientchar_t wdata[CM_UTILS_SPACESIZE]; 00017 char data[CM_UTILS_SPACESIZE]; 00018 }; 00019 struct cm_space *nextp; 00020 } cm_space_t; 00021 00022 /* error code hack */ 00023 #define VL_IDEXIST (363520L) 00024 #define VL_IO (363521L) 00025 #define VL_NAMEEXIST (363522L) 00026 #define VL_CREATEFAIL (363523L) 00027 #define VL_NOENT (363524L) 00028 #define VL_EMPTY (363525L) 00029 #define VL_ENTDELETED (363526L) 00030 #define VL_BADNAME (363527L) 00031 #define VL_BADINDEX (363528L) 00032 #define VL_BADVOLTYPE (363529L) 00033 #define VL_BADSERVER (363530L) 00034 #define VL_BADPARTITION (363531L) 00035 #define VL_REPSFULL (363532L) 00036 #define VL_NOREPSERVER (363533L) 00037 #define VL_DUPREPSERVER (363534L) 00038 #define VL_RWNOTFOUND (363535L) 00039 #define VL_BADREFCOUNT (363536L) 00040 #define VL_SIZEEXCEEDED (363537L) 00041 #define VL_BADENTRY (363538L) 00042 #define VL_BADVOLIDBUMP (363539L) 00043 #define VL_IDALREADYHASHED (363540L) 00044 #define VL_ENTRYLOCKED (363541L) 00045 #define VL_BADVOLOPER (363542L) 00046 #define VL_BADRELLOCKTYPE (363543L) 00047 #define VL_RERELEASE (363544L) 00048 #define VL_BADSERVERFLAG (363545L) 00049 #define VL_PERM (363546L) 00050 #define VL_NOMEM (363547L) 00051 #define VL_BADVERSION (363548L) 00052 #define VL_INDEXERANGE (363549L) 00053 #define VL_MULTIPADDR (363550L) 00054 #define VL_BADMASK (363551L) 00055 00056 extern cm_space_t *cm_GetSpace(void); 00057 00058 extern void cm_FreeSpace(cm_space_t *); 00059 00060 extern long cm_MapRPCError(long error, cm_req_t *reqp); 00061 00062 extern long cm_MapRPCErrorRmdir(long error, cm_req_t *reqp); 00063 00064 extern long cm_MapVLRPCError(long error, cm_req_t *reqp); 00065 00066 extern void init_et_to_sys_error(void); 00067 00068 extern int cm_Is8Dot3(clientchar_t *namep); 00069 00070 extern void cm_Gen8Dot3Name(struct cm_dirEntry *dep, clientchar_t *shortName, 00071 clientchar_t **shortNameEndp); 00072 00073 #define cm_Gen8Dot3Name(dep,shortName,shortNameEndp) \ 00074 cm_Gen8Dot3NameInt((dep)->name, &(dep)->fid, shortName, shortNameEndp) 00075 00076 extern void cm_Gen8Dot3NameInt(const fschar_t * longname, cm_dirFid_t * pfid, 00077 clientchar_t *shortName, clientchar_t **shortNameEndp); 00078 00079 extern void cm_Gen8Dot3NameIntW(const clientchar_t* longname, cm_dirFid_t * pfid, 00080 clientchar_t *shortName, clientchar_t **shortNameEndp); 00081 00082 extern void cm_Gen8Dot3VolNameW(afs_uint32 cell, afs_uint32 volume, 00083 clientchar_t *shortName, clientchar_t **shortNameEndp); 00084 00085 extern int cm_MatchMask(clientchar_t *namep, clientchar_t *maskp, int flags); 00086 00087 extern BOOL cm_TargetPerceivedAsDirectory(const fschar_t *target); 00088 00089 extern HANDLE cm_LoadAfsdHookLib(void); 00090 00091 extern BOOL cm_GetOSFileVersion(char *filename, LARGE_INTEGER *liVer); 00092 00093 extern BOOL msftSMBRedirectorSupportsExtendedTimeouts(void); 00094 00095 /* thread priority */ 00096 extern void cm_UpdateServerPriority(void); 00097 00098 extern void cm_SetRequestStartTime(void); 00099 00100 extern void cm_ResetServerPriority(void); 00101 00102 /* time related functions */ 00103 00104 extern void cm_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, time_t unixTime); 00105 00106 extern void cm_UnixTimeFromLargeSearchTime(time_t *unixTimep, FILETIME *largeTimep); 00107 00108 extern void cm_SearchTimeFromUnixTime(afs_uint32 *searchTimep, time_t unixTime); 00109 00110 extern void cm_UnixTimeFromSearchTime(time_t *unixTimep, afs_uint32 searchTime); 00111 00112 extern void cm_utilsInit(void); 00113 00114 extern void cm_utilsCleanup(void); 00115 00116 __inline void 00117 cm_InterlockedAnd(LONG * pdest, LONG value) 00118 { 00119 LONG orig, current, new; 00120 00121 current = *pdest; 00122 00123 do 00124 { 00125 orig = current; 00126 new = orig & value; 00127 current = _InterlockedCompareExchange(pdest, new, orig); 00128 } while (orig != current); 00129 } 00130 00131 __inline void 00132 cm_InterlockedOr(LONG * pdest, LONG value) 00133 { 00134 LONG orig, current, new; 00135 00136 current = *pdest; 00137 00138 do 00139 { 00140 orig = current; 00141 new = orig | value; 00142 current = _InterlockedCompareExchange(pdest, new, orig); 00143 } while (orig != current); 00144 } 00145 00146 #ifdef DEBUG 00147 #ifdef _M_IX86 00148 #define _InterlockedOr cm_InterlockedOr 00149 #define _InterlockedAnd cm_InterlockedAnd 00150 #endif 00151 #endif 00152 00153 extern afs_uint32 00154 cm_NextHighestPowerOf2(afs_uint32 n); 00155 00156 #endif /* OPENAFS_WINNT_AFSD_CM_UTILS_H */