Closed Maschell closed 2 years ago
The translation of mode bits isn't necessary. The bits are identical, you can just pass the mode flags as is.
No, e.g. S_IRUSR is 0400 but FS_MODE_READ_OWNER is 0x400
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));
}
Done
No, e.g. S_IRUSR is 0400 but FS_MODE_READ_OWNER is 0x400
octal somehow gets me every time :P
This also fixes the missing chmod mode translation in the devoptab