OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/src/afs/discon.h
00001 #ifndef _DISCON_H
00002 #define _DISCON_H
00003 
00004 extern afs_int32    afs_is_disconnected;
00005 extern afs_int32    afs_is_discon_rw;
00006 extern afs_int32    afs_in_sync;
00007 extern afs_rwlock_t afs_discon_lock;
00008 
00009 extern struct afs_q afs_disconDirty;
00010 extern struct afs_q afs_disconShadow;
00011 extern afs_rwlock_t afs_disconDirtyLock;
00012 extern afs_int32    afs_ConflictPolicy;
00013 
00014 extern afs_uint32 afs_DisconVnode; /* XXX: not protected. */
00015 
00016 extern int afs_WriteVCacheDiscon(struct vcache *avc,
00017                                         struct AFSStoreStatus *astatus,
00018                                         struct vattr *attrs);
00019 extern int afs_ResyncDisconFiles(struct vrequest *areq,
00020                                         afs_ucred_t *acred);
00021 extern void afs_RemoveAllConns(void);
00022 extern void afs_GenFakeFid(struct VenusFid *afid, afs_uint32 avtype,
00023                            int lock);
00024 extern void afs_GenShadowFid(struct VenusFid *afid);
00025 extern void afs_GenDisconStatus(struct vcache *adp,
00026                                         struct vcache *avc,
00027                                         struct VenusFid *afid,
00028                                         struct vattr *attrs,
00029                                         struct vrequest *areq,
00030                                         int file_type);
00031 extern int afs_MakeShadowDir(struct vcache *avc, struct dcache *adc);
00032 extern void afs_DeleteShadowDir(struct vcache *avc);
00033 extern struct dcache *afs_FindDCacheByFid(struct VenusFid *afid);
00034 extern void afs_UpdateStatus(struct vcache *avc,
00035                                         struct VenusFid *afid,
00036                                         struct vrequest *areq,
00037                                         struct AFSFetchStatus *Outsp,
00038                                         struct AFSCallBack *acb,
00039                                         afs_uint32 start);
00040 extern void afs_DisconDiscardAll(afs_ucred_t *);
00041 
00042 #define AFS_IS_DISCONNECTED (afs_is_disconnected || afs_is_discon_rw)
00043 #define AFS_IS_DISCON_RW (afs_is_discon_rw)
00044 #define AFS_IN_SYNC (afs_in_sync)
00045 #define AFS_DISCON_LOCK() ObtainReadLock(&afs_discon_lock)
00046 #define AFS_DISCON_UNLOCK() ReleaseReadLock(&afs_discon_lock)
00047 
00048 /* Call with avc lock held */
00049 static_inline void afs_DisconAddDirty(struct vcache *avc, int operation, int lock) {
00050     if (!avc->f.ddirty_flags) {
00051         if (lock)
00052             ObtainWriteLock(&afs_xvcache, 702);
00053         ObtainWriteLock(&afs_disconDirtyLock, 703);
00054         QAdd(&afs_disconDirty, &avc->dirtyq);
00055         osi_Assert((afs_RefVCache(avc) == 0));
00056         ReleaseWriteLock(&afs_disconDirtyLock);
00057         if (lock)
00058             ReleaseWriteLock(&afs_xvcache);
00059     }
00060     avc->f.ddirty_flags |= operation;
00061 }
00062 
00063 /* Call with avc lock held */
00064 static_inline void afs_DisconRemoveDirty(struct vcache *avc) {
00065     ObtainWriteLock(&afs_disconDirtyLock, 704);
00066     QRemove(&avc->dirtyq);
00067     ReleaseWriteLock(&afs_disconDirtyLock);
00068     avc->f.ddirty_flags = 0;
00069     afs_PutVCache(avc);
00070 }
00071 #endif /* _DISCON_H */
 All Data Structures Files Functions Variables