RTEMS: cpukit/libfs/src/rfs/rtems-rfs-inode.c File Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Functions
rtems-rfs-inode.c File Reference
IO Library » File System Types and Mount » RTEMS File System Group Management

RTEMS File Systems Inode Routines. More...

`#include <inttypes.h>`
`#include <string.h>`
`#include <rtems/rfs/rtems-rfs-block.h>`
`#include <rtems/rfs/rtems-rfs-file-system.h>`
`#include <rtems/rfs/rtems-rfs-inode.h>`
`#include <rtems/rfs/rtems-rfs-dir.h>`

## Functions
int | rtems_rfs_inode_alloc (rtems_rfs_file_system *fs, rtems_rfs_bitmap_bit goal, rtems_rfs_ino *ino)
int | rtems_rfs_inode_free (rtems_rfs_file_system *fs, rtems_rfs_ino ino)
int | rtems_rfs_inode_open (rtems_rfs_file_system *fs, rtems_rfs_ino ino, rtems_rfs_inode_handle *handle, bool load)
int | rtems_rfs_inode_close (rtems_rfs_file_system *fs, rtems_rfs_inode_handle *handle)
int | rtems_rfs_inode_load (rtems_rfs_file_system *fs, rtems_rfs_inode_handle *handle)
int | rtems_rfs_inode_unload (rtems_rfs_file_system *fs, rtems_rfs_inode_handle *handle, bool update_ctime)
int | rtems_rfs_inode_create (rtems_rfs_file_system *fs, rtems_rfs_ino parent, const char *name, size_t length, uint16_t mode, uint16_t links, uid_t uid, gid_t gid, rtems_rfs_ino *ino)
int | rtems_rfs_inode_delete (rtems_rfs_file_system *fs, rtems_rfs_inode_handle *handle)
int | rtems_rfs_inode_initialise (rtems_rfs_inode_handle *handle, uint16_t links, uint16_t mode, uid_t uid, gid_t gid)
int | rtems_rfs_inode_time_stamp_now (rtems_rfs_inode_handle *handle, bool atime, bool mtime)
rtems_rfs_pos | rtems_rfs_inode_get_size (rtems_rfs_file_system *fs, rtems_rfs_inode_handle *handle)

## Detailed Description

RTEMS File Systems Inode Routines.

These functions manage inodes in the RFS file system. An inode is part of a block that reside after the bitmaps in the group.

## Function Documentation

## ◆ rtems_rfs_inode_alloc()

int rtems_rfs_inode_alloc | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_bitmap_bit | goal,
|  | rtems_rfs_ino * | ino
| ) |  |

Allocate an inode number and return it.

Parameters

  [in] | fs | is the file system data.
  [out] | ino | will contain the ino.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_inode_close()

int rtems_rfs_inode_close | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_inode_handle * | handle
| ) |  |

The close inode handle. All opened inodes need to be closed.

Parameters

  [in] | fs | is the file system.
  [in] | handle | is the handle to close.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_inode_create()

int rtems_rfs_inode_create | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_ino | parent,
|  | const char * | name,
|  | size_t | length,
|  | uint16_t | mode,
|  | uint16_t | links,
|  | uid_t | uid,
|  | gid_t | gid,
|  | rtems_rfs_ino * | ino
| ) |  |

Create an inode allocating, initialising and adding an entry to the parent directory.

Parameters

  [in] | fs | is the file system data.
  [in] | parent | is the parent inode number to add the directory entry to.
  [in] | name | is a pointer to the name of the directory entryinode to create.

## ◆ rtems_rfs_inode_delete()

int rtems_rfs_inode_delete | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_inode_handle * | handle
| ) |  |

Delete the inode eraseing it and release the buffer to commit the write. You need to load the inode again if you wish to use it again.

Parameters

  [in] | fs | is the file system.
  [in] | handle | is the inode handle to erase.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_inode_free()

int rtems_rfs_inode_free | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_ino | ino
| ) |  |

Free an inode.

Parameters

  [in] | fs | is the file system data.
  [in] | ino | is the ino too free.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_inode_get_size()

rtems_rfs_pos rtems_rfs_inode_get_size | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_inode_handle * | handle
| ) |  |

Calculate the size of data attached to the inode.

Parameters

  [in] | fs | is the file system data.
  [in] | handle | is the inode handle.

Return values

  size | The data size in bytes in the block map attched to the inode.

## ◆ rtems_rfs_inode_initialise()

int rtems_rfs_inode_initialise | ( | rtems_rfs_inode_handle * | handle,
|  | uint16_t | links,
|  | uint16_t | mode,
|  | uid_t | uid,
|  | gid_t | gid
| ) |  |

Initialise a new inode.

Parameters

  [in] | handle | is the inode handle to initialise.
  [in] | links | are the number of links to the inode.
  [in] | mode | is the inode mode.
  [in] | uid | is the user id.
  [in] | gid | is the group id.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_inode_load()

int rtems_rfs_inode_load | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_inode_handle * | handle
| ) |  |

Load the inode into memory.

Parameters

  [in] | fs | is the file system.
  [in] | handle | is the inode handle to load.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_inode_open()

int rtems_rfs_inode_open | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_ino | ino,
|  | rtems_rfs_inode_handle * | handle,
|  | bool | load
| ) |  |

Open the inode handle. This reads the inode into the buffer and sets the data pointer. All data is in media byte order and needs to be accessed via the supporting calls.

Parameters

  [in] | fs | is the file system.
  [in] | ino | is the inode number.
  [in] | handle | is the handle to the inode we are opening.
  [in] | load | If true load the inode into memory from the media.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_inode_time_stamp_now()

int rtems_rfs_inode_time_stamp_now | ( | rtems_rfs_inode_handle * | handle,
|  | bool | atime,
|  | bool | mtime
| ) |  |

Time stamp the inode with the current time. The ctime field is hanlded automatically.

Parameters

  [in] | handle | is the inode handle.
  [in] | atime | Update the atime field.
  [in] | mtime | UPdate the mtime field.

Return values

  0 | Successful operation.
  ENXIO | No inode is loaded.
  error_code | An error occurred.

## ◆ rtems_rfs_inode_unload()

int rtems_rfs_inode_unload | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_inode_handle * | handle,
|  | bool | update_ctime
| ) |  |

Unload the inode from memory.

Parameters

  [in] | fs | is the file system.
  [in] | handle | is the inode handle to unload.
  [in] | update_ctime | Update the ctime field of the inode.

Return values

  0 | Successful operation.
  error_code | An error occurred.