mirror of
https://gitee.com/openharmony/filemanagement_storage_service
synced 2024-11-27 09:10:33 +00:00
add disk and volume ipc code
Signed-off-by: jiahaoluo <luojiahao5@huawei.com>
This commit is contained in:
parent
735d51b1e6
commit
823844db36
@ -51,8 +51,7 @@
|
||||
"//third_party/fsck_msdos:fsck_msdos",
|
||||
"//third_party/gptfdisk:sgdisk",
|
||||
"//third_party/newfs_msdos:newfs_msdos",
|
||||
"//third_party/ntfs-3g:ntfsprogs",
|
||||
"//third_party/e2fsprogs/misc:blkid"
|
||||
"//third_party/ntfs-3g:ntfsprogs"
|
||||
],
|
||||
"inner_kits": [
|
||||
{
|
||||
|
@ -51,6 +51,17 @@ void DiskManager::HandleDiskEvent(NetlinkData *data)
|
||||
std::string devPath = data->GetDevpath();
|
||||
std::string devType = data->GetParam("DEVTYPE");
|
||||
|
||||
LOGI("GetAction %{public}d", data->GetAction());
|
||||
LOGI("GetDevpath %{public}s", data->GetDevpath().c_str());
|
||||
LOGI("GetSyspath %{public}s", data->GetSyspath().c_str());
|
||||
LOGI("GetSubsystem %{public}s", data->GetSubsystem().c_str());
|
||||
LOGI("GetParam MAJOR %{public}s", data->GetParam("MAJOR").c_str());
|
||||
LOGI("GetParam MINOR %{public}s", data->GetParam("MINOR").c_str());
|
||||
LOGI("GetParam DEVNAME %{public}s", data->GetParam("DEVNAME").c_str());
|
||||
LOGI("GetParam DEVTYPE %{public}s", data->GetParam("DEVTYPE").c_str());
|
||||
LOGI("GetParam SEQNUM %{public}s", data->GetParam("SEQNUM").c_str());
|
||||
|
||||
LOGI("Disk type is %{public}s", devType.c_str());
|
||||
if (devType != "disk") {
|
||||
return;
|
||||
}
|
||||
|
@ -34,9 +34,6 @@ public:
|
||||
int32_t NotifyVolumeMounted(VolumeInfo volumeInfo);
|
||||
int32_t NotifyVolumeDestroyed(VolumeInfo volumeInfo);
|
||||
|
||||
int32_t GetAllDisks();
|
||||
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_MOVE(StorageManagerClient);
|
||||
|
||||
|
@ -105,20 +105,5 @@ int32_t StorageManagerClient::NotifyVolumeDestroyed(VolumeInfo volumeInfo)
|
||||
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
int32_t StorageManagerClient::GetAllDisks()
|
||||
{
|
||||
if (GetClient() != E_OK) {
|
||||
return E_IPC_ERROR;
|
||||
}
|
||||
|
||||
std::vector<StorageManager::Disk> ret = storageManager_->GetAllDisks();
|
||||
|
||||
for (auto i : ret) {
|
||||
LOGI("diskId: %{public}s, sizeb: %{public}lld, syspath: %{public}s, vendor: %{public}s, flag: %{public}d",i.GetDiskId().c_str(), i.GetSizeBytes(), i.GetSysPath().c_str(), i.GetVendor().c_str(), i.GetFlag());
|
||||
}
|
||||
|
||||
return E_OK;
|
||||
}
|
||||
} // StorageDaemon
|
||||
} // OHOS
|
@ -23,6 +23,9 @@ ohos_unittest("storage_daemon_test") {
|
||||
include_dirs = [
|
||||
"$ROOT_DIR/include",
|
||||
"$ROOT_DIR/utils",
|
||||
"$ROOT_DIR/../storage_manager/include",
|
||||
"//foundation/filemanagement/storage_service/interfaces/innerkits/storage_manager/native",
|
||||
"//foundation/distributedschedule/safwk/interfaces/innerkits/safwk",
|
||||
"//base/security/huks/interfaces/innerkits/huks_standard/main/include",
|
||||
"//foundation/communication/ipc/interfaces/innerkits/libdbinder/include",
|
||||
"//foundation/filemanagement/storage_service/utils/include",
|
||||
@ -39,6 +42,9 @@ ohos_unittest("storage_daemon_test") {
|
||||
"$ROOT_DIR/utils/mount_argument_utils.cpp",
|
||||
"$ROOT_DIR/utils/string_utils.cpp",
|
||||
"$ROOT_DIR/utils/test/common/help_utils.cpp",
|
||||
"$ROOT_DIR/disk/src/disk_config.cpp",
|
||||
"$ROOT_DIR/disk/src/disk_manager.cpp",
|
||||
"$ROOT_DIR/disk/src/disk_info.cpp",
|
||||
]
|
||||
|
||||
deps = [
|
||||
|
@ -59,6 +59,11 @@ public:
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
virtual int32_t Partition(std::string diskId, int32_t type) override
|
||||
{
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
virtual int32_t StartUser(int32_t userId) override
|
||||
{
|
||||
return E_OK;
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
MOCK_METHOD1(UMount, int32_t(std::string));
|
||||
MOCK_METHOD1(Check, int32_t(std::string));
|
||||
MOCK_METHOD1(Format, int32_t(std::string));
|
||||
MOCK_METHOD2(Partition, int32_t(std::string, int32_t));
|
||||
|
||||
MOCK_METHOD1(StartUser, int32_t(int32_t));
|
||||
MOCK_METHOD1(StopUser, int32_t(int32_t));
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "iservice_registry.h"
|
||||
#include "netlink/netlink_manager.h"
|
||||
#include "disk/disk_manager.h"
|
||||
#include "utils/string_utils.h"
|
||||
#include "storage_service_log.h"
|
||||
|
||||
using namespace OHOS;
|
||||
|
@ -18,6 +18,7 @@
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
VolumeCore::VolumeCore() {}
|
||||
|
||||
VolumeCore::VolumeCore(std::string id, int type, std::string diskId)
|
||||
{
|
||||
id_ = id;
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "disk.h"
|
||||
#include "disk/disk_manager_service.h"
|
||||
|
||||
|
||||
namespace OHOS {
|
||||
namespace StorageManager {
|
||||
VolumeExternal::VolumeExternal() {}
|
||||
|
@ -364,17 +364,16 @@ void StorageManagerProxy::NotifyVolumeMounted(std::string volumeId, int32_t fsTy
|
||||
}
|
||||
void StorageManagerProxy::NotifyVolumeDestroyed(std::string volumeId)
|
||||
{
|
||||
LOGI("StorageManagerProxy::NotifyVolumeDestoryed, volumeId:%{public}s", volumeId.c_str());
|
||||
LOGI("StorageManagerProxy::NotifyVolumedestroyed, volumeId:%{public}s", volumeId.c_str());
|
||||
MessageParcel data, reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
if (!data.WriteInterfaceToken(StorageManagerProxy::GetDescriptor())) {
|
||||
LOGE("StorageManagerProxy::NotifyVolumeDestoryed, WriteInterfaceToken failed");
|
||||
|
||||
LOGE("StorageManagerProxy::NotifyVolumedestroyed, WriteInterfaceToken failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteString(volumeId)) {
|
||||
LOGE("StorageManagerProxy::NotifyVolumeDestroyed, WriteInterfaceToken failed");
|
||||
LOGE("StorageManagerProxy::NotifyVolumedestroyed, WriteInterfaceToken failed");
|
||||
return;
|
||||
}
|
||||
int err = Remote()->SendRequest(NOTIFY_VOLUME_DESTROYED, data, reply, option);
|
||||
|
Loading…
Reference in New Issue
Block a user