You've already forked Zygisk-Assistant
mirror of
https://github.com/snake-4/Zygisk-Assistant.git
synced 2025-09-06 06:37:02 +00:00
POSIX compliant type names
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
|
||||
namespace Parsers
|
||||
{
|
||||
class map_entry_t
|
||||
class map_entry
|
||||
{
|
||||
public:
|
||||
map_entry_t(uintptr_t address_start, uintptr_t address_end, uintptr_t offset,
|
||||
map_entry(uintptr_t address_start, uintptr_t address_end, uintptr_t offset,
|
||||
const std::string &perms, const std::string &pathname, dev_t device, ino_t inode);
|
||||
|
||||
uintptr_t getAddressStart() const;
|
||||
@@ -27,5 +27,5 @@ namespace Parsers
|
||||
ino_t inode;
|
||||
};
|
||||
|
||||
const std::vector<map_entry_t> &parseSelfMaps(bool cached = true);
|
||||
const std::vector<map_entry> &parseSelfMaps(bool cached = true);
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
namespace Parsers
|
||||
{
|
||||
class mountinfo_entry_t
|
||||
class mountinfo_entry
|
||||
{
|
||||
public:
|
||||
mountinfo_entry_t(int mount_id, int parent_id, dev_t device,
|
||||
mountinfo_entry(int mount_id, int parent_id, dev_t device,
|
||||
const std::string &root, const std::string &mount_point,
|
||||
const std::string &mount_options, const std::string &optional_fields,
|
||||
const std::string &filesystem_type, const std::string &mount_source,
|
||||
@@ -33,13 +33,13 @@ namespace Parsers
|
||||
std::unordered_map<std::string, std::string> mount_options, super_options;
|
||||
};
|
||||
|
||||
const std::vector<mountinfo_entry_t> &parseSelfMountinfo(bool cached = true);
|
||||
const std::vector<mountinfo_entry> &parseSelfMountinfo(bool cached = true);
|
||||
|
||||
class mountinfo_root_resolver
|
||||
{
|
||||
public:
|
||||
mountinfo_root_resolver(const std::vector<mountinfo_entry_t> &mount_infos);
|
||||
std::string resolveRootOf(const mountinfo_entry_t &mount_info) const;
|
||||
mountinfo_root_resolver(const std::vector<mountinfo_entry> &mount_infos);
|
||||
std::string resolveRootOf(const mountinfo_entry &mount_info) const;
|
||||
|
||||
private:
|
||||
std::unordered_map<dev_t, std::string> device_mount_map;
|
||||
|
||||
@@ -9,21 +9,21 @@
|
||||
|
||||
using namespace Parsers;
|
||||
|
||||
map_entry_t::map_entry_t(uintptr_t address_start, uintptr_t address_end, uintptr_t offset, const std::string &perms, const std::string &pathname, dev_t device, ino_t inode)
|
||||
map_entry::map_entry(uintptr_t address_start, uintptr_t address_end, uintptr_t offset, const std::string &perms, const std::string &pathname, dev_t device, ino_t inode)
|
||||
: address_start(address_start), address_end(address_end), perms(perms),
|
||||
offset(offset), device(device), inode(inode), pathname(pathname) {}
|
||||
|
||||
uintptr_t map_entry_t::getAddressStart() const { return address_start; }
|
||||
uintptr_t map_entry_t::getAddressEnd() const { return address_end; }
|
||||
const std::string &map_entry_t::getPerms() const { return perms; }
|
||||
uintptr_t map_entry_t::getOffset() const { return offset; }
|
||||
dev_t map_entry_t::getDevice() const { return device; }
|
||||
ino_t map_entry_t::getInode() const { return inode; }
|
||||
const std::string &map_entry_t::getPathname() const { return pathname; }
|
||||
uintptr_t map_entry::getAddressStart() const { return address_start; }
|
||||
uintptr_t map_entry::getAddressEnd() const { return address_end; }
|
||||
const std::string &map_entry::getPerms() const { return perms; }
|
||||
uintptr_t map_entry::getOffset() const { return offset; }
|
||||
dev_t map_entry::getDevice() const { return device; }
|
||||
ino_t map_entry::getInode() const { return inode; }
|
||||
const std::string &map_entry::getPathname() const { return pathname; }
|
||||
|
||||
const std::vector<map_entry_t> &Parsers::parseSelfMaps(bool cached)
|
||||
const std::vector<map_entry> &Parsers::parseSelfMaps(bool cached)
|
||||
{
|
||||
static std::vector<map_entry_t> parser_cache;
|
||||
static std::vector<map_entry> parser_cache;
|
||||
if (cached && !parser_cache.empty())
|
||||
{
|
||||
return parser_cache;
|
||||
@@ -59,7 +59,7 @@ const std::vector<map_entry_t> &Parsers::parseSelfMaps(bool cached)
|
||||
// This operation can fail, it doesn't matter as it's an optional field.
|
||||
std::getline(iss >> std::ws, pathname);
|
||||
|
||||
parser_cache.emplace_back(map_entry_t(address_start, address_end, offset, perms, pathname, makedev(dev_major, dev_minor), inode));
|
||||
parser_cache.emplace_back(map_entry(address_start, address_end, offset, perms, pathname, makedev(dev_major, dev_minor), inode));
|
||||
}
|
||||
|
||||
return parser_cache;
|
||||
|
||||
@@ -32,7 +32,7 @@ static const std::unordered_map<std::string, int> mount_flags_procfs = {
|
||||
{"relatime", MS_RELATIME},
|
||||
{"nosymfollow", MS_NOSYMFOLLOW}};
|
||||
|
||||
static bool shouldUnmount(const mountinfo_entry_t &mount, const mountinfo_root_resolver &root_resolver)
|
||||
static bool shouldUnmount(const mountinfo_entry &mount, const mountinfo_root_resolver &root_resolver)
|
||||
{
|
||||
const auto true_root = root_resolver.resolveRootOf(mount);
|
||||
const auto &mount_point = mount.getMountPoint();
|
||||
|
||||
@@ -30,7 +30,7 @@ static std::unordered_map<std::string, std::string> parseMountOptions(const std:
|
||||
return ret;
|
||||
}
|
||||
|
||||
mountinfo_entry_t::mountinfo_entry_t(int mount_id, int parent_id, dev_t device,
|
||||
mountinfo_entry::mountinfo_entry(int mount_id, int parent_id, dev_t device,
|
||||
const std::string &root, const std::string &mount_point,
|
||||
const std::string &mount_options, const std::string &optional_fields,
|
||||
const std::string &filesystem_type, const std::string &mount_source,
|
||||
@@ -44,20 +44,20 @@ mountinfo_entry_t::mountinfo_entry_t(int mount_id, int parent_id, dev_t device,
|
||||
this->super_options = parseMountOptions(super_options);
|
||||
}
|
||||
|
||||
int mountinfo_entry_t::getMountId() const { return mount_id; }
|
||||
int mountinfo_entry_t::getParentId() const { return parent_id; }
|
||||
dev_t mountinfo_entry_t::getDevice() const { return device; }
|
||||
const std::string &mountinfo_entry_t::getRoot() const { return root; }
|
||||
const std::string &mountinfo_entry_t::getMountPoint() const { return mount_point; }
|
||||
const std::unordered_map<std::string, std::string> &mountinfo_entry_t::getMountOptions() const { return mount_options; }
|
||||
const std::string &mountinfo_entry_t::getOptionalFields() const { return optional_fields; }
|
||||
const std::string &mountinfo_entry_t::getFilesystemType() const { return filesystem_type; }
|
||||
const std::string &mountinfo_entry_t::getMountSource() const { return mount_source; }
|
||||
const std::unordered_map<std::string, std::string> &mountinfo_entry_t::getSuperOptions() const { return super_options; }
|
||||
int mountinfo_entry::getMountId() const { return mount_id; }
|
||||
int mountinfo_entry::getParentId() const { return parent_id; }
|
||||
dev_t mountinfo_entry::getDevice() const { return device; }
|
||||
const std::string &mountinfo_entry::getRoot() const { return root; }
|
||||
const std::string &mountinfo_entry::getMountPoint() const { return mount_point; }
|
||||
const std::unordered_map<std::string, std::string> &mountinfo_entry::getMountOptions() const { return mount_options; }
|
||||
const std::string &mountinfo_entry::getOptionalFields() const { return optional_fields; }
|
||||
const std::string &mountinfo_entry::getFilesystemType() const { return filesystem_type; }
|
||||
const std::string &mountinfo_entry::getMountSource() const { return mount_source; }
|
||||
const std::unordered_map<std::string, std::string> &mountinfo_entry::getSuperOptions() const { return super_options; }
|
||||
|
||||
const std::vector<mountinfo_entry_t> &Parsers::parseSelfMountinfo(bool cached)
|
||||
const std::vector<mountinfo_entry> &Parsers::parseSelfMountinfo(bool cached)
|
||||
{
|
||||
static std::vector<mountinfo_entry_t> parser_cache;
|
||||
static std::vector<mountinfo_entry> parser_cache;
|
||||
if (cached && !parser_cache.empty())
|
||||
{
|
||||
return parser_cache;
|
||||
@@ -106,7 +106,7 @@ const std::vector<mountinfo_entry_t> &Parsers::parseSelfMountinfo(bool cached)
|
||||
continue;
|
||||
}
|
||||
|
||||
parser_cache.emplace_back(mountinfo_entry_t(mount_id, parent_id, makedev(_major, _minor),
|
||||
parser_cache.emplace_back(mountinfo_entry(mount_id, parent_id, makedev(_major, _minor),
|
||||
root, mount_point, mount_options,
|
||||
optional_fields, filesystem_type, mount_source,
|
||||
super_options));
|
||||
@@ -115,7 +115,7 @@ const std::vector<mountinfo_entry_t> &Parsers::parseSelfMountinfo(bool cached)
|
||||
return parser_cache;
|
||||
}
|
||||
|
||||
mountinfo_root_resolver::mountinfo_root_resolver(const std::vector<mountinfo_entry_t> &mount_infos)
|
||||
mountinfo_root_resolver::mountinfo_root_resolver(const std::vector<mountinfo_entry> &mount_infos)
|
||||
{
|
||||
for (const auto &mount_info : mount_infos)
|
||||
{
|
||||
@@ -126,7 +126,7 @@ mountinfo_root_resolver::mountinfo_root_resolver(const std::vector<mountinfo_ent
|
||||
}
|
||||
}
|
||||
|
||||
std::string mountinfo_root_resolver::resolveRootOf(const mountinfo_entry_t &mount_info) const
|
||||
std::string mountinfo_root_resolver::resolveRootOf(const mountinfo_entry &mount_info) const
|
||||
{
|
||||
auto dev = mount_info.getDevice();
|
||||
if (device_mount_map.contains(dev))
|
||||
|
||||
Reference in New Issue
Block a user