Filesystem: Use ioctl_command_t

This commit is contained in:
Sebastian Huber
2012-05-14 13:16:31 +02:00
parent a1c6b96ac7
commit df01da6707
16 changed files with 46 additions and 92 deletions

View File

@@ -832,9 +832,9 @@ typedef ssize_t (*rtems_filesystem_write_t)(
* @see rtems_filesystem_default_ioctl(). * @see rtems_filesystem_default_ioctl().
*/ */
typedef int (*rtems_filesystem_ioctl_t)( typedef int (*rtems_filesystem_ioctl_t)(
rtems_libio_t *iop, rtems_libio_t *iop,
uint32_t request, ioctl_command_t request,
void *buffer void *buffer
); );
/** /**
@@ -1008,9 +1008,9 @@ ssize_t rtems_filesystem_default_write(
* @see rtems_filesystem_ioctl_t. * @see rtems_filesystem_ioctl_t.
*/ */
int rtems_filesystem_default_ioctl( int rtems_filesystem_default_ioctl(
rtems_libio_t *iop, rtems_libio_t *iop,
uint32_t command, ioctl_command_t request,
void *buffer void *buffer
); );
/** /**
@@ -1225,7 +1225,7 @@ typedef struct {
*/ */
typedef struct { typedef struct {
rtems_libio_t *iop; rtems_libio_t *iop;
uint32_t command; ioctl_command_t command;
void *buffer; void *buffer;
int ioctl_return; int ioctl_return;
} rtems_libio_ioctl_args_t; } rtems_libio_ioctl_args_t;

View File

@@ -83,15 +83,12 @@
#define FIOSETOWN _IOW('f', 124, int) /* set owner */ #define FIOSETOWN _IOW('f', 124, int) /* set owner */
#define FIOGETOWN _IOR('f', 123, int) /* get owner */ #define FIOGETOWN _IOR('f', 123, int) /* get owner */
typedef uint32_t ioctl_command_t;
#ifndef _KERNEL #ifndef _KERNEL
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef __ioctl_command_defined
typedef u_int32_t ioctl_command_t;
#define __ioctl_command_defined
#endif
__BEGIN_DECLS __BEGIN_DECLS
int ioctl(int, ioctl_command_t, ...); int ioctl(int, ioctl_command_t, ...);
__END_DECLS __END_DECLS

View File

@@ -7,14 +7,16 @@
* http://www.rtems.com/license/LICENSE. * http://www.rtems.com/license/LICENSE.
*/ */
#include <rtems/libio.h> #if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/libio_.h> #include <rtems/libio_.h>
#include <rtems/seterr.h>
int rtems_filesystem_default_ioctl( int rtems_filesystem_default_ioctl(
rtems_libio_t *iop, rtems_libio_t *iop,
uint32_t command, ioctl_command_t request,
void *buffer void *buffer
) )
{ {
rtems_set_errno_and_return_minus_one( ENOTSUP ); rtems_set_errno_and_return_minus_one( ENOTSUP );

View File

@@ -137,9 +137,9 @@ extern ssize_t devFS_write(
*/ */
extern int devFS_ioctl( extern int devFS_ioctl(
rtems_libio_t *iop, rtems_libio_t *iop,
uint32_t command, ioctl_command_t command,
void *buffer void *buffer
); );

View File

@@ -14,9 +14,9 @@
#include "devfs.h" #include "devfs.h"
int devFS_ioctl( int devFS_ioctl(
rtems_libio_t *iop, rtems_libio_t *iop,
uint32_t command, ioctl_command_t command,
void *buffer void *buffer
) )
{ {
rtems_libio_ioctl_args_t args; rtems_libio_ioctl_args_t args;

View File

@@ -162,9 +162,9 @@ ssize_t device_write(
*/ */
int device_ioctl( int device_ioctl(
rtems_libio_t *iop, rtems_libio_t *iop,
uint32_t command, ioctl_command_t command,
void *buffer void *buffer
) )
{ {
rtems_libio_ioctl_args_t args; rtems_libio_ioctl_args_t args;

View File

@@ -435,12 +435,6 @@ extern ssize_t memfile_write(
size_t count /* IN */ size_t count /* IN */
); );
extern int memfile_ioctl(
rtems_libio_t *iop, /* IN */
uint32_t command, /* IN */
void *buffer /* IN */
);
extern int device_open( extern int device_open(
rtems_libio_t *iop, /* IN */ rtems_libio_t *iop, /* IN */
const char *pathname, /* IN */ const char *pathname, /* IN */
@@ -465,9 +459,9 @@ extern ssize_t device_write(
); );
extern int device_ioctl( extern int device_ioctl(
rtems_libio_t *iop, /* IN */ rtems_libio_t *iop,
uint32_t command, /* IN */ ioctl_command_t command,
void *buffer /* IN */ void *buffer
); );
extern int device_ftruncate( extern int device_ftruncate(

View File

@@ -83,9 +83,9 @@ static ssize_t IMFS_fifo_write(
} }
static int IMFS_fifo_ioctl( static int IMFS_fifo_ioctl(
rtems_libio_t *iop, rtems_libio_t *iop,
uint32_t command, ioctl_command_t command,
void *buffer void *buffer
) )
{ {
int err; int err;

View File

@@ -33,7 +33,7 @@ static const rtems_filesystem_file_handlers_r IMFS_memfile_handlers = {
rtems_filesystem_default_close, rtems_filesystem_default_close,
memfile_read, memfile_read,
memfile_write, memfile_write,
memfile_ioctl, rtems_filesystem_default_ioctl,
rtems_filesystem_default_lseek_file, rtems_filesystem_default_lseek_file,
IMFS_stat_file, IMFS_stat_file,
memfile_ftruncate, memfile_ftruncate,

View File

@@ -151,22 +151,6 @@ ssize_t memfile_write(
return status; 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 * memfile_stat
* *

View File

@@ -549,10 +549,10 @@ out_nolock:
* Interface to file system ioctl. * Interface to file system ioctl.
*/ */
int pipe_ioctl( int pipe_ioctl(
pipe_control_t *pipe, pipe_control_t *pipe,
uint32_t cmd, ioctl_command_t cmd,
void *buffer, void *buffer,
rtems_libio_t *iop rtems_libio_t *iop
) )
{ {
if (cmd == FIONREAD) { if (cmd == FIONREAD) {

View File

@@ -96,10 +96,10 @@ extern ssize_t pipe_write(
* Interface to file system ioctl. * Interface to file system ioctl.
*/ */
extern int pipe_ioctl( extern int pipe_ioctl(
pipe_control_t *pipe, pipe_control_t *pipe,
uint32_t cmd, ioctl_command_t cmd,
void *buffer, void *buffer,
rtems_libio_t *iop rtems_libio_t *iop
); );
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -194,9 +194,9 @@ rtems_rfs_rtems_device_write (rtems_libio_t* iop,
*/ */
static int static int
rtems_rfs_rtems_device_ioctl (rtems_libio_t* iop, rtems_rfs_rtems_device_ioctl (rtems_libio_t* iop,
uint32_t command, ioctl_command_t command,
void* buffer) void* buffer)
{ {
rtems_libio_ioctl_args_t args; rtems_libio_ioctl_args_t args;
rtems_status_code status; rtems_status_code status;

View File

@@ -256,22 +256,6 @@ rtems_rfs_rtems_file_write (rtems_libio_t* iop,
return write; 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. * 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, .close_h = rtems_rfs_rtems_file_close,
.read_h = rtems_rfs_rtems_file_read, .read_h = rtems_rfs_rtems_file_read,
.write_h = rtems_rfs_rtems_file_write, .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, .lseek_h = rtems_rfs_rtems_file_lseek,
.fstat_h = rtems_rfs_rtems_fstat, .fstat_h = rtems_rfs_rtems_fstat,
.ftruncate_h = rtems_rfs_rtems_file_ftruncate, .ftruncate_h = rtems_rfs_rtems_file_ftruncate,

View File

@@ -22,12 +22,6 @@ typedef long long vm_ooffset_t;
typedef unsigned int vm_pindex_t; typedef unsigned int vm_pindex_t;
typedef unsigned int vm_size_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_OFF_T_ int32_t
#define _BSD_PID_T_ rtems_id #define _BSD_PID_T_ rtems_id
#define _BSD_VA_LIST_ char * #define _BSD_VA_LIST_ char *
@@ -38,6 +32,7 @@ typedef u_int32_t ioctl_command_t;
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/ioctl.h>
struct mdproc { struct mdproc {
int md_flags; int md_flags;

View File

@@ -334,9 +334,7 @@ int main(
puts("create /tmp/john"); puts("create /tmp/john");
fd = open( "/tmp/john", O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO ); fd = open( "/tmp/john", O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
rtems_test_assert( fd != -1 ); rtems_test_assert( fd != -1 );
status = close( fd );
puts("tcdrain /tmp/john" );
status = tcdrain( fd );
rtems_test_assert( status == 0 ); rtems_test_assert( status == 0 );
/* /*