osal_file.h

Overview

Related Modules:

OSAL

Description:

Declares the file structures and interfaces.

This file provides interfaces for opening, closing, reading, and writing a file, and setting the read/write offset.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

OsalFile

Declares a file type.

Macros

Macro Name and Value

Description

OSAL_O_RD_ONLY   0

Opens a file in read-only mode.

OSAL_O_WR_ONLY   1

Opens a file in write-only mode.

OSAL_O_RDWR   2

Opens a file in read and write mode.

OSAL_S_IREAD   00400

Defines the read permission for the owner.

OSAL_S_IWRITE   00200

Defines the write permission for the owner.

OSAL_S_IEXEC   00100

Defines the execution permission for the owner.

OSAL_S_IRGRP   00040

Defines the read permission for the group.

OSAL_S_IWGRP   00020

Defines the write permission for the group.

OSAL_S_IXGRP   00010

Defines the execution permission for the group.

OSAL_S_IROTH   00004

Defines the read permission for others.

OSAL_S_IWOTH   00002

Defines the write permission for others.

OSAL_S_IXOTH   00001

Defines the execution permission for others.

OSAL_SEEK_SET   0

Defines the offset from the file header.

OSAL_SEEK_CUR   1

Defines the offset from the current position.

OSAL_SEEK_END   2

Defines the offset from the end of the file.

Functions

Function Name

Description

OsalFileOpen (OsalFile file, const char path, int flags, uint32_t rights)

int32_t 

Opens a file.

OsalFileWrite (OsalFile file, const void string, uint32_t length)

ssize_t 

Writes a file.

OsalFileClose (OsalFile file)

void 

Closes a file.

OsalFileRead (OsalFile file, void buf, uint32_t length)

ssize_t 

Reads a file.

OsalFileLseek (OsalFile file, off_t offset, int32_t whence)

off_t 

Sets the file read/write offset.