devkitPro / wut

Let's try to make a Wii U Toolchain / SDK for creating rpx/rpl.
zlib License
244 stars 52 forks source link

coreinit: Add missing parameter to FSChangeMode/FSChangeModeAsync #199

Closed Maschell closed 2 years ago

Maschell commented 2 years ago

This also fixes the missing chmod mode translation in the devoptab

WinterMute commented 2 years ago

The translation of mode bits isn't necessary. The bits are identical, you can just pass the mode flags as is.

Maschell commented 2 years ago

No, e.g. S_IRUSR is 0400 but FS_MODE_READ_OWNER is 0x400

fincs commented 2 years ago

Heh, that's quite a trap. In that case, I think it would be best to make it clear that we are converting normal octal filesystem permissions into hexadecimal permissions. I'd suggest adding an internal wrapper function to devoptab_fs.h like this:

static inline FSMode
__wut_fs_convert_mode(mode_t mode) {
   // Convert normal Unix octal permission bits into CafeOS hexadecimal permission bits
   return (FSMode)(((mode & S_IRWXU) << 2) | ((mode & S_IRWXG) << 1) | (mode & S_IRWXO));
}
Maschell commented 2 years ago

Done

WinterMute commented 2 years ago

No, e.g. S_IRUSR is 0400 but FS_MODE_READ_OWNER is 0x400

octal somehow gets me every time :P