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_VOLUME_H 00011 #define OPENAFS_WINNT_AFSD_CM_VOLUME_H 1 00012 00013 #include <opr/jhash.h> 00014 00015 #define VL_MAXNAMELEN 65 00016 00017 #define CM_VOLUME_MAGIC ('V' | 'O' <<8 | 'L'<<16 | 'M'<<24) 00018 00019 /* 00020 * 00021 */ 00022 00023 typedef struct cm_vol_state { 00024 struct cm_volume *nextp; /* volumeIDHashTable; by cm_volumeLock */ 00025 afs_uint32 ID; /* by rw */ 00026 struct cm_fid dotdotFid; /* parent of volume root */ 00027 cm_serverRef_t *serversp; /* by cm_serverLock */ 00028 enum volstatus state; /* by rw */ 00029 afs_uint32 flags; /* by rw */ 00030 afs_uint32 qflags; /* by cm_volumeLock */ 00031 } cm_vol_state_t; 00032 00033 /* RWVOL, ROVOL, BACKVOL are defined in cm.h */ 00034 #define NUM_VOL_TYPES 3 00035 00036 #define CM_VOL_STATE_FLAG_REPLICATED 1 00037 00038 typedef struct cm_volume { 00039 osi_queue_t q; /* LRU queue; cm_volumeLock */ 00040 afs_uint32 qflags; /* by cm_volumeLock */ 00041 afs_uint32 magic; 00042 struct cm_volume *allNextp; /* allVolumes; by cm_volumeLock */ 00043 struct cm_volume *nameNextp; /* volumeNameHashTable; by cm_volumeLock */ 00044 cm_cell_t *cellp; /* never changes */ 00045 char namep[VL_MAXNAMELEN]; /* name of the normal volume - assigned during allocation; */ 00046 /* by cm_volumeLock */ 00047 struct cm_vol_state vol[NUM_VOL_TYPES]; /* by cm_volumeLock */ 00048 osi_rwlock_t rw; 00049 afs_uint32 flags; /* by rw */ 00050 afs_int32 refCount; /* by Interlocked operations */ 00051 struct cm_server *cbServerpRO; /* server granting RO callback; by cm_scacheLock */ 00052 time_t cbExpiresRO; /* latest RO expiration time; by cm_scacheLock */ 00053 time_t cbIssuedRO; /* latest RO issue time; by cm_scacheLock */ 00054 time_t creationDateRO; /* latest volume creation date; 0 if unknown; by cm_scacheLock */ 00055 time_t lastUpdateTime; /* most recent volume location update cm_volumeLock */ 00056 } cm_volume_t; 00057 00058 #define CM_VOLUMEFLAG_RESET 1 /* reload this info on next use */ 00059 #define CM_VOLUMEFLAG_RO_MIXED 2 00060 #define CM_VOLUMEFLAG_UPDATING_VL 8 00061 #define CM_VOLUMEFLAG_DFS_VOLUME 16 00062 #define CM_VOLUMEFLAG_NOEXIST 32 00063 00064 #define CM_VOLUME_QFLAG_IN_HASH 1 00065 #define CM_VOLUME_QFLAG_IN_LRU_QUEUE 2 00066 00067 typedef struct cm_volumeRef { 00068 struct cm_volumeRef * next; 00069 afs_uint32 volID; 00070 } cm_volumeRef_t; 00071 00072 extern void cm_InitVolume(int newFile, long maxVols); 00073 00074 extern long cm_FindVolumeByName(struct cm_cell *cellp, char *volNamep, 00075 struct cm_user *userp, struct cm_req *reqp, 00076 afs_uint32 flags, cm_volume_t **outVolpp); 00077 00078 extern long cm_FindVolumeByID(struct cm_cell *cellp, afs_uint32 volumeID, 00079 cm_user_t *userp, cm_req_t *reqp, 00080 afs_uint32 flags, cm_volume_t **outVolpp); 00081 00082 #define CM_GETVOL_FLAG_CREATE 1 00083 #define CM_GETVOL_FLAG_NO_LRU_UPDATE 2 00084 #define CM_GETVOL_FLAG_NO_RESET 4 00085 #define CM_GETVOL_FLAG_IGNORE_LINKED_CELL 8 00086 00087 /* hash define. Must not include the cell, since the callback revocation code 00088 * doesn't necessarily know the cell in the case of a multihomed server 00089 * contacting us from a mystery address. 00090 */ 00091 00092 #define CM_VOLUME_ID_HASH(volid) \ 00093 (opr_jhash_int((volid), 0) & (cm_data.volumeHashTableSize - 1)) 00094 00095 #define CM_VOLUME_NAME_HASH(name) (SDBMHash(name) % cm_data.volumeHashTableSize) 00096 00097 extern afs_uint32 SDBMHash(const char *); 00098 00099 extern void cm_GetVolume(cm_volume_t *volp); 00100 00101 extern cm_volume_t *cm_GetVolumeByFID(cm_fid_t *); 00102 00103 extern void cm_PutVolume(cm_volume_t *volp); 00104 00105 extern long cm_GetROVolumeID(cm_volume_t *volp); 00106 00107 extern LONG_PTR cm_ChecksumVolumeServerList(struct cm_fid *fidp, 00108 cm_user_t *userp, cm_req_t *reqp); 00109 00110 extern long cm_ForceUpdateVolume(struct cm_fid *fidp, cm_user_t *userp, 00111 cm_req_t *reqp); 00112 00113 extern cm_serverRef_t **cm_GetVolServers(cm_volume_t *volp, afs_uint32 volume, 00114 cm_user_t *userp, cm_req_t *reqp, afs_uint32 *replicated); 00115 00116 extern void cm_ChangeRankVolume(cm_server_t *tsp); 00117 00118 extern void cm_RefreshVolumes(int lifetime); 00119 00120 extern long cm_ValidateVolume(void); 00121 00122 extern long cm_ShutdownVolume(void); 00123 00124 extern int cm_DumpVolumes(FILE *outputFile, char *cookie, int lock); 00125 00126 extern int cm_VolNameIsID(char *aname); 00127 00128 extern void cm_RemoveVolumeFromNameHashTable(cm_volume_t * volp); 00129 00130 extern void cm_RemoveVolumeFromIDHashTable(cm_volume_t * volp, afs_uint32 volType); 00131 00132 extern void cm_AddVolumeToNameHashTable(cm_volume_t * volp); 00133 00134 extern void cm_AddVolumeToIDHashTable(cm_volume_t * volp, afs_uint32 volType); 00135 00136 extern void cm_AdjustVolumeLRU(cm_volume_t *volp); 00137 00138 extern void cm_MoveVolumeToLRULast(cm_volume_t *volp); 00139 00140 extern void cm_RemoveVolumeFromLRU(cm_volume_t *volp); 00141 00142 extern void cm_CheckOfflineVolumes(void); 00143 00144 extern long cm_CheckOfflineVolume(cm_volume_t *volp, afs_uint32 volID); 00145 00146 extern void cm_CheckOfflineVolumeState(cm_volume_t *volp, cm_vol_state_t *statep, 00147 afs_uint32 volID, afs_uint32 *onlinep, 00148 afs_uint32 *volumeUpdatedp); 00149 00150 extern void cm_UpdateVolumeStatus(cm_volume_t *volp, afs_uint32 volID); 00151 00152 extern void cm_VolumeStatusNotification(cm_volume_t * volp, afs_uint32 volID, enum volstatus oldState, enum volstatus newState); 00153 00154 extern enum volstatus cm_GetVolumeStatus(cm_volume_t *volp, afs_uint32 volID); 00155 00156 extern void cm_VolumeRenewROCallbacks(void); 00157 00158 extern cm_vol_state_t * cm_VolumeStateByType(cm_volume_t *volp, afs_uint32 type); 00159 00160 extern cm_vol_state_t * cm_VolumeStateByID(cm_volume_t *volp, afs_uint32 id); 00161 00162 extern cm_vol_state_t * cm_VolumeStateByName(cm_volume_t *volp, char *volname); 00163 00164 extern afs_int32 cm_VolumeType(cm_volume_t *volp, afs_uint32 id); 00165 00166 extern long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t *reqp, 00167 cm_volume_t *volp); 00168 00169 extern afs_int32 cm_IsVolumeReplicated(cm_fid_t *fidp); 00170 00171 extern osi_rwlock_t cm_volumeLock; 00172 #endif /* OPENAFS_WINNT_AFSD_CM_VOLUME_H */