1/* $OpenBSD: ntfs_subr.h,v 1.12 2024/05/13 01:15:53 jsg Exp $ */
2/* $NetBSD: ntfs_subr.h,v 1.1 2002/12/23 17:38:33 jdolecek Exp $ */
3
4/*-
5 * Copyright (c) 1998, 1999 Semen Ustimenko
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * Id: ntfs_subr.h,v 1.4 1999/05/12 09:43:02 semenu Exp
30 */
31
32#define VA_LOADED 0x0001
33#define VA_PRELOADED 0x0002
34
35struct 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_int64_t va_datalen;
50 u_int64_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
74int ntfs_procfixups( struct ntfsmount *, u_int32_t, caddr_t, size_t );
75int ntfs_parserun( cn_t *, cn_t *, u_int8_t *, u_long, u_long *);
76int ntfs_runtocn( cn_t *, struct ntfsmount *, u_int8_t *, u_long, cn_t);
77int ntfs_readntvattr_plain( struct ntfsmount *, struct ntnode *, struct ntvattr *, off_t, size_t, void *,size_t *, struct uio *);
78int ntfs_readattr_plain( struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *,size_t *, struct uio *);
79int ntfs_readattr( struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *, struct uio *);
80int ntfs_filesize( struct ntfsmount *, struct fnode *, u_int64_t *, u_int64_t *);
81struct timespec ntfs_nttimetounix( u_int64_t );
82int ntfs_runtovrun( cn_t **, cn_t **, u_long *, u_int8_t *);
83int ntfs_attrtontvattr( struct ntfsmount *, struct ntvattr **, struct attr * );
84void ntfs_freentvattr( struct ntvattr * );
85int ntfs_isnamepermitted(struct ntfsmount *, struct attr_indexentry * );
86int ntfs_ntvattrrele(struct ntvattr * );
87int ntfs_ntvattrget(struct ntfsmount *, struct ntnode *, u_int32_t, const char *, cn_t , struct ntvattr **);
88void ntfs_ntref(struct ntnode *);
89void ntfs_ntrele(struct ntnode *);
90int ntfs_loadntnode( struct ntfsmount *, struct ntnode * );
91int ntfs_fget(struct ntfsmount *, struct ntnode *, int, char *, struct fnode **);
92void ntfs_frele(struct fnode *);
93int ntfs_ntreaddir(struct ntfsmount *, struct fnode *, u_int32_t, struct attr_indexentry **, struct proc *);
94int ntfs_ntlookupfile(struct ntfsmount *, struct vnode *, struct componentname *, struct vnode **);
95int ntfs_ntlookup(struct ntfsmount *, ntfsino_t, struct ntnode **);
96int ntfs_ntget(struct ntnode *);
97void ntfs_ntput(struct ntnode *);
98int ntfs_toupper_use(struct mount *, struct ntfsmount *, struct proc *);
99void ntfs_toupper_unuse(struct proc *);
100
101/* ntfs_conv.c stuff */
102ntfs_wget_func_t ntfs_utf8_wget;
103ntfs_wput_func_t ntfs_utf8_wput;
104ntfs_wcmp_func_t ntfs_utf8_wcmp;