2012-03-22 01:51:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* fs/nfs/nfs.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
|
|
|
* Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved.
|
|
|
|
* Author: Jose Pablo Rojas Vargas <jrojas@nx-engineering.com>
|
2012-06-11 01:17:10 +02:00
|
|
|
* Gregory Nutt <gnutt@nuttx.org>
|
2012-03-22 01:51:01 +01:00
|
|
|
*
|
|
|
|
* Leveraged from OpenBSD:
|
|
|
|
*
|
|
|
|
* Copyright (c) 1989, 1993, 1995
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
2012-03-17 01:25:34 +01:00
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Rick Macklem at The University of Guelph.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
2012-03-22 01:51:01 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __FS_NFS_NFS_H
|
|
|
|
#define __FS_NFS_NFS_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
2012-06-14 23:54:50 +02:00
|
|
|
|
2012-04-19 01:31:47 +02:00
|
|
|
#include "nfs_mount.h"
|
2012-03-17 01:25:34 +01:00
|
|
|
|
2012-03-22 01:51:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
2012-03-17 01:25:34 +01:00
|
|
|
|
2012-06-14 23:54:50 +02:00
|
|
|
#define NFS_TICKINTVL MSEC_PER_TICK /* Smallest that we can get */
|
|
|
|
#define NFS_TICKS 1 /* Number of system ticks */
|
|
|
|
#define NFS_HZ CLOCKS_PER_SEC /* Ticks/sec */
|
|
|
|
#define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */
|
|
|
|
#define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */
|
|
|
|
#define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */
|
|
|
|
#define NFS_TIMEOUTMUL 2 /* Timeout/Delay multiplier */
|
|
|
|
#define NFS_MAXREXMIT 100 /* Stop counting after this many */
|
|
|
|
#define NFS_RETRANS 10 /* Num of retrans for soft mounts */
|
|
|
|
#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
|
|
|
|
#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
|
|
|
|
#define NFS_READDIRSIZE 8192 /* Def. readdir size */
|
2012-04-24 01:21:30 +02:00
|
|
|
#define NFS_NPROCS 23
|
2012-03-17 01:25:34 +01:00
|
|
|
|
|
|
|
/* Ideally, NFS_DIRBLKSIZ should be bigger, but I've seen servers with
|
|
|
|
* broken NFS/ethernet drivers that won't work with anything bigger (Linux..)
|
|
|
|
*/
|
2012-04-14 02:27:44 +02:00
|
|
|
|
2012-06-14 23:54:50 +02:00
|
|
|
#define NFS_DIRBLKSIZ 1024 /* Must be a multiple of DIRBLKSIZ */
|
2012-03-22 01:51:01 +01:00
|
|
|
|
2012-06-12 19:36:48 +02:00
|
|
|
/* Increment NFS statistics */
|
|
|
|
|
|
|
|
#ifdef CONFIG_NFS_STATISTICS
|
|
|
|
# define nfs_statistics(n) do { nfsstats.rpccnt[n]++; } while (0)
|
|
|
|
#else
|
|
|
|
# define nfs_statistics(n)
|
|
|
|
#endif
|
|
|
|
|
2012-06-09 21:29:49 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
extern uint32_t nfs_true;
|
|
|
|
extern uint32_t nfs_false;
|
|
|
|
extern uint32_t nfs_xdrneg1;
|
2012-06-12 19:36:48 +02:00
|
|
|
#ifdef CONFIG_NFS_STATISTICS
|
2012-06-09 21:29:49 +02:00
|
|
|
extern struct nfsstats nfsstats;
|
2012-06-12 19:36:48 +02:00
|
|
|
#endif
|
2012-06-09 21:29:49 +02:00
|
|
|
|
2012-03-22 01:51:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
2012-06-14 02:47:42 +02:00
|
|
|
/* NFS statistics structure */
|
2012-04-24 01:21:30 +02:00
|
|
|
|
|
|
|
struct nfsstats
|
|
|
|
{
|
|
|
|
uint64_t rpccnt[NFS_NPROCS];
|
|
|
|
};
|
2012-04-14 02:27:44 +02:00
|
|
|
|
2012-03-22 01:51:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
2012-06-12 19:36:48 +02:00
|
|
|
|
2012-04-19 01:31:47 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
extern "C" {
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2012-06-12 18:11:31 +02:00
|
|
|
EXTERN void nfs_semtake(FAR struct nfsmount *nmp);
|
|
|
|
EXTERN void nfs_semgive(FAR struct nfsmount *nmp);
|
|
|
|
EXTERN int nfs_checkmount(FAR struct nfsmount *nmp);
|
|
|
|
EXTERN int nfs_fsinfo(FAR struct nfsmount *nmp);
|
2012-06-28 00:03:32 +02:00
|
|
|
EXTERN int nfs_request(struct nfsmount *nmp, int procnum,
|
|
|
|
FAR void *request, size_t reqlen,
|
|
|
|
FAR void *response, size_t resplen);
|
2012-06-12 18:11:31 +02:00
|
|
|
EXTERN int nfs_lookup(FAR struct nfsmount *nmp, FAR const char *filename,
|
2012-06-10 02:13:59 +02:00
|
|
|
FAR struct file_handle *fhandle,
|
|
|
|
FAR struct nfs_fattr *obj_attributes,
|
|
|
|
FAR struct nfs_fattr *dir_attributes);
|
2012-06-12 18:11:31 +02:00
|
|
|
EXTERN int nfs_findnode(FAR struct nfsmount *nmp, FAR const char *relpath,
|
2012-06-10 02:13:59 +02:00
|
|
|
FAR struct file_handle *fhandle,
|
|
|
|
FAR struct nfs_fattr *obj_attributes,
|
|
|
|
FAR struct nfs_fattr *dir_attributes);
|
2012-06-12 18:11:31 +02:00
|
|
|
EXTERN int nfs_finddir(FAR struct nfsmount *nmp, FAR const char *relpath,
|
2012-06-11 16:39:19 +02:00
|
|
|
FAR struct file_handle *fhandle,
|
2012-06-11 19:14:46 +02:00
|
|
|
FAR struct nfs_fattr *attributes, FAR char *filename);
|
2012-06-12 18:11:31 +02:00
|
|
|
EXTERN void nfs_attrupdate(FAR struct nfsnode *np,
|
|
|
|
FAR struct nfs_fattr *attributes);
|
2012-06-12 19:36:48 +02:00
|
|
|
|
2012-04-19 01:31:47 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
2014-04-14 00:22:22 +02:00
|
|
|
|
2012-03-17 01:25:34 +01:00
|
|
|
#endif /* _NFS_NFS_H */
|