• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __UEVENTD_READ_CFG_H
17 #define __UEVENTD_READ_CFG_H
18 #include <ctype.h>
19 #include <string.h>
20 #include <stdlib.h>
21 #include <unistd.h>
22 #include <errno.h>
23 #include <fcntl.h>
24 #include <sys/stat.h>
25 #include "list.h"
26 
27 struct DeviceUdevConf {
28     const char *name;
29     mode_t mode;
30     uid_t uid;
31     gid_t gid;
32     const char *parameter;
33     int action;
34     struct ListNode list;
35     struct ListNode paramNode;
36 };
37 
38 struct SysUdevConf {
39     const char *sysPath;
40     const char *attr;
41     mode_t mode;
42     uid_t uid;
43     gid_t gid;
44     struct ListNode list;
45 };
46 
47 struct FirmwareUdevConf {
48     const char *fmPath;
49     struct ListNode list;
50 };
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 void ParseUeventdConfigFile(const char *file);
56 void GetDeviceNodePermissions(const char *devNode, uid_t *uid, gid_t *gid, mode_t *mode);
57 void ChangeSysAttributePermissions(const char *sysPath);
58 int ParseUeventConfig(char *buffer);
59 struct DeviceUdevConf *GetDeviceUdevConfByDevNode(const char *devNode);
60 #ifdef __cplusplus
61 }
62 #endif
63 #endif /* __UEVENTD_READ_CFG_H */
64