Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/osf1 convert flock struct
details: https://anonhg.NetBSD.org/src/rev/72c50f921775
branches: trunk
changeset: 474017:72c50f921775
user: cgd <cgd%NetBSD.org@localhost>
date: Sat Jun 26 01:23:23 1999 +0000
description:
convert flock struct
diffstat:
sys/compat/osf1/osf1_cvt.c | 92 +++++++++++++++++++++++++++++++++++++++++++++-
sys/compat/osf1/osf1_cvt.h | 7 +++-
2 files changed, 97 insertions(+), 2 deletions(-)
diffs (134 lines):
diff -r 6ffa33009ed7 -r 72c50f921775 sys/compat/osf1/osf1_cvt.c
--- a/sys/compat/osf1/osf1_cvt.c Sat Jun 26 01:21:30 1999 +0000
+++ b/sys/compat/osf1/osf1_cvt.c Sat Jun 26 01:23:23 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_cvt.c,v 1.6 1999/05/10 05:58:44 cgd Exp $ */
+/* $NetBSD: osf1_cvt.c,v 1.7 1999/06/26 01:23:23 cgd Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -307,6 +307,96 @@
{ 0 }
};
+void
+osf1_cvt_flock_from_native(nf, of)
+ const struct flock *nf;
+ struct osf1_flock *of;
+{
+
+ memset(of, 0, sizeof of);
+
+ of->l_start = nf->l_start;
+ of->l_len = nf->l_len;
+ of->l_pid = nf->l_pid;
+
+ switch (nf->l_type) {
+ case F_RDLCK:
+ of->l_type = OSF1_F_RDLCK;
+ break;
+
+ case F_WRLCK:
+ of->l_type = OSF1_F_WRLCK;
+ break;
+
+ case F_UNLCK:
+ of->l_type = OSF1_F_UNLCK;
+ break;
+ }
+
+ switch (nf->l_whence) {
+ case SEEK_SET:
+ of->l_whence = OSF1_SEEK_SET;
+ break;
+
+ case SEEK_CUR:
+ of->l_whence = OSF1_SEEK_CUR;
+ break;
+
+ case SEEK_END:
+ of->l_whence = OSF1_SEEK_END;
+ break;
+ }
+}
+
+int
+osf1_cvt_flock_to_native(of, nf)
+ const struct osf1_flock *of;
+ struct flock *nf;
+{
+
+ memset(nf, 0, sizeof nf);
+
+ nf->l_start = of->l_start;
+ nf->l_len = of->l_len;
+ nf->l_pid = of->l_pid;
+
+ switch (of->l_type) {
+ case OSF1_F_RDLCK:
+ nf->l_type = F_RDLCK;
+ break;
+
+ case OSF1_F_WRLCK:
+ nf->l_type = F_WRLCK;
+ break;
+
+ case OSF1_F_UNLCK:
+ nf->l_type = F_UNLCK;
+ break;
+
+ default:
+ return (EINVAL);
+ }
+
+ switch (of->l_whence) {
+ case OSF1_SEEK_SET:
+ nf->l_whence = SEEK_SET;
+ break;
+
+ case OSF1_SEEK_CUR:
+ nf->l_whence = SEEK_CUR;
+ break;
+
+ case OSF1_SEEK_END:
+ nf->l_whence = SEEK_END;
+ break;
+
+ default:
+ return (EINVAL);
+ }
+
+ return (0);
+}
+
int
osf1_cvt_msghdr_xopen_to_native(omh, bmh)
const struct osf1_msghdr_xopen *omh;
diff -r 6ffa33009ed7 -r 72c50f921775 sys/compat/osf1/osf1_cvt.h
--- a/sys/compat/osf1/osf1_cvt.h Sat Jun 26 01:21:30 1999 +0000
+++ b/sys/compat/osf1/osf1_cvt.h Sat Jun 26 01:23:23 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_cvt.h,v 1.5 1999/05/10 05:58:44 cgd Exp $ */
+/* $NetBSD: osf1_cvt.h,v 1.6 1999/06/26 01:23:25 cgd Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -39,6 +39,7 @@
#include <sys/resource.h>
#include <sys/signal.h>
#include <sys/stat.h>
+#include <sys/fcntl.h>
#include <compat/common/compat_util.h>
@@ -47,6 +48,10 @@
#define osf1_cvt_dev_to_native(dev) \
makedev(osf1_major(dev), osf1_minor(dev))
+void osf1_cvt_flock_from_native(const struct flock *nf,
+ struct osf1_flock *of);
+int osf1_cvt_flock_to_native(const struct osf1_flock *of,
+ struct flock *nf);
int osf1_cvt_msghdr_xopen_to_native(const struct osf1_msghdr_xopen *omh,
struct msghdr *nmh);
int osf1_cvt_pathconf_name_to_native(int oname, int *bnamep);
Home |
Main Index |
Thread Index |
Old Index