summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/dfs/dfs_v1/filesystems/nfs/dfs_nfs.c22
-rw-r--r--components/dfs/dfs_v1/filesystems/nfs/rpc/clnt_udp.c4
-rw-r--r--components/dfs/dfs_v1/filesystems/nfs/rpc/types.h6
-rw-r--r--components/dfs/dfs_v1/filesystems/nfs/rpc/xdr.c16
-rw-r--r--components/dfs/dfs_v2/filesystems/nfs/dfs_nfs.c22
-rw-r--r--components/dfs/dfs_v2/filesystems/nfs/rpc/clnt_udp.c4
-rw-r--r--components/dfs/dfs_v2/filesystems/nfs/rpc/types.h6
-rw-r--r--components/dfs/dfs_v2/filesystems/nfs/rpc/xdr.c16
-rw-r--r--components/finsh/msh_file.c11
9 files changed, 63 insertions, 44 deletions
diff --git a/components/dfs/dfs_v1/filesystems/nfs/dfs_nfs.c b/components/dfs/dfs_v1/filesystems/nfs/dfs_nfs.c
index 5b16875c29..aca6cf611a 100644
--- a/components/dfs/dfs_v1/filesystems/nfs/dfs_nfs.c
+++ b/components/dfs/dfs_v1/filesystems/nfs/dfs_nfs.c
@@ -562,8 +562,8 @@ int nfs_read(struct dfs_fd *file, void *buf, size_t count)
if (file->vnode->type == FT_DIRECTORY)
return -EISDIR;
- RT_ASSERT(file->vnode->data != NULL);
- struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->data));
+ RT_ASSERT(file->vnode->fs != NULL);
+ struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->fs));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
fd = (nfs_file *)(nfs->data);
RT_ASSERT(fd != NULL);
@@ -631,8 +631,8 @@ int nfs_write(struct dfs_fd *file, const void *buf, size_t count)
if (file->vnode->type == FT_DIRECTORY)
return -EISDIR;
- RT_ASSERT(file->vnode->data != NULL);
- struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->data));
+ RT_ASSERT(file->vnode->fs != NULL);
+ struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->fs));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
fd = (nfs_file *)(nfs->data);
RT_ASSERT(fd != NULL);
@@ -693,8 +693,8 @@ int nfs_lseek(struct dfs_fd *file, off_t offset)
if (file->vnode->type == FT_DIRECTORY)
return -EISDIR;
- RT_ASSERT(file->vnode->data != NULL);
- struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->data));
+ RT_ASSERT(file->vnode->fs != NULL);
+ struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->fs));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
fd = (nfs_file *)(nfs->data);
RT_ASSERT(fd != NULL);
@@ -712,8 +712,8 @@ int nfs_lseek(struct dfs_fd *file, off_t offset)
int nfs_close(struct dfs_fd *file)
{
nfs_filesystem *nfs;
- RT_ASSERT(file->vnode->data != NULL);
- struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->data));
+ RT_ASSERT(file->vnode->fs != NULL);
+ struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->fs));
RT_ASSERT(file->vnode->ref_count > 0);
if (file->vnode->ref_count > 1)
@@ -749,7 +749,7 @@ int nfs_close(struct dfs_fd *file)
int nfs_open(struct dfs_fd *file)
{
nfs_filesystem *nfs;
- RT_ASSERT(file->vnode->data != NULL);
+ RT_ASSERT(file->vnode->fs != NULL);
struct dfs_filesystem *dfs_nfs = file->vnode->fs;
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
RT_ASSERT(nfs != NULL);
@@ -1111,8 +1111,8 @@ int nfs_getdents(struct dfs_fd *file, struct dirent *dirp, uint32_t count)
nfs_filesystem *nfs;
char *name;
- RT_ASSERT(file->vnode->data != NULL);
- struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->data));
+ RT_ASSERT(file->vnode->fs != NULL);
+ struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->fs));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
dir = (nfs_dir *)(nfs->data);
RT_ASSERT(dir != NULL);
diff --git a/components/dfs/dfs_v1/filesystems/nfs/rpc/clnt_udp.c b/components/dfs/dfs_v1/filesystems/nfs/rpc/clnt_udp.c
index 17933539da..91973631c4 100644
--- a/components/dfs/dfs_v1/filesystems/nfs/rpc/clnt_udp.c
+++ b/components/dfs/dfs_v1/filesystems/nfs/rpc/clnt_udp.c
@@ -150,6 +150,7 @@ CLIENT *clntudp_bufcreate(struct sockaddr_in *raddr,
if ((port =
pmap_getport(raddr, program, version, IPPROTO_UDP)) == 0) {
+ rt_kprintf("pmap_getport failure\n");
goto fooy;
}
raddr->sin_port = htons(port);
@@ -164,7 +165,7 @@ CLIENT *clntudp_bufcreate(struct sockaddr_in *raddr,
cu->cu_total.tv_usec = -1;
cu->cu_sendsz = sendsz;
cu->cu_recvsz = recvsz;
- call_msg.rm_xid = ((unsigned long)rt_thread_self()) ^ ((unsigned long)rt_tick_get()) ^ (xid_count++);
+ call_msg.rm_xid = (uint32_t)(((unsigned long)rt_thread_self()) ^ ((unsigned long)rt_tick_get()) ^ (xid_count++));
call_msg.rm_direction = CALL;
call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
call_msg.rm_call.cb_prog = program;
@@ -172,6 +173,7 @@ CLIENT *clntudp_bufcreate(struct sockaddr_in *raddr,
xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf, sendsz, XDR_ENCODE);
if (!xdr_callhdr(&(cu->cu_outxdrs), &call_msg))
{
+ rt_kprintf("xdr_callhdr failure\n");
goto fooy;
}
cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs));
diff --git a/components/dfs/dfs_v1/filesystems/nfs/rpc/types.h b/components/dfs/dfs_v1/filesystems/nfs/rpc/types.h
index 9c4ccd3838..6afc2279b8 100644
--- a/components/dfs/dfs_v1/filesystems/nfs/rpc/types.h
+++ b/components/dfs/dfs_v1/filesystems/nfs/rpc/types.h
@@ -57,9 +57,6 @@ typedef unsigned long u_long;
#include <stdint.h>
#endif
-typedef long long int64_t;
-typedef unsigned long long uint64_t;
-
typedef int bool_t;
typedef int enum_t;
@@ -67,9 +64,6 @@ typedef int enum_t;
typedef unsigned long dev_t;
#endif
-#if !defined(RT_USING_NEWLIB) && !defined(RT_USING_MINILIBC) && !defined(RT_USING_MUSL)
-typedef rt_int32_t ssize_t;
-#endif
/* This needs to be changed to uint32_t in the future */
typedef unsigned long rpcprog_t;
diff --git a/components/dfs/dfs_v1/filesystems/nfs/rpc/xdr.c b/components/dfs/dfs_v1/filesystems/nfs/rpc/xdr.c
index fa3b12ef00..7045aef352 100644
--- a/components/dfs/dfs_v1/filesystems/nfs/rpc/xdr.c
+++ b/components/dfs/dfs_v1/filesystems/nfs/rpc/xdr.c
@@ -196,7 +196,7 @@ bool_t xdr_u_long(XDR* xdrs, unsigned long* ulp)
/*
* XDR long long integers
*/
-bool_t xdr_longlong_t (XDR * xdrs, long long* llp)
+bool_t xdr_longlong_t (XDR * xdrs, int64_t* llp)
{
int32_t t1, t2;
@@ -223,7 +223,7 @@ bool_t xdr_longlong_t (XDR * xdrs, long long* llp)
/*
* XDR unsigned long long integers
*/
-bool_t xdr_u_longlong_t (XDR * xdrs, unsigned long long* ullp)
+bool_t xdr_u_longlong_t (XDR * xdrs, uint64_t* ullp)
{
uint32_t t1, t2;
@@ -363,10 +363,20 @@ bool_t xdr_bool(XDR *xdrs, bool_t *bp)
*/
bool_t xdr_enum(XDR *xdrs, enum_t *ep)
{
+ enum sizecheck { SIZEVAL }; /* used to find the size of an enum */
+
/*
* enums are treated as ints
*/
- return (xdr_long(xdrs, (long *) ep));
+ /* LINTED */ if (sizeof (enum sizecheck) == sizeof (long)) {
+ return (xdr_long(xdrs, (long *)(void *)ep));
+ } else /* LINTED */ if (sizeof (enum sizecheck) == sizeof (int)) {
+ return (xdr_int(xdrs, (int *)(void *)ep));
+ } else /* LINTED */ if (sizeof (enum sizecheck) == sizeof (short)) {
+ return (xdr_short(xdrs, (short *)(void *)ep));
+ } else {
+ return (FALSE);
+ }
}
/*
diff --git a/components/dfs/dfs_v2/filesystems/nfs/dfs_nfs.c b/components/dfs/dfs_v2/filesystems/nfs/dfs_nfs.c
index 5b16875c29..aca6cf611a 100644
--- a/components/dfs/dfs_v2/filesystems/nfs/dfs_nfs.c
+++ b/components/dfs/dfs_v2/filesystems/nfs/dfs_nfs.c
@@ -562,8 +562,8 @@ int nfs_read(struct dfs_fd *file, void *buf, size_t count)
if (file->vnode->type == FT_DIRECTORY)
return -EISDIR;
- RT_ASSERT(file->vnode->data != NULL);
- struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->data));
+ RT_ASSERT(file->vnode->fs != NULL);
+ struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->fs));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
fd = (nfs_file *)(nfs->data);
RT_ASSERT(fd != NULL);
@@ -631,8 +631,8 @@ int nfs_write(struct dfs_fd *file, const void *buf, size_t count)
if (file->vnode->type == FT_DIRECTORY)
return -EISDIR;
- RT_ASSERT(file->vnode->data != NULL);
- struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->data));
+ RT_ASSERT(file->vnode->fs != NULL);
+ struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->fs));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
fd = (nfs_file *)(nfs->data);
RT_ASSERT(fd != NULL);
@@ -693,8 +693,8 @@ int nfs_lseek(struct dfs_fd *file, off_t offset)
if (file->vnode->type == FT_DIRECTORY)
return -EISDIR;
- RT_ASSERT(file->vnode->data != NULL);
- struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->data));
+ RT_ASSERT(file->vnode->fs != NULL);
+ struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->fs));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
fd = (nfs_file *)(nfs->data);
RT_ASSERT(fd != NULL);
@@ -712,8 +712,8 @@ int nfs_lseek(struct dfs_fd *file, off_t offset)
int nfs_close(struct dfs_fd *file)
{
nfs_filesystem *nfs;
- RT_ASSERT(file->vnode->data != NULL);
- struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->data));
+ RT_ASSERT(file->vnode->fs != NULL);
+ struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->fs));
RT_ASSERT(file->vnode->ref_count > 0);
if (file->vnode->ref_count > 1)
@@ -749,7 +749,7 @@ int nfs_close(struct dfs_fd *file)
int nfs_open(struct dfs_fd *file)
{
nfs_filesystem *nfs;
- RT_ASSERT(file->vnode->data != NULL);
+ RT_ASSERT(file->vnode->fs != NULL);
struct dfs_filesystem *dfs_nfs = file->vnode->fs;
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
RT_ASSERT(nfs != NULL);
@@ -1111,8 +1111,8 @@ int nfs_getdents(struct dfs_fd *file, struct dirent *dirp, uint32_t count)
nfs_filesystem *nfs;
char *name;
- RT_ASSERT(file->vnode->data != NULL);
- struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->data));
+ RT_ASSERT(file->vnode->fs != NULL);
+ struct dfs_filesystem *dfs_nfs = ((struct dfs_filesystem *)(file->vnode->fs));
nfs = (struct nfs_filesystem *)(dfs_nfs->data);
dir = (nfs_dir *)(nfs->data);
RT_ASSERT(dir != NULL);
diff --git a/components/dfs/dfs_v2/filesystems/nfs/rpc/clnt_udp.c b/components/dfs/dfs_v2/filesystems/nfs/rpc/clnt_udp.c
index 17933539da..91973631c4 100644
--- a/components/dfs/dfs_v2/filesystems/nfs/rpc/clnt_udp.c
+++ b/components/dfs/dfs_v2/filesystems/nfs/rpc/clnt_udp.c
@@ -150,6 +150,7 @@ CLIENT *clntudp_bufcreate(struct sockaddr_in *raddr,
if ((port =
pmap_getport(raddr, program, version, IPPROTO_UDP)) == 0) {
+ rt_kprintf("pmap_getport failure\n");
goto fooy;
}
raddr->sin_port = htons(port);
@@ -164,7 +165,7 @@ CLIENT *clntudp_bufcreate(struct sockaddr_in *raddr,
cu->cu_total.tv_usec = -1;
cu->cu_sendsz = sendsz;
cu->cu_recvsz = recvsz;
- call_msg.rm_xid = ((unsigned long)rt_thread_self()) ^ ((unsigned long)rt_tick_get()) ^ (xid_count++);
+ call_msg.rm_xid = (uint32_t)(((unsigned long)rt_thread_self()) ^ ((unsigned long)rt_tick_get()) ^ (xid_count++));
call_msg.rm_direction = CALL;
call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
call_msg.rm_call.cb_prog = program;
@@ -172,6 +173,7 @@ CLIENT *clntudp_bufcreate(struct sockaddr_in *raddr,
xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf, sendsz, XDR_ENCODE);
if (!xdr_callhdr(&(cu->cu_outxdrs), &call_msg))
{
+ rt_kprintf("xdr_callhdr failure\n");
goto fooy;
}
cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs));
diff --git a/components/dfs/dfs_v2/filesystems/nfs/rpc/types.h b/components/dfs/dfs_v2/filesystems/nfs/rpc/types.h
index 9c4ccd3838..6afc2279b8 100644
--- a/components/dfs/dfs_v2/filesystems/nfs/rpc/types.h
+++ b/components/dfs/dfs_v2/filesystems/nfs/rpc/types.h
@@ -57,9 +57,6 @@ typedef unsigned long u_long;
#include <stdint.h>
#endif
-typedef long long int64_t;
-typedef unsigned long long uint64_t;
-
typedef int bool_t;
typedef int enum_t;
@@ -67,9 +64,6 @@ typedef int enum_t;
typedef unsigned long dev_t;
#endif
-#if !defined(RT_USING_NEWLIB) && !defined(RT_USING_MINILIBC) && !defined(RT_USING_MUSL)
-typedef rt_int32_t ssize_t;
-#endif
/* This needs to be changed to uint32_t in the future */
typedef unsigned long rpcprog_t;
diff --git a/components/dfs/dfs_v2/filesystems/nfs/rpc/xdr.c b/components/dfs/dfs_v2/filesystems/nfs/rpc/xdr.c
index fa3b12ef00..7045aef352 100644
--- a/components/dfs/dfs_v2/filesystems/nfs/rpc/xdr.c
+++ b/components/dfs/dfs_v2/filesystems/nfs/rpc/xdr.c
@@ -196,7 +196,7 @@ bool_t xdr_u_long(XDR* xdrs, unsigned long* ulp)
/*
* XDR long long integers
*/
-bool_t xdr_longlong_t (XDR * xdrs, long long* llp)
+bool_t xdr_longlong_t (XDR * xdrs, int64_t* llp)
{
int32_t t1, t2;
@@ -223,7 +223,7 @@ bool_t xdr_longlong_t (XDR * xdrs, long long* llp)
/*
* XDR unsigned long long integers
*/
-bool_t xdr_u_longlong_t (XDR * xdrs, unsigned long long* ullp)
+bool_t xdr_u_longlong_t (XDR * xdrs, uint64_t* ullp)
{
uint32_t t1, t2;
@@ -363,10 +363,20 @@ bool_t xdr_bool(XDR *xdrs, bool_t *bp)
*/
bool_t xdr_enum(XDR *xdrs, enum_t *ep)
{
+ enum sizecheck { SIZEVAL }; /* used to find the size of an enum */
+
/*
* enums are treated as ints
*/
- return (xdr_long(xdrs, (long *) ep));
+ /* LINTED */ if (sizeof (enum sizecheck) == sizeof (long)) {
+ return (xdr_long(xdrs, (long *)(void *)ep));
+ } else /* LINTED */ if (sizeof (enum sizecheck) == sizeof (int)) {
+ return (xdr_int(xdrs, (int *)(void *)ep));
+ } else /* LINTED */ if (sizeof (enum sizecheck) == sizeof (short)) {
+ return (xdr_short(xdrs, (short *)(void *)ep));
+ } else {
+ return (FALSE);
+ }
}
/*
diff --git a/components/finsh/msh_file.c b/components/finsh/msh_file.c
index 04255747bd..621b8303a5 100644
--- a/components/finsh/msh_file.c
+++ b/components/finsh/msh_file.c
@@ -104,7 +104,7 @@ int msh_exec_script(const char *cmd_line, int size)
int length;
line_buf = (char *) rt_malloc(RT_CONSOLEBUF_SIZE);
- if (line_buf == RT_NULL)
+ if (line_buf == RT_NULL)
{
close(fd);
return -RT_ENOMEM;
@@ -514,10 +514,17 @@ static int cmd_mount(int argc, char **argv)
char *device = argv[1];
char *path = argv[2];
char *fstype = argv[3];
+ char *data = 0;
/* mount a filesystem to the specified directory */
rt_kprintf("mount device %s(%s) onto %s ... ", device, fstype, path);
- if (dfs_mount(device, path, fstype, 0, 0) == 0)
+ if (strcmp(fstype, "nfs") == 0)
+ {
+ data = argv[1];
+ device = 0;
+ }
+
+ if (dfs_mount(device, path, fstype, 0, data) == 0)
{
rt_kprintf("succeed!\n");
return 0;