Branch data Line data Source code
1 : : #ifndef __CR_FDSET_H__
2 : : #define __CR_FDSET_H__
3 : :
4 : : #include "image-desc.h"
5 : : #include "bug.h"
6 : :
7 : : struct cr_fdset {
8 : : int fd_off;
9 : : int fd_nr;
10 : : int *_fds;
11 : : };
12 : :
13 : 13117 : static inline int fdset_fd(const struct cr_fdset *fdset, int type)
14 : : {
15 : : int idx;
16 : :
17 : 13117 : idx = type - fdset->fd_off;
18 [ - + ]: 13117 : BUG_ON(idx > fdset->fd_nr);
19 : :
20 : 13117 : return fdset->_fds[idx];
21 : : }
22 : :
23 : : extern struct cr_fdset *glob_fdset;
24 : :
25 : : extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
26 : :
27 : : extern struct cr_fdset *cr_task_fdset_open(int pid, int mode);
28 : : extern struct cr_fdset *cr_fdset_open_range(int pid, int from, int to,
29 : : unsigned long flags);
30 : : #define cr_fdset_open(pid, type, flags) cr_fdset_open_range(pid, \
31 : : _CR_FD_##type##_FROM, _CR_FD_##type##_TO, flags)
32 : : extern struct cr_fdset *cr_glob_fdset_open(int mode);
33 : :
34 : : extern void close_cr_fdset(struct cr_fdset **cr_fdset);
35 : :
36 : : #endif /* __CR_FDSET_H__ */
|