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$ 29 */ 30 31#define VA_LOADED 0x0001 32#define VA_PRELOADED 0x0002 33 34struct ntvattr { 35 LIST_ENTRY(ntvattr) va_list; 36 37 u_int32_t va_vflag; 38 struct vnode *va_vp; 39 struct ntnode *va_ip; 40 41 u_int32_t va_flag; 42 u_int32_t va_type; 43 u_int8_t va_namelen; 44 char va_name[NTFS_MAXATTRNAME]; 45 46 u_int32_t va_compression; 47 u_int32_t va_compressalg; 48 u_int64_t va_datalen; 49 u_int64_t va_allocated; 50 cn_t va_vcnstart; 51 cn_t va_vcnend; 52 u_int16_t va_index; 53 union { 54 struct { 55 cn_t * cn; 56 cn_t * cl; 57 u_long cnt; 58 } vrun; 59 caddr_t datap; 60 struct attr_name *name; 61 struct attr_indexroot *iroot; 62 struct attr_indexalloc *ialloc; 63 } va_d; 64}; 65#define va_vruncn va_d.vrun.cn 66#define va_vruncl va_d.vrun.cl 67#define va_vruncnt va_d.vrun.cnt 68#define va_datap va_d.datap 69#define va_a_name va_d.name 70#define va_a_iroot va_d.iroot 71#define va_a_ialloc va_d.ialloc 72 73struct componentname; 74struct fnode; 75struct uio; 76 77int ntfs_procfixups( struct ntfsmount *, u_int32_t, caddr_t, size_t ); 78int ntfs_parserun( cn_t *, cn_t *, u_int8_t *, u_long, u_long *); 79int ntfs_runtocn( cn_t *, struct ntfsmount *, u_int8_t *, u_long, cn_t); 80int ntfs_readntvattr_plain( struct ntfsmount *, struct ntnode *, struct ntvattr *, off_t, size_t, void *,size_t *, struct uio *); 81int ntfs_readattr_plain( struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *,size_t *, struct uio *); 82int ntfs_readattr( struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *, struct uio *); 83int ntfs_filesize( struct ntfsmount *, struct fnode *, u_int64_t *, u_int64_t *); 84int ntfs_times( struct ntfsmount *, struct ntnode *, ntfs_times_t *); 85struct timespec ntfs_nttimetounix( u_int64_t ); 86int ntfs_ntreaddir( struct ntfsmount *, struct fnode *, u_int32_t, struct attr_indexentry **); 87int ntfs_runtovrun( cn_t **, cn_t **, u_long *, u_int8_t *); 88int ntfs_attrtontvattr( struct ntfsmount *, struct ntvattr **, struct attr * ); 89void ntfs_freentvattr( struct ntvattr * ); 90int ntfs_loadntvattrs( struct ntfsmount *, struct vnode *, caddr_t, struct ntvattr **); 91struct ntvattr * ntfs_findntvattr( struct ntfsmount *, struct ntnode *, u_int32_t, cn_t ); 92int ntfs_ntlookupfile(struct ntfsmount *, struct vnode *, struct componentname *, struct vnode **); 93int ntfs_isnamepermitted(struct ntfsmount *, struct attr_indexentry * ); 94int ntfs_ntvattrrele(struct ntvattr * ); 95int ntfs_ntvattrget(struct ntfsmount *, struct ntnode *, u_int32_t, const char *, cn_t , struct ntvattr **); 96int ntfs_ntlookup(struct ntfsmount *, ino_t, struct ntnode **); 97int ntfs_ntget(struct ntnode *); 98void ntfs_ntref(struct ntnode *); 99void ntfs_ntrele(struct ntnode *); 100void ntfs_ntput(struct ntnode *); 101int ntfs_loadntnode( struct ntfsmount *, struct ntnode * ); 102int ntfs_writentvattr_plain(struct ntfsmount *, struct ntnode *, struct ntvattr *, off_t, size_t, void *, size_t *, struct uio *); 103int ntfs_writeattr_plain(struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *, size_t *, struct uio *); 104void ntfs_toupper_init(void); 105void ntfs_toupper_destroy(void); 106int ntfs_toupper_use(struct mount *, struct ntfsmount *); 107void ntfs_toupper_unuse(void); 108int ntfs_fget(struct ntfsmount *, struct ntnode *, int, char *, struct fnode **); 109void ntfs_frele(struct fnode *); 110 111int ntfs_u28_init(struct ntfsmount *ntmp, wchar *u2w, char *cs_local, char *cs_ntfs); 112int ntfs_u28_uninit(struct ntfsmount *ntmp); 113int ntfs_82u_init(struct ntfsmount *ntmp, char *cs_local, char *cs_ntfs); 114int ntfs_82u_uninit(struct ntfsmount *ntmp); 115char * ntfs_u28(char *outbuf, struct ntfsmount *ntmp, wchar wc); 116wchar ntfs_82u(struct ntfsmount *ntmp, const char *c, int *len); 117#define NTFS_U28(ch) ntfs_u28(tmpbuf, ntmp, (ch)) 118#define NTFS_82U(ch, len) ntfs_82u(ntmp, (ch), len) 119#define NTFS_UASTRCMP(ustr, ustrlen, astr, astrlen) \ 120 ntfs_uastrcmp(ntmp, (ustr), (ustrlen), (astr), (astrlen)) 121#define NTFS_UASTRICMP(ustr, ustrlen, astr, astrlen) \ 122 ntfs_uastricmp(ntmp, (ustr), (ustrlen), (astr), (astrlen)) 123