RTEMS  5.0.0
Files | Data Structures | Functions | Variables
Device Only File System

This structure defines the type of device table. More...

Files

file  devclose.c
 Maps Close Operation to rtems_io_close.
 
file  devfs_eval.c
 Evaluate Patch.
 
file  devfs_init.c
 Creates the Main Device Table.
 
file  devfs_mknod.c
 Creates an item in the main device table.
 
file  devfs_show.c
 Retrieves and Prints all the Device Registered in System.
 
file  devioctl.c
 Maps ioctl Operation to rtems_io_ioctl.
 
file  devopen.c
 Maps Open Operation to rtems_io_open.
 
file  devstat.c
 Gets the Device File Information.
 
file  devwrite.c
 Writes Operation to rtems_io_write.
 

Data Structures

struct  devFS_node
 Per Device Node Control Structure. More...
 
struct  devFS_data
 

Functions

void devFS_eval_path (rtems_filesystem_eval_path_context_t *ctx)
 Evaluate Path.
 
int devFS_open (rtems_libio_t *iop, const char *pathname, int oflag, mode_t mode)
 Maps Open Operation to rtems_io_open. More...
 
int devFS_close (rtems_libio_t *iop)
 Maps Close Operation to rtems_io_close. More...
 
ssize_t devFS_read (rtems_libio_t *iop, void *buffer, size_t count)
 Maps Read Operation to rtems_io_read. More...
 
ssize_t devFS_write (rtems_libio_t *iop, const void *buffer, size_t count)
 Writes Operation to rtems_io_write. More...
 
int devFS_ioctl (rtems_libio_t *iop, ioctl_command_t command, void *buffer)
 Maps ioctl Operation to rtems_io_ioctl. More...
 
int devFS_stat (const rtems_filesystem_location_info_t *loc, struct stat *buf)
 Gets the Device File Information. More...
 
int devFS_mknod (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, mode_t mode, dev_t dev)
 Creates an item in the main device table. More...
 
int devFS_initialize (rtems_filesystem_mount_table_entry_t *mt_entry, const void *data)
 Creates the Main Device Table. More...
 
void devFS_Show (void)
 Retrieves and Prints all the Device Registered in System. More...
 

Variables

const rtems_filesystem_operations_table devFS_ops
 
const rtems_filesystem_file_handlers_r devFS_file_handlers
 

Detailed Description

This structure defines the type of device table.

Function Documentation

◆ devFS_close()

int devFS_close ( rtems_libio_t iop)

Maps Close Operation to rtems_io_close.

This handler maps close operation to rtems_io_close.

Parameters
iopThis is the RTEMS's internal representation of file
Return values
thesame as close

◆ devFS_initialize()

int devFS_initialize ( rtems_filesystem_mount_table_entry_t mt_entry,
const void *  data 
)

Creates the Main Device Table.

This routine is invoked upon rtems filesystem initialization. It is responsible for creating the main device table, initializing it to a known state, and set device file operation handlers. After this, the device-only filesytem is ready for use

Parameters
mt_entryThe filesystem mount table entry.
dataFilesystem specific data.
Return values
uponsuccess, this routine returns 0; otherwise it returns -1 and errno is set to proper value. The only error is when malloc failed, and errno is set to NOMEM.

◆ devFS_ioctl()

int devFS_ioctl ( rtems_libio_t iop,
ioctl_command_t  command,
void *  buffer 
)

Maps ioctl Operation to rtems_io_ioctl.

This handler maps ioctl operation to rtems_io_ioctl.

Parameters
iopThis is the RTEMS's internal representation of file
commandio control command
bufferio control parameters
Return values
Onsuccessful, this routine returns total bytes written. On error it returns -1 and errno is set to proper value.

◆ devFS_mknod()

int devFS_mknod ( const rtems_filesystem_location_info_t parentloc,
const char *  name,
size_t  namelen,
mode_t  mode,
dev_t  dev 
)

Creates an item in the main device table.

This routine is invoked upon registration of a new device file. It is responsible for creating a item in the main device table. This routine searches the device table in sequential order, when found a empty slot, it fills the slot with proper values.

See also
rtems_filesystem_mknod_t.

◆ devFS_open()

int devFS_open ( rtems_libio_t iop,
const char *  pathname,
int  oflag,
mode_t  mode 
)

Maps Open Operation to rtems_io_open.

This handler maps open operation to rtems_io_open.

Parameters
iopThis is the RTEMS's internal representation of file.
pathnamea null-terminated string that starts with /dev.
oflagaccess flags
modeaccess mode
Return values
thesame as open

◆ devFS_read()

ssize_t devFS_read ( rtems_libio_t iop,
void *  buffer,
size_t  count 
)

Maps Read Operation to rtems_io_read.

This handler maps read operation to rtems_io_read.

Parameters
iopThis is the RTEMS's internal representation of file
buffermemory location to store read data
counthow many bytes to read
Return values
Onsuccessful, this routine returns total bytes read. On error it returns -1 and errno is set to proper value.

◆ devFS_Show()

void devFS_Show ( void  )

Retrieves and Prints all the Device Registered in System.

This routine retrieves all the device registered in system, and prints out their detail information. For example, on one system, devFS_show will print out following message:

/dev/console 0 0
/dev/clock 1 0
/dev/tty0 0 0
/flash 2 0

This routine is intended for debugging, and can be used by shell program to provide user with the system information.

◆ devFS_stat()

int devFS_stat ( const rtems_filesystem_location_info_t loc,
struct stat *  buf 
)

Gets the Device File Information.

This handler gets the device file information. This routine only set the following member of struct stat:

  • st_dev: device number
  • st_mode: device file creation mode, only two mode are accepted:
    • S_IFCHR: character device file
    • S_IFBLK: block device file
Parameters
loccontains filesystem access information
bufbuffer to hold the device file's information
Return values
Onsuccessful, this routine returns 0. On error it returns -1 and errno is set to proper value.

◆ devFS_write()

ssize_t devFS_write ( rtems_libio_t iop,
const void *  buffer,
size_t  count 
)

Writes Operation to rtems_io_write.

This handler maps write operation to rtems_io_write.

Parameters
iopThis is the RTEMS's internal representation of file
bufferdata to be written
counthow many bytes to write
Return values
Onsuccessful, this routine returns total bytes written. On error it returns -1 and errno is set to proper value.

Variable Documentation

◆ devFS_file_handlers

const rtems_filesystem_file_handlers_r devFS_file_handlers

The following defines the device-only filesystem operating handlers.

◆ devFS_ops

The following defines the device-only filesystem operating operations.