Special Functions.
[File System API.]

Collaboration diagram for Special Functions.:
UNIX compatible file system functions. More...


Modules

 Reading Directories
 UNIX compatible directory read functions.

Data Structures

struct  dirent
 Directory entry structure. More...
struct  DIR
 Internally used directory information structure. More...
struct  IOCTL_ARG2
 General structure for two arguments. More...
struct  IOCTL_ARG3
 General structure for three arguments. More...
struct  FSCP_VOL_MOUNT
struct  FSCP_RENAME
struct  FSCP_STATUS
struct  stat
 File status structure. More...

File System Directory Configuration

The Nut/OS Configurator may be used to override the default values.

#define MAXNAMLEN   255
 UDP port of DHCP server.

File System I/O Control Codes

#define FS_STATUS   0x1101
 Obtain information about a specified file entry.
#define FS_DIR_CREATE   0x1111
 Create a new directory entry.
#define FS_DIR_REMOVE   0x1112
 Remove a previously created directory entry.
#define FS_DIR_OPEN   0x1113
 Open a directory stream.
#define FS_DIR_CLOSE   0x1114
 Close a directory stream.
#define FS_DIR_READ   0x1115
 Read the next directory entry.
#define FS_FILE_STATUS   0x1121
 Obtain information about an opened file.
#define FS_FILE_DELETE   0x1122
 Remove a previously created file.
#define FS_FILE_SEEK   0x1123
 Set a file pointer position.

Defines

#define FS_VOL_MOUNT   0x1130
#define FS_VOL_UNMOUNT   0x1131
#define FS_RENAME   0x1132
#define NUTFS_UNLINK   0x1133
#define NUTFS_MKDIR   0x1134
#define NUTFS_RMDIR   0x1135
#define S_ISDIR(m)   ((m) != 0)
 Check for directory.
#define S_ISREG(m)   ((m) == 0)
 Check for regular file.

Functions

int access (CONST char *path, int what)
 Check the accessibility of a file.
long lseek (int fh, long pos, int whence)
 Reposition a file pointer.
int rmdir (CONST char *path)
 Remove a directory.
int unlink (CONST char *path)
 Remove a file entry.
int stat (CONST char *path, struct stat *s)
 Get information about a specified file.
int fstat (int fh, struct stat *s)
 Get information about an opened file.
int mkdir (CONST char *path, int mode)
 Create a directory entry.
int rename (CONST char *old_name, CONST char *new_name)
 Rename a file.

Detailed Description

UNIX compatible file system functions.


Define Documentation

#define MAXNAMLEN   255

UDP port of DHCP server.

Definition at line 108 of file dirent.h.

#define FS_STATUS   0x1101

Obtain information about a specified file entry.

Definition at line 79 of file fs.h.

Referenced by PnutIOCtl(), and stat().

#define FS_DIR_CREATE   0x1111

Create a new directory entry.

Definition at line 84 of file fs.h.

Referenced by mkdir(), and PnutIOCtl().

#define FS_DIR_REMOVE   0x1112

Remove a previously created directory entry.

Definition at line 89 of file fs.h.

Referenced by PnutIOCtl(), and rmdir().

#define FS_DIR_OPEN   0x1113

Open a directory stream.

Definition at line 94 of file fs.h.

Referenced by opendir(), and PnutIOCtl().

#define FS_DIR_CLOSE   0x1114

Close a directory stream.

Definition at line 99 of file fs.h.

Referenced by closedir(), and PnutIOCtl().

#define FS_DIR_READ   0x1115

Read the next directory entry.

Definition at line 104 of file fs.h.

Referenced by PnutIOCtl(), and readdir().

#define FS_FILE_STATUS   0x1121

Obtain information about an opened file.

Definition at line 109 of file fs.h.

Referenced by PnutIOCtl().

#define FS_FILE_DELETE   0x1122

Remove a previously created file.

Definition at line 114 of file fs.h.

