• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2023 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #ifndef HDF_SYSCALL_ADAPTER_H
10 #define HDF_SYSCALL_ADAPTER_H
11 
12 #include "hdf_dlist.h"
13 #include "hdf_io_service_if.h"
14 #include "osal_mutex.h"
15 #include "osal_thread.h"
16 
17 struct HdfSyscallAdapter;
18 
19 enum HdfDevListenerThreadStatus {
20     LISTENER_UNINITED = 0,
21     LISTENER_INITED,
22     LISTENER_EXITED,
23     LISTENER_STARTED,
24     LISTENER_RUNNING,
25     LISTENER_WAITING,
26 };
27 
28 struct HdfDevListenerThread {
29     struct OsalMutex mutex;
30     struct OsalThread thread;
31     struct DListHead *adapterListPtr;
32     struct HdfSyscallAdapter *adapter;
33     struct pollfd *pfds;
34     uint16_t pfdSize;
35     bool pollChanged;
36     bool shouldStop;
37     struct DListHead *listenerListPtr;
38     uint8_t status;
39     int policy;
40 };
41 
42 struct HdfSyscallAdapter {
43     struct HdfIoService super;
44     struct OsalMutex mutex;
45     struct DListHead listenerList;
46     int fd;
47     struct DListHead listNode;
48     struct HdfDevListenerThread *thread;
49     struct HdfSyscallAdapterGroup *group;
50 };
51 
52 struct HdfSyscallAdapterGroup {
53     struct HdfIoServiceGroup serviceGroup;
54     struct OsalMutex mutex;
55     struct DListHead adapterList;
56     struct HdfDevListenerThread *thread;
57     struct DListHead listenerList;
58 };
59 
60 #endif /* HDF_SYSCALL_ADAPTER_H */
61