Home | History | Annotate | Line # | Download | only in filecorefs
      1  1.8  christos /*	$NetBSD: filecore_node.h,v 1.8 2022/03/27 17:10:55 christos Exp $	*/
      2  1.1  jdolecek 
      3  1.1  jdolecek /*-
      4  1.1  jdolecek  * Copyright (c) 1994 The Regents of the University of California.
      5  1.1  jdolecek  * All rights reserved.
      6  1.2       agc  *
      7  1.2       agc  * Redistribution and use in source and binary forms, with or without
      8  1.2       agc  * modification, are permitted provided that the following conditions
      9  1.2       agc  * are met:
     10  1.2       agc  * 1. Redistributions of source code must retain the above copyright
     11  1.2       agc  *    notice, this list of conditions and the following disclaimer.
     12  1.2       agc  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.2       agc  *    notice, this list of conditions and the following disclaimer in the
     14  1.2       agc  *    documentation and/or other materials provided with the distribution.
     15  1.2       agc  * 3. Neither the name of the University nor the names of its contributors
     16  1.2       agc  *    may be used to endorse or promote products derived from this software
     17  1.2       agc  *    without specific prior written permission.
     18  1.2       agc  *
     19  1.2       agc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20  1.2       agc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  1.2       agc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  1.2       agc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23  1.2       agc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  1.2       agc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  1.2       agc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  1.2       agc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  1.2       agc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  1.2       agc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  1.2       agc  * SUCH DAMAGE.
     30  1.2       agc  *
     31  1.2       agc  *	filecore_node.h		1.1	1998/6/26
     32  1.2       agc  */
     33  1.2       agc 
     34  1.2       agc /*-
     35  1.2       agc  * Copyright (c) 1998 Andrew McMurry
     36  1.1  jdolecek  *
     37  1.1  jdolecek  * Redistribution and use in source and binary forms, with or without
     38  1.1  jdolecek  * modification, are permitted provided that the following conditions
     39  1.1  jdolecek  * are met:
     40  1.1  jdolecek  * 1. Redistributions of source code must retain the above copyright
     41  1.1  jdolecek  *    notice, this list of conditions and the following disclaimer.
     42  1.1  jdolecek  * 2. Redistributions in binary form must reproduce the above copyright
     43  1.1  jdolecek  *    notice, this list of conditions and the following disclaimer in the
     44  1.1  jdolecek  *    documentation and/or other materials provided with the distribution.
     45  1.1  jdolecek  * 3. All advertising materials mentioning features or use of this software
     46  1.1  jdolecek  *    must display the following acknowledgement:
     47  1.1  jdolecek  *	This product includes software developed by the University of
     48  1.1  jdolecek  *	California, Berkeley and its contributors.
     49  1.1  jdolecek  * 4. Neither the name of the University nor the names of its contributors
     50  1.1  jdolecek  *    may be used to endorse or promote products derived from this software
     51  1.1  jdolecek  *    without specific prior written permission.
     52  1.1  jdolecek  *
     53  1.1  jdolecek  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     54  1.1  jdolecek  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     55  1.1  jdolecek  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     56  1.1  jdolecek  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     57  1.1  jdolecek  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     58  1.1  jdolecek  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     59  1.1  jdolecek  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     60  1.1  jdolecek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     61  1.1  jdolecek  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     62  1.1  jdolecek  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     63  1.1  jdolecek  * SUCH DAMAGE.
     64  1.1  jdolecek  *
     65  1.1  jdolecek  *	filecore_node.h		1.1	1998/6/26
     66  1.1  jdolecek  */
     67  1.1  jdolecek 
     68  1.4  christos #if !defined(_KERNEL)
     69  1.4  christos #error not supposed to be exposed to userland.
     70  1.4  christos #endif
     71  1.4  christos 
     72  1.1  jdolecek #include <miscfs/genfs/genfs_node.h>
     73  1.1  jdolecek 
     74  1.1  jdolecek /*
     75  1.1  jdolecek  * In a future format, directories may be more than 2Gb in length,
     76  1.1  jdolecek  * however, in practice this seems unlikely. So, we define
     77  1.1  jdolecek  * the type doff_t as a long to keep down the cost of doing
     78  1.1  jdolecek  * lookup on a 32-bit machine. If you are porting to a 64-bit
     79  1.1  jdolecek  * architecture, you should make doff_t the same as off_t.
     80  1.1  jdolecek  */
     81  1.1  jdolecek #define doff_t	long
     82  1.1  jdolecek 
     83  1.1  jdolecek struct filecore_node {
     84  1.1  jdolecek 	struct	genfs_node i_gnode;
     85  1.1  jdolecek 	LIST_ENTRY(filecore_node) i_hash;
     86  1.1  jdolecek 	struct	vnode *i_vnode;	/* vnode associated with this inode */
     87  1.1  jdolecek 	struct	vnode *i_devvp;	/* vnode for block I/O */
     88  1.1  jdolecek 	u_long	i_flag;		/* see below */
     89  1.1  jdolecek 	dev_t	i_dev;		/* device where inode resides */
     90  1.1  jdolecek 	ino_t	i_number;	/* the identity of the inode */
     91  1.1  jdolecek 	daddr_t	i_block;	/* the disc address of the file */
     92  1.1  jdolecek 	ino_t	i_parent;	/* the ino of the file's parent */
     93  1.1  jdolecek 
     94  1.1  jdolecek 	struct	filecore_mnt *i_mnt;	/* filesystem associated with this inode */
     95  1.1  jdolecek 	struct	lockf *i_lockf;	/* head of byte-level lock list */
     96  1.1  jdolecek         int	i_diroff;	/* offset in dir, where we found last entry */
     97  1.1  jdolecek 
     98  1.1  jdolecek 	struct	filecore_direntry i_dirent; /* directory entry */
     99  1.1  jdolecek };
    100  1.1  jdolecek 
    101  1.1  jdolecek #define i_size		i_dirent.len
    102  1.1  jdolecek 
    103  1.1  jdolecek /* flags */
    104  1.1  jdolecek #define	IN_ACCESS	0x0020		/* inode access time to be updated */
    105  1.1  jdolecek 
    106  1.1  jdolecek #define VTOI(vp) ((struct filecore_node *)(vp)->v_data)
    107  1.1  jdolecek #define ITOV(ip) ((ip)->i_vnode)
    108  1.1  jdolecek 
    109  1.1  jdolecek #define filecore_staleinode(ip) ((ip)->i_dirent.name[0]==0)
    110  1.1  jdolecek 
    111  1.1  jdolecek /*
    112  1.1  jdolecek  * Prototypes for Filecore vnode operations
    113  1.1  jdolecek  */
    114  1.5       dsl int	filecore_lookup(void *);
    115  1.5       dsl int	filecore_access(void *);
    116  1.5       dsl int	filecore_getattr(void *);
    117  1.5       dsl int	filecore_read(void *);
    118  1.5       dsl int	filecore_readdir(void *);
    119  1.5       dsl int	filecore_readlink(void *);
    120  1.5       dsl int	filecore_inactive(void *);
    121  1.5       dsl int	filecore_reclaim(void *);
    122  1.5       dsl int	filecore_bmap(void *);
    123  1.5       dsl int	filecore_strategy(void *);
    124  1.5       dsl int	filecore_print(void *);
    125  1.5       dsl int	filecore_pathconf(void *);
    126  1.5       dsl int	filecore_blkatoff(void *);
    127  1.5       dsl 
    128  1.5       dsl mode_t	filecore_mode(struct filecore_node *);
    129  1.5       dsl struct timespec	filecore_time(struct filecore_node *);
    130  1.5       dsl ino_t	filecore_getparent(struct filecore_node *);
    131  1.5       dsl int	filecore_fn2unix(char *, char *, u_int16_t *);
    132  1.5       dsl int	filecore_fncmp(const char *, const char *, u_short);
    133  1.5       dsl int	filecore_dbread(struct filecore_node *, struct buf **);
    134