Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / sys / vfs / ntfs / ntfs_subr.h
1 /*      $NetBSD: ntfs_subr.h,v 1.8 1999/10/10 14:48:37 jdolecek Exp $   */
2
3 /*-
4  * Copyright (c) 1998, 1999 Semen Ustimenko
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  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  * $FreeBSD: src/sys/ntfs/ntfs_subr.h,v 1.7.2.1 2001/10/12 22:08:49 semenu Exp $
29  * $DragonFly: src/sys/vfs/ntfs/ntfs_subr.h,v 1.2 2003/06/17 04:28:54 dillon Exp $
30  */
31
32 #define VA_LOADED               0x0001
33 #define VA_PRELOADED            0x0002
34
35 struct ntvattr {
36         LIST_ENTRY(ntvattr)     va_list;
37
38         u_int32_t               va_vflag;
39         struct vnode           *va_vp;
40         struct ntnode          *va_ip;
41
42         u_int32_t               va_flag;
43         u_int32_t               va_type;
44         u_int8_t                va_namelen;
45         char                    va_name[NTFS_MAXATTRNAME];
46
47         u_int32_t               va_compression;
48         u_int32_t               va_compressalg;
49         u_int32_t               va_datalen;
50         u_int32_t               va_allocated;
51         cn_t                    va_vcnstart;
52         cn_t                    va_vcnend;
53         u_int16_t               va_index;
54         union {
55                 struct {
56                         cn_t *          cn;
57                         cn_t *          cl;
58                         u_long          cnt;
59                 } vrun;
60                 caddr_t         datap;
61                 struct attr_name *name;
62                 struct attr_indexroot *iroot;
63                 struct attr_indexalloc *ialloc;
64         } va_d;
65 };
66 #define va_vruncn       va_d.vrun.cn
67 #define va_vruncl       va_d.vrun.cl
68 #define va_vruncnt      va_d.vrun.cnt
69 #define va_datap        va_d.datap
70 #define va_a_name       va_d.name
71 #define va_a_iroot      va_d.iroot
72 #define va_a_ialloc     va_d.ialloc
73
74 struct componentname;
75 struct fnode;
76 struct uio;
77
78 int ntfs_procfixups __P(( struct ntfsmount *, u_int32_t, caddr_t, size_t ));
79 int ntfs_parserun __P(( cn_t *, cn_t *, u_int8_t *, u_long, u_long *));
80 int ntfs_runtocn __P(( cn_t *, struct ntfsmount *, u_int8_t *, u_long, cn_t));
81 int ntfs_readntvattr_plain __P(( struct ntfsmount *, struct ntnode *, struct ntvattr *, off_t, size_t, void *,size_t *, struct uio *));
82 int ntfs_readattr_plain __P(( struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *,size_t *, struct uio *));
83 int ntfs_readattr __P(( struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *, struct uio *));
84 int ntfs_filesize __P(( struct ntfsmount *, struct fnode *, u_int64_t *, u_int64_t *));
85 int ntfs_times __P(( struct ntfsmount *, struct ntnode *, ntfs_times_t *));
86 struct timespec ntfs_nttimetounix __P(( u_int64_t ));
87 int ntfs_ntreaddir __P(( struct ntfsmount *, struct fnode *, u_int32_t, struct attr_indexentry **));
88 int ntfs_runtovrun __P(( cn_t **, cn_t **, u_long *, u_int8_t *));
89 int ntfs_attrtontvattr __P(( struct ntfsmount *, struct ntvattr **, struct attr * ));
90 void ntfs_freentvattr __P(( struct ntvattr * ));
91 int ntfs_loadntvattrs __P(( struct ntfsmount *, struct vnode *, caddr_t, struct ntvattr **));
92 struct ntvattr * ntfs_findntvattr __P(( struct ntfsmount *, struct ntnode *, u_int32_t, cn_t ));
93 int ntfs_ntlookupfile __P((struct ntfsmount *, struct vnode *, struct componentname *, struct vnode **));
94 int ntfs_isnamepermitted __P((struct ntfsmount *, struct attr_indexentry * ));
95 int ntfs_ntvattrrele __P((struct ntvattr * ));
96 int ntfs_ntvattrget __P((struct ntfsmount *, struct ntnode *, u_int32_t, const char *, cn_t , struct ntvattr **));
97 int ntfs_ntlookup __P((struct ntfsmount *, ino_t, struct ntnode **));
98 int ntfs_ntget __P((struct ntnode *));
99 void ntfs_ntref __P((struct ntnode *));
100 void ntfs_ntrele __P((struct ntnode *));
101 void ntfs_ntput __P((struct ntnode *));
102 int ntfs_loadntnode __P(( struct ntfsmount *, struct ntnode * ));
103 int ntfs_writentvattr_plain __P((struct ntfsmount *, struct ntnode *, struct ntvattr *, off_t, size_t, void *, size_t *, struct uio *));
104 int ntfs_writeattr_plain __P((struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *, size_t *, struct uio *));
105 void ntfs_toupper_init __P((void));
106 int ntfs_toupper_use __P((struct mount *, struct ntfsmount *));
107 void ntfs_toupper_unuse __P((void));
108 int ntfs_fget __P((struct ntfsmount *, struct ntnode *, int, char *, struct fnode **));
109 void ntfs_frele __P((struct fnode *));
110
111 int ntfs_u28_init(struct ntfsmount *ntmp, wchar *u2w);
112 int ntfs_u28_uninit(struct ntfsmount *ntmp);
113 int ntfs_82u_init(struct ntfsmount *ntmp, u_int16_t *u2w);
114 int ntfs_82u_uninit(struct ntfsmount *ntmp);
115 char ntfs_u28(struct ntfsmount *ntmp, wchar wc);
116 #define NTFS_U28(ch)            ntfs_u28(ntmp, (ch))
117 #define NTFS_82U(ch)            (ntmp->ntm_82u[(ch)&0xFF])
118 #define NTFS_UASTRCMP(ustr, ustrlen, astr, astrlen)     \
119         ntfs_uastrcmp(ntmp, (ustr), (ustrlen), (astr), (astrlen))
120 #define NTFS_UASTRICMP(ustr, ustrlen, astr, astrlen)    \
121         ntfs_uastricmp(ntmp, (ustr), (ustrlen), (astr), (astrlen))