modify some function prototypes of the dfs_file_ops structure and the function declarations based on it (#7849)
This commit is contained in:
parent
fc28baeb15
commit
befa951451
|
@ -61,7 +61,7 @@ int dfs_device_fs_ioctl(struct dfs_file *file, int cmd, void *args)
|
|||
return result;
|
||||
}
|
||||
|
||||
int dfs_device_fs_read(struct dfs_file *file, void *buf, size_t count)
|
||||
ssize_t dfs_device_fs_read(struct dfs_file *file, void *buf, size_t count)
|
||||
{
|
||||
int result;
|
||||
rt_device_t dev_id;
|
||||
|
@ -82,7 +82,7 @@ int dfs_device_fs_read(struct dfs_file *file, void *buf, size_t count)
|
|||
return result;
|
||||
}
|
||||
|
||||
int dfs_device_fs_write(struct dfs_file *file, const void *buf, size_t count)
|
||||
ssize_t dfs_device_fs_write(struct dfs_file *file, const void *buf, size_t count)
|
||||
{
|
||||
int result;
|
||||
rt_device_t dev_id;
|
||||
|
|
|
@ -537,7 +537,7 @@ int dfs_elm_ioctl(struct dfs_file *file, int cmd, void *args)
|
|||
return -ENOSYS;
|
||||
}
|
||||
|
||||
int dfs_elm_read(struct dfs_file *file, void *buf, size_t len)
|
||||
ssize_t dfs_elm_read(struct dfs_file *file, void *buf, size_t len)
|
||||
{
|
||||
FIL *fd;
|
||||
FRESULT result;
|
||||
|
@ -560,7 +560,7 @@ int dfs_elm_read(struct dfs_file *file, void *buf, size_t len)
|
|||
return elm_result_to_dfs(result);
|
||||
}
|
||||
|
||||
int dfs_elm_write(struct dfs_file *file, const void *buf, size_t len)
|
||||
ssize_t dfs_elm_write(struct dfs_file *file, const void *buf, size_t len)
|
||||
{
|
||||
FIL *fd;
|
||||
FRESULT result;
|
||||
|
@ -596,7 +596,7 @@ int dfs_elm_flush(struct dfs_file *file)
|
|||
return elm_result_to_dfs(result);
|
||||
}
|
||||
|
||||
int dfs_elm_lseek(struct dfs_file *file, off_t offset)
|
||||
off_t dfs_elm_lseek(struct dfs_file *file, off_t offset)
|
||||
{
|
||||
FRESULT result = FR_OK;
|
||||
if (file->vnode->type == FT_REGULAR)
|
||||
|
|
|
@ -146,7 +146,7 @@ struct romfs_dirent *dfs_romfs_lookup(struct romfs_dirent *root_dirent, const ch
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int dfs_romfs_read(struct dfs_file *file, void *buf, size_t count)
|
||||
ssize_t dfs_romfs_read(struct dfs_file *file, void *buf, size_t count)
|
||||
{
|
||||
rt_size_t length;
|
||||
struct romfs_dirent *dirent;
|
||||
|
@ -173,7 +173,7 @@ int dfs_romfs_read(struct dfs_file *file, void *buf, size_t count)
|
|||
return length;
|
||||
}
|
||||
|
||||
int dfs_romfs_lseek(struct dfs_file *file, off_t offset)
|
||||
off_t dfs_romfs_lseek(struct dfs_file *file, off_t offset)
|
||||
{
|
||||
if (offset <= file->vnode->size)
|
||||
{
|
||||
|
|
|
@ -267,7 +267,7 @@ find_subpath:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count)
|
||||
ssize_t dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count)
|
||||
{
|
||||
rt_size_t length;
|
||||
struct tmpfs_file *d_file;
|
||||
|
@ -290,7 +290,7 @@ int dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count)
|
|||
}
|
||||
|
||||
|
||||
int dfs_tmpfs_write(struct dfs_file *fd, const void *buf, size_t count)
|
||||
ssize_t dfs_tmpfs_write(struct dfs_file *fd, const void *buf, size_t count)
|
||||
{
|
||||
struct tmpfs_file *d_file;
|
||||
struct tmpfs_sb *superblock;
|
||||
|
@ -328,7 +328,7 @@ int dfs_tmpfs_write(struct dfs_file *fd, const void *buf, size_t count)
|
|||
return count;
|
||||
}
|
||||
|
||||
int dfs_tmpfs_lseek(struct dfs_file *file, off_t offset)
|
||||
off_t dfs_tmpfs_lseek(struct dfs_file *file, off_t offset)
|
||||
{
|
||||
if (offset <= (off_t)file->vnode->size)
|
||||
{
|
||||
|
|
|
@ -25,10 +25,10 @@ struct dfs_file_ops
|
|||
int (*open) (struct dfs_file *fd);
|
||||
int (*close) (struct dfs_file *fd);
|
||||
int (*ioctl) (struct dfs_file *fd, int cmd, void *args);
|
||||
int (*read) (struct dfs_file *fd, void *buf, size_t count);
|
||||
int (*write) (struct dfs_file *fd, const void *buf, size_t count);
|
||||
ssize_t (*read) (struct dfs_file *fd, void *buf, size_t count);
|
||||
ssize_t (*write) (struct dfs_file *fd, const void *buf, size_t count);
|
||||
int (*flush) (struct dfs_file *fd);
|
||||
int (*lseek) (struct dfs_file *fd, off_t offset);
|
||||
off_t (*lseek) (struct dfs_file *fd, off_t offset);
|
||||
int (*getdents) (struct dfs_file *fd, struct dirent *dirp, uint32_t count);
|
||||
|
||||
int (*poll) (struct dfs_file *fd, struct rt_pollreq *req);
|
||||
|
@ -82,12 +82,12 @@ int dfs_file_is_open(const char *pathname);
|
|||
int dfs_file_open(struct dfs_file *fd, const char *path, int flags);
|
||||
int dfs_file_close(struct dfs_file *fd);
|
||||
int dfs_file_ioctl(struct dfs_file *fd, int cmd, void *args);
|
||||
int dfs_file_read(struct dfs_file *fd, void *buf, size_t len);
|
||||
ssize_t dfs_file_read(struct dfs_file *fd, void *buf, size_t len);
|
||||
int dfs_file_getdents(struct dfs_file *fd, struct dirent *dirp, size_t nbytes);
|
||||
int dfs_file_unlink(const char *path);
|
||||
int dfs_file_write(struct dfs_file *fd, const void *buf, size_t len);
|
||||
ssize_t dfs_file_write(struct dfs_file *fd, const void *buf, size_t len);
|
||||
int dfs_file_flush(struct dfs_file *fd);
|
||||
int dfs_file_lseek(struct dfs_file *fd, off_t offset);
|
||||
off_t dfs_file_lseek(struct dfs_file *fd, off_t offset);
|
||||
|
||||
int dfs_file_stat(const char *path, struct stat *buf);
|
||||
int dfs_file_rename(const char *oldpath, const char *newpath);
|
||||
|
|
|
@ -389,7 +389,7 @@ int dfs_file_ioctl(struct dfs_file *fd, int cmd, void *args)
|
|||
*
|
||||
* @return the actual read data bytes or 0 on end of file or failed.
|
||||
*/
|
||||
int dfs_file_read(struct dfs_file *fd, void *buf, size_t len)
|
||||
ssize_t dfs_file_read(struct dfs_file *fd, void *buf, size_t len)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
|
@ -503,7 +503,7 @@ __exit:
|
|||
*
|
||||
* @return the actual written data length.
|
||||
*/
|
||||
int dfs_file_write(struct dfs_file *fd, const void *buf, size_t len)
|
||||
ssize_t dfs_file_write(struct dfs_file *fd, const void *buf, size_t len)
|
||||
{
|
||||
if (fd == NULL)
|
||||
{
|
||||
|
@ -544,7 +544,7 @@ int dfs_file_flush(struct dfs_file *fd)
|
|||
*
|
||||
* @return the current position after seek.
|
||||
*/
|
||||
int dfs_file_lseek(struct dfs_file *fd, off_t offset)
|
||||
off_t dfs_file_lseek(struct dfs_file *fd, off_t offset)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ struct device_dirent
|
|||
|
||||
int dfs_devfs_open(struct dfs_file *file);
|
||||
int dfs_devfs_close(struct dfs_file *file);
|
||||
int generic_dfs_lseek(struct dfs_file *file, off_t offset, int whence);
|
||||
int dfs_devfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos);
|
||||
int dfs_devfs_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos);
|
||||
off_t generic_dfs_lseek(struct dfs_file *file, off_t offset, int whence);
|
||||
ssize_t dfs_devfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos);
|
||||
ssize_t dfs_devfs_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos);
|
||||
int dfs_devfs_ioctl(struct dfs_file *file, int cmd, void *args);
|
||||
int dfs_devfs_getdents(struct dfs_file *file, struct dirent *dirp, uint32_t count);
|
||||
static int dfs_devfs_poll(struct dfs_file *file, struct rt_pollreq *req);
|
||||
|
@ -275,7 +275,7 @@ int dfs_devfs_ioctl(struct dfs_file *file, int cmd, void *args)
|
|||
return result;
|
||||
}
|
||||
|
||||
int dfs_devfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos)
|
||||
ssize_t dfs_devfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos)
|
||||
{
|
||||
int result;
|
||||
rt_device_t dev_id;
|
||||
|
@ -296,7 +296,7 @@ int dfs_devfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos)
|
|||
return result;
|
||||
}
|
||||
|
||||
int dfs_devfs_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos)
|
||||
ssize_t dfs_devfs_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos)
|
||||
{
|
||||
int result;
|
||||
rt_device_t dev_id;
|
||||
|
|
|
@ -557,7 +557,7 @@ int dfs_elm_ioctl(struct dfs_file *file, int cmd, void *args)
|
|||
return -ENOSYS;
|
||||
}
|
||||
|
||||
int dfs_elm_read(struct dfs_file *file, void *buf, size_t len, off_t *pos)
|
||||
ssize_t dfs_elm_read(struct dfs_file *file, void *buf, size_t len, off_t *pos)
|
||||
{
|
||||
FIL *fd;
|
||||
FRESULT result;
|
||||
|
@ -581,7 +581,7 @@ int dfs_elm_read(struct dfs_file *file, void *buf, size_t len, off_t *pos)
|
|||
return elm_result_to_dfs(result);
|
||||
}
|
||||
|
||||
int dfs_elm_write(struct dfs_file *file, const void *buf, size_t len, off_t *pos)
|
||||
ssize_t dfs_elm_write(struct dfs_file *file, const void *buf, size_t len, off_t *pos)
|
||||
{
|
||||
FIL *fd;
|
||||
FRESULT result;
|
||||
|
@ -618,7 +618,7 @@ int dfs_elm_flush(struct dfs_file *file)
|
|||
return elm_result_to_dfs(result);
|
||||
}
|
||||
|
||||
int dfs_elm_lseek(struct dfs_file *file, off_t offset, int wherece)
|
||||
off_t dfs_elm_lseek(struct dfs_file *file, off_t offset, int wherece)
|
||||
{
|
||||
FRESULT result = FR_OK;
|
||||
if (file->vnode->type == FT_REGULAR)
|
||||
|
|
|
@ -228,7 +228,7 @@ static int dfs_romfs_free_vnode(struct dfs_vnode *vnode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dfs_romfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos)
|
||||
static ssize_t dfs_romfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos)
|
||||
{
|
||||
rt_size_t length;
|
||||
struct romfs_dirent *dirent;
|
||||
|
|
|
@ -272,7 +272,7 @@ find_subpath:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos)
|
||||
static ssize_t dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count, off_t *pos)
|
||||
{
|
||||
rt_size_t length;
|
||||
struct tmpfs_file *d_file;
|
||||
|
@ -295,7 +295,7 @@ static int dfs_tmpfs_read(struct dfs_file *file, void *buf, size_t count, off_t
|
|||
return length;
|
||||
}
|
||||
|
||||
static int dfs_tmpfs_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos)
|
||||
static ssize_t dfs_tmpfs_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos)
|
||||
{
|
||||
struct tmpfs_file *d_file;
|
||||
struct tmpfs_sb *superblock;
|
||||
|
@ -334,7 +334,7 @@ static int dfs_tmpfs_write(struct dfs_file *file, const void *buf, size_t count,
|
|||
return count;
|
||||
}
|
||||
|
||||
static int dfs_tmpfs_lseek(struct dfs_file *file, off_t offset, int wherece)
|
||||
static off_t dfs_tmpfs_lseek(struct dfs_file *file, off_t offset, int wherece)
|
||||
{
|
||||
if (offset <= (off_t)file->vnode->size)
|
||||
{
|
||||
|
|
|
@ -39,10 +39,10 @@ struct dfs_file_ops
|
|||
int (*open)(struct dfs_file *file);
|
||||
int (*close)(struct dfs_file *file);
|
||||
int (*ioctl)(struct dfs_file *file, int cmd, void *arg);
|
||||
int (*read)(struct dfs_file *file, void *buf, size_t count, off_t *pos);
|
||||
int (*write)(struct dfs_file *file, const void *buf, size_t count, off_t *pos);
|
||||
ssize_t (*read)(struct dfs_file *file, void *buf, size_t count, off_t *pos);
|
||||
ssize_t (*write)(struct dfs_file *file, const void *buf, size_t count, off_t *pos);
|
||||
int (*flush)(struct dfs_file *file);
|
||||
int (*lseek)(struct dfs_file *file, off_t offset, int wherece);
|
||||
off_t (*lseek)(struct dfs_file *file, off_t offset, int wherece);
|
||||
int (*truncate)(struct dfs_file *file, off_t offset);
|
||||
int (*getdents)(struct dfs_file *file, struct dirent *dirp, uint32_t count);
|
||||
int (*poll)(struct dfs_file *file, struct rt_pollreq *req);
|
||||
|
@ -142,7 +142,7 @@ int dfs_file_close(struct dfs_file *file);
|
|||
|
||||
ssize_t dfs_file_read(struct dfs_file *file, void *buf, size_t len);
|
||||
ssize_t dfs_file_write(struct dfs_file *file, const void *buf, size_t len);
|
||||
int generic_dfs_lseek(struct dfs_file *file, off_t offset, int whence);
|
||||
off_t generic_dfs_lseek(struct dfs_file *file, off_t offset, int whence);
|
||||
off_t dfs_file_lseek(struct dfs_file *file, off_t offset, int wherece);
|
||||
int dfs_file_stat(const char *path, struct stat *buf);
|
||||
int dfs_file_lstat(const char *path, struct stat *buf);
|
||||
|
|
|
@ -652,7 +652,7 @@ ssize_t dfs_file_write(struct dfs_file *file, const void *buf, size_t len)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int generic_dfs_lseek(struct dfs_file *file, off_t offset, int whence)
|
||||
off_t generic_dfs_lseek(struct dfs_file *file, off_t offset, int whence)
|
||||
{
|
||||
off_t foffset;
|
||||
|
||||
|
|
|
@ -203,9 +203,9 @@ static int pipe_fops_ioctl(struct dfs_file *fd, int cmd, void *args)
|
|||
* When the return value is -EAGAIN, it means there are no data to be read.
|
||||
*/
|
||||
#ifdef RT_USING_DFS_V2
|
||||
static int pipe_fops_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos)
|
||||
static ssize_t pipe_fops_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos)
|
||||
#else
|
||||
static int pipe_fops_read(struct dfs_file *fd, void *buf, size_t count)
|
||||
static ssize_t pipe_fops_read(struct dfs_file *fd, void *buf, size_t count)
|
||||
#endif
|
||||
{
|
||||
int len = 0;
|
||||
|
@ -261,9 +261,9 @@ out:
|
|||
* When the return value is -EPIPE, it means there is no thread that has the pipe open for reading.
|
||||
*/
|
||||
#ifdef RT_USING_DFS_V2
|
||||
static int pipe_fops_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos)
|
||||
static ssize_t pipe_fops_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos)
|
||||
#else
|
||||
static int pipe_fops_write(struct dfs_file *fd, const void *buf, size_t count)
|
||||
static ssize_t pipe_fops_write(struct dfs_file *fd, const void *buf, size_t count)
|
||||
#endif
|
||||
{
|
||||
int len;
|
||||
|
|
|
@ -136,9 +136,9 @@ static int serial_fops_ioctl(struct dfs_file *fd, int cmd, void *args)
|
|||
}
|
||||
|
||||
#ifdef RT_USING_DFS_V2
|
||||
static int serial_fops_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos)
|
||||
static ssize_t serial_fops_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos)
|
||||
#else
|
||||
static int serial_fops_read(struct dfs_file *fd, void *buf, size_t count)
|
||||
static ssize_t serial_fops_read(struct dfs_file *fd, void *buf, size_t count)
|
||||
#endif
|
||||
{
|
||||
int size = 0;
|
||||
|
@ -174,9 +174,9 @@ static int serial_fops_read(struct dfs_file *fd, void *buf, size_t count)
|
|||
}
|
||||
|
||||
#ifdef RT_USING_DFS_V2
|
||||
static int serial_fops_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos)
|
||||
static ssize_t serial_fops_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos)
|
||||
#else
|
||||
static int serial_fops_write(struct dfs_file *fd, const void *buf, size_t count)
|
||||
static ssize_t serial_fops_write(struct dfs_file *fd, const void *buf, size_t count)
|
||||
#endif
|
||||
{
|
||||
rt_device_t device;
|
||||
|
|
|
@ -306,9 +306,9 @@ static int tty_ioctl(struct dfs_file *fd, int cmd, void *args)
|
|||
}
|
||||
|
||||
#ifdef RT_USING_DFS_V2
|
||||
static int tty_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos)
|
||||
static ssize_t tty_read(struct dfs_file *fd, void *buf, size_t count, off_t *pos)
|
||||
#else
|
||||
static int tty_read(struct dfs_file *fd, void *buf, size_t count)
|
||||
static ssize_t tty_read(struct dfs_file *fd, void *buf, size_t count)
|
||||
#endif
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -327,9 +327,9 @@ static int tty_read(struct dfs_file *fd, void *buf, size_t count)
|
|||
}
|
||||
|
||||
#ifdef RT_USING_DFS_V2
|
||||
static int tty_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos)
|
||||
static ssize_t tty_write(struct dfs_file *fd, const void *buf, size_t count, off_t *pos)
|
||||
#else
|
||||
static int tty_write(struct dfs_file *fd, const void *buf, size_t count )
|
||||
static ssize_t tty_write(struct dfs_file *fd, const void *buf, size_t count )
|
||||
#endif
|
||||
{
|
||||
int ret = 0;
|
||||
|
|
|
@ -47,9 +47,9 @@ static int dfs_net_ioctl(struct dfs_file* file, int cmd, void* args)
|
|||
}
|
||||
|
||||
#ifdef RT_USING_DFS_V2
|
||||
static int dfs_net_read(struct dfs_file* file, void *buf, size_t count, off_t *pos)
|
||||
static ssize_t dfs_net_read(struct dfs_file* file, void *buf, size_t count, off_t *pos)
|
||||
#else
|
||||
static int dfs_net_read(struct dfs_file* file, void *buf, size_t count)
|
||||
static ssize_t dfs_net_read(struct dfs_file* file, void *buf, size_t count)
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
|
@ -66,9 +66,9 @@ static int dfs_net_read(struct dfs_file* file, void *buf, size_t count)
|
|||
}
|
||||
|
||||
#ifdef RT_USING_DFS_V2
|
||||
static int dfs_net_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos)
|
||||
static ssize_t dfs_net_write(struct dfs_file *file, const void *buf, size_t count, off_t *pos)
|
||||
#else
|
||||
static int dfs_net_write(struct dfs_file *file, const void *buf, size_t count)
|
||||
static ssize_t dfs_net_write(struct dfs_file *file, const void *buf, size_t count)
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
|
|
Loading…
Reference in New Issue