diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2018-01-22 10:14:39 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-01-25 08:28:02 +0100 |
commit | 3f86edfc2b942e57d452feca0450a6fb14066fbd (patch) | |
tree | 7482d58d16663d64f333d0816c2612f0eb37ba64 /include | |
parent | 573d6ae5bb909e1c887be558953d1fb2a0f7335a (diff) | |
download | barebox-3f86edfc2b942e57d452feca0450a6fb14066fbd.tar.gz barebox-3f86edfc2b942e57d452feca0450a6fb14066fbd.tar.xz |
fs: implement is_tftp_fs()
Some commands need files in which they can lseek backwards which
is particularly not possible on TFTP. Instead of hiding this
behind can_lseek_backward() create a function for it which tests
if the file is on TFTP directly rather than using different
lseek operations.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/fs.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/fs.h b/include/fs.h index 3d88bfad4a..d75a1ef644 100644 --- a/include/fs.h +++ b/include/fs.h @@ -121,6 +121,16 @@ static inline int can_lseek_backward(int fd) return 1; } +bool __is_tftp_fs(const char *path); + +static inline bool is_tftp_fs(const char *path) +{ + if (!IS_ENABLED(CONFIG_FS_TFTP)) + return false; + + return __is_tftp_fs(path); +} + #define drv_to_fs_driver(d) container_of(d, struct fs_driver_d, drv) int flush(int fd); |