summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/sys/pioctl.h60
-rw-r--r--sys/sys/xfs_attr.h132
-rw-r--r--sys/sys/xfs_message.h389
3 files changed, 581 insertions, 0 deletions
diff --git a/sys/sys/pioctl.h b/sys/sys/pioctl.h
new file mode 100644
index 00000000000..f8db02b7970
--- /dev/null
+++ b/sys/sys/pioctl.h
@@ -0,0 +1,60 @@
+#ifndef _SYS_PIOCTL_H_
+#define _SYS_PIOCTL_H_
+
+/*
+ */
+#define AFSCALL_PIOCTL 20
+#define AFSCALL_SETPAG 21
+
+#ifndef _VICEIOCTL
+#define _VICEIOCTL(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl))
+#endif /* _VICEIOCTL */
+
+#define VIOCSETAL _VICEIOCTL(1)
+#define VIOCGETAL _VICEIOCTL(2)
+#define VIOCSETTOK _VICEIOCTL(3)
+#define VIOCGETVOLSTAT _VICEIOCTL(4)
+#define VIOCSETVOLSTAT _VICEIOCTL(5)
+#define VIOCFLUSH _VICEIOCTL(6)
+#define VIOCGETTOK _VICEIOCTL(8)
+#define VIOCUNLOG _VICEIOCTL(9)
+#define VIOCCKSERV _VICEIOCTL(10)
+#define VIOCCKBACK _VICEIOCTL(11)
+#define VIOCCKCONN _VICEIOCTL(12)
+#define VIOCWHEREIS _VICEIOCTL(14)
+#define VIOCACCESS _VICEIOCTL(20)
+#define VIOCUNPAG _VICEIOCTL(21)
+#define VIOCGETFID _VICEIOCTL(22)
+#define VIOCSETCACHESIZE _VICEIOCTL(24)
+#define VIOCFLUSHCB _VICEIOCTL(25)
+#define VIOCNEWCELL _VICEIOCTL(26)
+#define VIOCGETCELL _VICEIOCTL(27)
+#define VIOC_AFS_DELETE_MT_PT _VICEIOCTL(28)
+#define VIOC_AFS_STAT_MT_PT _VICEIOCTL(29)
+#define VIOC_FILE_CELL_NAME _VICEIOCTL(30)
+#define VIOC_GET_WS_CELL _VICEIOCTL(31)
+#define VIOC_AFS_MARINER_HOST _VICEIOCTL(32)
+#define VIOC_GET_PRIMARY_CELL _VICEIOCTL(33)
+#define VIOC_VENUSLOG _VICEIOCTL(34)
+#define VIOC_GETCELLSTATUS _VICEIOCTL(35)
+#define VIOC_SETCELLSTATUS _VICEIOCTL(36)
+#define VIOC_FLUSHVOLUME _VICEIOCTL(37)
+#define VIOC_AFS_SYSNAME _VICEIOCTL(38)
+#define VIOC_EXPORTAFS _VICEIOCTL(39)
+#define VIOCGETCACHEPARAMS _VICEIOCTL(40)
+
+struct ViceIoctl {
+ caddr_t in, out;
+ short in_size;
+ short out_size;
+};
+
+struct ClearToken {
+ int32_t AuthHandle;
+ char HandShakeKey[8];
+ int32_t ViceId;
+ int32_t BeginTimestamp;
+ int32_t EndTimestamp;
+};
+
+#endif
diff --git a/sys/sys/xfs_attr.h b/sys/sys/xfs_attr.h
new file mode 100644
index 00000000000..14102c9bd7e
--- /dev/null
+++ b/sys/sys/xfs_attr.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the Kungliga Tekniska
+ * Högskolan and its contributors.
+ *
+ * 4. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
+ */
+
+/* $Id: xfs_attr.h,v 1.1 1998/08/30 16:49:58 art Exp $ */
+
+#ifndef _XFS_ATTR_H
+#define _XFS_ATTR_H
+
+#define XA_V_NONE 0
+#define XA_V_MODE (1 << 0)
+#define XA_V_NLINK (1 << 1)
+#define XA_V_SIZE (1 << 2)
+#define XA_V_UID (1 << 3)
+#define XA_V_GID (1 << 4)
+#define XA_V_ATIME (1 << 5)
+#define XA_V_MTIME (1 << 6)
+#define XA_V_CTIME (1 << 7)
+#define XA_V_FILEID (1 << 8)
+#define XA_V_TYPE (1 << 9)
+
+enum xfs_file_type { XFS_FILE_NON, XFS_FILE_REG, XFS_FILE_DIR,
+ XFS_FILE_BLK, XFS_FILE_CHR, XFS_FILE_LNK,
+ XFS_FILE_SOCK, XFS_FILE_FIFO, XFS_FILE_BAD };
+
+#define XA_CLEAR(xa_p) \
+ ((xa_p)->valid = XA_V_NONE)
+#define XA_SET_MODE(xa_p, value) \
+ (((xa_p)->valid) |= XA_V_MODE, ((xa_p)->xa_mode) = value)
+#define XA_SET_NLINK(xa_p, value) \
+ (((xa_p)->valid) |= XA_V_NLINK, ((xa_p)->xa_nlink) = value)
+#define XA_SET_SIZE(xa_p, value) \
+ (((xa_p)->valid) |= XA_V_SIZE, ((xa_p)->xa_size) = value)
+#define XA_SET_UID(xa_p, value) \
+ (((xa_p)->valid) |= XA_V_UID, ((xa_p)->xa_uid) = value)
+#define XA_SET_GID(xa_p, value) \
+ (((xa_p)->valid) |= XA_V_GID, ((xa_p)->xa_gid) = value)
+#define XA_SET_ATIME(xa_p, value) \
+ (((xa_p)->valid) |= XA_V_ATIME, ((xa_p)->xa_atime) = value)
+#define XA_SET_MTIME(xa_p, value) \
+ (((xa_p)->valid) |= XA_V_MTIME, ((xa_p)->xa_mtime) = value)
+#define XA_SET_CTIME(xa_p, value) \
+ (((xa_p)->valid) |= XA_V_CTIME, ((xa_p)->xa_ctime) = value)
+#define XA_SET_FILEID(xa_p, value) \
+ (((xa_p)->valid) |= XA_V_FILEID, ((xa_p)->xa_fileid) = value)
+#define XA_SET_TYPE(xa_p, value) \
+ (((xa_p)->valid) |= XA_V_TYPE, ((xa_p)->xa_type) = value)
+
+
+#define XA_VALID_MODE(xa_p) \
+ (((xa_p)->valid) & XA_V_MODE)
+#define XA_VALID_NLINK(xa_p) \
+ (((xa_p)->valid) & XA_V_NLINK)
+#define XA_VALID_SIZE(xa_p) \
+ (((xa_p)->valid) & XA_V_SIZE)
+#define XA_VALID_UID(xa_p) \
+ (((xa_p)->valid) & XA_V_UID)
+#define XA_VALID_GID(xa_p) \
+ (((xa_p)->valid) & XA_V_GID)
+#define XA_VALID_ATIME(xa_p) \
+ (((xa_p)->valid) & XA_V_ATIME)
+#define XA_VALID_MTIME(xa_p) \
+ (((xa_p)->valid) & XA_V_MTIME)
+#define XA_VALID_CTIME(xa_p) \
+ (((xa_p)->valid) & XA_V_CTIME)
+#define XA_VALID_FILEID(xa_p) \
+ (((xa_p)->valid) & XA_V_FILEID)
+#define XA_VALID_TYPE(xa_p) \
+ (((xa_p)->valid) & XA_V_TYPE)
+
+/*
+ * Under glibc and Linux, foo_t in the kernel is not the same type as
+ * foo_t in user-level. Therefore we need these defines.
+ */
+
+#if !defined(HAVE_LINUX_TYPES_H) && !defined(__KERNEL__)
+typedef mode_t __kernel_mode_t;
+typedef nlink_t __kernel_nlink_t;
+typedef off_t __kernel_off_t;
+typedef uid_t __kernel_uid_t;
+typedef gid_t __kernel_gid_t;
+#endif
+
+struct xfs_attr {
+ u_int32_t valid;
+ __kernel_mode_t xa_mode;
+ __kernel_nlink_t xa_nlink;
+ __kernel_off_t xa_size;
+ __kernel_uid_t xa_uid;
+ __kernel_gid_t xa_gid;
+ time_t xa_atime;
+ time_t xa_mtime;
+ time_t xa_ctime;
+ u_int32_t xa_fileid;
+ enum xfs_file_type xa_type;
+};
+
+#endif /* _XFS_ATTR_H */
diff --git a/sys/sys/xfs_message.h b/sys/sys/xfs_message.h
new file mode 100644
index 00000000000..18d6e38cee8
--- /dev/null
+++ b/sys/sys/xfs_message.h
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the Kungliga Tekniska
+ * Högskolan and its contributors.
+ *
+ * 4. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
+ */
+
+/* $Id: xfs_message.h,v 1.1 1998/08/30 16:49:58 art Exp $ */
+
+#ifndef _xmsg_h
+#define _xmsg_h
+
+#if !defined(__LINUX__) && !defined(HAVE_GLIBC)
+#include <sys/types.h>
+#include <sys/param.h>
+#else
+#include <linux/types.h>
+#include <linux/param.h>
+#endif
+
+#include <sys/xfs_attr.h>
+
+/* Temporary hack? */
+#define MAX_XMSG_SIZE (1024*64)
+
+typedef u_int32_t pag_t;
+
+/*
+ * The xfs_cred, if pag == 0, use uid
+ */
+struct xfs_cred {
+ __kernel_uid_t uid;
+ pag_t pag;
+};
+typedef struct xfs_cred xfs_cred;
+
+#define MAXHANDLE (4*4)
+#define MAXRIGHTS 8
+
+#define XFS_ANONYMOUSID 32766
+
+typedef struct xfs_handle {
+ u_int a, b, c, d;
+} xfs_handle;
+
+#define xfs_handle_eq(p, q) \
+((p)->a == (q)->a && (p)->b == (q)->b && (p)->c == (q)->c && (p)->d == (q)->d)
+
+#define CACHEHANDLESIZE 4
+
+typedef struct xfs_cache_handle {
+ u_char data[CACHEHANDLESIZE];
+} xfs_cache_handle;
+
+/*
+ * Tokens that apply to nodes, open modes and attributes. Shared
+ * reading might be used for exec and exclusive write for remove.
+ */
+#define XFS_OPEN_MASK 0x000f
+#define XFS_OPEN_NR 0x0001 /* Normal reading, data might change */
+#define XFS_OPEN_SR 0x0002 /* Shared reading, data won't change */
+#define XFS_OPEN_NW 0x0004 /* Normal writing, multiple writers */
+#define XFS_OPEN_EW 0x0008 /* Exclusive writing (open really) */
+
+#define XFS_ATTR_MASK 0x0030
+#define XFS_ATTR_R 0x0010 /* Attributes valid */
+#define XFS_ATTR_W 0x0020 /* Attributes valid and modifiable */
+
+/*
+ * Tokens that apply to node data.
+ */
+#define XFS_DATA_MASK 0x00c0
+#define XFS_DATA_R 0x0040 /* Data valid */
+#define XFS_DATA_W 0x0080 /* Data valid and modifiable */
+#define XFS_LOCK_MASK 0x0300
+#define XFS_LOCK_R 0x0100 /* Data Shared locks? */
+#define XFS_LOCK_W 0x0200 /* Data Exclusive locks? */
+
+#define XFS_ATTR_VALID XFS_ATTR_R
+#define XFS_DATA_VALID XFS_DATA_W
+
+/* xfs_node.flags */
+#define XFS_DATA_DIRTY 0x0001
+#define XFS_ATTR_DIRTY 0x0002
+
+/* Are necessary tokens available? */
+#define XFS_TOKEN_GOT(xn, tok) ((xn)->tokens & (tok))
+#define XFS_TOKEN_SET(xn, tok, mask) ((xn)->tokens |= ((tok) & (mask)))
+#define XFS_TOKEN_CLEAR(xn, tok, mask) ((xn)->tokens &= ~((tok) & (mask)))
+
+/* definitions for the rights fields */
+#define XFS_RIGHT_R 0x01 /* may read? */
+#define XFS_RIGHT_W 0x02 /* may write? */
+#define XFS_RIGHT_X 0x04 /* may execute? */
+
+struct xfs_msg_node {
+ xfs_handle handle;
+ u_int tokens;
+ struct xfs_attr attr;
+ pag_t id[MAXRIGHTS];
+ u_char rights[MAXRIGHTS];
+ u_char anonrights;
+};
+
+/*
+ * Messages passed through the xfs_dev.
+ */
+struct xfs_message_header {
+ u_int size;
+ u_int opcode;
+ u_int sequence_num; /* Private */
+};
+
+/*
+ * Used by putdata flag
+ */
+
+enum { XFS_READ = 1, XFS_WRITE = 2, XFS_NONBLOCK = 4, XFS_APPEND = 8};
+
+/*
+ * Flags for inactivenode
+ */
+
+enum { XFS_NOREFS = 1, XFS_DELETE = 2 };
+
+/*
+ * Defined message types and their opcodes.
+ */
+#define XFS_MSG_VERSION 0
+#define XFS_MSG_WAKEUP 1
+
+#define XFS_MSG_GETROOT 2
+#define XFS_MSG_INSTALLROOT 3
+
+#define XFS_MSG_GETNODE 4
+#define XFS_MSG_INSTALLNODE 5
+
+#define XFS_MSG_GETATTR 6
+#define XFS_MSG_INSTALLATTR 7
+
+#define XFS_MSG_GETDATA 8
+#define XFS_MSG_INSTALLDATA 9
+
+#define XFS_MSG_INACTIVENODE 10
+#define XFS_MSG_INVALIDNODE 11
+ /* XXX Must handle dropped/revoked tokens better */
+
+#define XFS_MSG_OPEN 12
+
+#define XFS_MSG_PUTDATA 13
+#define XFS_MSG_PUTATTR 14
+
+/* Directory manipulating messages. */
+#define XFS_MSG_CREATE 15
+#define XFS_MSG_MKDIR 16
+#define XFS_MSG_LINK 17
+#define XFS_MSG_SYMLINK 18
+
+#define XFS_MSG_REMOVE 19
+#define XFS_MSG_RMDIR 20
+
+#define XFS_MSG_RENAME 21
+
+#define XFS_MSG_PIOCTL 22
+#define XFS_MSG_WAKEUP_DATA 23
+
+#define XFS_MSG_COUNT 24
+
+/* XFS_MESSAGE_WAKEUP */
+struct xfs_message_wakeup {
+ struct xfs_message_header header;
+ int sleepers_sequence_num; /* Where to send wakeup */
+ int error; /* Return value */
+};
+
+/* XFS_MESSAGE_GETROOT */
+struct xfs_message_getroot {
+ struct xfs_message_header header;
+ struct xfs_cred cred;
+};
+
+/* XFS_MESSAGE_INSTALLROOT */
+struct xfs_message_installroot {
+ struct xfs_message_header header;
+ struct xfs_msg_node node;
+};
+
+/* XFS_MESSAGE_GETNODE */
+struct xfs_message_getnode {
+ struct xfs_message_header header;
+ struct xfs_cred cred;
+ xfs_handle parent_handle;
+ char name[256]; /* XXX */
+};
+
+/* XFS_MESSAGE_INSTALLNODE */
+struct xfs_message_installnode {
+ struct xfs_message_header header;
+ xfs_handle parent_handle;
+ char name[256]; /* XXX */
+ struct xfs_msg_node node;
+};
+
+/* XFS_MESSAGE_GETATTR */
+struct xfs_message_getattr {
+ struct xfs_message_header header;
+ struct xfs_cred cred;
+ xfs_handle handle;
+};
+
+/* XFS_MESSAGE_INSTALLATTR */
+struct xfs_message_installattr {
+ struct xfs_message_header header;
+ struct xfs_msg_node node;
+};
+
+/* XFS_MESSAGE_GETDATA */
+struct xfs_message_getdata {
+ struct xfs_message_header header;
+ struct xfs_cred cred;
+ xfs_handle handle;
+ u_int tokens;
+};
+
+/* XFS_MESSAGE_INSTALLDATA */
+struct xfs_message_installdata {
+ struct xfs_message_header header;
+ struct xfs_msg_node node;
+ struct xfs_cache_handle cache_handle;
+};
+
+/* XFS_MSG_INACTIVENODE */
+struct xfs_message_inactivenode {
+ struct xfs_message_header header;
+ xfs_handle handle;
+ u_int flag;
+};
+
+/* XFS_MSG_INVALIDNODE */
+struct xfs_message_invalidnode {
+ struct xfs_message_header header;
+ xfs_handle handle;
+};
+
+/* XFS_MSG_OPEN */
+struct xfs_message_open {
+ struct xfs_message_header header;
+ struct xfs_cred cred;
+ xfs_handle handle;
+ u_int tokens;
+};
+
+/* XFS_MSG_PUTDATA */
+struct xfs_message_putdata {
+ struct xfs_message_header header;
+ xfs_handle handle;
+ struct xfs_attr attr; /* XXX ??? */
+ struct xfs_cred cred;
+ u_int flag;
+};
+
+/* XFS_MSG_PUTATTR */
+struct xfs_message_putattr {
+ struct xfs_message_header header;
+ xfs_handle handle;
+ struct xfs_attr attr;
+ struct xfs_cred cred;
+};
+
+/* XFS_MSG_CREATE */
+struct xfs_message_create {
+ struct xfs_message_header header;
+ xfs_handle parent_handle;
+ char name[256]; /* XXX */
+ struct xfs_attr attr;
+#if 0 /* XXX ??? */
+ enum vcexcl exclusive;
+#endif
+ int mode;
+ struct xfs_cred cred;
+};
+
+/* XFS_MSG_MKDIR */
+struct xfs_message_mkdir {
+ struct xfs_message_header header;
+ xfs_handle parent_handle;
+ char name[256]; /* XXX */
+ struct xfs_attr attr;
+ struct xfs_cred cred;
+};
+
+/* XFS_MSG_LINK */
+struct xfs_message_link {
+ struct xfs_message_header header;
+ xfs_handle parent_handle;
+ char name[256]; /* XXX */
+ xfs_handle from_handle;
+ struct xfs_cred cred;
+};
+
+/* XFS_MSG_SYMLINK */
+struct xfs_message_symlink {
+ struct xfs_message_header header;
+ xfs_handle parent_handle;
+ char name[256]; /* XXX */
+ char contents[2048]; /* XXX */
+ struct xfs_attr attr;
+ struct xfs_cred cred;
+};
+
+/* XFS_MSG_REMOVE */
+struct xfs_message_remove {
+ struct xfs_message_header header;
+ xfs_handle parent_handle;
+ char name[256]; /* XXX */
+ struct xfs_cred cred;
+};
+
+/* XFS_MSG_RMDIR */
+struct xfs_message_rmdir {
+ struct xfs_message_header header;
+ xfs_handle parent_handle;
+ char name[256]; /* XXX */
+ struct xfs_cred cred;
+};
+
+/* XFS_MSG_RENAME */
+struct xfs_message_rename {
+ struct xfs_message_header header;
+ xfs_handle old_parent_handle;
+ char old_name[256]; /* XXX */
+ xfs_handle new_parent_handle;
+ char new_name[256]; /* XXX */
+ struct xfs_cred cred;
+};
+
+/* XFS_MSG_PIOCTL */
+struct xfs_message_pioctl {
+ struct xfs_message_header header;
+ int opcode ;
+ xfs_cred cred; /* XXX we should also use PAG */
+ int insize;
+ int outsize;
+ char msg[2048] ; /* XXX */
+ xfs_handle handle;
+};
+
+
+/* XFS_MESSAGE_WAKEUP_DATA */
+struct xfs_message_wakeup_data {
+ struct xfs_message_header header;
+ int sleepers_sequence_num; /* Where to send wakeup */
+ int error; /* Return value */
+ int len;
+ char msg[2048] ; /* XXX */
+};
+
+#endif /* _xmsg_h */