xref: /netbsd-src/sys/fs/filecorefs/filecore_node.h (revision 71457ba88259d7cec51e9493842a56bf2ce69219)
1*71457ba8Schristos /*	$NetBSD: filecore_node.h,v 1.8 2022/03/27 17:10:55 christos Exp $	*/
2aad01611Sagc 
3aad01611Sagc /*-
4aad01611Sagc  * Copyright (c) 1994 The Regents of the University of California.
5aad01611Sagc  * All rights reserved.
6aad01611Sagc  *
7aad01611Sagc  * Redistribution and use in source and binary forms, with or without
8aad01611Sagc  * modification, are permitted provided that the following conditions
9aad01611Sagc  * are met:
10aad01611Sagc  * 1. Redistributions of source code must retain the above copyright
11aad01611Sagc  *    notice, this list of conditions and the following disclaimer.
12aad01611Sagc  * 2. Redistributions in binary form must reproduce the above copyright
13aad01611Sagc  *    notice, this list of conditions and the following disclaimer in the
14aad01611Sagc  *    documentation and/or other materials provided with the distribution.
15aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
16aad01611Sagc  *    may be used to endorse or promote products derived from this software
17aad01611Sagc  *    without specific prior written permission.
18aad01611Sagc  *
19aad01611Sagc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20aad01611Sagc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21aad01611Sagc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22aad01611Sagc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23aad01611Sagc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24aad01611Sagc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25aad01611Sagc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26aad01611Sagc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27aad01611Sagc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28aad01611Sagc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29aad01611Sagc  * SUCH DAMAGE.
30aad01611Sagc  *
31aad01611Sagc  *	filecore_node.h		1.1	1998/6/26
32aad01611Sagc  */
335356de15Sjdolecek 
345356de15Sjdolecek /*-
355356de15Sjdolecek  * Copyright (c) 1998 Andrew McMurry
365356de15Sjdolecek  *
375356de15Sjdolecek  * Redistribution and use in source and binary forms, with or without
385356de15Sjdolecek  * modification, are permitted provided that the following conditions
395356de15Sjdolecek  * are met:
405356de15Sjdolecek  * 1. Redistributions of source code must retain the above copyright
415356de15Sjdolecek  *    notice, this list of conditions and the following disclaimer.
425356de15Sjdolecek  * 2. Redistributions in binary form must reproduce the above copyright
435356de15Sjdolecek  *    notice, this list of conditions and the following disclaimer in the
445356de15Sjdolecek  *    documentation and/or other materials provided with the distribution.
455356de15Sjdolecek  * 3. All advertising materials mentioning features or use of this software
465356de15Sjdolecek  *    must display the following acknowledgement:
475356de15Sjdolecek  *	This product includes software developed by the University of
485356de15Sjdolecek  *	California, Berkeley and its contributors.
495356de15Sjdolecek  * 4. Neither the name of the University nor the names of its contributors
505356de15Sjdolecek  *    may be used to endorse or promote products derived from this software
515356de15Sjdolecek  *    without specific prior written permission.
525356de15Sjdolecek  *
535356de15Sjdolecek  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
545356de15Sjdolecek  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
555356de15Sjdolecek  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
565356de15Sjdolecek  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
575356de15Sjdolecek  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
585356de15Sjdolecek  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
595356de15Sjdolecek  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
605356de15Sjdolecek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
615356de15Sjdolecek  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
625356de15Sjdolecek  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
635356de15Sjdolecek  * SUCH DAMAGE.
645356de15Sjdolecek  *
655356de15Sjdolecek  *	filecore_node.h		1.1	1998/6/26
665356de15Sjdolecek  */
675356de15Sjdolecek 
684bffed72Schristos #if !defined(_KERNEL)
694bffed72Schristos #error not supposed to be exposed to userland.
704bffed72Schristos #endif
714bffed72Schristos 
725356de15Sjdolecek #include <miscfs/genfs/genfs_node.h>
735356de15Sjdolecek 
745356de15Sjdolecek /*
755356de15Sjdolecek  * In a future format, directories may be more than 2Gb in length,
765356de15Sjdolecek  * however, in practice this seems unlikely. So, we define
775356de15Sjdolecek  * the type doff_t as a long to keep down the cost of doing
785356de15Sjdolecek  * lookup on a 32-bit machine. If you are porting to a 64-bit
795356de15Sjdolecek  * architecture, you should make doff_t the same as off_t.
805356de15Sjdolecek  */
815356de15Sjdolecek #define doff_t	long
825356de15Sjdolecek 
835356de15Sjdolecek struct filecore_node {
845356de15Sjdolecek 	struct	genfs_node i_gnode;
855356de15Sjdolecek 	LIST_ENTRY(filecore_node) i_hash;
865356de15Sjdolecek 	struct	vnode *i_vnode;	/* vnode associated with this inode */
875356de15Sjdolecek 	struct	vnode *i_devvp;	/* vnode for block I/O */
885356de15Sjdolecek 	u_long	i_flag;		/* see below */
895356de15Sjdolecek 	dev_t	i_dev;		/* device where inode resides */
905356de15Sjdolecek 	ino_t	i_number;	/* the identity of the inode */
915356de15Sjdolecek 	daddr_t	i_block;	/* the disc address of the file */
925356de15Sjdolecek 	ino_t	i_parent;	/* the ino of the file's parent */
935356de15Sjdolecek 
945356de15Sjdolecek 	struct	filecore_mnt *i_mnt;	/* filesystem associated with this inode */
955356de15Sjdolecek 	struct	lockf *i_lockf;	/* head of byte-level lock list */
965356de15Sjdolecek         int	i_diroff;	/* offset in dir, where we found last entry */
975356de15Sjdolecek 
985356de15Sjdolecek 	struct	filecore_direntry i_dirent; /* directory entry */
995356de15Sjdolecek };
1005356de15Sjdolecek 
1015356de15Sjdolecek #define i_size		i_dirent.len
1025356de15Sjdolecek 
1035356de15Sjdolecek /* flags */
1045356de15Sjdolecek #define	IN_ACCESS	0x0020		/* inode access time to be updated */
1055356de15Sjdolecek 
1065356de15Sjdolecek #define VTOI(vp) ((struct filecore_node *)(vp)->v_data)
1075356de15Sjdolecek #define ITOV(ip) ((ip)->i_vnode)
1085356de15Sjdolecek 
1095356de15Sjdolecek #define filecore_staleinode(ip) ((ip)->i_dirent.name[0]==0)
1105356de15Sjdolecek 
1115356de15Sjdolecek /*
1125356de15Sjdolecek  * Prototypes for Filecore vnode operations
1135356de15Sjdolecek  */
11402cdf4d2Sdsl int	filecore_lookup(void *);
11502cdf4d2Sdsl int	filecore_access(void *);
11602cdf4d2Sdsl int	filecore_getattr(void *);
11702cdf4d2Sdsl int	filecore_read(void *);
11802cdf4d2Sdsl int	filecore_readdir(void *);
11902cdf4d2Sdsl int	filecore_readlink(void *);
12002cdf4d2Sdsl int	filecore_inactive(void *);
12102cdf4d2Sdsl int	filecore_reclaim(void *);
12202cdf4d2Sdsl int	filecore_bmap(void *);
12302cdf4d2Sdsl int	filecore_strategy(void *);
12402cdf4d2Sdsl int	filecore_print(void *);
12502cdf4d2Sdsl int	filecore_pathconf(void *);
12602cdf4d2Sdsl int	filecore_blkatoff(void *);
1275356de15Sjdolecek 
12802cdf4d2Sdsl mode_t	filecore_mode(struct filecore_node *);
12902cdf4d2Sdsl struct timespec	filecore_time(struct filecore_node *);
13002cdf4d2Sdsl ino_t	filecore_getparent(struct filecore_node *);
13102cdf4d2Sdsl int	filecore_fn2unix(char *, char *, u_int16_t *);
13202cdf4d2Sdsl int	filecore_fncmp(const char *, const char *, u_short);
13302cdf4d2Sdsl int	filecore_dbread(struct filecore_node *, struct buf **);
134