summaryrefslogtreecommitdiffstats
path: root/rtemsbsd/nfsclient/nfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'rtemsbsd/nfsclient/nfs.c')
-rw-r--r--rtemsbsd/nfsclient/nfs.c141
1 files changed, 53 insertions, 88 deletions
diff --git a/rtemsbsd/nfsclient/nfs.c b/rtemsbsd/nfsclient/nfs.c
index d6f43305..e9e83abb 100644
--- a/rtemsbsd/nfsclient/nfs.c
+++ b/rtemsbsd/nfsclient/nfs.c
@@ -397,71 +397,36 @@ DirInfo dip;
/* Macro for accessing serporid fields
*/
-#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)
-
-/*
- * FIXME: The use of the serporid structure with several embedded unions to
- * split up the specific NFS request/response structures is quite a hack. It
- * breaks on 64-bit targets due to the presence of pointer members which affect
- * the overall alignment. Use a packed serporidok structure to hopefully fix
- * this issue.
- */
+#define SERP_ARGS(node) ((node)->serporid.serporid)
+#define SERP_ATTR(node) ((node)->serporid.serporid.attributes)
+#define SERP_FILE(node) ((node)->serporid.serporid.file)
typedef struct serporidok {
fattr attributes;
- nfs_fh file;
union {
- struct {
- filename name;
- } diroparg;
- struct {
- sattr attributes;
- } sattrarg;
- struct {
- uint32_t offset;
- uint32_t count;
- uint32_t totalcount;
- } readarg;
- struct {
- uint32_t beginoffset;
- uint32_t offset;
- uint32_t totalcount;
- struct {
- uint32_t data_len;
- char* data_val;
- } data;
- } writearg;
- struct {
- filename name;
- sattr attributes;
- } createarg;
- struct {
- filename name;
- diropargs to;
- } renamearg;
- struct {
- diropargs to;
- } linkarg;
- struct {
- filename name;
- nfspath to;
- sattr attributes;
- } symlinkarg;
- struct {
- nfscookie cookie;
- uint32_t count;
- } readdirarg;
- } arg_u;
-} RTEMS_PACKED serporidok;
+ nfs_fh file;
+ diropargs diroparg;
+ sattrargs sattrarg;
+ readargs readarg;
+ writeargs writearg;
+ createargs createarg;
+ renameargs renamearg;
+ linkargs linkarg;
+ symlinkargs symlinkarg;
+ readdirargs readdirarg;
+ };
+} serporidok;
+/*
+ * The nfsstat is an enum, so has an integer alignment. The serporid contains
+ * pointers, so has at least a pointer alignment. The packed attribute ensures
+ * that there is no gap between the status and serporid members on 64-bit
+ * targets.
+ */
typedef struct serporid {
nfsstat status;
- union {
- serporidok serporid;
- } serporid_u;
-} serporid;
+ serporidok serporid;
+} RTEMS_PACKED serporid;
/* an XDR routine to encode/decode the inverted diropres
* into an nfsnodestat;
@@ -493,7 +458,7 @@ xdr_serporid(XDR *xdrs, serporid *objp)
return FALSE;
switch (objp->status) {
case NFS_OK:
- if (!xdr_serporidok(xdrs, &objp->serporid_u.serporid))
+ if (!xdr_serporidok(xdrs, &objp->serporid))
return FALSE;
break;
default:
@@ -2040,7 +2005,7 @@ char *dupname;
rtems_clock_get_tod_timeval(&now);
- SERP_ARGS(node).createarg.name = dupname;
+ SERP_ARGS(node).createarg.where.name = dupname;
SERP_ARGS(node).createarg.attributes.mode = mode;
SERP_ARGS(node).createarg.attributes.uid = nfs->uid;
SERP_ARGS(node).createarg.attributes.gid = nfs->gid;
@@ -2093,19 +2058,19 @@ static int nfs_rmnod(
return rv;
}
-static int nfs_utime(
+static int nfs_utimens(
const rtems_filesystem_location_info_t *pathloc, /* IN */
- time_t actime, /* IN */
- time_t modtime /* IN */
+ struct timespec times[2] /* IN */
+
)
{
sattr arg;
/* TODO: add rtems EPOCH - UNIX EPOCH seconds */
- arg.atime.seconds = actime;
- arg.atime.useconds = 0;
- arg.mtime.seconds = modtime;
- arg.mtime.useconds = 0;
+ arg.atime.seconds = times[0].tv_sec;
+ arg.atime.useconds = times[0].tv_nsec / 1000;
+ arg.mtime.seconds = times[1].tv_sec;
+ arg.mtime.useconds = times[1].tv_nsec / 1000;
return nfs_sattr(pathloc->node_access, &arg, SATTR_ATIME | SATTR_MTIME);
}
@@ -2134,7 +2099,7 @@ char *dupname;
rtems_clock_get_tod_timeval(&now);
- SERP_ARGS(node).symlinkarg.name = dupname;
+ SERP_ARGS(node).symlinkarg.from.name = dupname;
SERP_ARGS(node).symlinkarg.to = (nfspath) target;
SERP_ARGS(node).symlinkarg.attributes.mode = S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO;
@@ -2231,7 +2196,7 @@ static int nfs_rename(
nfs_fh *toDirDst = &SERP_ARGS(oldParentNode).renamearg.to.dir;
nfsstat status;
- SERP_ARGS(oldParentNode).renamearg.name = oldNode->str;
+ SERP_ARGS(oldParentNode).renamearg.from.name = oldNode->str;
SERP_ARGS(oldParentNode).renamearg.to.name = dupname;
memcpy(toDirDst, toDirSrc, sizeof(*toDirDst));
@@ -2297,25 +2262,25 @@ sattr arg;
}
const struct _rtems_filesystem_operations_table nfs_fs_ops = {
- .lock_h = nfs_lock,
- .unlock_h = nfs_unlock,
- .eval_path_h = nfs_eval_path,
- .link_h = nfs_link,
+ .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,
- .mount_h = rtems_filesystem_default_mount,
- .unmount_h = rtems_filesystem_default_unmount,
- .fsunmount_me_h = nfs_fsunmount_me,
- .utime_h = nfs_utime,
- .symlink_h = nfs_symlink,
- .readlink_h = nfs_readlink,
- .rename_h = nfs_rename,
- .statvfs_h = rtems_filesystem_default_statvfs
+ .mknod_h = nfs_mknod,
+ .rmnod_h = nfs_rmnod,
+ .fchmod_h = nfs_fchmod,
+ .chown_h = nfs_chown,
+ .clonenod_h = nfs_clonenode,
+ .freenod_h = nfs_freenode,
+ .mount_h = rtems_filesystem_default_mount,
+ .unmount_h = rtems_filesystem_default_unmount,
+ .fsunmount_me_h = nfs_fsunmount_me,
+ .utimens_h = nfs_utimens,
+ .symlink_h = nfs_symlink,
+ .readlink_h = nfs_readlink,
+ .rename_h = nfs_rename,
+ .statvfs_h = rtems_filesystem_default_statvfs
};
/*****************************************
@@ -3149,7 +3114,7 @@ rtems_filesystem_location_info_t old;
rtems_filesystem_current->location = old;
}
rtems_semaphore_release(rpa->sync);
- rtems_task_delete(RTEMS_SELF);
+ rtems_task_exit();
}