/* Copyright (c) 1993 Xerox Corporation. All rights reserved. */ /* $Id$ $Date$ * * PCR - I/O global descriptor support on Unix File System. * * This deals mostly with wait for host descriptor ready. * * Not for client use. */ #ifndef __PCR_IOGblUFS_h #define __PCR_IOGblUFS_h 1 #include #include #include #include #include #if PCR_OS_EWOULDBLOCK # define PCR_IOGblUFS_ShouldRetry(res) \ ( ((res) == PCR_ERes_FromErr(EWOULDBLOCK)) \ || ((res) == PCR_ERes_FromErr(EAGAIN))\ || ((res) == PCR_ERes_FromErr(EINTR)) ) #else # define PCR_IOGblUFS_ShouldRetry(res) \ ( ((res) == PCR_ERes_FromErr(EAGAIN)) \ || ((res) == PCR_ERes_FromErr(EINTR)) ) #endif #define PCR_IOGblUFS_HOSTFD(gde) \ ((gde)->gde_data[0].gde_data__long) #define PCR_IOGblUFS_SPLITSIZE(gde) \ ((gde)->gde_data[1].gde_data__long) #define PCR_IOGblUFS_DEFAULTSPLITSIZE (16*1024) extern PCR_ERes PCR_IOGblUFS_SetHostFDBlocking(int hd, PCR_Bool blocking); /* Turn on/off host descriptor blocking behavior. */ extern PCR_ERes PCR_IOGblUFS_InstallHostFD( PCR_IOGbl_DEPtr gde, int hd ); extern PCR_ERes PCR_IOGblUFS_InstallHostFDs( PCR_IOGbl_DEPtr gde0, PCR_IOGbl_DEPtr gde1, int hd0, int hd1 ); /* Create association between allocated gde's and host fd's. On failure, caller is responsible for closing hd's. */ #if PCR_OS_POLL # include /* extern int poll(struct pollfd *fds, unsigned long nfds, int timeout); */ #else struct pollfd { int fd; short events; short revents; }; # define POLLIN 01 # define POLLPRI 02 # define POLLOUT 04 # define POLLERR 010 # define POLLHUP 020 # define POLLNVAL 040 #endif typedef volatile struct PCR_IOGblUFS_WaitReadyInfoRep * PCR_IOGblUFS_WaitReadyInfoPtr; typedef struct PCR_IOGblUFS_WaitReadyInfoRep { PCR_IOGblUFS_WaitReadyInfoPtr ufswri_next; PCR_IOGblUFS_WaitReadyInfoPtr ufswri_prev; PCR_IOGbl_DEPtr ufswri_gde; PCR_Th_CV ufswri_cvAny; PCR_Th_CV ufswri_cvIn; PCR_Th_CV ufswri_cvOut; int ufswri_pollSlot; } PCR_IOGblUFS_WaitReadyInfo; extern volatile PCR_IOGblUFS_WaitReadyInfoPtr PCR_IOGblUFS_waitReadyInfo; extern volatile PCR_IOGblUFS_WaitReadyInfoPtr PCR_IOGblUFS_waitReadyInfoSet; extern struct pollfd * PCR_IOGblUFS_pollfds; extern volatile int PCR_IOGblUFS_pollfdCnt; extern PCR_ERes PCR_IOGblUFS_WaitGDEReady( PCR_IOGbl_DEPtr gde, int events, const PCR_sigset_t *sigMask, PCR_Msec wakeup ); /* Wait for gbl descriptor ready for one of given events, or for error on the descriptor. */ extern PCR_ERes PCR_IOGblUFS_WaitHDReady( int hd, int events, const PCR_sigset_t *sigMask, PCR_Msec wakeup ); /* Wait for host descriptor ready for one of given events, or for error on descriptor. Caller must be in sys critical section. */ extern void PCR_IOGblUFS_NotifyHDReady( int hd ); /* Caller must be in sys critical section. */ extern void PCR_IOGblUFS_NotifyHDClosed( int hd ); /* Caller must be in sys critical section. */ #endif /* ! __PCR_IOGblUFS_h */ /* $Log$ */