1 | /* $NetBSD: smbfs_node.h,v 1.15 2015/01/02 09:48:01 martin Exp $ */ |
2 | |
3 | /* |
4 | * Copyright (c) 2000-2001, Boris Popov |
5 | * All rights reserved. |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions |
9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. |
15 | * 3. All advertising materials mentioning features or use of this software |
16 | * must display the following acknowledgement: |
17 | * This product includes software developed by Boris Popov. |
18 | * 4. Neither the name of the author nor the names of any co-contributors |
19 | * may be used to endorse or promote products derived from this software |
20 | * without specific prior written permission. |
21 | * |
22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | * SUCH DAMAGE. |
33 | * |
34 | * FreeBSD: src/sys/fs/smbfs/smbfs_node.h,v 1.1 2001/04/10 07:59:05 bp Exp |
35 | */ |
36 | #ifndef _FS_SMBFS_SMBFS_NODE_H_ |
37 | #define _FS_SMBFS_SMBFS_NODE_H_ |
38 | |
39 | #include <sys/hash.h> /* for hash32_strn() */ |
40 | #include <miscfs/genfs/genfs_node.h> /* for struct genfs_node */ |
41 | |
42 | #define SMBFS_ROOT_INO 2 /* just like in UFS */ |
43 | |
44 | /* Bits for smbnode.n_flag */ |
45 | #define NFLUSHINPROG 0x0001 |
46 | #define NFLUSHWANT 0x0002 /* they should gone ... */ |
47 | #define NMODIFIED 0x0004 /* bogus, until async IO implemented */ |
48 | /*efine NNEW 0x0008*//* smb/vnode has been allocated */ |
49 | #define NREFPARENT 0x0010 /* node holds parent from recycling */ |
50 | #define NOPEN 0x2000 /* file is open */ |
51 | #define NGONE 0x4000 /* file has been removed/renamed */ |
52 | |
53 | #define SMBFS_ATTRTIMO 5 /* Attribute cache timeout in sec */ |
54 | |
55 | struct smbfs_fctx; |
56 | |
57 | #define SMBFS_KEYSIZE(nmlen) (sizeof(struct smbkey) + (nmlen)) |
58 | struct smbkey { |
59 | struct vnode * k_parent; /* Parent vnode. */ |
60 | u_char k_nmlen; /* Name length. */ |
61 | u_char k_name[]; /* Name (variable length). */ |
62 | } __packed; |
63 | |
64 | struct smbnode { |
65 | struct genfs_node n_gnode; |
66 | kmutex_t n_lock; |
67 | struct smbkey * n_key; |
68 | int n_flag; |
69 | #define n_parent n_key->k_parent |
70 | struct vnode * n_vnode; |
71 | struct smbmount * n_mount; |
72 | time_t n_attrage; /* attributes cache time */ |
73 | time_t n_ctime; /* Prev create time. */ |
74 | time_t n_nctime; /* last neg cache entry (dir) */ |
75 | struct timespec n_mtime; /* modify time */ |
76 | struct timespec n_atime; /* last access time */ |
77 | u_quad_t n_size; |
78 | long n_ino; |
79 | int n_dosattr; |
80 | u_int16_t n_fid; /* file handle */ |
81 | int n_rwstate; /* granted access mode */ |
82 | #define n_nmlen n_key->k_nmlen |
83 | #define n_name n_key->k_name |
84 | struct smbfs_fctx * n_dirseq; /* ff context */ |
85 | long n_dirofs; /* last ff offset */ |
86 | struct lockf * n_lockf; /* Locking records of file */ |
87 | }; |
88 | |
89 | #define VTOSMB(vp) ((struct smbnode *)(vp)->v_data) |
90 | #define SMBTOV(np) ((struct vnode *)(np)->n_vnode) |
91 | |
92 | struct smbfattr; |
93 | |
94 | int smbfs_inactive(void *); |
95 | int smbfs_reclaim(void *); |
96 | int smbfs_loadvnode(struct mount *, struct vnode *, |
97 | const void *, size_t, const void **); |
98 | int smbfs_nget(struct mount *, struct vnode *, const char *, int, |
99 | struct smbfattr *, struct vnode **); |
100 | |
101 | int smbfs_readvnode(struct vnode *, struct uio *, kauth_cred_t); |
102 | int smbfs_writevnode(struct vnode *, struct uio *, kauth_cred_t, int); |
103 | void smbfs_attr_cacheenter(struct vnode *, struct smbfattr *); |
104 | int smbfs_attr_cachelookup(struct vnode * ,struct vattr *); |
105 | |
106 | #define smbfs_attr_cacheremove(vp) VTOSMB(vp)->n_attrage = 0 |
107 | |
108 | #endif /* _FS_SMBFS_SMBFS_NODE_H_ */ |
109 | |