• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//foundation/filemanagement/storage_service/storage_service_aafwk.gni")
16
17## Install storage_daemon.cfg to /system/etc/init/storage_daemon.cfg {{{
18ohos_prebuilt_etc("storage_daemon_cfg") {
19  source = "storage_daemon.cfg"
20  relative_install_dir = "init"
21  part_name = "storage_service"
22  subsystem_name = "filemanagement"
23}
24
25## Install storage_daemon.cfg to /system/etc/init/storage_daemon.cfg }}}
26
27config("storage_daemon_config") {
28  include_dirs = [
29    "include",
30    "//third_party/bounds_checking_function/include",
31    "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include",
32    "../storage_manager/include",
33    "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk",
34    "//foundation/filemanagement/storage_service/interfaces/innerkits/storage_manager/native",
35    "//base/security/access_token/interfaces/innerkits/accesstoken/include",
36    "//foundation/filemanagement/storage_service/services/common/include",
37  ]
38}
39
40## Install config.txt to /system/etc/init/config.txt {{{
41ohos_prebuilt_etc("storage_daemon_disk_config") {
42  source = "config.txt"
43  relative_install_dir = "init"
44  part_name = "storage_service"
45  subsystem_name = "filemanagement"
46}
47
48declare_args() {
49  storage_service_user_file_sharing = true
50}
51
52ohos_executable("storage_daemon") {
53  sources = [
54    "../storage_manager/innerkits_impl/src/bundle_stats.cpp",
55    "../storage_manager/innerkits_impl/src/disk.cpp",
56    "../storage_manager/innerkits_impl/src/storage_stats.cpp",
57    "../storage_manager/innerkits_impl/src/volume_core.cpp",
58    "../storage_manager/innerkits_impl/src/volume_external.cpp",
59    "../storage_manager/ipc/src/storage_manager_proxy.cpp",
60    "disk/src/disk_config.cpp",
61    "disk/src/disk_info.cpp",
62    "disk/src/disk_manager.cpp",
63    "ipc/src/storage_daemon.cpp",
64    "ipc/src/storage_daemon_stub.cpp",
65    "ipc/src/storage_manager_client.cpp",
66    "main.cpp",
67    "netlink/src/netlink_data.cpp",
68    "netlink/src/netlink_handler.cpp",
69    "netlink/src/netlink_listener.cpp",
70    "netlink/src/netlink_manager.cpp",
71    "user/src/mount_manager.cpp",
72    "user/src/user_manager.cpp",
73    "volume/src/external_volume_info.cpp",
74    "volume/src/process.cpp",
75    "volume/src/volume_info.cpp",
76    "volume/src/volume_manager.cpp",
77  ]
78
79  defines = [
80    "STORAGE_LOG_TAG = \"StorageDaemon\"",
81    "LOG_DOMAIN = 0xD004301",
82  ]
83
84  if (storage_service_user_file_sharing) {
85    defines += [ "USER_FILE_SHARING" ]
86    sources += [
87      "file_sharing/src/acl.cpp",
88      "file_sharing/src/file_sharing.cpp",
89      "file_sharing/src/setacl.cpp",
90    ]
91  }
92
93  configs = [ ":storage_daemon_config" ]
94
95  deps = [
96    ":sdc",
97    ":storage_common_utils",
98    "crypto:libsdcrypto",
99    "libfscrypt:libfscryptutils",
100  ]
101
102  external_deps = [
103    "ability_base:base",
104    "ability_base:want",
105    "ability_base:zuri",
106    "access_token:libaccesstoken_sdk",
107    "app_file_service:fileshare_native",
108    "c_utils:utils",
109    "hiviewdfx_hilog_native:libhilog",
110    "init:libbegetutil",
111    "ipc:ipc_core",
112    "samgr:samgr_proxy",
113  ]
114
115  subsystem_name = "filemanagement"
116  part_name = "storage_service"
117  install_enable = true
118}
119
120config("sdc_config") {
121  include_dirs = [
122    "include",
123    "//foundation/filemanagement/storage_service/services/common/include",
124    "//commonlibrary/c_utils/base/include",
125    "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include",
126    "//utils/system/safwk/native/include",
127    "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include/",
128    "client/include",
129    "../../interfaces/innerkits/storage_manager/native",
130    "../storage_manager/include",
131    "//foundation/bundlemanager/bundle_framework/services/bundlemgr/include",
132    "//foundation/systemabilitymgr/safwk/interfaces/innerkits/safwk",
133  ]
134}
135
136ohos_executable("sdc") {
137  sources = [
138    "../storage_manager/client/storage_manager_client.cpp",
139    "../storage_manager/innerkits_impl/src/bundle_stats.cpp",
140    "../storage_manager/innerkits_impl/src/disk.cpp",
141    "../storage_manager/innerkits_impl/src/storage_stats.cpp",
142    "../storage_manager/innerkits_impl/src/volume_core.cpp",
143    "../storage_manager/innerkits_impl/src/volume_external.cpp",
144    "../storage_manager/ipc/src/storage_manager_proxy.cpp",
145    "client/storage_daemon_client.cpp",
146    "ipc/src/storage_daemon_proxy.cpp",
147    "sdc.cpp",
148  ]
149
150  defines = [
151    "STORAGE_LOG_TAG = \"StorageDaemon\"",
152    "LOG_DOMAIN = 0xD004301",
153  ]
154
155  configs = [ ":sdc_config" ]
156
157  deps = [
158    ":storage_common_utils",
159    "libfscrypt:libfscryptutils",
160  ]
161
162  public_deps = [ "//commonlibrary/c_utils/base:utils" ]
163
164  external_deps = [
165    "hiviewdfx_hilog_native:libhilog",
166    "ipc:ipc_core",
167    "samgr:samgr_proxy",
168  ]
169
170  subsystem_name = "filemanagement"
171  part_name = "storage_service"
172  install_enable = true
173}
174
175declare_args() {
176  storage_service_fstools = true
177}
178
179ohos_shared_library("storage_common_utils") {
180  include_dirs = [
181    "./include",
182    "//foundation/filemanagement/storage_service/services/common/include",
183  ]
184
185  defines = [
186    "STORAGE_LOG_TAG = \"StorageCommonUtils\"",
187    "LOG_DOMAIN = 0xD004301",
188  ]
189
190  sources = [
191    "./utils/disk_utils.cpp",
192    "./utils/file_utils.cpp",
193    "./utils/mount_argument_utils.cpp",
194    "./utils/string_utils.cpp",
195  ]
196
197  if (build_selinux) {
198    defines += [ "USE_LIBRESTORECON" ]
199    include_dirs +=
200        [ "//base/security/selinux/interfaces/policycoreutils/include" ]
201
202    deps = [ "//base/security/selinux:librestorecon" ]
203  }
204
205  external_deps = [
206    "c_utils:utils",
207    "hiviewdfx_hilog_native:libhilog",
208  ]
209
210  subsystem_name = "filemanagement"
211  part_name = "storage_service"
212  install_enable = true
213}
214
215group("storage_daemon_third_party") {
216  deps = []
217  if (storage_service_fstools) {
218    deps += [
219      "//third_party/FreeBSD/sbin/fsck_msdosfs:fsck_msdos",
220      "//third_party/FreeBSD/sbin/newfs_msdos:newfs_msdos",
221      "//third_party/e2fsprogs/misc:blkid",
222      "//third_party/exfatprogs:exfatprogs",
223      "//third_party/f2fs-tools:f2fs-tools",
224      "//third_party/gptfdisk:sgdisk",
225      "//third_party/ntfs-3g:ntfsprogs",
226    ]
227  }
228}
229