forked from Imagelibrary/rtems
Filesystem: Use ioctl_command_t
This commit is contained in:
@@ -832,9 +832,9 @@ typedef ssize_t (*rtems_filesystem_write_t)(
|
||||
* @see rtems_filesystem_default_ioctl().
|
||||
*/
|
||||
typedef int (*rtems_filesystem_ioctl_t)(
|
||||
rtems_libio_t *iop,
|
||||
uint32_t request,
|
||||
void *buffer
|
||||
rtems_libio_t *iop,
|
||||
ioctl_command_t request,
|
||||
void *buffer
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1008,9 +1008,9 @@ ssize_t rtems_filesystem_default_write(
|
||||
* @see rtems_filesystem_ioctl_t.
|
||||
*/
|
||||
int rtems_filesystem_default_ioctl(
|
||||
rtems_libio_t *iop,
|
||||
uint32_t command,
|
||||
void *buffer
|
||||
rtems_libio_t *iop,
|
||||
ioctl_command_t request,
|
||||
void *buffer
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1225,7 +1225,7 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
rtems_libio_t *iop;
|
||||
uint32_t command;
|
||||
ioctl_command_t command;
|
||||
void *buffer;
|
||||
int ioctl_return;
|
||||
} rtems_libio_ioctl_args_t;
|
||||
|
||||
@@ -83,15 +83,12 @@
|
||||
#define FIOSETOWN _IOW('f', 124, int) /* set owner */
|
||||
#define FIOGETOWN _IOR('f', 123, int) /* get owner */
|
||||
|
||||
typedef uint32_t ioctl_command_t;
|
||||
|
||||
#ifndef _KERNEL
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifndef __ioctl_command_defined
|
||||
typedef u_int32_t ioctl_command_t;
|
||||
#define __ioctl_command_defined
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
int ioctl(int, ioctl_command_t, ...);
|
||||
__END_DECLS
|
||||
|
||||
@@ -7,14 +7,16 @@
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*/
|
||||
|
||||
#include <rtems/libio.h>
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
int rtems_filesystem_default_ioctl(
|
||||
rtems_libio_t *iop,
|
||||
uint32_t command,
|
||||
void *buffer
|
||||
rtems_libio_t *iop,
|
||||
ioctl_command_t request,
|
||||
void *buffer
|
||||
)
|
||||
{
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
@@ -137,9 +137,9 @@ extern ssize_t devFS_write(
|
||||
*/
|
||||
|
||||
extern int devFS_ioctl(
|
||||
rtems_libio_t *iop,
|
||||
uint32_t command,
|
||||
void *buffer
|
||||
rtems_libio_t *iop,
|
||||
ioctl_command_t command,
|
||||
void *buffer
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
#include "devfs.h"
|
||||
|
||||
int devFS_ioctl(
|
||||
rtems_libio_t *iop,
|
||||
uint32_t command,
|
||||
void *buffer
|
||||
rtems_libio_t *iop,
|
||||
ioctl_command_t command,
|
||||
void *buffer
|
||||
)
|
||||
{
|
||||
rtems_libio_ioctl_args_t args;
|
||||
|
||||
@@ -162,9 +162,9 @@ ssize_t device_write(
|
||||
*/
|
||||
|
||||
int device_ioctl(
|
||||
rtems_libio_t *iop,
|
||||
uint32_t command,
|
||||
void *buffer
|
||||
rtems_libio_t *iop,
|
||||
ioctl_command_t command,
|
||||
void *buffer
|
||||
)
|
||||
{
|
||||
rtems_libio_ioctl_args_t args;
|
||||
|
||||
@@ -435,12 +435,6 @@ extern ssize_t memfile_write(
|
||||
size_t count /* IN */
|
||||
);
|
||||
|
||||
extern int memfile_ioctl(
|
||||
rtems_libio_t *iop, /* IN */
|
||||
uint32_t command, /* IN */
|
||||
void *buffer /* IN */
|
||||
);
|
||||
|
||||
extern int device_open(
|
||||
rtems_libio_t *iop, /* IN */
|
||||
const char *pathname, /* IN */
|
||||
@@ -465,9 +459,9 @@ extern ssize_t device_write(
|
||||
);
|
||||
|
||||
extern int device_ioctl(
|
||||
rtems_libio_t *iop, /* IN */
|
||||
uint32_t command, /* IN */
|
||||
void *buffer /* IN */
|
||||
rtems_libio_t *iop,
|
||||
ioctl_command_t command,
|
||||
void *buffer
|
||||
);
|
||||
|
||||
extern int device_ftruncate(
|
||||
|
||||
@@ -83,9 +83,9 @@ static ssize_t IMFS_fifo_write(
|
||||
}
|
||||
|
||||
static int IMFS_fifo_ioctl(
|
||||
rtems_libio_t *iop,
|
||||
uint32_t command,
|
||||
void *buffer
|
||||
rtems_libio_t *iop,
|
||||
ioctl_command_t command,
|
||||
void *buffer
|
||||
)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -33,7 +33,7 @@ static const rtems_filesystem_file_handlers_r IMFS_memfile_handlers = {
|
||||
rtems_filesystem_default_close,
|
||||
memfile_read,
|
||||
memfile_write,
|
||||
memfile_ioctl,
|
||||
rtems_filesystem_default_ioctl,
|
||||
rtems_filesystem_default_lseek_file,
|
||||
IMFS_stat_file,
|
||||
memfile_ftruncate,
|
||||
|
||||
@@ -151,22 +151,6 @@ ssize_t memfile_write(
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* memfile_ioctl
|
||||
*
|
||||
* This routine processes the ioctl() system call.
|
||||
*
|
||||
* NOTE: No ioctl()'s are supported for in-memory files.
|
||||
*/
|
||||
int memfile_ioctl(
|
||||
rtems_libio_t *iop,
|
||||
uint32_t command,
|
||||
void *buffer
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* memfile_stat
|
||||
*
|
||||
|
||||
@@ -549,10 +549,10 @@ out_nolock:
|
||||
* Interface to file system ioctl.
|
||||
*/
|
||||
int pipe_ioctl(
|
||||
pipe_control_t *pipe,
|
||||
uint32_t cmd,
|
||||
void *buffer,
|
||||
rtems_libio_t *iop
|
||||
pipe_control_t *pipe,
|
||||
ioctl_command_t cmd,
|
||||
void *buffer,
|
||||
rtems_libio_t *iop
|
||||
)
|
||||
{
|
||||
if (cmd == FIONREAD) {
|
||||
|
||||
@@ -96,10 +96,10 @@ extern ssize_t pipe_write(
|
||||
* Interface to file system ioctl.
|
||||
*/
|
||||
extern int pipe_ioctl(
|
||||
pipe_control_t *pipe,
|
||||
uint32_t cmd,
|
||||
void *buffer,
|
||||
rtems_libio_t *iop
|
||||
pipe_control_t *pipe,
|
||||
ioctl_command_t cmd,
|
||||
void *buffer,
|
||||
rtems_libio_t *iop
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -194,9 +194,9 @@ rtems_rfs_rtems_device_write (rtems_libio_t* iop,
|
||||
*/
|
||||
|
||||
static int
|
||||
rtems_rfs_rtems_device_ioctl (rtems_libio_t* iop,
|
||||
uint32_t command,
|
||||
void* buffer)
|
||||
rtems_rfs_rtems_device_ioctl (rtems_libio_t* iop,
|
||||
ioctl_command_t command,
|
||||
void* buffer)
|
||||
{
|
||||
rtems_libio_ioctl_args_t args;
|
||||
rtems_status_code status;
|
||||
|
||||
@@ -256,22 +256,6 @@ rtems_rfs_rtems_file_write (rtems_libio_t* iop,
|
||||
return write;
|
||||
}
|
||||
|
||||
/**
|
||||
* This routine processes the ioctl() system call.
|
||||
*
|
||||
* @note No ioctl()'s are currently supported for RFS files.
|
||||
*
|
||||
* @param iop
|
||||
* @param command
|
||||
* @param buffer
|
||||
*/
|
||||
|
||||
static int
|
||||
rtems_rfs_rtems_file_ioctl (rtems_libio_t* iop, uint32_t command, void* buffer)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This routine processes the lseek() system call.
|
||||
*
|
||||
@@ -351,7 +335,7 @@ const rtems_filesystem_file_handlers_r rtems_rfs_rtems_file_handlers = {
|
||||
.close_h = rtems_rfs_rtems_file_close,
|
||||
.read_h = rtems_rfs_rtems_file_read,
|
||||
.write_h = rtems_rfs_rtems_file_write,
|
||||
.ioctl_h = rtems_rfs_rtems_file_ioctl,
|
||||
.ioctl_h = rtems_filesystem_default_ioctl,
|
||||
.lseek_h = rtems_rfs_rtems_file_lseek,
|
||||
.fstat_h = rtems_rfs_rtems_fstat,
|
||||
.ftruncate_h = rtems_rfs_rtems_file_ftruncate,
|
||||
|
||||
@@ -22,12 +22,6 @@ typedef long long vm_ooffset_t;
|
||||
typedef unsigned int vm_pindex_t;
|
||||
typedef unsigned int vm_size_t;
|
||||
|
||||
#ifndef __ioctl_command_defined
|
||||
typedef u_int32_t ioctl_command_t;
|
||||
#define __ioctl_command_defined
|
||||
#endif
|
||||
|
||||
|
||||
#define _BSD_OFF_T_ int32_t
|
||||
#define _BSD_PID_T_ rtems_id
|
||||
#define _BSD_VA_LIST_ char *
|
||||
@@ -38,6 +32,7 @@ typedef u_int32_t ioctl_command_t;
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
struct mdproc {
|
||||
int md_flags;
|
||||
|
||||
@@ -334,9 +334,7 @@ int main(
|
||||
puts("create /tmp/john");
|
||||
fd = open( "/tmp/john", O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
|
||||
rtems_test_assert( fd != -1 );
|
||||
|
||||
puts("tcdrain /tmp/john" );
|
||||
status = tcdrain( fd );
|
||||
status = close( fd );
|
||||
rtems_test_assert( status == 0 );
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user