fs: implement fstat
fstat is useful to get information about an already opened file. Add it to barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
4f7a18cdb5
commit
a3993a38da
16
fs/fs.c
16
fs/fs.c
|
@ -1472,6 +1472,22 @@ out:
|
|||
}
|
||||
EXPORT_SYMBOL(lstat);
|
||||
|
||||
int fstat(int fd, struct stat *s)
|
||||
{
|
||||
FILE *f;
|
||||
struct fs_device_d *fsdev;
|
||||
|
||||
if (check_fd(fd))
|
||||
return -errno;
|
||||
|
||||
f = &files[fd];
|
||||
|
||||
fsdev = f->fsdev;
|
||||
|
||||
return fsdev->driver->stat(&fsdev->dev, f->path, s);
|
||||
}
|
||||
EXPORT_SYMBOL(fstat);
|
||||
|
||||
int mkdir (const char *pathname, mode_t mode)
|
||||
{
|
||||
struct fs_driver_d *fsdrv;
|
||||
|
|
|
@ -114,6 +114,7 @@ int close(int fd);
|
|||
int flush(int fd);
|
||||
int lstat(const char *filename, struct stat *s);
|
||||
int stat(const char *filename, struct stat *s);
|
||||
int fstat(int fd, struct stat *s);
|
||||
ssize_t read(int fd, void *buf, size_t count);
|
||||
ssize_t pread(int fd, void *buf, size_t count, loff_t offset);
|
||||
int ioctl(int fd, int request, void *buf);
|
||||
|
|
Loading…
Reference in New Issue