mirror of https://gitee.com/openkylin/linux.git
[S390] __FD_foo definitions.
Make the definitions of __FD_SET, __FD_CLR and __FD_ISSET independent from asm/bitops.h and remove the macro magic that tests for __GLIBC__. Use simple C inline functions instead of set_bit, clear_bit and test_bit. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This commit is contained in:
parent
d27317657a
commit
9348f0de2d
|
@ -76,24 +76,36 @@ typedef struct {
|
||||||
} __kernel_fsid_t;
|
} __kernel_fsid_t;
|
||||||
|
|
||||||
|
|
||||||
#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
|
#ifdef __KERNEL__
|
||||||
|
|
||||||
#ifndef _S390_BITOPS_H
|
#undef __FD_SET
|
||||||
#include <asm/bitops.h>
|
static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
|
||||||
#endif
|
{
|
||||||
|
unsigned long _tmp = fd / __NFDBITS;
|
||||||
|
unsigned long _rem = fd % __NFDBITS;
|
||||||
|
fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
|
||||||
|
}
|
||||||
|
|
||||||
#undef __FD_SET
|
#undef __FD_CLR
|
||||||
#define __FD_SET(fd,fdsetp) set_bit((fd),(fdsetp)->fds_bits)
|
static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
|
||||||
|
{
|
||||||
|
unsigned long _tmp = fd / __NFDBITS;
|
||||||
|
unsigned long _rem = fd % __NFDBITS;
|
||||||
|
fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
|
||||||
|
}
|
||||||
|
|
||||||
#undef __FD_CLR
|
#undef __FD_ISSET
|
||||||
#define __FD_CLR(fd,fdsetp) clear_bit((fd),(fdsetp)->fds_bits)
|
static inline int __FD_ISSET(unsigned long fd, const __kernel_fd_set *fdsetp)
|
||||||
|
{
|
||||||
#undef __FD_ISSET
|
unsigned long _tmp = fd / __NFDBITS;
|
||||||
#define __FD_ISSET(fd,fdsetp) test_bit((fd),(fdsetp)->fds_bits)
|
unsigned long _rem = fd % __NFDBITS;
|
||||||
|
return (fdsetp->fds_bits[_tmp] & (1UL<<_rem)) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
#undef __FD_ZERO
|
#undef __FD_ZERO
|
||||||
#define __FD_ZERO(fdsetp) (memset ((fdsetp), 0, sizeof(*(fd_set *)(fdsetp))))
|
#define __FD_ZERO(fdsetp) \
|
||||||
|
((void) memset ((__ptr_t) (fdsetp), 0, sizeof (__kernel_fd_set)))
|
||||||
|
|
||||||
#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)*/
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue