mirror of
https://gitee.com/openharmony/filemanagement_storage_service
synced 2025-02-18 22:08:48 +00:00
add storage manager code
Signed-off-by: 张文迪 <zhangwendi3@huawei.com>
This commit is contained in:
parent
2327d9c92c
commit
a628362de2
402
LICENSE
402
LICENSE
@ -1,201 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
132
OAT.xml
132
OAT.xml
@ -1,66 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Notes:
|
||||
This is project config file for OpenHarmony OSS Audit Tool, if you have any questions or concerns, please email chenyaxun.
|
||||
-->
|
||||
<!-- OAT(OSS Audit Tool) configuration guide:
|
||||
basedir: Root dir, the basedir + project path is the real source file location.
|
||||
licensefile:
|
||||
1.If the project don't have "LICENSE" in root dir, please define all the license files in this project in , OAT will check license files according to this rule.
|
||||
|
||||
tasklist(only for batch mode):
|
||||
1. task: Define oat check thread, each task will start a new thread.
|
||||
2. task name: Only an name, no practical effect.
|
||||
3. task policy: Default policy for projects under this task, this field is required and the specified policy must defined in policylist.
|
||||
4. task filter: Default filefilter for projects under this task, this field is required and the specified filefilter must defined in filefilterlist.
|
||||
5. task project: Projects to be checked, the path field define the source root dir of the project.
|
||||
|
||||
|
||||
policyList:
|
||||
1. policy: All policyitems will be merged to default OAT.xml rules, the name of policy doesn't affect OAT check process.
|
||||
2. policyitem: The fields type, name, path, desc is required, and the fields rule, group, filefilter is optional,the default value is:
|
||||
<policyitem type="" name="" path="" desc="" rule="may" group="defaultGroup" filefilter="defaultPolicyFilter"/>
|
||||
3. policyitem type:
|
||||
"compatibility" is used to check license compatibility in the specified path;
|
||||
"license" is used to check source license header in the specified path;
|
||||
"copyright" is used to check source copyright header in the specified path;
|
||||
"import" is used to check source dependency in the specified path, such as import ... ,include ...
|
||||
"filetype" is used to check file type in the specified path, supported file types: archive, binary
|
||||
"filename" is used to check whether the specified file exists in the specified path(support projectroot in default OAT.xml), supported file names: LICENSE, README, README.OpenSource
|
||||
|
||||
4. policyitem name: This field is used for define the license, copyright, "*" means match all, the "!" prefix means could not match this value. For example, "!GPL" means can not use GPL license.
|
||||
5. policyitem path: This field is used for define the source file scope to apply this policyitem, the "!" prefix means exclude the files. For example, "!.*/lib/.*" means files in lib dir will be exclude while process this policyitem.
|
||||
6. policyitem rule and group: These two fields are used together to merge policy results. "may" policyitems in the same group means any one in this group passed, the result will be passed.
|
||||
7. policyitem filefilter: Used to bind filefilter which define filter rules.
|
||||
8. filefilter: Filter rules, the type filename is used to filter file name, the type filepath is used to filter file path.
|
||||
|
||||
Note:If the text contains special characters, please escape them according to the following rules:
|
||||
" == >
|
||||
& == >
|
||||
' == >
|
||||
< == >
|
||||
> == >
|
||||
-->
|
||||
<configuration>
|
||||
<oatconfig>
|
||||
<licensefile>LICENSE</licensefile>
|
||||
<filefilterlist>
|
||||
<filefilter name="defaultFilter" desc="Files that do not need to be scanned">
|
||||
<filteritem type="filename" name="*.jpg" desc="jpg no need to add policy"/>
|
||||
</filefilter>
|
||||
</filefilterlist>
|
||||
</oatconfig>
|
||||
</configuration>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Notes:
|
||||
This is project config file for OpenHarmony OSS Audit Tool, if you have any questions or concerns, please email chenyaxun.
|
||||
-->
|
||||
<!-- OAT(OSS Audit Tool) configuration guide:
|
||||
basedir: Root dir, the basedir + project path is the real source file location.
|
||||
licensefile:
|
||||
1.If the project don't have "LICENSE" in root dir, please define all the license files in this project in , OAT will check license files according to this rule.
|
||||
|
||||
tasklist(only for batch mode):
|
||||
1. task: Define oat check thread, each task will start a new thread.
|
||||
2. task name: Only an name, no practical effect.
|
||||
3. task policy: Default policy for projects under this task, this field is required and the specified policy must defined in policylist.
|
||||
4. task filter: Default filefilter for projects under this task, this field is required and the specified filefilter must defined in filefilterlist.
|
||||
5. task project: Projects to be checked, the path field define the source root dir of the project.
|
||||
|
||||
|
||||
policyList:
|
||||
1. policy: All policyitems will be merged to default OAT.xml rules, the name of policy doesn't affect OAT check process.
|
||||
2. policyitem: The fields type, name, path, desc is required, and the fields rule, group, filefilter is optional,the default value is:
|
||||
<policyitem type="" name="" path="" desc="" rule="may" group="defaultGroup" filefilter="defaultPolicyFilter"/>
|
||||
3. policyitem type:
|
||||
"compatibility" is used to check license compatibility in the specified path;
|
||||
"license" is used to check source license header in the specified path;
|
||||
"copyright" is used to check source copyright header in the specified path;
|
||||
"import" is used to check source dependency in the specified path, such as import ... ,include ...
|
||||
"filetype" is used to check file type in the specified path, supported file types: archive, binary
|
||||
"filename" is used to check whether the specified file exists in the specified path(support projectroot in default OAT.xml), supported file names: LICENSE, README, README.OpenSource
|
||||
|
||||
4. policyitem name: This field is used for define the license, copyright, "*" means match all, the "!" prefix means could not match this value. For example, "!GPL" means can not use GPL license.
|
||||
5. policyitem path: This field is used for define the source file scope to apply this policyitem, the "!" prefix means exclude the files. For example, "!.*/lib/.*" means files in lib dir will be exclude while process this policyitem.
|
||||
6. policyitem rule and group: These two fields are used together to merge policy results. "may" policyitems in the same group means any one in this group passed, the result will be passed.
|
||||
7. policyitem filefilter: Used to bind filefilter which define filter rules.
|
||||
8. filefilter: Filter rules, the type filename is used to filter file name, the type filepath is used to filter file path.
|
||||
|
||||
Note:If the text contains special characters, please escape them according to the following rules:
|
||||
" == >
|
||||
& == >
|
||||
' == >
|
||||
< == >
|
||||
> == >
|
||||
-->
|
||||
<configuration>
|
||||
<oatconfig>
|
||||
<licensefile>LICENSE</licensefile>
|
||||
<filefilterlist>
|
||||
<filefilter name="defaultFilter" desc="Files that do not need to be scanned">
|
||||
<filteritem type="filename" name="*.jpg" desc="jpg no need to add policy"/>
|
||||
</filefilter>
|
||||
</filefilterlist>
|
||||
</oatconfig>
|
||||
</configuration>
|
||||
|
48
interfaces/innerkits/storage_manager/native/BUILD.gn
Normal file
48
interfaces/innerkits/storage_manager/native/BUILD.gn
Normal file
@ -0,0 +1,48 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import("//build/ohos.gni")
|
||||
import("//build/ohos_var.gni")
|
||||
|
||||
config("public_config") {
|
||||
include_dirs = [ "." ]
|
||||
}
|
||||
|
||||
config("private_config") {
|
||||
include_dirs = [
|
||||
"../../../../services/storage_manager/include",
|
||||
"../../../../services/storage_daemon/include"
|
||||
]
|
||||
}
|
||||
|
||||
ohos_shared_library("storage_manager_sa_proxy") {
|
||||
sources = [
|
||||
"../../../../services/storage_manager/ipc/src/storage_manager_proxy.cpp",
|
||||
"../../../../services/storage_daemon/ipc/src/storage_daemon_proxy.cpp"
|
||||
]
|
||||
|
||||
configs = [ ":private_config" ]
|
||||
public_configs = [ ":public_config" ]
|
||||
|
||||
external_deps = [
|
||||
"ipc:ipc_core",
|
||||
"safwk:system_ability_fwk",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
]
|
||||
public_deps = [
|
||||
"//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
|
||||
part_name = "storage_standard"
|
||||
subsystem_name = "storage_manager"
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_ISTORAGE_MANAGER_H
|
||||
#define OHOS_STORAGE_MANAGER_ISTORAGE_MANAGER_H
|
||||
|
||||
#include "iremote_broker.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
class IStorageManager : public IRemoteBroker {
|
||||
public:
|
||||
virtual int32_t OnUserCreate(int32_t UserId) = 0;
|
||||
virtual int32_t OnUserDelete(int32_t UserId) = 0;
|
||||
|
||||
enum {
|
||||
ON_USER_CREATE = 1,
|
||||
ON_USER_DELETE
|
||||
};
|
||||
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.StorageManager.IStorageManager");
|
||||
};
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
||||
#endif // OHOS_STORAGE_MANAGER_ISTORAGER_MANAGER_H
|
16
ohos.build
16
ohos.build
@ -4,10 +4,24 @@
|
||||
"storage_standard": {
|
||||
"module_list": [
|
||||
"//foundation/storage_manager/services/storage_daemon:storage_daemon",
|
||||
"//foundation/storage_manager/services/storage_daemon:storage_daemon_cfg"
|
||||
"//foundation/storage_manager/services/storage_daemon:storage_daemon_cfg",
|
||||
"//foundation/storage_manager/services/storage_manager/sa_profile:storage_manager_sa_profile",
|
||||
"//foundation/storage_manager/services/storage_manager/sa_profile:storage_manager.cfg",
|
||||
"//foundation/storage_manager/services/storage_manager:storage_manager"
|
||||
],
|
||||
"test_list": [
|
||||
"//foundation/storage_manager/services/storage_daemon/user/test:user_unit_test"
|
||||
],
|
||||
"inner_kits": [
|
||||
{
|
||||
"name": "//foundation/storage_manager/interfaces/innerkits/storage_manager/native:storage_manager_sa_proxy",
|
||||
"header": {
|
||||
"header_files": [
|
||||
"istorage_manager.h"
|
||||
],
|
||||
"header_base": "//foundation/storage_manager/interfaces/innerkits/storage_manager/native"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
54
services/storage_manager/BUILD.gn
Normal file
54
services/storage_manager/BUILD.gn
Normal file
@ -0,0 +1,54 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos.gni")
|
||||
import("//build/ohos/sa_profile/sa_profile.gni")
|
||||
|
||||
config("storage_manager_config") {
|
||||
include_dirs = [
|
||||
"include",
|
||||
"../../interfaces/innerkits/storage_manager/native",
|
||||
"//utils/system/safwk/native/include",
|
||||
"//utils/native/base/include",
|
||||
"../storage_daemon/include"
|
||||
]
|
||||
}
|
||||
|
||||
ohos_shared_library("storage_manager") {
|
||||
sources = [
|
||||
"ipc/src/storage_manager.cpp",
|
||||
"ipc/src/storage_manager_stub.cpp",
|
||||
|
||||
|
||||
"user/src/multi_user_manager_service.cpp",
|
||||
"storage_daemon_communication/src/storage_daemon_communication.cpp",
|
||||
]
|
||||
|
||||
configs = [ ":storage_manager_config"]
|
||||
|
||||
deps = [
|
||||
"../../interfaces/innerkits/storage_manager/native:storage_manager_sa_proxy",
|
||||
"//utils/native/base:utils"
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"safwk:system_ability_fwk",
|
||||
"ipc:ipc_core",
|
||||
"samgr_standard:samgr_proxy",
|
||||
]
|
||||
|
||||
subsystem_name = "storage_manager"
|
||||
part_name = "storage_standard"
|
||||
install_enable = true
|
||||
}
|
28
services/storage_manager/include/disk/disk.h
Normal file
28
services/storage_manager/include/disk/disk.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_DISK_H
|
||||
#define OHOS_STORAGE_MANAGER_DISK_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
class Disk {
|
||||
|
||||
};
|
||||
} // STORAGE_MANAGER
|
||||
} // OHOS
|
||||
|
||||
#endif // OHOS_STORAGE_MANAGER_DISK_H
|
28
services/storage_manager/include/disk/disk_manager_service.h
Normal file
28
services/storage_manager/include/disk/disk_manager_service.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_DISK_MANAGER_SERVICE_H
|
||||
#define OHOS_STORAGE_MANAGER_DISK_MANAGER_SERVICE_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
class DiskManagerService {
|
||||
|
||||
};
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
||||
#endif // OHOS_STORAGE_MANAGER_DISK_MANAGER_SERVICE_H
|
45
services/storage_manager/include/ipc/storage_manager.h
Normal file
45
services/storage_manager/include/ipc/storage_manager.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_STORAGE_MANAGER_H
|
||||
#define OHOS_STORAGE_MANAGER_STORAGE_MANAGER_H
|
||||
|
||||
#include "system_ability.h"
|
||||
#include "storage_manager_stub.h"
|
||||
#include "istorage_manager.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
class StorageManager : public SystemAbility, public StorageManagerStub {
|
||||
DECLARE_SYSTEM_ABILITY(StorageManager)
|
||||
public:
|
||||
StorageManager(int32_t saID, bool runOnCreate = true) : SystemAbility(saID, runOnCreate){};
|
||||
~StorageManager() = default;
|
||||
|
||||
void OnStart() override;
|
||||
void OnStop() override;
|
||||
|
||||
int32_t OnUserCreate(int32_t userId) override;
|
||||
int32_t OnUserDelete(int32_t userId) override;
|
||||
private:
|
||||
StorageManager();
|
||||
static sptr<StorageManager> instance_;
|
||||
static std::mutex instanceLock_;
|
||||
};
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
||||
#endif // OHOS_STORAGE_MANAGER_STORAGE_MANAGER_H
|
40
services/storage_manager/include/ipc/storage_manager_proxy.h
Normal file
40
services/storage_manager/include/ipc/storage_manager_proxy.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_STORAGE_MANAGER_PROXY_H
|
||||
#define OHOS_STORAGE_MANAGER_STORAGE_MANAGER_PROXY_H
|
||||
|
||||
#include "iremote_proxy.h"
|
||||
#include "istorage_manager.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
class StorageManagerProxy : public IRemoteProxy<IStorageManager> {
|
||||
public:
|
||||
explicit StorageManagerProxy(const sptr<IRemoteObject>& impl)
|
||||
: IRemoteProxy<IStorageManager>(impl) {}
|
||||
~StorageManagerProxy() override{}
|
||||
|
||||
int32_t OnUserCreate(int32_t UserId) override;
|
||||
int32_t OnUserDelete(int32_t UserId) override;
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<StorageManagerProxy> delegator_;
|
||||
};
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
||||
#endif // OHOS_STORAGE_MANAGER_STORAGE_MANAGER_PROXY_H
|
36
services/storage_manager/include/ipc/storage_manager_stub.h
Normal file
36
services/storage_manager/include/ipc/storage_manager_stub.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_STORAGE_MANAGER_STUB_H
|
||||
#define OHOS_STORAGE_MANAGER_STORAGE_MANAGER_STUB_H
|
||||
|
||||
#include "iremote_stub.h"
|
||||
#include "istorage_manager.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
class StorageManagerStub : public IRemoteStub<IStorageManager> {
|
||||
public:
|
||||
int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
int32_t HandleOnUserCreate(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleOnUserDelete(MessageParcel &data, MessageParcel &reply);
|
||||
};
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
||||
#endif // OHOS_STORAGE_MANAGER_STORAGE_MANAGER_STUB_H
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_STORAGE_TOTAL_STATUS_SERVICE_H
|
||||
#define OHOS_STORAGE_MANAGER_STORAGE_TOTAL_STATUS_SERVICE_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
class StorageTotalStatusService {
|
||||
|
||||
};
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
||||
#endif // OHOS_STORAGE_MANAGER_STORAGE_TOTAL_STATUS_SERVICE_H
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_STORAGE_DAEMON_COMMUNICATION_H
|
||||
#define OHOS_STORAGE_MANAGER_STORAGE_DAEMON_COMMUNICATION_H
|
||||
|
||||
#include <singleton.h>
|
||||
#include <nocopyable.h>
|
||||
#include "ipc/istorage_daemon.h"
|
||||
#include "system_ability.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
class StorageDaemonCommunication : public NoCopyable {
|
||||
DECLARE_DELAYED_SINGLETON(StorageDaemonCommunication);
|
||||
|
||||
public:
|
||||
int32_t Connect();
|
||||
|
||||
int32_t OnUserCreate(int32_t userId);
|
||||
int32_t OnUserDelete(int32_t userId);
|
||||
|
||||
private:
|
||||
sptr<OHOS::StorageDaemon::IStorageDaemon> storageDaemon_;
|
||||
};
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
||||
#endif
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_MULTI_USER_MANAGER_SERVICE_H
|
||||
#define OHOS_STORAGE_MANAGER_MULTI_USER_MANAGER_SERVICE_H
|
||||
|
||||
#include <singleton.h>
|
||||
#include <nocopyable.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
using namespace std;
|
||||
|
||||
class MultiUserManagerService final : public NoCopyable {
|
||||
DECLARE_DELAYED_SINGLETON(MultiUserManagerService);
|
||||
public:
|
||||
int32_t OnUserCreate(int32_t userId) const;
|
||||
int32_t OnUserDelete(int32_t userId) const;
|
||||
};
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
||||
#endif // OHOS_STORAGE_MANAGER_MULTI_USER_MANAGER_SERVICE_H
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef STORAGE_MANAGER_UTILS_ERRNO_H
|
||||
#define STORAGE_MANAGER_UTILS_ERRNO_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
constexpr int32_t E_OK = 0;
|
||||
constexpr int32_t E_ERR = -1;
|
||||
|
||||
constexpr int32_t E_PERMISSION_DENIED = 1; // no permission
|
||||
constexpr int32_t E_IPC_ERROR = 2; // ipc error
|
||||
constexpr int32_t E_EXIST = 3; // exist
|
||||
constexpr int32_t E_WRONG_TYPE = 4; // wrong file type
|
||||
constexpr int32_t E_USER_STATE = 5; // wrong user state
|
||||
constexpr int32_t E_NON_EXIST = 6; // no such user
|
||||
}
|
||||
}
|
||||
|
||||
#endif // STORAGE_MANAGER_UTILS_ERRNO_H
|
41
services/storage_manager/include/utils/storage_manager_log.h
Normal file
41
services/storage_manager/include/utils/storage_manager_log.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef STORAGE_MANAGER_UTILS_LOG_H
|
||||
#define STORAGE_MANAGER_UTILS_LOG_H
|
||||
#include "hilog/log.h"
|
||||
|
||||
|
||||
#ifndef LOG_DOMAIN
|
||||
#define LOG_DOMAIN 0 // TODO tmp value 0, need request unique LOG_DOMAIN
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_DOMAIN, "StorageManager" };
|
||||
|
||||
#define PRINT_LOG(Level, fmt, ...) \
|
||||
HiviewDFX::HiLog::Level(LOG_LABEL, "[%{public}s:%{public}d] " fmt, \
|
||||
__FUNCTION__, __LINE__, ##__VA_ARGS__)
|
||||
|
||||
#define LOGD(fmt, ...) PRINT_LOG(Debug, fmt, ##__VA_ARGS__)
|
||||
#define LOGI(fmt, ...) PRINT_LOG(Info, fmt, ##__VA_ARGS__)
|
||||
#define LOGW(fmt, ...) PRINT_LOG(Warn, fmt, ##__VA_ARGS__)
|
||||
#define LOGE(fmt, ...) PRINT_LOG(Error, fmt, ##__VA_ARGS__)
|
||||
#define LOGF(fmt, ...) PRINT_LOG(Fatal, fmt, ##__VA_ARGS__)
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
||||
#endif // STORAGE_Manager_UTILS_LOG_H
|
28
services/storage_manager/include/volume/notification.h
Normal file
28
services/storage_manager/include/volume/notification.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_NOTIFICATION_H
|
||||
#define OHOS_STORAGE_MANAGER_NOTIFICATION_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
class Notification {
|
||||
|
||||
};
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
||||
#endif // OHOS_STORAGE_MANAGER_NOTIFICATION_H
|
28
services/storage_manager/include/volume/volume_core.h
Normal file
28
services/storage_manager/include/volume/volume_core.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_VOLUME_CORE_H
|
||||
#define OHOS_STORAGE_MANAGER_VOLUME_CORE_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
class VolumeCore {
|
||||
|
||||
};
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
||||
#endif // OHOS_STORAGE_MANAGER_VOLUME_CORE_H
|
30
services/storage_manager/include/volume/volume_external.h
Normal file
30
services/storage_manager/include/volume/volume_external.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_VOLUME_EXTERNAL_H
|
||||
#define OHOS_STORAGE_MANAGER_VLOUME_EXTERNAL_H
|
||||
|
||||
#include "volume_core.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
class VolumeExternal : public VolumeCore {
|
||||
|
||||
};
|
||||
} // OHOS
|
||||
} // StorageManager
|
||||
|
||||
#endif // OHOS_STORAGE_MANAGER_VOLUME_EXTERNAL_H
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_STORAGE_MANAGER_VOLUME_MANAGER_SERVICE_H
|
||||
#define OHOS_STORAGE_MANAGER_VOLUME_MANAGER_SERVICE_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
class VolumeManagerService {
|
||||
|
||||
};
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
||||
#endif // OHOS_STORAGE_MANAGER_VOLUME_MANAGER_SERVICE_H
|
55
services/storage_manager/ipc/src/storage_manager.cpp
Normal file
55
services/storage_manager/ipc/src/storage_manager.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ipc/storage_manager.h"
|
||||
#include "utils/storage_manager_log.h"
|
||||
#include "system_ability_definition.h"
|
||||
#include "utils/storage_manager_errno.h"
|
||||
#include "user/multi_user_manager_service.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
REGISTER_SYSTEM_ABILITY_BY_ID(StorageManager, STORAGE_MANAGER_SA_ID , true);
|
||||
|
||||
void StorageManager::OnStart()
|
||||
{
|
||||
LOGI("Begin");
|
||||
bool res = SystemAbility::Publish(this);
|
||||
LOGI("End, res = %{public}d", res);
|
||||
}
|
||||
|
||||
void StorageManager::OnStop()
|
||||
{
|
||||
LOGI("Done");
|
||||
}
|
||||
|
||||
int32_t StorageManager::OnUserCreate(int32_t userId)
|
||||
{
|
||||
LOGI("StorageManager::OnUserCreate start, userId: %{public}d", userId);
|
||||
std::shared_ptr<MultiUserManagerService> userManager = DelayedSingleton<MultiUserManagerService>::GetInstance();
|
||||
int32_t err = userManager->OnUserCreate(userId);
|
||||
return err;
|
||||
}
|
||||
|
||||
int32_t StorageManager::OnUserDelete(int32_t userId)
|
||||
{
|
||||
LOGI("StorageManger::OnUserDelete start, userId: %{public}d", userId);
|
||||
std::shared_ptr<MultiUserManagerService> userManager = DelayedSingleton<MultiUserManagerService>::GetInstance();
|
||||
int32_t err = userManager->OnUserDelete(userId);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
}
|
63
services/storage_manager/ipc/src/storage_manager_proxy.cpp
Normal file
63
services/storage_manager/ipc/src/storage_manager_proxy.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ipc/storage_manager_proxy.h"
|
||||
#include "utils/storage_manager_errno.h"
|
||||
#include "utils/storage_manager_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
int32_t StorageManagerProxy::OnUserCreate(int32_t userId)
|
||||
{
|
||||
LOGI("StorageManagerProxy::OnUserCreate, userId:%{public}d", userId);
|
||||
MessageParcel data, reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
|
||||
return E_IPC_ERROR;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(userId)) {
|
||||
return E_IPC_ERROR;
|
||||
}
|
||||
int err = Remote()->SendRequest(ON_USER_CREATE, data, reply, option);
|
||||
if (err != E_OK) {
|
||||
return E_IPC_ERROR;
|
||||
}
|
||||
|
||||
return reply.ReadUint32();
|
||||
}
|
||||
|
||||
int32_t StorageManagerProxy::OnUserDelete(int32_t userId)
|
||||
{
|
||||
LOGI("StorageManagerProxy::OnUserDelete, userId:%{public}d", userId);
|
||||
MessageParcel data, reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
|
||||
return E_IPC_ERROR;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(userId)) {
|
||||
return E_IPC_ERROR;
|
||||
}
|
||||
int err = Remote()->SendRequest(ON_USER_DELETE, data, reply, option);
|
||||
if (err != E_OK) {
|
||||
return E_IPC_ERROR;
|
||||
}
|
||||
return reply.ReadUint32();
|
||||
}
|
||||
} // StorageManager
|
||||
} // OHOS
|
||||
|
70
services/storage_manager/ipc/src/storage_manager_stub.cpp
Normal file
70
services/storage_manager/ipc/src/storage_manager_stub.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ipc/storage_manager_stub.h"
|
||||
#include "utils/storage_manager_errno.h"
|
||||
#include "utils/storage_manager_log.h"
|
||||
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
int32_t StorageManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
auto remoteDescriptor = data.ReadInterfaceToken();
|
||||
if (GetDescriptor() != remoteDescriptor) {
|
||||
return E_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
int err= 0;
|
||||
switch (code) {
|
||||
case ON_USER_CREATE:
|
||||
HandleOnUserCreate(data, reply);
|
||||
break;
|
||||
case ON_USER_DELETE:
|
||||
HandleOnUserDelete(data, reply);
|
||||
break;
|
||||
default: {
|
||||
LOGI(" use IPCObjectStub default OnRemoteRequest");
|
||||
err = IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int32_t StorageManagerStub::HandleOnUserCreate(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
int32_t userId = data.ReadInt32();
|
||||
LOGI("StorageManagerStub::HandleOnUserCreate, userId:%{public}d", userId);
|
||||
int err = OnUserCreate(userId);
|
||||
if (!reply.WriteUint32(err)) {
|
||||
return E_IPC_ERROR;
|
||||
}
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
int32_t StorageManagerStub::HandleOnUserDelete(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
int32_t userId = data.ReadInt32();
|
||||
LOGI("StorageManagerStub::HandleOnUserDelete, userId:%{public}d", userId);
|
||||
int err = OnUserDelete(userId);
|
||||
if (!reply.WriteUint32(err)) {
|
||||
return E_IPC_ERROR;
|
||||
}
|
||||
return E_OK;
|
||||
}
|
||||
} // StorageManager
|
||||
} // OHOS
|
27
services/storage_manager/sa_profile/5200.xml
Normal file
27
services/storage_manager/sa_profile/5200.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
-->
|
||||
<info>
|
||||
<process>storage_manager</process>
|
||||
<systemability> <!-- Declare a sytem ability and its profile -->
|
||||
<name>5200</name> <!-- Declare the name of system ability -->
|
||||
<libpath>system/lib/libstorage_manager.z.so</libpath> <!-- Declare the path of .so file which includes the system ability; Note: 1 .so file can have 1 to N system abilities. -->
|
||||
<!--<depend></depend> --> <!-- Declare the name of system abilities which the system ability depends on, using ";" as separator among names. If there are dependencies, it needs to check if all those dependencies are avliable in service manager before starting the system ability. -->
|
||||
<!--<depend-time-out></depend-time-out> --> <!-- Check all dependencies are avaliable before the timeout period ended. The MAX_DEPENDENCY_TIMEOUT is 60s. -->
|
||||
<run-on-create>true</run-on-create> <!-- "true" means the system ability would start imediately, "false" means the system ability would start on demand. -->
|
||||
<distributed>false</distributed> <!-- "true" means the system ability supports distributed scheduling while "false" is not. -->
|
||||
<dump-level>1</dump-level> <!-- Declare the dump level. 1-high; 2-media; 3-low -->
|
||||
</systemability>
|
||||
</info>
|
27
services/storage_manager/sa_profile/BUILD.gn
Normal file
27
services/storage_manager/sa_profile/BUILD.gn
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright (C) 2021 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import("//build/ohos.gni")
|
||||
import("//build/ohos/sa_profile/sa_profile.gni")
|
||||
|
||||
ohos_sa_profile("storage_manager_sa_profile") {
|
||||
sources = [ "5200.xml" ]
|
||||
part_name = "storage_standard"
|
||||
}
|
||||
|
||||
ohos_prebuilt_etc("storage_manager.cfg") {
|
||||
source = "../storage_manager.cfg"
|
||||
relative_install_dir = "init"
|
||||
part_name = "storage_standard"
|
||||
subsystem_name = "storage_manager"
|
||||
}
|
||||
|
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include <system_ability_definition.h>
|
||||
#include <iservice_registry.h>
|
||||
#include "storage_daemon_communication/storage_daemon_communication.h"
|
||||
#include "utils/storage_manager_log.h"
|
||||
#include "utils/storage_manager_errno.h"
|
||||
#include "../../../storage_daemon/include/ipc/istorage_daemon.h"
|
||||
#include "../../../storage_daemon/include/ipc/storage_daemon.h"
|
||||
#include "../../../storage_daemon/include/ipc/storage_daemon_proxy.h"
|
||||
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
|
||||
StorageDaemonCommunication::StorageDaemonCommunication()
|
||||
{
|
||||
LOGI("DEBUG StorageDaemonCommunication constructer");
|
||||
storageDaemon_ = nullptr;
|
||||
}
|
||||
|
||||
StorageDaemonCommunication::~StorageDaemonCommunication()
|
||||
{
|
||||
LOGI("DEBUG ~StorageDaemonCommunication destructer ~");
|
||||
}
|
||||
|
||||
int32_t StorageDaemonCommunication::Connect()
|
||||
{
|
||||
if (storageDaemon_ != nullptr) {
|
||||
return E_OK;
|
||||
}
|
||||
int32_t err = 0;
|
||||
LOGI("StorageDaemonCommunication::Connect start");
|
||||
if (storageDaemon_ == nullptr) {
|
||||
auto sam = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (sam == nullptr) {
|
||||
LOGE("StorageDaemonCommunication::Connect samgr == nullptr");
|
||||
return E_IPC_ERROR;
|
||||
}
|
||||
auto object = sam->GetSystemAbility(STORAGE_DAEMON_SA_ID);
|
||||
if (object == nullptr) {
|
||||
LOGE("StorageDaemonCommunication::Connect object == nullptr");
|
||||
return E_IPC_ERROR;
|
||||
}
|
||||
storageDaemon_ = iface_cast<OHOS::StorageDaemon::IStorageDaemon>(object);
|
||||
if (storageDaemon_ == nullptr) {
|
||||
LOGE("StorageDaemonCommunication::Connect service == nullptr");
|
||||
return E_IPC_ERROR;
|
||||
}
|
||||
}
|
||||
LOGI("StorageDaemonCommunication::Connect end");
|
||||
return err;
|
||||
}
|
||||
|
||||
int32_t StorageDaemonCommunication::OnUserCreate(int32_t userId)
|
||||
{
|
||||
LOGI("StorageDaemonCommunication::OnUserCreate start");
|
||||
|
||||
if (Connect() != E_OK) {
|
||||
LOGE("StorageDaemonCommunication::OnUserCreate failed");
|
||||
return E_IPC_ERROR;
|
||||
} else {
|
||||
return storageDaemon_->AddUser(userId);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t StorageDaemonCommunication::OnUserDelete(int32_t userId)
|
||||
{
|
||||
LOGI("StorageDaemonCommunication::OnUserDelete start");
|
||||
if (Connect() != E_OK) {
|
||||
LOGE("StorageDaemonCommunication::OnUserDelete failed");
|
||||
return E_IPC_ERROR;
|
||||
} else {
|
||||
return storageDaemon_->RemoveUser(userId);
|
||||
}
|
||||
}
|
||||
} // StorageManager
|
||||
} // OHOS
|
14
services/storage_manager/storage_manager.cfg
Normal file
14
services/storage_manager/storage_manager.cfg
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"jobs": [{
|
||||
"name": "post-fs-data",
|
||||
"cmds": [
|
||||
"start storage_manager"
|
||||
]
|
||||
}],
|
||||
"services": [{
|
||||
"name": "storage_manager",
|
||||
"path": ["/system/bin/sa_main", "/system/profile/storage_manager.xml"],
|
||||
"uid": "system",
|
||||
"gid": ["system","shell"]
|
||||
}]
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "user/multi_user_manager_service.h"
|
||||
#include "storage_daemon_communication/storage_daemon_communication.h"
|
||||
#include "utils/storage_manager_log.h"
|
||||
#include "utils/storage_manager_errno.h"
|
||||
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
using namespace std;
|
||||
|
||||
MultiUserManagerService::MultiUserManagerService()
|
||||
{
|
||||
LOGI("DEBUG MultiUserManagerService constructer");
|
||||
}
|
||||
|
||||
MultiUserManagerService::~MultiUserManagerService()
|
||||
{
|
||||
LOGI("DEBUG ~MultiUserManagerService destructer ~");
|
||||
}
|
||||
|
||||
int32_t MultiUserManagerService::OnUserCreate(int32_t userId) const
|
||||
{
|
||||
LOGI("MultiUserManagerService_create, userId:%{public}d", userId);
|
||||
std::shared_ptr<StorageDaemonCommunication> sdCommunication = DelayedSingleton<StorageDaemonCommunication>::GetInstance();
|
||||
int32_t err = sdCommunication->OnUserCreate(userId);
|
||||
return err;
|
||||
}
|
||||
|
||||
int32_t MultiUserManagerService::OnUserDelete(int32_t userId) const
|
||||
{
|
||||
LOGI("MultiUserManagerService_Delete, userId:%{public}d", userId);
|
||||
std::shared_ptr<StorageDaemonCommunication> sdCommunication = DelayedSingleton<StorageDaemonCommunication>::GetInstance();
|
||||
int32_t err = sdCommunication->OnUserDelete(userId);
|
||||
return err;
|
||||
}
|
||||
|
||||
} // StorageManager
|
||||
} // OHOS
|
Loading…
x
Reference in New Issue
Block a user