blob: c1ce976929efd5bc4392b5a59f5a519f48e79c9f [file] [log] [blame]
Tom Cherryed506f72017-05-25 15:58:59 -07001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _INIT_UEVENTD_PARSER_H
18#define _INIT_UEVENTD_PARSER_H
19
20#include <string>
21#include <vector>
22
23#include "devices.h"
24#include "init_parser.h"
25
26class SubsystemParser : public SectionParser {
27 public:
28 SubsystemParser(std::vector<Subsystem>* subsystems) : subsystems_(subsystems) {}
29 bool ParseSection(std::vector<std::string>&& args, const std::string& filename, int line,
30 std::string* err) override;
31 bool ParseLineSection(std::vector<std::string>&& args, int line, std::string* err) override;
32 void EndSection() override;
33
34 private:
35 bool ParseDevName(std::vector<std::string>&& args, std::string* err);
36 bool ParseDirName(std::vector<std::string>&& args, std::string* err);
37
38 Subsystem subsystem_;
39 std::vector<Subsystem>* subsystems_;
40};
41
42bool ParsePermissionsLine(std::vector<std::string>&& args, std::string* err,
43 std::vector<SysfsPermissions>* out_sysfs_permissions,
44 std::vector<Permissions>* out_dev_permissions);
45
46#endif