Loading fs_mgr/libdm/dm.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ #ifndef DM_DEFERRED_REMOVE #define DM_DEFERRED_REMOVE (1 << 17) #endif #ifndef DM_IMA_MEASUREMENT_FLAG #define DM_IMA_MEASUREMENT_FLAG (1 << 19) #endif namespace android { namespace dm { Loading Loading @@ -540,6 +543,10 @@ bool DeviceMapper::GetTableStatus(const std::string& name, std::vector<TargetInf return GetTable(name, 0, table); } bool DeviceMapper::GetTableStatusIma(const std::string& name, std::vector<TargetInfo>* table) { return GetTable(name, DM_IMA_MEASUREMENT_FLAG, table); } bool DeviceMapper::GetTableInfo(const std::string& name, std::vector<TargetInfo>* table) { return GetTable(name, DM_STATUS_TABLE_FLAG, table); } Loading fs_mgr/libdm/include/libdm/dm.h +7 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ class IDeviceMapper { virtual bool LoadTable(const std::string& name, const DmTable& table) = 0; virtual bool GetTableInfo(const std::string& name, std::vector<TargetInfo>* table) = 0; virtual bool GetTableStatus(const std::string& name, std::vector<TargetInfo>* table) = 0; virtual bool GetTableStatusIma(const std::string& name, std::vector<TargetInfo>* table) = 0; virtual bool GetDmDevicePathByName(const std::string& name, std::string* path) = 0; virtual bool GetDeviceString(const std::string& name, std::string* dev) = 0; virtual bool DeleteDeviceIfExists(const std::string& name) = 0; Loading Loading @@ -267,6 +268,12 @@ class DeviceMapper final : public IDeviceMapper { // false. bool GetTableStatus(const std::string& name, std::vector<TargetInfo>* table) override; // Query the status of a table, given a device name. The output vector will // contain IMA TargetInfo for each target in the table. If the device does // not exist, or there were too many targets, the call will fail and return // false. bool GetTableStatusIma(const std::string& name, std::vector<TargetInfo>* table) override; // Identical to GetTableStatus, except also retrives the active table for the device // mapper device from the kernel. bool GetTableInfo(const std::string& name, std::vector<TargetInfo>* table) override; Loading fs_mgr/libsnapshot/include_test/libsnapshot/test_helpers.h +3 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,9 @@ class DeviceMapperWrapper : public android::dm::IDeviceMapper { virtual bool GetTableStatus(const std::string& name, std::vector<TargetInfo>* table) { return impl_.GetTableStatus(name, table); } virtual bool GetTableStatusIma(const std::string& name, std::vector<TargetInfo>* table) { return impl_.GetTableStatusIma(name, table); } virtual bool GetDmDevicePathByName(const std::string& name, std::string* path) { return impl_.GetDmDevicePathByName(name, path); } Loading fs_mgr/tools/dmctl.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ static int Usage(void) { std::cerr << " list <devices | targets> [-v]" << std::endl; std::cerr << " getpath <dm-name>" << std::endl; std::cerr << " getuuid <dm-name>" << std::endl; std::cerr << " ima <dm-name>" << std::endl; std::cerr << " info <dm-name>" << std::endl; std::cerr << " replace <dm-name> <targets...>" << std::endl; std::cerr << " status <dm-name>" << std::endl; Loading Loading @@ -508,7 +509,14 @@ static int DumpTable(const std::string& mode, int argc, char** argv) { << std::endl; return -EINVAL; } } else if (mode == "ima") { if (!dm.GetTableStatusIma(argv[0], &table)) { std::cerr << "Could not query table status of device \"" << argv[0] << "\"." << std::endl; return -EINVAL; } } std::cout << "Targets in the device-mapper table for " << argv[0] << ":" << std::endl; for (const auto& target : table) { std::cout << target.spec.sector_start << "-" Loading @@ -530,6 +538,10 @@ static int StatusCmdHandler(int argc, char** argv) { return DumpTable("status", argc, argv); } static int ImaCmdHandler(int argc, char** argv) { return DumpTable("ima", argc, argv); } static int ResumeCmdHandler(int argc, char** argv) { if (argc != 1) { std::cerr << "Invalid arguments, see \'dmctl help\'" << std::endl; Loading Loading @@ -570,6 +582,7 @@ static std::map<std::string, std::function<int(int, char**)>> cmdmap = { {"info", InfoCmdHandler}, {"table", TableCmdHandler}, {"status", StatusCmdHandler}, {"ima", ImaCmdHandler}, {"resume", ResumeCmdHandler}, {"suspend", SuspendCmdHandler}, // clang-format on Loading Loading
fs_mgr/libdm/dm.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ #ifndef DM_DEFERRED_REMOVE #define DM_DEFERRED_REMOVE (1 << 17) #endif #ifndef DM_IMA_MEASUREMENT_FLAG #define DM_IMA_MEASUREMENT_FLAG (1 << 19) #endif namespace android { namespace dm { Loading Loading @@ -540,6 +543,10 @@ bool DeviceMapper::GetTableStatus(const std::string& name, std::vector<TargetInf return GetTable(name, 0, table); } bool DeviceMapper::GetTableStatusIma(const std::string& name, std::vector<TargetInfo>* table) { return GetTable(name, DM_IMA_MEASUREMENT_FLAG, table); } bool DeviceMapper::GetTableInfo(const std::string& name, std::vector<TargetInfo>* table) { return GetTable(name, DM_STATUS_TABLE_FLAG, table); } Loading
fs_mgr/libdm/include/libdm/dm.h +7 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ class IDeviceMapper { virtual bool LoadTable(const std::string& name, const DmTable& table) = 0; virtual bool GetTableInfo(const std::string& name, std::vector<TargetInfo>* table) = 0; virtual bool GetTableStatus(const std::string& name, std::vector<TargetInfo>* table) = 0; virtual bool GetTableStatusIma(const std::string& name, std::vector<TargetInfo>* table) = 0; virtual bool GetDmDevicePathByName(const std::string& name, std::string* path) = 0; virtual bool GetDeviceString(const std::string& name, std::string* dev) = 0; virtual bool DeleteDeviceIfExists(const std::string& name) = 0; Loading Loading @@ -267,6 +268,12 @@ class DeviceMapper final : public IDeviceMapper { // false. bool GetTableStatus(const std::string& name, std::vector<TargetInfo>* table) override; // Query the status of a table, given a device name. The output vector will // contain IMA TargetInfo for each target in the table. If the device does // not exist, or there were too many targets, the call will fail and return // false. bool GetTableStatusIma(const std::string& name, std::vector<TargetInfo>* table) override; // Identical to GetTableStatus, except also retrives the active table for the device // mapper device from the kernel. bool GetTableInfo(const std::string& name, std::vector<TargetInfo>* table) override; Loading
fs_mgr/libsnapshot/include_test/libsnapshot/test_helpers.h +3 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,9 @@ class DeviceMapperWrapper : public android::dm::IDeviceMapper { virtual bool GetTableStatus(const std::string& name, std::vector<TargetInfo>* table) { return impl_.GetTableStatus(name, table); } virtual bool GetTableStatusIma(const std::string& name, std::vector<TargetInfo>* table) { return impl_.GetTableStatusIma(name, table); } virtual bool GetDmDevicePathByName(const std::string& name, std::string* path) { return impl_.GetDmDevicePathByName(name, path); } Loading
fs_mgr/tools/dmctl.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ static int Usage(void) { std::cerr << " list <devices | targets> [-v]" << std::endl; std::cerr << " getpath <dm-name>" << std::endl; std::cerr << " getuuid <dm-name>" << std::endl; std::cerr << " ima <dm-name>" << std::endl; std::cerr << " info <dm-name>" << std::endl; std::cerr << " replace <dm-name> <targets...>" << std::endl; std::cerr << " status <dm-name>" << std::endl; Loading Loading @@ -508,7 +509,14 @@ static int DumpTable(const std::string& mode, int argc, char** argv) { << std::endl; return -EINVAL; } } else if (mode == "ima") { if (!dm.GetTableStatusIma(argv[0], &table)) { std::cerr << "Could not query table status of device \"" << argv[0] << "\"." << std::endl; return -EINVAL; } } std::cout << "Targets in the device-mapper table for " << argv[0] << ":" << std::endl; for (const auto& target : table) { std::cout << target.spec.sector_start << "-" Loading @@ -530,6 +538,10 @@ static int StatusCmdHandler(int argc, char** argv) { return DumpTable("status", argc, argv); } static int ImaCmdHandler(int argc, char** argv) { return DumpTable("ima", argc, argv); } static int ResumeCmdHandler(int argc, char** argv) { if (argc != 1) { std::cerr << "Invalid arguments, see \'dmctl help\'" << std::endl; Loading Loading @@ -570,6 +582,7 @@ static std::map<std::string, std::function<int(int, char**)>> cmdmap = { {"info", InfoCmdHandler}, {"table", TableCmdHandler}, {"status", StatusCmdHandler}, {"ima", ImaCmdHandler}, {"resume", ResumeCmdHandler}, {"suspend", SuspendCmdHandler}, // clang-format on Loading