Referenced by PnutIOCtl(), and unlink().

#define FS_FILE_SEEK   0x1123

Set a file pointer position.

Definition at line 119 of file fs.h.

Referenced by _seek(), _tell(), PnutIOCtl(), and UromIOCtl().

#define FS_VOL_MOUNT   0x1130

Definition at line 123 of file fs.h.

Referenced by MmCardMount(), and NutBlockDeviceOpen().

#define FS_VOL_UNMOUNT   0x1131

Definition at line 124 of file fs.h.

Referenced by MmCardUnmount(), and NutBlockDeviceClose().

#define FS_RENAME   0x1132

Definition at line 125 of file fs.h.

Referenced by rename().

#define NUTFS_UNLINK   0x1133

Definition at line 126 of file fs.h.

#define NUTFS_MKDIR   0x1134

Definition at line 127 of file fs.h.

#define NUTFS_RMDIR   0x1135

Definition at line 128 of file fs.h.

#define S_ISDIR (  )     ((m) != 0)

Check for directory.

Definition at line 79 of file stat.h.

Referenced by NutFtpProcessCwd(), and NutFtpTransferDirectory().

#define S_ISREG (  )     ((m) == 0)

Check for regular file.

Definition at line 80 of file stat.h.


Function Documentation

int access ( CONST char *  path,
int  what 
)

Check the accessibility of a file.

Parameters:
path Pathname of the file to check.
what Access permission to check. Set to F_OK for existence check or any of the following values or'ed:
  • R_OK checks read permission
  • W_OK checks write permission
  • X_OK checks execute permission
Returns:
0 on success, otherwise -1 is returned.
Note:
Access permissions are not supported by all file systems.

Definition at line 136 of file pathops.c.

References stat().

long lseek ( int  fh,
long  pos,
int  whence 
)

Reposition a file pointer.

Parameters:
fh Handle of an open file.
pos Positioning value.
whence Positioning directive.
Returns:
Always -1 due to missing implementation.

Definition at line 155 of file pathops.c.

int rmdir ( CONST char *  path  ) 

Remove a directory.

Parameters:
path Pathname of the directory. Must be the full pathname including the device, because Nut/OS doesn't support relative paths.
Returns:
0 if the remove succeeds, otherwise -1 is returned.

Definition at line 175 of file pathops.c.

References FS_DIR_REMOVE.

int unlink ( CONST char *  path  ) 

Remove a file entry.

Returns:
0 if the remove succeeds, otherwise -1 is returned.

Definition at line 185 of file pathops.c.

References FS_FILE_DELETE.

int stat ( CONST char *  path,
struct stat s 
)

Get information about a specified file.

Returns:
0 if the query succeeds, otherwise -1 is returned.

Definition at line 196 of file pathops.c.

References CONST, _NUTDEVICE::dev_ioctl, FS_STATUS, NutDeviceLookup(), FSCP_STATUS::par_path, and FSCP_STATUS::par_stp.

int fstat ( int  fh,
struct stat s 
)

Get information about an opened file.

Returns:
Always -1 due to missing implementation.

Definition at line 227 of file pathops.c.

int mkdir ( CONST char *  path,
int  mode 
)

Create a directory entry.

Returns:
0 on success, otherwise -1 is returned.

Definition at line 237 of file pathops.c.

References FS_DIR_CREATE.

int rename ( CONST char *  old_name,
CONST char *  new_name 
)

Rename a file.

New and old filename must contain the name of a registered device, followed by a colon and a filename. Moving a file from one device to another is not supported.

Parameters:
old_name Pathname of an existing file.
new_name New pathname.
Returns:
0 for success or -1 to indicate an error.

Definition at line 254 of file pathops.c.

References CONST, _NUTDEVICE::dev_ioctl, ENOENT, errno, FS_RENAME, NutDeviceLookup(), FSCP_RENAME::par_new, FSCP_RENAME::par_old, and strcmp().


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/