diff options
-rw-r--r-- | storaged/main.cpp | 8 | ||||
-rw-r--r-- | storaged/storaged_service.cpp | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/storaged/main.cpp b/storaged/main.cpp index 2f2273dc1..4d1e43014 100644 --- a/storaged/main.cpp +++ b/storaged/main.cpp | |||
@@ -42,11 +42,11 @@ | |||
42 | #include <storaged_service.h> | 42 | #include <storaged_service.h> |
43 | #include <storaged_utils.h> | 43 | #include <storaged_utils.h> |
44 | 44 | ||
45 | storaged_t storaged; | 45 | sp<storaged_t> storaged; |
46 | 46 | ||
47 | // Function of storaged's main thread | 47 | // Function of storaged's main thread |
48 | void* storaged_main(void* s) { | 48 | void* storaged_main(void* /* unused */) { |
49 | storaged_t* storaged = (storaged_t*)s; | 49 | storaged = new storaged_t(); |
50 | 50 | ||
51 | storaged->init_battery_service(); | 51 | storaged->init_battery_service(); |
52 | 52 | ||
@@ -116,7 +116,7 @@ int main(int argc, char** argv) { | |||
116 | report_storage_health(); | 116 | report_storage_health(); |
117 | // Start the main thread of storaged | 117 | // Start the main thread of storaged |
118 | pthread_t storaged_main_thread; | 118 | pthread_t storaged_main_thread; |
119 | errno = pthread_create(&storaged_main_thread, NULL, storaged_main, &storaged); | 119 | errno = pthread_create(&storaged_main_thread, NULL, storaged_main, NULL); |
120 | if (errno != 0) { | 120 | if (errno != 0) { |
121 | PLOG_TO(SYSTEM, ERROR) << "Failed to create main thread"; | 121 | PLOG_TO(SYSTEM, ERROR) << "Failed to create main thread"; |
122 | return -1; | 122 | return -1; |
diff --git a/storaged/storaged_service.cpp b/storaged/storaged_service.cpp index 33e85e3bc..b1d3bfd24 100644 --- a/storaged/storaged_service.cpp +++ b/storaged/storaged_service.cpp | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | using namespace android::base; | 34 | using namespace android::base; |
35 | 35 | ||
36 | extern storaged_t storaged; | 36 | extern sp<storaged_t> storaged; |
37 | 37 | ||
38 | std::vector<struct uid_info> BpStoraged::dump_uids(const char* /*option*/) { | 38 | std::vector<struct uid_info> BpStoraged::dump_uids(const char* /*option*/) { |
39 | Parcel data, reply; | 39 | Parcel data, reply; |
@@ -74,7 +74,7 @@ status_t BnStoraged::onTransact(uint32_t code, const Parcel& data, Parcel* reply | |||
74 | 74 | ||
75 | std::vector<struct uid_info> Storaged::dump_uids(const char* /* option */) { | 75 | std::vector<struct uid_info> Storaged::dump_uids(const char* /* option */) { |
76 | std::vector<struct uid_info> uids_v; | 76 | std::vector<struct uid_info> uids_v; |
77 | std::unordered_map<uint32_t, struct uid_info> uids_m = storaged.get_uids(); | 77 | std::unordered_map<uint32_t, struct uid_info> uids_m = storaged->get_uids(); |
78 | 78 | ||
79 | for (const auto& it : uids_m) { | 79 | for (const auto& it : uids_m) { |
80 | uids_v.push_back(it.second); | 80 | uids_v.push_back(it.second); |
@@ -127,7 +127,7 @@ status_t Storaged::dump(int fd, const Vector<String16>& args) { | |||
127 | 127 | ||
128 | uint64_t last_ts = 0; | 128 | uint64_t last_ts = 0; |
129 | const std::map<uint64_t, struct uid_records>& records = | 129 | const std::map<uint64_t, struct uid_records>& records = |
130 | storaged.get_uid_records(hours, threshold, force_report); | 130 | storaged->get_uid_records(hours, threshold, force_report); |
131 | for (const auto& it : records) { | 131 | for (const auto& it : records) { |
132 | if (last_ts != it.second.start_ts) { | 132 | if (last_ts != it.second.start_ts) { |
133 | dprintf(fd, "%llu", (unsigned long long)it.second.start_ts); | 133 | dprintf(fd, "%llu", (unsigned long long)it.second.start_ts); |
@@ -150,7 +150,7 @@ status_t Storaged::dump(int fd, const Vector<String16>& args) { | |||
150 | } | 150 | } |
151 | 151 | ||
152 | if (time_window) { | 152 | if (time_window) { |
153 | storaged.update_uid_io_interval(time_window); | 153 | storaged->update_uid_io_interval(time_window); |
154 | } | 154 | } |
155 | 155 | ||
156 | return NO_ERROR; | 156 | return NO_ERROR; |