.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\"
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng .
.TH "NTFS_ATTR_LOOKUP" "9" "09 October 2005" "" ""
.SH NAME
ntfs_attr_lookup \- find an attribute in an ntfs inode
.SH SYNOPSIS
"SYNOPSIS"
.sp
\fB
.sp
int ntfs_attr_lookup (const ATTR_TYPE \fItype\fB, const ntfschar * \fIname\fB, const u32 \fIname_len\fB, const IGNORE_CASE_BOOL \fIic\fB, const VCN \fIlowest_vcn\fB, const u8 * \fIval\fB, const u32 \fIval_len\fB, ntfs_attr_search_ctx * \fIctx\fB);
\fR
.SH "ARGUMENTS"
.TP
\fB\fItype\fB\fR
attribute type to find
.TP
\fB\fIname\fB\fR
attribute name to find (optional, i.e. NULL means don't care)
.TP
\fB\fIname_len\fB\fR
attribute name length (only needed if \fIname\fR present)
.TP
\fB\fIic\fB\fR
IGNORE_CASE or CASE_SENSITIVE (ignored if \fIname\fR not present)
.TP
\fB\fIlowest_vcn\fB\fR
lowest vcn to find (optional, non-resident attributes only)
.TP
\fB\fIval\fB\fR
attribute value to find (optional, resident attributes only)
.TP
\fB\fIval_len\fB\fR
attribute value length
.TP
\fB\fIctx\fB\fR
search context with mft record and attribute to search from
.SH "DESCRIPTION"
.PP
Find an attribute in an ntfs inode. On first search \fIctx\fR->ntfs_ino must
be the base mft record and \fIctx\fR must have been obtained from a call to
\fBntfs_attr_get_search_ctx\fR\&.
.PP
This function transparently handles attribute lists and \fIctx\fR is used to
continue searches where they were left off at.
.PP
After finishing with the attribute/mft record you need to call
\fBntfs_attr_put_search_ctx\fR to cleanup the search context (unmapping any
mapped inodes, etc).
.PP
Return 0 if the search was successful and -errno if not.
.PP
When 0, \fIctx\fR->attr is the found attribute and it is in mft record
\fIctx\fR->mrec. If an attribute list attribute is present, \fIctx\fR->al_entry is
the attribute list entry of the found attribute.
.PP
When -ENOENT, \fIctx\fR->attr is the attribute which collates just after the
attribute being searched for, i.e. if one wants to add the attribute to the
mft record this is the correct place to insert it into. If an attribute
list attribute is present, \fIctx\fR->al_entry is the attribute list entry which
collates just after the attribute list entry of the attribute being searched
for, i.e. if one wants to add the attribute to the mft record this is the
correct place to insert its attribute list entry into.
.PP
When -errno != -ENOENT, an error occured during the lookup. \fIctx\fR->attr is
then undefined and in particular you should not rely on it not changing.