RTEMS  5.0.0
Data Structures | Macros | Typedefs | Functions | Variables
nfs.c File Reference

NFS Client Implementation for RTEMSHooks Into the RTEMS NFS Filesystem. More...

#include <rtems.h>
#include <rtems/libio.h>
#include <rtems/libio_.h>
#include <rtems/seterr.h>
#include <rtems/thread.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/stat.h>
#include <dirent.h>
#include <netdb.h>
#include <ctype.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "../proto/nfs_prot.h"
#include "../proto/mount_prot.h"
#include "rpcio.h"
#include "librtemsNfs.h"

Data Structures

struct  strbuf
 
struct  readlinkres_strbuf
 
struct  DirInfoRec_
 
struct  serporidok
 
struct  serporid
 
struct  NfsRec_
 
struct  NfsNodeRec_
 
struct  nfsstats
 
struct  ResolvePathArgRec_
 

Macros

#define CONFIG_AVG_NAMLEN   10
 
#define CONFIG_NFS_SMALL_XACT_SIZE   800 /* size of RPC arguments for non-write ops */
 
#define CONFIG_ATTR_LIFETIME   10/*secs*/
 
#define DEFAULT_NFS_ST_BLKSIZE   NFS_MAXDATA
 
#define CONFIG_NFS_BIG_XACT_SIZE   UDPMSGSIZE /* dont change this */
 
#define NFSCALL_TIMEOUT   (&_nfscalltimeout)
 
#define MNTCALL_TIMEOUT   (&_nfscalltimeout)
 
#define DELIM   '/'
 
#define HOSTDELIM   ':'
 
#define UPDIR   ".."
 
#define UIDSEP   '@'
 
#define NFS_VERSION_2   NFS_VERSION
 
#define NFS_MAJOR   (nfsGlob.nfs_major)
 
#define NFS_MAKE_DEV_T_INO_HACK(node)
 
#define NFS_MAKE_DEV_T(node)
 
#define DIRENT_HEADER_SIZE
 
#define DEBUG_COUNT_NODES   (1<<0)
 
#define DEBUG_TRACK_NODES   (1<<1)
 
#define DEBUG_EVALPATH   (1<<2)
 
#define DEBUG_READDIR   (1<<3)
 
#define DEBUG_SYSCALLS   (1<<4)
 
#define STATIC   static
 
#define LOCK(s)   rtems_recursive_mutex_lock(&(s))
 
#define UNLOCK(s)   rtems_recursive_mutex_unlock(&(s))
 
#define NFS_GLOBAL_ACQUIRE(lock_context)   rtems_interrupt_lock_acquire(&nfs_global_lock, lock_context)
 
#define NFS_GLOBAL_RELEASE(lock_context)   rtems_interrupt_lock_release(&nfs_global_lock, lock_context)
 
#define SERP_ARGS(node)   ((node)->serporid.serporid_u.serporid.arg_u)
 
#define SERP_ATTR(node)   ((node)->serporid.serporid_u.serporid.attributes)
 
#define SERP_FILE(node)   ((node)->serporid.serporid_u.serporid.file)
 
#define READ_LONG_IS_ATOMIC
 
#define SATTR_MODE   (1<<0)
 
#define SATTR_UID   (1<<1)
 
#define SATTR_GID   (1<<2)
 
#define SATTR_SIZE   (1<<3)
 
#define SATTR_ATIME   (1<<4)
 
#define SATTR_TOUCHA   (1<<5)
 
#define SATTR_MTIME   (1<<6)
 
#define SATTR_TOUCHM   (1<<7)
 
#define SATTR_TOUCH   (SATTR_TOUCHM | SATTR_TOUCHA)
 

Typedefs

typedef struct strbuf strbuf
 
typedef struct readlinkres_strbuf readlinkres_strbuf
 
typedef struct DirInfoRec_ DirInfoRec
 
typedef struct DirInfoRec_DirInfo
 
typedef struct serporidok serporidok
 
typedef struct serporid serporid
 
typedef uint32_t TimeStamp
 
typedef struct NfsRec_ NfsRec
 
typedef struct NfsRec_Nfs
 
typedef struct NfsNodeRec_ NfsNodeRec
 
typedef struct NfsNodeRec_NfsNode
 
typedef struct ResolvePathArgRec_ ResolvePathArgRec
 
typedef struct ResolvePathArgRec_ResolvePathArg
 

Functions

int nfsMountsShow (FILE *)
 
rtems_status_code rtems_filesystem_resolve_location (char *buf, int len, rtems_filesystem_location_info_t *loc)
 
int nfsInit (int smallPoolDepth, int bigPoolDepth)
 
int nfsCleanup (void)
 
STATIC int nfscall (RpcUdpServer srvr, int proc, xdrproc_t xargs, void *pargs, xdrproc_t xres, void *pres)
 
int rtems_nfs_initialize (rtems_filesystem_mount_table_entry_t *mt_entry, const void *data)
 
STATIC void nfs_fsunmount_me (rtems_filesystem_mount_table_entry_t *mt_entry)
 
int nfsSetTimeout (uint32_t timeout_ms)
 
uint32_t nfsGetTimeout (void)
 

Variables

const struct _rtems_filesystem_operations_table nfs_fs_ops
 
int nfsStBlksize = DEFAULT_NFS_ST_BLKSIZE
 

Detailed Description

NFS Client Implementation for RTEMS

Hooks Into the RTEMS NFS Filesystem.

Macro Definition Documentation

◆ DIRENT_HEADER_SIZE

#define DIRENT_HEADER_SIZE
Value:
( sizeof(struct dirent) - \
sizeof( ((struct dirent *)0)->d_name ) )

◆ NFS_MAKE_DEV_T

#define NFS_MAKE_DEV_T (   node)
Value:
rtems_filesystem_make_dev_t( NFS_MAJOR, \
(((rtems_device_minor_number)((node)->nfs->id))<<16) | (SERP_ATTR((node)).fsid & (((rtems_device_minor_number)1<<16)-1)) )

◆ NFS_MAKE_DEV_T_INO_HACK

#define NFS_MAKE_DEV_T_INO_HACK (   node)
Value:
rtems_filesystem_make_dev_t( NFS_MAJOR, \
(((rtems_device_minor_number)((node)->nfs->id))<<16) | (((rtems_device_minor_number)SERP_ATTR((node)).fileid) >> 16) )

Variable Documentation

◆ nfs_fs_ops

const struct _rtems_filesystem_operations_table nfs_fs_ops
Initial value:
= {
.lock_h = nfs_lock,
.unlock_h = nfs_unlock,
.eval_path_h = nfs_eval_path,
.link_h = nfs_link,
.are_nodes_equal_h = nfs_are_nodes_equal,
.mknod_h = nfs_mknod,
.rmnod_h = nfs_rmnod,
.fchmod_h = nfs_fchmod,
.chown_h = nfs_chown,
.clonenod_h = nfs_clonenode,
.freenod_h = nfs_freenode,
.fsunmount_me_h = nfs_fsunmount_me,
.utime_h = nfs_utime,
.symlink_h = nfs_symlink,
.readlink_h = nfs_readlink,
.rename_h = nfs_rename,
}
int rtems_filesystem_default_unmount(rtems_filesystem_mount_table_entry_t *mt_entry)
Definition: default_unmount.c:21
int rtems_filesystem_default_mount(rtems_filesystem_mount_table_entry_t *mt_entry)
Definition: default_mount.c:21
int rtems_filesystem_default_statvfs(const rtems_filesystem_location_info_t *loc, struct statvfs *buf)
Definition: default_statvfs.c:23