/* * Copyright 2001-2009, Axel Dörfler, axeld@pinc-software.de. * This file may be used under the terms of the MIT License. */ #ifndef UTILITY_H #define UTILITY_H #include "ext2.h" enum inode_type { S_DIRECTORY = S_IFDIR, S_FILE = S_IFREG, S_SYMLINK = S_IFLNK, S_INDEX_TYPES = (S_STR_INDEX | S_INT_INDEX | S_UINT_INDEX | S_LONG_LONG_INDEX | S_ULONG_LONG_INDEX | S_FLOAT_INDEX | S_DOUBLE_INDEX), S_EXTENDED_TYPES = (S_ATTR_DIR | S_ATTR | S_INDEX_DIR) }; /*! Converts the open mode, the open flags given to bfs_open(), into access modes, e.g. since O_RDONLY requires read access to the file, it will be converted to R_OK. */ inline int open_mode_to_access(int openMode) { openMode &= O_RWMASK; if (openMode == O_RDONLY) return R_OK; if (openMode == O_WRONLY) return W_OK; return R_OK | W_OK; } #endif // UTILITY_H