2 * attrib.h - Defines for attribute handling in NTFS Linux kernel driver.
3 * Part of the Linux-NTFS project.
5 * Copyright (c) 2001-2003 Anton Altaparmakov
6 * Copyright (c) 2002 Richard Russon
8 * This program/include file is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as published
10 * by the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program/include file is distributed in the hope that it will be
14 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program (in the main directory of the Linux-NTFS
20 * distribution in the file COPYING); if not, write to the Free Software
21 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #ifndef _LINUX_NTFS_ATTRIB_H
25 #define _LINUX_NTFS_ATTRIB_H
33 static inline void init_run_list(run_list
*rl
)
36 init_rwsem(&rl
->lock
);
40 LCN_HOLE
= -1, /* Keep this as highest value or die! */
41 LCN_RL_NOT_MAPPED
= -2,
47 * attr_search_context - used in attribute search functions
48 * @mrec: buffer containing mft record to search
49 * @attr: attribute record in @mrec where to begin/continue search
50 * @is_first: if true lookup_attr() begins search with @attr, else after @attr
52 * Structure must be initialized to zero before the first call to one of the
53 * attribute search functions. Initialize @mrec to point to the mft record to
54 * search, and @attr to point to the first attribute within @mrec (not necessary
55 * if calling the _first() functions), and set @is_first to TRUE (not necessary
56 * if calling the _first() functions).
58 * If @is_first is TRUE, the search begins with @attr. If @is_first is FALSE,
59 * the search begins after @attr. This is so that, after the first call to one
60 * of the search attribute functions, we can call the function again, without
61 * any modification of the search context, to automagically get the next
69 ATTR_LIST_ENTRY
*al_entry
;
70 ntfs_inode
*base_ntfs_ino
;
71 MFT_RECORD
*base_mrec
;
72 ATTR_RECORD
*base_attr
;
73 } attr_search_context
;
75 extern run_list_element
*decompress_mapping_pairs(const ntfs_volume
*vol
,
76 const ATTR_RECORD
*attr
, run_list_element
*old_rl
);
78 extern int map_run_list(ntfs_inode
*ni
, VCN vcn
);
80 extern LCN
vcn_to_lcn(const run_list_element
*rl
, const VCN vcn
);
82 extern BOOL
find_attr(const ATTR_TYPES type
, const uchar_t
*name
,
83 const u32 name_len
, const IGNORE_CASE_BOOL ic
, const u8
*val
,
84 const u32 val_len
, attr_search_context
*ctx
);
86 BOOL
lookup_attr(const ATTR_TYPES type
, const uchar_t
*name
, const u32 name_len
,
87 const IGNORE_CASE_BOOL ic
, const VCN lowest_vcn
, const u8
*val
,
88 const u32 val_len
, attr_search_context
*ctx
);
90 extern int load_attribute_list(ntfs_volume
*vol
, run_list
*rl
, u8
*al_start
,
91 const s64 size
, const s64 initialized_size
);
93 static inline s64
attribute_value_length(const ATTR_RECORD
*a
)
96 return (s64
)le32_to_cpu(a
->data
.resident
.value_length
);
97 return sle64_to_cpu(a
->data
.non_resident
.data_size
);
100 extern void reinit_attr_search_ctx(attr_search_context
*ctx
);
101 extern attr_search_context
*get_attr_search_ctx(ntfs_inode
*ni
,
103 extern void put_attr_search_ctx(attr_search_context
*ctx
);
105 #endif /* _LINUX_NTFS_ATTRIB_H */