diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 1999-04-30 01:59:21 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 1999-04-30 01:59:21 +0000 |
commit | f323580e7a86b5c7f0036e25994c940666bdb13e (patch) | |
tree | f8ead946a9dabf864257de746d7fb6b431b0f212 /sys/xfs | |
parent | 07b4a33ad356d7a2d300f6ca586637879e4ad5fd (diff) |
upgrade Arla to fresher code. Too many new features and bugfixes.
Diffstat (limited to 'sys/xfs')
-rw-r--r-- | sys/xfs/nxfs.h | 41 | ||||
-rw-r--r-- | sys/xfs/xfs_attr.h | 35 | ||||
-rw-r--r-- | sys/xfs/xfs_common.h | 28 | ||||
-rw-r--r-- | sys/xfs/xfs_deb.c | 20 | ||||
-rw-r--r-- | sys/xfs/xfs_deb.h | 36 | ||||
-rw-r--r-- | sys/xfs/xfs_dev.h | 139 | ||||
-rw-r--r-- | sys/xfs/xfs_fs.h | 62 | ||||
-rw-r--r-- | sys/xfs/xfs_message.c | 310 | ||||
-rw-r--r-- | sys/xfs/xfs_message.h | 299 | ||||
-rw-r--r-- | sys/xfs/xfs_msg_locl.h | 65 | ||||
-rw-r--r-- | sys/xfs/xfs_node.h | 81 | ||||
-rw-r--r-- | sys/xfs/xfs_pioctl.h | 46 | ||||
-rw-r--r-- | sys/xfs/xfs_syscalls.h | 61 |
13 files changed, 770 insertions, 453 deletions
diff --git a/sys/xfs/nxfs.h b/sys/xfs/nxfs.h index 5a584697642..1083484d7c8 100644 --- a/sys/xfs/nxfs.h +++ b/sys/xfs/nxfs.h @@ -1,40 +1 @@ -/* $OpenBSD: nxfs.h,v 1.2 1998/08/30 17:35:41 art Exp $ */ -/* - * Copyright (c) 1995, 1996, 1997 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. - */ - -#define NXFS 2 +#define NXFS 2 diff --git a/sys/xfs/xfs_attr.h b/sys/xfs/xfs_attr.h index de66a2ee837..a1a921ea7f8 100644 --- a/sys/xfs/xfs_attr.h +++ b/sys/xfs/xfs_attr.h @@ -1,4 +1,3 @@ -/* $OpenBSD: xfs_attr.h,v 1.1 1998/08/31 05:13:21 art Exp $ */ /* * Copyright (c) 1998 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). @@ -37,10 +36,10 @@ * SUCH DAMAGE. */ -/* $KTH: xfs_attr.h,v 1.7 1998/07/12 15:29:09 map Exp $ */ +/* $Id: xfs_attr.h,v 1.2 1999/04/30 01:58:59 art Exp $ */ -#ifndef _SYS_XFS_ATTR_H_ -#define _SYS_XFS_ATTR_H_ +#ifndef _XFS_ATTR_H +#define _XFS_ATTR_H #define XA_V_NONE 0 #define XA_V_MODE (1 << 0) @@ -55,11 +54,11 @@ #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 }; + 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) + ((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) \ @@ -117,17 +116,17 @@ 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; + 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/xfs/xfs_common.h b/sys/xfs/xfs_common.h index ea927f3858a..4193434a3e6 100644 --- a/sys/xfs/xfs_common.h +++ b/sys/xfs/xfs_common.h @@ -1,6 +1,5 @@ -/* $OpenBSD: xfs_common.h,v 1.2 1998/08/31 05:13:21 art Exp $ */ /* - * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan + * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -37,20 +36,21 @@ * SUCH DAMAGE. */ -/* $KTH: xfs_common.h,v 1.5 1998/07/13 20:36:36 art Exp $ */ +/* $Id: xfs_common.h,v 1.3 1999/04/30 01:58:59 art Exp $ */ -#ifndef _XFS_XFS_COMMON_H_ -#define _XFS_XFS_COMMON_H_ +#ifndef _xfs_common_h +#define _xfs_common_h -#include <sys/malloc.h> - -#ifdef DEBUG -void *xfs_alloc __P((u_int size)); -void xfs_free __P((void *, u_int size)); +#ifdef XFS_DEBUG +void *xfs_alloc(u_int size); +void xfs_free(void *, u_int size); +#else +#ifdef __osf__ +#define xfs_alloc(a) malloc((a), BUCKETINDEX(a), M_TEMP, M_WAITOK) #else -#define xfs_alloc(s) malloc((s), M_TEMP, M_WAITOK) /* XXX - what kind? */ -#define xfs_free(p, s) free((p), M_TEMP) +#define xfs_alloc(a) malloc((a), M_TEMP, M_WAITOK) #endif +#define xfs_free(a, size) free(a, M_TEMP) +#endif /* XFS_DEBUG */ -#define RCSID(x) -#endif +#endif /* _xfs_common_h */ diff --git a/sys/xfs/xfs_deb.c b/sys/xfs/xfs_deb.c index f1f259404bb..2e838360af7 100644 --- a/sys/xfs/xfs_deb.c +++ b/sys/xfs/xfs_deb.c @@ -1,6 +1,5 @@ -/* $OpenBSD: xfs_deb.c,v 1.1 1998/08/30 16:47:20 art Exp $ */ /* - * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -38,15 +37,24 @@ */ #include <xfs/xfs_deb.h> +#include <xfs/xfs_debug.h> -/* $KTH: xfs_deb.c,v 1.3 1998/03/20 21:02:32 art Exp $ */ +/* $Id: xfs_deb.c,v 1.2 1999/04/30 01:59:00 art Exp $ */ /* X is on */ #define X(y) y /* and x is off */ #define x(y) 0 -int xfsdeb = (0 - | - x(XDEBANY) +unsigned int xfsdeb = (0 | + x(XDEBDEV) | + x(XDEBMSG) | + x(XDEBDNLC) | + x(XDEBNODE) | + x(XDEBVNOPS) | + x(XDEBVFOPS) | + x(XDEBLKM) | + x(XDEBSYS) | + x(XDEBMEM) | + 0 ); diff --git a/sys/xfs/xfs_deb.h b/sys/xfs/xfs_deb.h index cfec18d92af..dcfb21f97d9 100644 --- a/sys/xfs/xfs_deb.h +++ b/sys/xfs/xfs_deb.h @@ -1,4 +1,3 @@ -/* $OpenBSD: xfs_deb.h,v 1.2 1998/08/31 05:13:22 art Exp $ */ /* * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). @@ -37,27 +36,30 @@ * SUCH DAMAGE. */ -#ifndef _XFS_XFS_DEB_H_ -#define _XFS_XFS_DEB_H_ +/* $Id: xfs_deb.h,v 1.3 1999/04/30 01:59:00 art Exp $ */ -/* masks */ -#define XDEBANY 0xffffffff -#define XDEBDEV 0x00000001 -#define XDEBMSG 0x00000002 -#define XDEBDNLC 0x00000004 -#define XDEBNODE 0x00000008 -#define XDEBVNOPS 0x00000010 -#define XDEBVFOPS 0x00000020 -#define XDEBLKM 0x00000040 -#define XDEBSYS 0x00000080 -#define XDEBMEM 0x00000100 +#ifndef _xfs_deb_h +#define _xfs_deb_h -extern int xfsdeb; +#include <xfs/xfs_debug.h> -#ifdef DEBUG +#define HAVE_XDEBDEV +#define HAVE_XDEBMSG +#define HAVE_XDEBDNLC +#define HAVE_XDEBNODE +#define HAVE_XDEBVNOPS +#define HAVE_XDEBVFOPS +#define HAVE_XDEBLKM +#define HAVE_XDEBSYS +#define HAVE_XDEBMEM +#define HAVE_XDEBSYS + +extern unsigned int xfsdeb; + +#ifdef XFS_DEBUG #define XFSDEB(mask, args) do { if (mask&xfsdeb) printf args; } while (0) #else #define XFSDEB(mask, args) do { ; } while (0) #endif -#endif +#endif /* _xfs_deb_h */ diff --git a/sys/xfs/xfs_dev.h b/sys/xfs/xfs_dev.h index 4b95a68959c..095d004976d 100644 --- a/sys/xfs/xfs_dev.h +++ b/sys/xfs/xfs_dev.h @@ -1,4 +1,3 @@ -/* $OpenBSD: xfs_dev.h,v 1.2 1998/08/31 05:13:23 art Exp $ */ /* * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). @@ -37,34 +36,128 @@ * SUCH DAMAGE. */ -/* $KTH: xfs_dev.h,v 1.4 1998/04/05 18:19:50 art Exp $ */ +/* $Id: xfs_dev.h,v 1.3 1999/04/30 01:59:00 art Exp $ */ -#ifndef _XFS_XFS_DEV_H_ -#define _XFS_XFS_DEV_H_ +#ifndef _xfs_dev_h +#define _xfs_dev_h -int xfs_devopen __P((dev_t dev, int flags, int devtype, struct proc * p)); +/* + * Queues of xfs_links hold outbound messages and processes sleeping + * for replies. The last field is used to return error to sleepers and + * to keep record of memory to be deallocated when messages have been + * delivered or dropped. + */ + +struct xfs_link { + struct xfs_link *prev, *next; + struct xfs_message_header *message; + u_int error_or_size; /* error on sleepq and size on + * messageq */ +}; + +struct xfs_channel { + struct xfs_link messageq; /* Messages not yet read */ + struct xfs_link sleepq; /* Waiting for reply message */ + u_int nsequence; +#ifdef __osf__ + sel_queue_t sel_q; +#else + struct selinfo selinfo; +#endif + struct xfs_message_header *message_buffer; + int status; +#define CHANNEL_OPENED 0x1 +#define CHANNEL_WAITING 0x2 +}; + +extern struct xfs_channel xfs_channel[NXFS]; + +/* + * These are variant dependent + */ + +int xfs_func_is_devopen(void*); +void xfs_select_wakeup(struct xfs_channel *); + +int xfs_install_device(void); +int xfs_uninstall_device(void); -int xfs_install_device __P((void)); -int xfs_uninstall_device __P((void)); +int xfs_install_filesys(void); +int xfs_may_uninstall_filesys(void); +int xfs_uninstall_filesys(void); -int xfs_install_filesys __P((void)); -int xfs_uninstall_filesys __P((void)); +int xfs_stat_filesys(void); +int xfs_stat_device(void); + +/* + * And these should be generic + */ -int xfs_stat_filesys __P((void)); -int xfs_stat_device __P((void)); +void +xfs_initq(struct xfs_link *q); -int xfs_message_send __P((int fd, struct xfs_message_header *message, - u_int size)); -int xfs_message_rpc __P((int fd, struct xfs_message_header *message, - u_int size)); -int xfs_message_receive __P((int fd,struct xfs_message_header *message, - u_int size,struct proc *p)); -int xfs_message_wakeup __P((int fd, struct xfs_message_wakeup *message, - u_int size, struct proc *p)); -int xfs_message_wakeup_data __P((int fd, - struct xfs_message_wakeup_data *message, - u_int size, struct proc *p)); -#define USE_SELECT +int +xfs_emptyq(struct xfs_link *q); +int +xfs_onq(struct xfs_link *link); + +void +xfs_appendq(struct xfs_link *q, struct xfs_link *p); + +void +xfs_outq(struct xfs_link *p); + +int +xfs_devopen_common(dev_t dev); + +#ifndef __osf__ /* XXX - we should do the same for osf */ +int xfs_devopen(dev_t dev, int flag, int devtype, struct proc *proc); +int xfs_devclose(dev_t dev, int flag, int devtype, struct proc *proc); +int xfs_devioctl(dev_t dev, +#if defined(__NetBSD__) || defined(__OpenBSD__) + u_long cmd, +#else /* if defined(__FreeBSD__) */ + int cmd, #endif + caddr_t data, int flags, struct proc *p); +int xfs_devselect(dev_t dev, int which, struct proc *p); +#endif /* ! __osf__ */ + +int +xfs_devclose_common(dev_t dev, struct proc *p); + +int +xfs_devread(dev_t dev, struct uio * uiop, int ioflag); + +int +xfs_devwrite(dev_t dev, struct uio *uiop, int ioflag); + +int +xfs_message_send(int fd, struct xfs_message_header * message, u_int size); + +int +xfs_message_rpc(int fd, struct xfs_message_header * message, u_int size); + +int +xfs_message_receive(int fd, + struct xfs_message_header *message, + u_int size, + struct proc *p); + +int +xfs_message_wakeup(int fd, + struct xfs_message_wakeup *message, + u_int size, + struct proc *p); + +int +xfs_message_wakeup_data(int fd, + struct xfs_message_wakeup_data * message, + u_int size, + struct proc *p); + +int +xfs_uprintf_device(void); +#endif /* _xfs_dev_h */ diff --git a/sys/xfs/xfs_fs.h b/sys/xfs/xfs_fs.h index 007c32e706f..51f9bb4dbcd 100644 --- a/sys/xfs/xfs_fs.h +++ b/sys/xfs/xfs_fs.h @@ -1,4 +1,3 @@ -/* $OpenBSD: xfs_fs.h,v 1.2 1998/08/31 05:13:26 art Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). @@ -37,30 +36,36 @@ * SUCH DAMAGE. */ -/* $KTH: xfs_fs.h,v 1.8 1998/04/04 01:17:26 art Exp $ */ +/* $Id: xfs_fs.h,v 1.3 1999/04/30 01:59:00 art Exp $ */ -#ifndef _XFS_XFS_H_ -#define _XFS_XFS_H_ +#ifndef _xfs_h +#define _xfs_h #include <sys/types.h> +#include <xfs/xfs_common.h> #include <xfs/xfs_node.h> #include <xfs/xfs_attr.h> -#include <xfs/nxfs.h> + +#define NXFS 2 /* maximal number of filesystems on a single device */ /* * Filesystem struct. */ struct xfs { - u_int status; /* Inited, opened or mounted */ + u_int status; /* Inited, opened or mounted */ #define XFS_MOUNTED 0x1 - struct mount *mp; - struct xfs_node *root; - u_int nnodes; - int fd; + struct mount *mp; + struct xfs_node *root; + u_int nnodes; + int fd; }; +#ifdef __osf__ +#define VFS_TO_XFS(v) ((struct xfs *) ((v)->m_data)) +#else #define VFS_TO_XFS(v) ((struct xfs *) ((v)->mnt_data)) +#endif #define XFS_TO_VFS(x) ((x)->mp) #define XFS_FROM_VNODE(vp) VFS_TO_XFS((vp)->v_mount) @@ -70,20 +75,31 @@ extern struct xfs xfs[]; extern struct vnodeops xfs_vnodeops; -struct xfs_node *xfs_node_find __P((struct xfs *, struct xfs_handle *)); -int new_xfs_node __P((struct xfs *, struct xfs_msg_node *, struct xfs_node **, - struct proc *)); -void free_xfs_node __P((struct xfs_node *)); -int free_all_xfs_nodes __P((struct xfs *, int)); +struct xfs_node *xfs_node_find(struct xfs *, struct xfs_handle *); +int new_xfs_node(struct xfs *, struct xfs_msg_node *, struct xfs_node **, + struct proc *); +void free_xfs_node(struct xfs_node *); +int free_all_xfs_nodes(struct xfs *, int, int); -int xfs_dnlc_enter __P((struct vnode *, char *, struct vnode *)); -void xfs_dnlc_purge __P((struct mount *)); -int xfs_dnlc_lookup __P((struct vnode *, struct componentname *, - struct vnode **)); +int xfs_dnlc_enter(struct vnode *, xfs_componentname *, struct vnode *); +int xfs_dnlc_enter_name(struct vnode *, const char *, struct vnode *); +void xfs_dnlc_purge_mp(struct mount *); +void xfs_dnlc_purge(struct vnode *); +int xfs_dnlc_lookup(struct vnode *, xfs_componentname *, struct vnode **); +int xfs_dnlc_lookup_name(struct vnode *, const char *, struct vnode **); -void vattr2xfs_attr __P((const struct vattr * va, struct xfs_attr *xa)); -void xfs_attr2vattr __P((const struct xfs_attr *xa, struct vattr * va)); +void +xfs_cnp_init (xfs_componentname *ndp, + const char *name, + struct vnode *vp, + struct vnode *dvp, + struct proc *proc, + struct ucred *cred, + int nameiop); -int xfs_has_pag __P((const struct xfs_node *xn, pag_t pag)); +void vattr2xfs_attr(const struct vattr *, struct xfs_attr *); +void xfs_attr2vattr(const struct xfs_attr *, struct vattr *); -#endif +int xfs_has_pag(const struct xfs_node *, pag_t); + +#endif /* _xfs_h */ diff --git a/sys/xfs/xfs_message.c b/sys/xfs/xfs_message.c index 2a3086611d9..beb951376b3 100644 --- a/sys/xfs/xfs_message.c +++ b/sys/xfs/xfs_message.c @@ -1,4 +1,3 @@ -/* $OpenBSD: xfs_message.c,v 1.3 1998/09/06 01:48:58 art Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). @@ -37,181 +36,234 @@ * SUCH DAMAGE. */ -#include <sys/types.h> -#include <sys/uio.h> -#include <sys/namei.h> -#include <sys/systm.h> -#include <sys/time.h> -#include <sys/vnode.h> - -#include <xfs/xfs_common.h> +#include <xfs/xfs_locl.h> #include <xfs/xfs_deb.h> #include <xfs/xfs_fs.h> #include <xfs/xfs_message.h> #include <xfs/xfs_msg_locl.h> +#include <xfs/xfs_syscalls.h> +#include <xfs/xfs_vfsops.h> +#include <xfs/xfs_vnodeops.h> -RCSID("$KTH: xfs_message.c,v 1.16 1998/07/19 00:19:54 art Exp $"); +RCSID("$Id: xfs_message.c,v 1.4 1999/04/30 01:59:00 art Exp $"); int xfs_message_installroot(int fd, - struct xfs_message_installroot *message, + struct xfs_message_installroot * message, u_int size, struct proc *p) { - int error = 0; + int error = 0; - XFSDEB(XDEBMSG, ("xfs_message_installroot\n")); + XFSDEB(XDEBMSG, ("xfs_message_installroot\n")); - if (xfs[fd].root != NULL) { - printf("XFS WARNING! xfs_message_installroot: again!\n"); - error = EBUSY; - } else { - error = new_xfs_node(&xfs[fd], &message->node, &xfs[fd].root, - p); - if (error) - return error; - xfs[fd].root->vn->v_flag |= VROOT; - } - - return error; + if (xfs[fd].root != NULL) { + printf("XFS PANIC WARNING! xfs_message_installroot: called again!\n"); + error = EBUSY; + } else { + error = new_xfs_node(&xfs[fd], &message->node, &xfs[fd].root, p); + if (error) + return error; + xfs[fd].root->vn->v_flag |= VROOT; + } + return error; } int xfs_message_installnode(int fd, - struct xfs_message_installnode *message, + struct xfs_message_installnode * message, u_int size, struct proc *p) { - int error = 0; - struct xfs_node *n, *dp; - - XFSDEB(XDEBMSG, ("xfs_message_installnode\n")); - - dp = xfs_node_find(&xfs[fd], &message->parent_handle); - if (dp) { - error = new_xfs_node(&xfs[fd], &message->node, &n, p); - if (error) - return error; - cache_purge (XNODE_TO_VNODE(dp)); - xfs_dnlc_enter(XNODE_TO_VNODE(dp), message->name, - XNODE_TO_VNODE(n)); - vrele(XNODE_TO_VNODE(n)); - } else { - printf("XFS WARNING! xfs_message_installnode: no parent\n"); - error = ENOENT; + int error = 0; + struct xfs_node *n, *dp; + + XFSDEB(XDEBMSG, ("xfs_message_installnode\n")); + + dp = xfs_node_find(&xfs[fd], &message->parent_handle); + if (dp) { + struct vnode *t_vnode = XNODE_TO_VNODE(dp); + + xfs_do_vget (t_vnode, LK_INTERLOCK|LK_SHARED, p); + + error = new_xfs_node(&xfs[fd], &message->node, &n, p); + if (error) { + vrele (t_vnode); + return error; } - XFSDEB(XDEBMSG, ("return: xfs_message_installnode: %d\n", error)); - return error; + xfs_dnlc_enter_name(t_vnode, + message->name, + XNODE_TO_VNODE(n)); + vrele(XNODE_TO_VNODE(n)); + vput (t_vnode); + } else { + printf("XFS PANIC WARNING! xfs_message_installnode: no parent\n"); + error = ENOENT; + } + XFSDEB(XDEBMSG, ("return: xfs_message_installnode: %d\n", error)); + + return error; } int xfs_message_installattr(int fd, - struct xfs_message_installattr *message, + struct xfs_message_installattr * message, u_int size, struct proc *p) { - int error = 0; - struct xfs_node *t; - - t = xfs_node_find(&xfs[fd], &message->node.handle); - if (t != 0) { - t->tokens = message->node.tokens; - xfs_attr2vattr(&message->node.attr, &t->attr); - bcopy(message->node.id, t->id, sizeof(t->id)); - bcopy(message->node.rights, t->rights, sizeof(t->rights)); - t->anonrights = message->node.anonrights; - } else { - printf("XFS WARNING! xfs_message_installattr: no node!\n"); - error = ENOENT; - } + int error = 0; + struct xfs_node *t; + + t = xfs_node_find(&xfs[fd], &message->node.handle); + if (t != 0) { + t->tokens = message->node.tokens; + xfs_attr2vattr(&message->node.attr, &t->attr); +#ifdef HAVE_KERNEL_VNODE_PAGER_SETSIZE + vnode_pager_setsize(XNODE_TO_VNODE(t), t->attr.va_size); +#endif + bcopy(message->node.id, t->id, sizeof(t->id)); + bcopy(message->node.rights, t->rights, sizeof(t->rights)); + t->anonrights = message->node.anonrights; + } else { + printf("XFS PANIC WARNING! xfs_message_installattr: no node!\n"); + error = ENOENT; + } - return error; + return error; } int xfs_message_installdata(int fd, - struct xfs_message_installdata *message, + struct xfs_message_installdata * message, u_int size, struct proc *p) { - struct xfs_node *t; - int error = 0; - - XFSDEB(XDEBMSG, ("xfs_message_installdata\n")); - - t = xfs_node_find(&xfs[fd], &message->node.handle); - if (t != NULL) { - struct nameidata nd; - char tmp[CACHEHANDLESIZE + 1]; - struct vnode *vp; - - bcopy((char *) &message->cache_handle.data, tmp, sizeof(tmp)); - tmp[CACHEHANDLESIZE] = '\0'; - - XFSDEB(XDEBMSG, ("cache_handle = '%s'\n", tmp)); - - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, tmp, p); - error = namei(&nd); - vp = nd.ni_vp; - if (error == 0) { - if (DATA_FROM_XNODE(t)) - vrele(DATA_FROM_XNODE(t)); - VOP_UNLOCK(vp, 0, p); - DATA_FROM_XNODE(t) = vp; - XFSDEB(XDEBMSG, - ("xfs_message_installdata: t= %p tokens= %x\n", - t, message->node.tokens)); - - t->tokens = message->node.tokens; - xfs_attr2vattr(&message->node.attr, &t->attr); - if (XNODE_TO_VNODE(t)->v_type == VDIR) - cache_purge (XNODE_TO_VNODE(t)); - - bcopy(message->node.id, t->id, sizeof(t->id)); - bcopy(message->node.rights, t->rights, - sizeof(t->rights)); - t->anonrights = message->node.anonrights; - } else { - printf("XFS WARNING! xfs_message_installdata fail!\n"); - printf("Reason: lookup failed on cache file '%s', " - "error = %d\n", tmp, error); - } + struct xfs_node *t; + int error = 0; + + XFSDEB(XDEBMSG, ("xfs_message_installdata\n")); + + t = xfs_node_find(&xfs[fd], &message->node.handle); + + if (t != NULL) { + struct xfs_fh_args *fh_args = (struct xfs_fh_args *)&message->cache_handle; + struct vnode *vp; + struct vnode *t_vnode = XNODE_TO_VNODE(t); + + XFSDEB(XDEBMSG, ("cache_name = '%s'\n", message->cache_name)); + XFSDEB(XDEBMSG, ("fileno = %ld, gen = %ld\n", + SCARG(fh_args, fileid), + SCARG(fh_args, gen))); + + xfs_do_vget (t_vnode, LK_INTERLOCK|LK_SHARED, p); + + error = xfs_fhlookup (p, + SCARG(fh_args,fsid), + SCARG(fh_args,fileid), + SCARG(fh_args,gen), + &vp); + + if (error != 0) { +#ifdef __osf__ + struct nameidata *ndp = &u.u_nd; +#else + struct nameidata nd; + struct nameidata *ndp = &nd; +#endif + + XFSDEB(XDEBMSG, + ("xfs_message_installdata: fhlookup failed: %d, " + "opening by name\n", error)); + + NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, + message->cache_name, p); + error = namei(ndp); + vp = ndp->ni_vp; + } + + if (error == 0) { + xfs_vfs_unlock(vp, p); + if (DATA_FROM_XNODE(t)) + vrele(DATA_FROM_XNODE(t)); + DATA_FROM_XNODE(t) = vp; + + XFSDEB(XDEBMSG, ("xfs_message_installdata: t = %p;" + " tokens = %x\n", + t, message->node.tokens)); + + t->tokens = message->node.tokens; + xfs_attr2vattr(&message->node.attr, &t->attr); +#ifdef HAVE_KERNEL_VNODE_PAGER_SETSIZE + vnode_pager_setsize(XNODE_TO_VNODE(t), t->attr.va_size); +#endif + if (XNODE_TO_VNODE(t)->v_type == VDIR + && (message->flag & XFS_INVALID_DNLC)) + cache_purge (XNODE_TO_VNODE(t)); + bcopy(message->node.id, t->id, sizeof(t->id)); + bcopy(message->node.rights, t->rights, sizeof(t->rights)); + t->anonrights = message->node.anonrights; } else { - printf("XFS WARNING! xfs_message_installdata failed\n"); - printf("Reason: No node to install the data into!\n"); - error = ENOENT; + printf("XFS PANIC WARNING! xfs_message_installdata failed!\n"); + printf("Reason: lookup failed on cache file '%s', error = %d\n", + message->cache_name, error); } + vput (t_vnode); + } else { + printf("XFS PANIC WARNING! xfs_message_installdata failed\n"); + printf("Reason: No node to install the data into!\n"); + error = ENOENT; + } - return error; + return error; } int xfs_message_invalidnode(int fd, - struct xfs_message_invalidnode *message, + struct xfs_message_invalidnode * message, u_int size, struct proc *p) { - int error = 0; - struct xfs_node *t; - - XFSDEB(XDEBMSG, ("xfs_message_invalidnode\n")); - - t = xfs_node_find(&xfs[fd], &message->handle); - if (t != 0) { - /* XXX Really need to put back dirty data first. */ - if (DATA_FROM_XNODE(t)) { - vrele(DATA_FROM_XNODE(t)); - DATA_FROM_XNODE(t) = (struct vnode *) 0; - } - XFS_TOKEN_CLEAR(t, ~0, - XFS_OPEN_MASK | XFS_ATTR_MASK | - XFS_DATA_MASK | XFS_LOCK_MASK); - cache_purge(XNODE_TO_VNODE(t)); - } else { - printf("XFS WARNING! xfs_message_invalidnode: no node!\n"); - error = ENOENT; + int error = 0; + struct xfs_node *t; + + XFSDEB(XDEBMSG, ("xfs_message_invalidnode\n")); + + t = xfs_node_find(&xfs[fd], &message->handle); + if (t != 0) { + /* XXX Really need to put back dirty data first. */ + if (DATA_FROM_XNODE(t)) { + vrele(DATA_FROM_XNODE(t)); + DATA_FROM_XNODE(t) = (struct vnode *) 0; } + XFS_TOKEN_CLEAR(t, ~0, + XFS_OPEN_MASK | XFS_ATTR_MASK | + XFS_DATA_MASK | XFS_LOCK_MASK); + cache_purge(XNODE_TO_VNODE(t)); + } else { + printf("XFS PANIC WARNING! xfs_message_invalidnode: no node!\n"); + error = ENOENT; + } + + return error; +} + +int +xfs_message_updatefid(int fd, + struct xfs_message_updatefid * message, + u_int size, + struct proc *p) +{ + int error = 0; + struct xfs_node *t; - return error; + XFSDEB(XDEBMSG, ("xfs_message_updatefid\n")); + t = xfs_node_find (&xfs[fd], &message->old_handle); + if (t != NULL) { + t->handle = message->new_handle; + } else { + printf ("XFS PANIC WARNING! xfs_message_updatefid: no node!\n"); + error = ENOENT; + } + return error; } diff --git a/sys/xfs/xfs_message.h b/sys/xfs/xfs_message.h index 1e30b1f217c..d3741a1d3bd 100644 --- a/sys/xfs/xfs_message.h +++ b/sys/xfs/xfs_message.h @@ -1,6 +1,5 @@ -/* $OpenBSD: xfs_message.h,v 1.1 1998/08/31 05:13:27 art Exp $ */ /* - * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan + * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -37,16 +36,22 @@ * SUCH DAMAGE. */ -/* $KTH: xfs_message.h,v 1.21 1998/06/27 11:05:24 assar Exp $ */ +/* $Id: xfs_message.h,v 1.2 1999/04/30 01:59:00 art Exp $ */ -#ifndef _SYS_XFS_MESSAGE_H_ -#define _SYS_XFS_MESSAGE_H_ +#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 <xfs/xfs_attr.h> +/* Temporary hack? */ #define MAX_XMSG_SIZE (1024*64) typedef u_int32_t pag_t; @@ -54,29 +59,36 @@ 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 { + __kernel_uid_t uid; + pag_t pag; +} xfs_cred; + +typedef unsigned long xfs_locktype_t; +typedef unsigned long xfs_lockid_t; -typedef struct xfs_cred xfs_cred; -#define MAXHANDLE (4*4) -#define MAXRIGHTS 8 +#define MAXHANDLE (4*4) +#define MAXRIGHTS 8 + +#define XFS_ANONYMOUSID 32766 -#define XFS_ANONYMOUSID 32766 typedef struct xfs_handle { - u_int a, b, c, d; + 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) +/* + * This should be the maximum size of any `file handle' + */ -#define CACHEHANDLESIZE 4 -struct xfs_cache_handle { - u_char data[CACHEHANDLESIZE]; -}; -typedef struct xfs_cache_handle xfs_cache_handle; +#define CACHEHANDLESIZE 80 + +typedef struct xfs_cache_handle { + u_char data[CACHEHANDLESIZE]; +} xfs_cache_handle; /* * Tokens that apply to nodes, open modes and attributes. Shared @@ -99,11 +111,11 @@ typedef struct xfs_cache_handle xfs_cache_handle; #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_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 +#define XFS_ATTR_VALID XFS_ATTR_R +#define XFS_DATA_VALID XFS_DATA_W /* xfs_node.flags */ #define XFS_DATA_DIRTY 0x0001 @@ -120,21 +132,21 @@ typedef struct xfs_cache_handle xfs_cache_handle; #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; + 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 */ + u_int size; + u_int opcode; + u_int sequence_num; /* Private */ }; /* @@ -148,6 +160,12 @@ enum { XFS_READ = 1, XFS_WRITE = 2, XFS_NONBLOCK = 4, XFS_APPEND = 8}; enum { XFS_NOREFS = 1, XFS_DELETE = 2 }; /* + * Flags for installdata + */ + +enum { XFS_INVALID_DNLC = 1 }; + +/* * Defined message types and their opcodes. */ #define XFS_MSG_VERSION 0 @@ -188,195 +206,218 @@ enum { XFS_NOREFS = 1, XFS_DELETE = 2 }; #define XFS_MSG_PIOCTL 22 #define XFS_MSG_WAKEUP_DATA 23 -#define XFS_MSG_COUNT 24 +#define XFS_MSG_UPDATEFID 24 + +#define XFS_MSG_ADVLOCK 25 + +#define XFS_MSG_COUNT 26 /* XFS_MESSAGE_WAKEUP */ struct xfs_message_wakeup { - struct xfs_message_header header; - int sleepers_sequence_num; /* Where to send wakeup */ - int error; /* Return value */ + 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; + 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; + 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 */ + 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; + 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; + 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; + 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; + 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; + struct xfs_message_header header; + struct xfs_msg_node node; + char cache_name[256]; /* XXX */ + struct xfs_cache_handle cache_handle; + u_int flag; }; /* XFS_MSG_INACTIVENODE */ struct xfs_message_inactivenode { - struct xfs_message_header header; - xfs_handle handle; - u_int flag; + 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; + 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; + 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; - struct xfs_cred cred; - u_int flag; + 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; + 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; + struct xfs_message_header header; + xfs_handle parent_handle; + char name[256]; /* XXX */ + struct xfs_attr attr; + 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; + 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; + 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; + 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; + 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; + 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; + 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; - int insize; - int outsize; - char msg[2048]; /* XXX */ - xfs_handle handle; + struct xfs_message_header header; + int opcode ; + xfs_cred cred; + 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 */ + struct xfs_message_header header; + int sleepers_sequence_num; /* Where to send wakeup */ + int error; /* Return value */ + int len; + char msg[2048] ; /* XXX */ +}; + +/* XFS_MESSAGE_UPDATEFID */ +struct xfs_message_updatefid { + struct xfs_message_header header; + xfs_handle old_handle; + xfs_handle new_handle; +}; + +/* XFS_MESSAGE_ADVLOCK */ +struct xfs_message_advlock { + struct xfs_message_header header; + xfs_handle handle; + struct xfs_cred cred; + xfs_locktype_t locktype; +#define XFS_WR_LOCK 1 /* Write lock */ +#define XFS_RD_LOCK 2 /* Read lock */ +#define XFS_UN_LOCK 3 /* Unlock */ +#define XFS_BR_LOCK 4 /* Break lock (inform that we don't want the lock) */ + xfs_lockid_t lockid; }; #endif /* _xmsg_h */ diff --git a/sys/xfs/xfs_msg_locl.h b/sys/xfs/xfs_msg_locl.h index 18fe0613a93..b552e8c148f 100644 --- a/sys/xfs/xfs_msg_locl.h +++ b/sys/xfs/xfs_msg_locl.h @@ -1,4 +1,3 @@ -/* $OpenBSD: xfs_msg_locl.h,v 1.2 1998/08/31 05:13:27 art Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). @@ -37,25 +36,45 @@ * SUCH DAMAGE. */ -/* $KTH: xfs_msg_locl.h,v 1.1 1998/03/26 02:25:53 assar Exp $ */ - -#ifndef _XFS_XFS_MSG_LOCL_H_ -#define _XFS_XFS_MSG_LOCL_H_ - -int xfs_message_installroot __P((int fd, - struct xfs_message_installroot *message, - u_int size, struct proc *p)); -int xfs_message_installnode __P((int fd, - struct xfs_message_installnode *message, - u_int size,struct proc *p)); -int xfs_message_installattr __P((int fd, - struct xfs_message_installattr *message, - u_int size,struct proc *p)); -int xfs_message_installdata __P((int fd, - struct xfs_message_installdata *message, - u_int size, struct proc *p)); -int xfs_message_invalidnode __P((int fd, - struct xfs_message_invalidnode *message, - u_int size, struct proc *p)); - -#endif +/* $Id: xfs_msg_locl.h,v 1.3 1999/04/30 01:59:00 art Exp $ */ + +#ifndef _xfs_msg_locl_h +#define _xfs_msg_locl_h + +int +xfs_message_installroot(int fd, + struct xfs_message_installroot * message, + u_int size, + struct proc *p); + +int +xfs_message_installnode(int fd, + struct xfs_message_installnode * message, + u_int size, + struct proc *p); + +int +xfs_message_installattr(int fd, + struct xfs_message_installattr * message, + u_int size, + struct proc *p); + +int +xfs_message_installdata(int fd, + struct xfs_message_installdata * message, + u_int size, + struct proc *p); + +int +xfs_message_invalidnode(int fd, + struct xfs_message_invalidnode * message, + u_int size, + struct proc *p); + +int +xfs_message_updatefid(int fd, + struct xfs_message_updatefid * message, + u_int size, + struct proc *p); + +#endif /* _xfs_msg_locl_h */ diff --git a/sys/xfs/xfs_node.h b/sys/xfs/xfs_node.h index 6e64c14b657..a77ab61d993 100644 --- a/sys/xfs/xfs_node.h +++ b/sys/xfs/xfs_node.h @@ -1,4 +1,3 @@ -/* $OpenBSD: xfs_node.h,v 1.3 1998/09/06 01:48:58 art Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). @@ -37,36 +36,90 @@ * SUCH DAMAGE. */ -/* $KTH: xfs_node.h,v 1.3 1998/07/13 20:36:37 art Exp $ */ +/* $Id: xfs_node.h,v 1.4 1999/04/30 01:59:01 art Exp $ */ -#ifndef _XFS_XFS_NODE_H_ -#define _XFS_XFS_NODE_H_ +#ifndef _xfs_xnode_h +#define _xfs_xnode_h -#if 0 #include <sys/types.h> #include <sys/time.h> +#if defined(_KERNEL) || !defined(__OpenBSD__) #include <sys/vnode.h> #endif +#ifdef __NetBSD__ +#include <sys/lockf.h> +#endif /* __NetBSD__ */ #include <xfs/xfs_attr.h> #include <xfs/xfs_message.h> struct xfs_node { - struct vnode *vn; - struct vnode *data; - struct vattr attr; - u_int flags; - u_int tokens; - xfs_handle handle; - pag_t id[MAXRIGHTS]; - u_char rights[MAXRIGHTS]; - u_char anonrights; + struct vnode *vn; + struct vnode *data; + struct vattr attr; + u_int flags; + u_int tokens; + xfs_handle handle; + pag_t id[MAXRIGHTS]; + u_char rights[MAXRIGHTS]; + u_char anonrights; + int vnlocks; +#ifdef __NetBSD__ + struct lockf *i_lockf; +#endif }; +int xfs_getnewvnode(struct mount *mp, struct vnode **vpp, + struct xfs_handle *handle); + + #define DATA_FROM_VNODE(vp) DATA_FROM_XNODE(VNODE_TO_XNODE(vp)) + #define DATA_FROM_XNODE(xp) ((xp)->data) #define XNODE_TO_VNODE(xp) ((xp)->vn) #define VNODE_TO_XNODE(vp) ((struct xfs_node *) (vp)->v_data) +#if defined(HAVE_THREE_ARGUMENT_VGET) +#define xfs_do_vget(vp, lockflag, proc) vget((vp), (lockflag), (proc)) +#elif !defined(__osf__) +#define xfs_do_vget(vp, lockflag, proc) vget((vp), (lockflag)) +#else +#define xfs_do_vget(vp, lockflag, proc) vget((vp)) +#endif + +#ifndef HAVE_VOP_T +typedef int vop_t (void *); +#endif + +#ifdef LK_INTERLOCK +#define HAVE_LK_INTERLOCK +#else +#define LK_INTERLOCK 0 +#endif + +#ifdef LK_RETRY +#define HAVE_LK_RETRY +#else +#define LK_RETRY 0 #endif + +/* + * This is compat code for older vfs that have a + * vget that only take a integer (really boolean) argument + * that the the returned vnode will be returned locked + */ + +#ifdef LK_EXCLUSIVE +#define HAVE_LK_EXCLUSIVE 1 +#else +#define LK_EXCLUSIVE 1 +#endif + +#ifdef LK_SHARED +#define HAVE_LK_SHARED 1 +#else +#define LK_SHARED 1 +#endif + +#endif /* _xfs_xnode_h */ diff --git a/sys/xfs/xfs_pioctl.h b/sys/xfs/xfs_pioctl.h index 76ab12cf8a0..ee2d499df0b 100644 --- a/sys/xfs/xfs_pioctl.h +++ b/sys/xfs/xfs_pioctl.h @@ -1,6 +1,6 @@ -/* $OpenBSD: xfs_pioctl.h,v 1.2 1998/09/17 20:47:15 art Exp $ */ +/* $OpenBSD: xfs_pioctl.h,v 1.3 1999/04/30 01:59:01 art Exp $ */ /* - * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -18,7 +18,7 @@ * 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. + * 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 @@ -37,8 +37,8 @@ * SUCH DAMAGE. */ -#ifndef _SYS_PIOCTL_H_ -#define _SYS_PIOCTL_H_ +#ifndef _XFS_XFS_PIOCTL_H_ +#define _XFS_XFS_PIOCTL_H_ /* */ @@ -111,9 +111,28 @@ #define VIOC_TWIDDLE _VICEIOCTL(45) #define VIOC_SETSPREFS _VICEIOCTL(46) #define VIOC_STORBEHIND _VICEIOCTL(47) -#define VIOC_GETRXKCRYPT _VICEIOCTL(48) -#define VIOC_SETRXKCRYPT _VICEIOCTL(49) -#define VIOC_FPRIOSTATUS _VICEIOCTL(50) +#define VIOC_GCPAGS _VICEIOCTL(48) +#define VIOC_GETRXKCRYPT _VICEIOCTL(49) +#define VIOC_SETRXKCRYPT _VICEIOCTL(50) +#define VIOC_FPRIOSTATUS _VICEIOCTL(51) + +#define VIOC_FHGET _VICEIOCTL(52) +#define VIOC_FHOPEN _VICEIOCTL(53) + +#define VIOC_XFSDEBUG _VICEIOCTL(54) +#define VIOC_ARLADEBUG _VICEIOCTL(55) + +#define VIOC_AVIATOR _VICEIOCTL(56) + +#define VIOC_XFSDEBUG_PRINT _VICEIOCTL(57) + +/* + * GETCELLSTATUS flags + */ + +#define CELLSTATUS_PRIMARY 0x01 /* this is the `primary' cell */ +#define CELLSTATUS_SETUID 0x02 /* setuid honored for this cell */ +#define CELLSTATUS_OBSOLETE_VL 0x04 /* uses obsolete VL servers */ /* * VIOCCONNECTMODE arguments @@ -123,6 +142,7 @@ #define CONNMODE_CONN 1 #define CONNMODE_FETCH 2 #define CONNMODE_DISCONN 3 +#define CONNMODE_PARCONNECTED 4 /* * The struct for VIOC_FPRIOSTATUS @@ -146,6 +166,16 @@ struct vioc_fprio { int32_t Unique; }; +/* + * Flags for VIOCCKSERV + */ + +#define CKSERV_DONTPING 1 +#define CKSERV_FSONLY 2 + +#define CKSERV_MAXSERVERS 16 /* limitation of VIOCCKSERV number of + returned servers */ + struct ViceIoctl { caddr_t in, out; short in_size; diff --git a/sys/xfs/xfs_syscalls.h b/sys/xfs/xfs_syscalls.h index 4a8d1bfaadf..2ebdaa17674 100644 --- a/sys/xfs/xfs_syscalls.h +++ b/sys/xfs/xfs_syscalls.h @@ -1,6 +1,5 @@ -/* $OpenBSD: xfs_syscalls.h,v 1.2 1998/08/31 05:13:29 art Exp $ */ /* - * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -37,14 +36,58 @@ * SUCH DAMAGE. */ -/* $KTH: xfs_syscalls.h,v 1.2 1998/01/21 01:03:57 mho Exp $ */ +/* $Id: xfs_syscalls.h,v 1.3 1999/04/30 01:59:01 art Exp $ */ -#ifndef _XFS_XFS_SYSCALLS_H_ -#define _XFS_XFS_SYSCALLS_H_ +#ifndef __xfs_syscalls +#define __xfs_syscalls -int xfs_install_syscalls __P((void)); -int xfs_uninstall_syscalls __P((void)); -int xfs_stat_syscalls __P((void)); -pag_t xfs_get_pag __P((struct ucred *)); +#include <xfs/xfs_common.h> +#include <xfs/xfs_message.h> +#ifdef HAVE_SYS_SYSCALLARGS_H +#include <sys/syscallargs.h> +#endif + +/* + * XXX + */ + +#ifndef SCARG +#define SCARG(a, b) ((a)->b.datum) +#define syscallarg(x) union { x datum; register_t pad; } +#endif + +#ifndef syscallarg +#define syscallarg(x) x +#endif +#ifndef HAVE_REGISTER_T +typedef int register_t; #endif + +struct sys_pioctl_args { + syscallarg(int) operation; + syscallarg(char *) a_pathP; + syscallarg(int) a_opcode; + syscallarg(struct ViceIoctl *) a_paramsP; + syscallarg(int) a_followSymlinks; +}; + +struct xfs_fh_args { + syscallarg(fsid_t) fsid; + syscallarg(long) fileid; + syscallarg(long) gen; +}; + +int xfs_install_syscalls(void); +int xfs_uninstall_syscalls(void); +int xfs_stat_syscalls(void); +pag_t xfs_get_pag(struct ucred *); + +int xfs_setpag_call(struct ucred **ret_cred); +int xfs_pioctl_call(struct proc *proc, + struct sys_pioctl_args *args, + register_t *return_value); + +int sys_xfspioctl(struct proc *proc, void *varg, register_t *retval); + +#endif /* __xfs_syscalls */ |