-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vfs: file system abstraction #5616
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
33566a2
msp430: Discard order argument when using __sync_xxx for atomics
0f74b5b
tests/emb6: Revert workaround for false positive
5638359
tools/externc: Remove #endif in extern C pattern match
03d9f0f
sys/posix: Add fcntl.h
89ba41c
sys/posix: Add sys/statvfs.h
738876a
cpu/atmega_common: Improve POSIX headers
9ec001b
atmega_common: Update unistd.h with prototypes of all POSIX defined f…
3485ab4
msp430: add libc missing symbols and defines
5e27bf4
msp430: Add all expected POSIX unistd.h declarations
dcc3732
sys/vfs: A virtual file system (VFS) layer for RIOT
a1faeb9
newlib: Use vfs for file I/O syscalls
fdd129d
uart_stdio: Bind uart_stdio to vfs fds for stdin/out/err
0371769
devfs: Dynamic file system for device nodes
26b99a5
cpu: native: add vfs wrappers
kaspar030 e021b3b
drivers/nvram: Add vfs compatible functions
8f81121
boards/mulle: Add FRAM to DevFS
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* | ||
* Copyright (C) 2016 Eistec AB | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser | ||
* General Public License v2.1. See the file LICENSE in the top level | ||
* directory for more details. | ||
*/ | ||
|
||
/** | ||
* @file | ||
* @brief POSIX compatible sys/stat.h definitions | ||
* @author Joakim Nohlgård <joakim.nohlgard@eistec.se> | ||
*/ | ||
|
||
#ifndef SYS_STAT_H_ | ||
#define SYS_STAT_H_ | ||
|
||
#include <time.h> /* for struct timespec */ | ||
#include <sys/types.h> /* for fsblkcnt_t, fsfilcnt_t */ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief File information | ||
*/ | ||
struct stat { | ||
dev_t st_dev; /**< Device ID of device containing file. */ | ||
ino_t st_ino; /**< File serial number. */ | ||
mode_t st_mode; /**< Mode of file (see below). */ | ||
nlink_t st_nlink; /**< Number of hard links to the file. */ | ||
uid_t st_uid; /**< User ID of file. */ | ||
gid_t st_gid; /**< Group ID of file. */ | ||
dev_t st_rdev; /**< Device ID (if file is character or block special). */ | ||
/** | ||
* For regular files, the file size in bytes. | ||
* For symbolic links, the length in bytes of the pathname contained in the | ||
* symbolic link. | ||
* For a shared memory object, the length in bytes. | ||
* For a typed memory object, the length in bytes. | ||
* For other file types, the use of this field is unspecified. | ||
*/ | ||
off_t st_size; | ||
struct timespec st_atim; /**< Last data access timestamp. */ | ||
struct timespec st_mtim; /**< Last data modification timestamp. */ | ||
struct timespec st_ctim; /**< Last file status change timestamp. */ | ||
/** | ||
* A file system-specific preferred I/O block size for this object. In some | ||
* file system types, this may vary from file to file. | ||
*/ | ||
blksize_t st_blksize; | ||
blkcnt_t st_blocks; /**< Number of blocks allocated for this object. */ | ||
}; | ||
|
||
/* These bitmasks and numbers are the same as in newlib */ | ||
#define S_IFMT 0170000 /* type of file */ | ||
#define S_IFDIR 0040000 /* directory */ | ||
#define S_IFCHR 0020000 /* character special */ | ||
#define S_IFBLK 0060000 /* block special */ | ||
#define S_IFREG 0100000 /* regular */ | ||
#define S_IFLNK 0120000 /* symbolic link */ | ||
#define S_IFSOCK 0140000 /* socket */ | ||
#define S_IFIFO 0010000 /* fifo */ | ||
|
||
/* These numbers are well-known and can be found in the manual page for sys_stat.h */ | ||
#define S_IRWXU 0700 /**< Read, write, execute/search by owner. */ | ||
#define S_IRUSR 0400 /**< Read permission, owner. */ | ||
#define S_IWUSR 0200 /**< Write permission, owner. */ | ||
#define S_IXUSR 0100 /**< Execute/search permission, owner. */ | ||
#define S_IRWXG 070 /**< Read, write, execute/search by group. */ | ||
#define S_IRGRP 040 /**< Read permission, group. */ | ||
#define S_IWGRP 020 /**< Write permission, group. */ | ||
#define S_IXGRP 010 /**< Execute/search permission, group. */ | ||
#define S_IRWXO 07 /**< Read, write, execute/search by others. */ | ||
#define S_IROTH 04 /**< Read permission, others. */ | ||
#define S_IWOTH 02 /**< Write permission, others. */ | ||
#define S_IXOTH 01 /**< Execute/search permission, others. */ | ||
#define S_ISUID 04000 /**< Set-user-ID on execution. */ | ||
#define S_ISGID 02000 /**< Set-group-ID on execution. */ | ||
#define S_ISVTX 01000 /**< On directories, restricted deletion flag */ | ||
|
||
/* File type test macros, taken from newlib */ | ||
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | ||
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | ||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | ||
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | ||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | ||
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) | ||
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) | ||
|
||
/* These function prototypes are required by the standard */ | ||
int chmod(const char *, mode_t); | ||
int fchmod(int, mode_t); | ||
int fchmodat(int, const char *, mode_t, int); | ||
int fstat(int, struct stat *); | ||
int fstatat(int, const char *restrict, struct stat *restrict, int); | ||
int futimens(int, const struct timespec [2]); | ||
int lstat(const char *restrict, struct stat *restrict); | ||
int mkdir(const char *, mode_t); | ||
int mkdirat(int, const char *, mode_t); | ||
int mkfifo(const char *, mode_t); | ||
int mkfifoat(int, const char *, mode_t); | ||
int mknod(const char *, mode_t, dev_t); | ||
int mknodat(int, const char *, mode_t, dev_t); | ||
int stat(const char *restrict, struct stat *restrict); | ||
mode_t umask(mode_t); | ||
int utimensat(int, const char *, const struct timespec [2], int); | ||
|
||
/* Special tv_nsec values for futimens(2) and utimensat(2). */ | ||
#define UTIME_NOW (-2L) | ||
#define UTIME_OMIT (-1L) | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* SYS_STAT_H_ */ | ||
|
||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's probably a good idea to move the proposed atmega changes to a seperate PR, as they are mostly unrelated to this new feature. (here and above)