Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/include
In directory usw-pr-cvs1:/tmp/cvs-serv1700
Modified Files:
attrib.h
Log Message:
New attribute searching API header part complete.
This shouldn't change any more, except for the search context structure,
which might be simplified at some point.
Index: attrib.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/attrib.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** attrib.h 2001/03/22 13:16:32 1.16
--- attrib.h 2001/03/26 03:35:35 1.17
***************
*** 104,108 ****
* The flags (32-bit) describing attribute properties in the attribute
* definition structure. FIXME: This information is from Regis's information
! * and according to him it is not certain and probably incomplete.
* Empirically, it would seem that 0x40 means that it must be resident,
* 0x01 is never encountered on NT4/W2k, 0x2 would be indexable as only
--- 104,108 ----
* The flags (32-bit) describing attribute properties in the attribute
* definition structure. FIXME: This information is from Regis's information
! * and, according to him, it is not certain and probably incomplete.
* Empirically, it would seem that 0x40 means that it must be resident,
* 0x01 is never encountered on NT4/W2k, 0x2 would be indexable as only
***************
*** 1747,1887 ****
} FIND_ATTR_CTX_FLAGS;
- /*
- * FIXME: The below descriptions are no longer accurate as I am rewriting the
- * functions completely. (AIA)
- */
-
/**
! * find_first_attr_in_attr_list - find attribute (type, name) in attribute list
! * @v: ntfs volume the mft record @m is from
! * @m: mft record the attribute list @al is from
! * @al: the attribute list to search
! * @t: find attribute of this type
! * @n: find attribute of this name
! *
! * Get the location of the desired attribute of type @t and name @n (@n can be
! * NULL for unnamed attributes; note that @n is a Unicode string). Return a
! * pointer to the attribute or NULL if the attribute is not present or an
! * error situation exists.
! *
! * There can be several attributes which have the same type and name. Hence,
! * call find_next_attr_in_attr_list() to obtain the next attribute passing in
! * the return value from find_first_attr_in_attr_list() as the fourth parameter
! * to find_next_attr_in_attr_list().
! */
! extern __inline__ ATTR_RECORD *find_first_attr_in_attr_list(
! const ntfs_volume *v,
! const MFT_RECORD *m,
! const ATTR_RECORD *al,
! const ATTR_TYPES t,
! const wchar_t *n);
!
! /**
! * find_next_attr_in_attr_list - find attribute (type, name) in attribute list
! * @v: ntfs volume the mft record @m is from
! * @m: mft record the attribute list @al is from
! * @al: the attribute list to search
! * @t: find attribute of this type
! * @n: find attribute of this name
! * @ctx: search context
! *
! * Get the location of the desired attribute of type @t and name @n (@n can be
! * NULL for unnamed attributes; note that @n is a Unicode string). Return a
! * pointer to the attribute or NULL if the attribute is not present or an
! * error situation exists.
! *
! * @ctx is the search context. When @ctx is NULL the first attribute with
! * matching type and name will be returned. When @ctx is not NULL it is a
! * pointer to the attribute returned either by find_first_attr_in_attr_list()
! * or by a previous call to find_next_attr_in_attr_list(). In this way a loop
! * can be made in which the result of find_next_attr_in_attr_list() is used as
! * the parameter @ctx in a subsequent call to find_next_attr_in_attr_list(),
! * until find_next_attr_in_attr_list() returns NULL, which is in fact an
! * iteration over all attributes in the attribute list @al matching the type
! * @t and name @n.
! *
! * Also, note that you do not need to call find_first_attr_in_attr_list() at
! * all. Instead, you can just call find_next_attr_in_attr_list() with
! * @ctx = NULL. This is in fact what find_first_attr_in_attr_list() does.
! */
! ATTR_RECORD *find_next_attr_in_attr_list(
! const ntfs_volume *v,
! const MFT_RECORD *m,
! const ATTR_RECORD *al,
! const ATTR_TYPES t,
! const wchar_t *n,
! const ATTR_RECORD *ctx);
!
! /**
! * find_first_attr - find first attribute of a type and name in mft record
! * @v: ntfs volume the mft record @b is from
! * @b: pointer to a buffer containing the mft record to search
! * @t: find attribute of this type
! * @n: find attribute of this name
! * @ctx: optional search context for future calls to find_next_attr()
! *
! * Get the location of the desired attribute of type @t and name @n (@n can be
! * NULL for unnamed attributes; note that @n is a Unicode string). Return a
! * pointer to the attribute or NULL if the attribute is not present or an
! * error situation exists. @ctx is optional and if NULL it will be ignored.
! * When @ctx is not NULL, it is a pointer to an integer, holding the search
! * context. In fact, it will contain the attribute instance number of the found
! * attribute (need to use INSTANCE_MASK to get it). @ctx will be ORed with
! * IN_ATTR_LIST bit if the corresponding attribute is not in a base mft record,
! * i.e. it is only in the attribute list of the base mft record).
! *
! * There can be several attributes which have the same type and name. Hence,
! * call find_next_attr() to obtain the next attribute passing in the returned
! * @ctx value value from find_first_attr() as the fourth parameter to
! * find_next_attr().
! *
! * Note, if @t is zero the first attribute in the mft record @b will be
! * returned, no matter what it is.
! */
! extern __inline__ ATTR_RECORD *find_first_attr(const ntfs_volume *v,
! const MFT_RECORD *b,
! const ATTR_TYPES t,
! const wchar_t *n,
! FIND_ATTR_CTX_FLAGS *ctx);
!
! /**
! * find_next_attr - find next attribute of a type and name in mft record
! * @v: ntfs volume the mft record @b is from
! * @b: pointer to a buffer containing the mft record to search
! * @t: find attribute of this type
! * @n: find attribute of this name
! * @ctx: search context
! *
! * Get the location of the desired attribute of type @t and name @n (@n can be
! * NULL for unnamed attributes; note that @n is a Unicode string). Return a
! * pointer to the attribute or NULL if the attribute is not present or an
! * error situation exists.
! *
! * @ctx is the search context. When *@ctx equls FIRST_SEARCH the first
! * attribute with matching type and name will be returned. When *@ctx is not
! * FIRST_SEARCH it contains the instance number of the attribute returned in
! * *@ctx either by find_first_attr() or by a previous call to find_next_attr().
! * (Need to use INSTANCE_MASK to get the instance number.) The bit IN_ATTR_LIST
! * is set if the corresponding attribute is not in the base mft record, i.e.
! * the instance number is only in the attribute list. In this way a, loop can
! * be made in which find_next_attr() is called recursively until it returns
! * NULL, and this effectively iterates over all attributes in the mft record @b
! * matching the type @t and name @n in order of their sequence numbers.
! *
! * Also, note that you do not need to call find_first_attr() at all. Instead,
! * you can just call find_next_attr() with *@ctx = FIRST_SEARCG. This is in
! * fact what find_first_attr() does.
! *
! * Note: Instance number is __u16 and hence using 32 bits we can use negative
! * numbers without clashing with any actual sequence numbers.
! *
! * Note, if @t is zero the first attribute in the mft record @b will be
! * returned, no matter what it is.
! */
! ATTR_RECORD *find_next_attr(const ntfs_volume *v,
! const MFT_RECORD *b,
! const ATTR_TYPES t,
! const wchar_t *n,
! FIND_ATTR_CTX_FLAGS *ctx);
/**
--- 1747,1814 ----
} FIND_ATTR_CTX_FLAGS;
/**
! * attr_search_context - used in attribute search functions
! * @mrec: buffer containing mft record to search
! * @attr: attribute record in @mrec where to begin/continue search
! * @base_mrec: base mft record
! * @alist_attr: attribute list attribute record (in @base_mrec, not @mrec)
! * @alist_val: attribute list value (if alist is resident in @base_mrec)
! * @alist_val_end: end of attribute list value + 1
! * @alist_val_len: length of attribute list in bytes
! * @is_first: if true lookup_attr() begins search with @attr, else after @attr
! *
! * Structure must be initialized to zero before the first call to one of the
! * attribute search functions. If the mft record in which to search has already
! * been loaded into memory, then initialize @mrec to point to it, @attr to point
! * to the first attribute within @mrec, and set @is_first to TRUE.
! *
! * @is_first is only honoured in lookup_attr() and only when called with @mrec
! * not NULL. Then, if @is_first is TRUE, lookup_attr() begins the search with
! * @attr. If @is_first is FALSE, lookup_attr() begins the search after @attr.
! * This is so that, after the first call to lookup_attr(), we can call
! * lookup_attr() again, without any modification of the search context, to
! * automagically get the next matching attribute.
! *
! * In contrast, find_attr() ignores @is_first and always begins the search with
! * @attr. find_attr() shouldn't really be called directly; it is just for
! * internal use. FIXME: Might want to change this behaviour later, but not
! * before I am finished with lookup_external_attr(). (AIA)
! *
! * FIXME: alist_val* stuff is subject to change. A bit of redundancy at the
! * moment. (AIA)
! */
! typedef struct {
! MFT_RECORD *mrec;
! ATTR_RECORD *attr;
! MFT_RECORD *base_mrec;
! ATTR_RECORD *alist_attr;
! ATTR_LIST_ENTRY *alist_val;
! ATTR_LIST_ENTRY *alist_val_end;
! __u32 alist_val_len;
! IS_FIRST_BOOL is_first;
! } attr_search_context;
!
! /*
! * See attrib.c for descriptions of the below functions.
! */
!
! extern __inline__ BOOL find_first_attr(const ntfs_volume *vol,
! const ATTR_TYPES type, const wchar_t *name, const __u32 name_len,
! const IGNORE_CASE_BOOL ic, const __u8 *val, const __u32 val_len,
! attr_search_context ctx);
!
! BOOL find_attr(const ntfs_volume *vol, const ATTR_TYPES type,
! const wchar_t *name, const __u32 name_len, const IGNORE_CASE_BOOL ic,
! const __u8 *val, const __u32 val_len, attr_search_context *ctx);
!
! BOOL lookup_external_attr(const ntfs_volume *vol, const ATTR_TYPES type,
! const wchar_t *name, const __u32 name_len, const IGNORE_CASE_BOOL ic,
! const __s64 lowest_vcn, const __u8 *val, const __u32 val_len,
! attr_search_context *ctx);
!
! BOOL lookup_attr(const ntfs_volume *vol, const MFT_REFERENCE mref,
! const ATTR_TYPES type, const wchar_t *name, const __u32 name_len,
! const IGNORE_CASE_BOOL ic, const __s64 lowest_vcn, const __u8 *val,
! const __u32 val_len, attr_search_context *ctx);
/**
|