NFS update

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4532 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-03-28 00:10:43 +00:00
parent 1a975c0a58
commit fb9d418f66
14 changed files with 122 additions and 85 deletions

View File

@ -173,6 +173,12 @@
# endif
#endif
/* Graphics Device */
#ifndef CONFIG_EXAMPLES_NXCON_DEVNO
# define CONFIG_EXAMPLES_NXCON_DEVNO 0
#endif
/* NX Console Device */
#ifndef CONFIG_EXAMPLES_NXCON_MINOR

View File

@ -321,10 +321,14 @@ static int nxcon_initialize(void)
int MAIN_NAME(int argc, char **argv)
{
int exitcode = EXIT_FAILURE;
#if 0 /* Don't re-direct... too hard to debug */
int fd;
#else
FILE *outstream;
#endif
nxgl_mxpixel_t color;
int ndx;
int ret;
int fd;
/* Reset all global data */
@ -432,6 +436,7 @@ int MAIN_NAME(int argc, char **argv)
/* Open the driver */
#if 0 /* Don't re-direct... too hard to debug */
fd = open(CONFIG_EXAMPLES_NXCON_DEVNAME, O_WRONLY);
if (fd < 0)
{
@ -440,7 +445,10 @@ int MAIN_NAME(int argc, char **argv)
goto errout_with_driver;
}
/* Now re-direct stdout and stderr so that they use the NX console driver */
/* Now re-direct stdout and stderr so that they use the NX console driver.
* If debug is enabled, then perform the test using only stderr so that we
* can still get debug output on stdout.
*/
(void)dup2(fd, 1);
(void)dup2(fd, 2);
@ -448,6 +456,17 @@ int MAIN_NAME(int argc, char **argv)
/* And we can close our original driver fd */
close(fd);
#else
/* Open the Console driver as a write-only stream */
outstream = fopen(CONFIG_EXAMPLES_NXCON_DEVNAME, "w");
if (!outstream)
{
message(MAIN_NAME_STRING ": fopen %s read-only failed: %d\n",
CONFIG_EXAMPLES_NXCON_DEVNAME, errno);
goto errout_with_driver;
}
#endif
/* Test Loop **************************************************************/
/* Now loop, adding text to the NX console */
@ -461,7 +480,13 @@ int MAIN_NAME(int argc, char **argv)
/* Give another line of text to the NX console.*/
#if 0 /* Don't re-direct... too hard to debug */
printf(g_nxcon_msg[ndx]);
fflush(stdout);
#else
fprintf(outstream, g_nxcon_msg[ndx]);
fflush(outstream);
#endif
if (++ndx >= NCON_MSG_NLINES)
{
#ifdef CONFIG_NSH_BUILTIN_APPS
@ -481,6 +506,10 @@ int MAIN_NAME(int argc, char **argv)
/* Clean-up and Error Exits ***********************************************/
#if 1 /* Don't re-direct... too hard to debug */
fclose(outstream);
#endif
errout_with_driver:
message(MAIN_NAME_STRING ": Unregister the NX console device\n");
(void)nxcon_unregister(g_nxcon_vars.hdrvr);

View File

@ -215,7 +215,7 @@ struct nfsd_srvargs
unsigned char *nsd_authstr; /* Auth string (ret) */
int nsd_verflen; /* and the verifier */
unsigned char *nsd_verfstr;
struct timeval nsd_timestamp; /* timestamp from verifier */
struct timeval nsd_timestamp; /* timestamp from verifier */
uint32_t nsd_ttl; /* credential ttl (sec) */
};
@ -303,13 +303,13 @@ enum nfs_rto_timers
union nethostaddr
{
u_int32_t had_inetaddr;
uint32_t had_inetaddr;
struct mbuf *had_nam;
};
struct nfssvc_sock
{
TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */
// TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */
struct file *ns_fp; /* fp from the... */
struct socket *ns_so; /* ...socket this struct wraps */
int ns_flag; /* socket status flags */
@ -323,7 +323,7 @@ struct nfssvc_sock
struct nfsd
{
TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */
//TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */
int nfsd_flag; /* NFSD_ flags */
struct nfssvc_sock *nfsd_slp; /* Current socket */
struct nfsrv_descript *nfsd_nd; /* Associated nfsrv_descript */
@ -342,7 +342,7 @@ struct nfsrv_descript
/****************************************************************************
* Public Data
****************************************************************************/
/*
extern int nfs_niothreads;
extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead;
extern int nfssvc_sockhead_flag;
@ -351,7 +351,7 @@ extern struct pool nfsreqpl;
extern struct pool nfs_node_pool;
extern TAILQ_HEAD(nfsdhead, nfsd) nfsd_head;
extern int nfsd_head_flag;
*/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/

View File

@ -46,14 +46,12 @@
* Included Files
****************************************************************************/
#include "nfs_proto.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* File identifier */
#define MAXFIDSZ 16
/* NFS mount option flags */
#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */
@ -92,32 +90,6 @@
* Public Types
****************************************************************************/
typedef struct
{
int32_t val[2];
} fsid_t; /* file system id type */
/* File identifier.
* These are unique per filesystem on a single machine.
*/
struct fid
{
unsigned short fid_len; /* length of data in bytes */
unsigned short fid_reserved; /* force longword alignment */
char fid_data[MAXFIDSZ]; /* data (variable length) */
};
/* Generic file handle */
struct fhandle
{
fsid_t fh_fsid; /* File system id of mount point */
struct fid fh_fid; /* File sys specific id */
};
typedef struct fhandle fhandle_t;
/* Arguments to mount NFS */
struct nfs_args

View File

@ -109,20 +109,18 @@ struct nfsmount
/* Prototypes for NFS mount operations: */
int nfs_mount(struct mount *, const char *, void *, struct nameidata *,
struct proc *);
int mountnfs(struct nfs_args *, struct mount *, struct mbuf *, char *, char *);
int nfs_mount(struct inode *, const char *, void *);
int mountnfs(struct nfs_args *, struct inode *, char *, char *);
void nfs_decode_args(struct nfsmount *, struct nfs_args *, struct nfs_args *);
int nfs_start(struct mount *, int, struct proc *);
int nfs_unmount(struct mount *, int, struct proc *);
int nfs_root(struct mount *, struct vnode **);
int nfs_statfs(struct mount *, struct statfs *, struct proc *);
int nfs_sync(struct mount *, int, struct ucred *, struct proc *);
int nfs_vget(struct mount *, ino_t, struct vnode **);
int nfs_fhtovp(struct mount *, struct fid *, struct vnode **);
int nfs_vptofh(struct vnode *, struct fid *);
int nfs_fsinfo(struct nfsmount *, struct vnode *, struct ucred *,
struct proc *);
int nfs_start(struct inode *, int);
int nfs_unmount(struct inode *, int);
int nfs_root(struct inode *, struct file **);
int nfs_statfs(struct inode *, struct statfs *);
int nfs_sync(struct inode *, int);
int nfs_vget(struct inode *, ino_t, struct file **);
int nfs_fhtovp(struct inode *, struct fid *);
int nfs_vptofh(struct file *, struct fid *);
int nfs_fsinfo(struct nfsmount *, struct file *);
void nfs_init(void);
#endif

View File

@ -249,6 +249,10 @@
# define NFS_MAXFHSIZE 64
#endif
/* File identifier */
#define MAXFIDSZ 16
/****************************************************************************
* Public Types
****************************************************************************/
@ -267,6 +271,32 @@ typedef enum
NFFIFO = 7
} nfstype;
typedef struct
{
int32_t val[2];
} fsid_t; /* file system id type */
/* File identifier.
* These are unique per filesystem on a single machine.
*/
struct fid
{
unsigned short fid_len; /* length of data in bytes */
unsigned short fid_reserved; /* force longword alignment */
char fid_data[MAXFIDSZ]; /* data (variable length) */
};
/* Generic file handle */
struct fhandle
{
fsid_t fh_fsid; /* File system id of mount point */
struct fid fh_fid; /* File sys specific id */
};
typedef struct fhandle fhandle_t;
/* File Handle (32 bytes for version 2), variable up to 64 for version 3. */
union nfsfh

View File

@ -80,7 +80,7 @@ static struct rpc_program nfs3_program =
* Public Variables
****************************************************************************/
int nfs_ticks = rpcclnt_ticks;
int nfs_ticks;
/****************************************************************************
* Private Functions
@ -163,7 +163,7 @@ int nfsx_request_xx(struct nfsmount *nm, int procnum, void *data)
int error;
struct nfsmount *nmp;
struct rpcclnt *clnt;
struct rpc_reply reply;
struct rpc_reply *reply;
int trylater_delay;
nmp = nm;
@ -171,12 +171,12 @@ int nfsx_request_xx(struct nfsmount *nm, int procnum, void *data)
tryagain:
memset(&reply, 0, sizeof(reply));
memset(reply, 0, sizeof(struct rpc_reply));
if ((error = rpcclnt_request(clnt, procnum, &reply)) != 0)
if ((error = rpcclnt_request(clnt, procnum, reply)) != 0)
goto out;
data = reply->where;
data = reply->stat.where;
if (reply->rpc_verfi.authtype != 0)
{

View File

@ -53,14 +53,14 @@ int nfsx_sigintr(struct nfsmount *, struct nfsreq *, cthread_t *);
void nfsx_safedisconnect(struct nfsmount *);
#define nfs_safedisconnect nfsx_safedisconnect
#endif
int nfsx_request_xx(struct nfsmount *, int);
int nfsx_request_xx(struct nfsmount *, int, void*);
int nfsx_nmcancelreqs(struct nfsmount *);
#define nfs_connect nfs_connect_nfsx
#define nfs_disconnect nfs_disconnect_nfsx
#define nfs_nmcancelreqs nfsx_nmcancelreqs
#define nfsx_request(nmp, m) \
nfsx_request_xx(nmp, m)
#define nfsx_request(nmp, m, s) \
nfsx_request_xx(nmp, m, s)
#ifdef CONFIG_NFS_TCPIP
#define nfs_sigintr nfs_sigintr_nfsx

View File

@ -1,4 +1,3 @@
/****************************************************************************
* fs/nfs/nfs_vfsops.c
*
@ -64,17 +63,17 @@
#include <sys/statfs>
#include <queue.h>
#include <nuttx/fs/fs.h>
#include <net/if.h>
#include <netinet/in.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
#include <nfs/nfsnode.h>
#include <nfs/nfs.h>
#include <nfs/nfsmount.h>
#include <nfs/xdr_subs.h>
#include <nfs/nfs_var.h>
#include "rpcv2.h"
#include "nfsproto.h"
#include "nfs_node.h"
#include "nfs.h"
#include "nfs_mount.h"
#include "xdr_subs.h"
/****************************************************************************
* Pre-processor Definitions

View File

@ -158,7 +158,7 @@ struct rpc_reply
uint32_t type;
uint32_t status;
void where; /* Data */
void *where; /* Data */
/* used only when reply == RPC_MSGDENIED and status == RPC_AUTHERR */

View File

@ -92,9 +92,9 @@
#include <debug.h>
#include "xdr_subs.h"
#include "nfs_args.h"
#include "nfs_proto.h"
#include "nfs.h"
#include "nfs_args.h"
#include "rpc.h"
#include "rpc_clnt_private.h"
#include "rpc_v2.h"
@ -186,8 +186,8 @@ static uint32_t rpc_reply, rpc_call, rpc_vers, rpc_msgdenied,
static uint32_t rpcclnt_xid = 0;
static uint32_t rpcclnt_xid_touched = 0;
struct rpcstats rpcstats;
int rpcclnt_ticks;
struct rpcstats rpcstats;
struct rpc_call *callmgs;
struct rpc_reply *replymsg;
@ -512,7 +512,7 @@ rpcclnt_reply(struct rpctask *myrep, struct rpc_call *call,
struct rpctask *rep;
struct rpcclnt *rpc = myrep->r_rpcclnt;
int32_t t1;
struct sockaddr *nam;
struct sockaddr *nam = NULL;
uint32_t rxid;
int error;
@ -845,8 +845,8 @@ int rpcclnt_connect(struct rpcclnt *rpc)
struct socket *so;
int error;
struct sockaddr *saddr;
struct sockaddr_in *sin;
struct timeval *tv;
struct sockaddr_in *sin = NULL;
struct timeval *tv = NULL;
uint16_t tport;
/* create the socket */
@ -932,10 +932,8 @@ int rpcclnt_connect(struct rpcclnt *rpc)
/* Initialize other non-zero congestion variables */
rpc->rc_srtt[0] = rpc->rc_srtt[1] = rpc->rc_srtt[2] = rpc->rc_srtt[3] =
rpc->rc_srtt[4] = (RPC_TIMEO << 3);
rpc->rc_sdrtt[0] = rpc->rc_sdrtt[1] = rpc->rc_sdrtt[2] = rpc->rc_sdrtt[3] =
rpc->rc_sdrtt[4] = 0;
rpc->rc_srtt[0] = rpc->rc_srtt[1] = rpc->rc_srtt[2] = rpc->rc_srtt[3] = (RPC_TIMEO << 3);
rpc->rc_sdrtt[0] = rpc->rc_sdrtt[1] = rpc->rc_sdrtt[2] = rpc->rc_sdrtt[3] = 0;
rpc->rc_cwnd = RPC_MAXCWND / 2; /* Initial send window */
rpc->rc_sent = 0;
rpc->rc_timeouts = 0;
@ -1023,11 +1021,11 @@ void rpcclnt_safedisconnect(struct rpcclnt *rpc)
int rpcclnt_request(struct rpcclnt *rpc, int procnum, struct rpc_reply *reply)
{
struct rpc_call *call;
struct rpc_reply *replysvr;
struct rpc_call *call = NULL;
struct rpc_reply *replysvr = NULL;
struct rpctask *task, _task;
int error = 0;
int xid;
int xid = 0;
task = &_task;
memset(task, 0, sizeof(*task));
@ -1163,7 +1161,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, struct rpc_reply *reply)
if (reply->stat.status == RPC_SUCCESS)
{
printf("RPC_SUCCESS");
reply->where = replysvr->where;
reply->stat.where = replysvr->stat.where;
}
else if (reply->stat.status == RPC_PROGMISMATCH)
{
@ -1291,7 +1289,7 @@ void rpcclnt_timer(void *arg, struct rpc_call *call)
int rpcclnt_buildheader(struct rpcclnt *rc, int procid,
int xidp, struct rpc_call *call)
{
struct timeval *tv;
struct timeval *tv = NULL;
srand(time(NULL));
/* The RPC header.*/
@ -1326,6 +1324,7 @@ int rpcclnt_buildheader(struct rpcclnt *rc, int procid,
call->rpc_auth.authlen = txdr_unsigned(sizeof(NULL));
tv->tv_sec = 1;
tv->tv_usec = 0;
#ifdef CONFIG_NFS_UNIX_AUTH
call->rpc_unix.ua_time = txdr_unsigned(tv->tv_sec);
call->rpc_unix.ua_hostname = 0;
@ -1368,3 +1367,4 @@ int rpcclnt_cancelreqs(struct rpcclnt *rpc)
return (EBUSY);
}
#endif

View File

@ -1,8 +1,8 @@
/****************************************************************************
* graphics/nxbe/nxbe_bitmap.c
*
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@ -183,6 +183,9 @@ nxcon_allocglyph(FAR struct nxcon_state_s *priv)
luglyph->usecnt = 1;
return luglyph;
#else
/* TODO: Instead allocating an freeing, just allocate the max glyph once */
nxcon_freeglyph(&priv->glyph);
return &priv->glyph;
#endif
}

View File

@ -278,7 +278,7 @@ void os_start(void)
strncpy(g_idletcb.name, g_idlename, CONFIG_TASK_NAME_SIZE-1);
g_idletcb.argv[0] = g_idletcb.name;
#else
g_idletcb.argv[0] = g_idlename;
g_idletcb.argv[0] = (char*)g_idlename;
#endif /* CONFIG_TASK_NAME_SIZE */
/* Then add the idle task's TCB to the head of the ready to run list */