1
1
Fork 0
forked from suyu/suyu

Merge pull request #131 from lioncash/enum

nvmap: Make IoctlCommands an enum class
This commit is contained in:
bunnei 2018-01-21 22:01:27 -05:00 committed by GitHub
commit fdbb039427
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

View file

@ -22,20 +22,21 @@ VAddr nvmap::GetObjectAddress(u32 handle) const {
} }
u32 nvmap::ioctl(u32 command, const std::vector<u8>& input, std::vector<u8>& output) { u32 nvmap::ioctl(u32 command, const std::vector<u8>& input, std::vector<u8>& output) {
switch (command) { switch (static_cast<IoctlCommand>(command)) {
case IocCreateCommand: case IoctlCommand::Create:
return IocCreate(input, output); return IocCreate(input, output);
case IocAllocCommand: case IoctlCommand::Alloc:
return IocAlloc(input, output); return IocAlloc(input, output);
case IocGetIdCommand: case IoctlCommand::GetId:
return IocGetId(input, output); return IocGetId(input, output);
case IocFromIdCommand: case IoctlCommand::FromId:
return IocFromId(input, output); return IocFromId(input, output);
case IocParamCommand: case IoctlCommand::Param:
return IocParam(input, output); return IocParam(input, output);
} }
UNIMPLEMENTED(); UNIMPLEMENTED();
return 0;
} }
u32 nvmap::IocCreate(const std::vector<u8>& input, std::vector<u8>& output) { u32 nvmap::IocCreate(const std::vector<u8>& input, std::vector<u8>& output) {

View file

@ -48,12 +48,12 @@ private:
/// Mapping of currently allocated handles to the objects they represent. /// Mapping of currently allocated handles to the objects they represent.
std::unordered_map<u32, std::shared_ptr<Object>> handles; std::unordered_map<u32, std::shared_ptr<Object>> handles;
enum IoctlCommands { enum class IoctlCommand : u32 {
IocCreateCommand = 0xC0080101, Create = 0xC0080101,
IocFromIdCommand = 0xC0080103, FromId = 0xC0080103,
IocAllocCommand = 0xC0200104, Alloc = 0xC0200104,
IocParamCommand = 0xC00C0109, Param = 0xC00C0109,
IocGetIdCommand = 0xC008010E GetId = 0xC008010E
}; };
struct IocCreateParams { struct IocCreateParams {