Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/include
In directory usw-pr-cvs1:/tmp/cvs-serv2913
Modified Files:
attrib.h
Log Message:
Initial proposal for ntfs attribute ntfs_attr structure typedef.
Index: attrib.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/attrib.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -U2 -r1.31 -r1.32
--- attrib.h 22 Apr 2002 10:34:31 -0000 1.31
+++ attrib.h 23 Apr 2002 11:02:59 -0000 1.32
@@ -66,4 +66,64 @@
} ntfs_attr_search_ctx;
+/**
+ * ntfs_attr_state_bits - bits for the state field in the ntfs_attr structure
+ * @NA_NonResident: if set, the attribute is not resident, and vice versa
+ */
+typedef enum {
+ NA_NonResident, /* 1: Attribute is not resident. */
+} ntfs_attr_state_bits;
+
+#define test_nattr_flag(na, flag) test_bit(NA_##flag, (na)->state)
+#define set_nattr_flag(na, flag) set_bit(NA_##flag, (na)->state)
+#define clear_nattr_flag(na, flag) clear_bit(NA_##flag, (na)->state)
+
+#define NAttrNonResident(na) test_nattr_flag(na, NonResident)
+#define NAttrSetNonResident(na) set_nattr_flag(na, NonResident)
+#define NAttrClearNonResident(na) clear_nattr_flag(na, NonResident)
+
+/**
+ * ntfs_attr - ntfs in memory non-resident attribute structure
+ * @rl: if not NULL, the decompressed run list
+ * @ni: base ntfs inode to which this attribute belongs
+ * @type: attribute type
+ * @name: Unicode name of the attribute
+ * @name_len: length of @name in Unicode characters
+ * @state: NTFS attribute specific flags descibing this attribute
+ *
+ * This structure exists purely to provide a mechanism of caching the run list
+ * of an attribute. If you want to operate on a particular attribute extent,
+ * you should not be using this structure at all. If you want to work with a
+ * resident attribute, you should not be using this structure at all. As a
+ * fail-safe check make sure to test NAttrNonResident() and if it is false, you
+ * know you shouldn't be using this structure.
+ *
+ * If you want to work on a resident attribute or on a specific attribute
+ * extent, you should use ntfs_lookup_attr() to retrieve the attribute (extent)
+ * record, edit that, and then write back the mft record (or set the
+ * corresponding ntfs inode dirty for delayed write back).
+ *
+ * @rl is the decompressed run list of the attribute described by this
+ * structure. Obviously this only makes sense if the attribute is not resident,
+ * i.e. NAttrNonResident() is true. If the run list hasn't been decomressed yet
+ * @rl is NULL, so be prepared to cope with @rl == NULL.
+ *
+ * @ni is the base ntfs inode of the attribute described by this structure.
+ *
+ * @type is the attribute type (see layout.h for the definition of ATTR_TYPES),
+ * @name and @name_len are the Unicode name and name length in Unicode
+ * characters of the attribute, respecitvely.
+ *
+ * @state contains NTFS attribute specific flags descibing this attribute
+ * structure. See ntfs_attr_state_bits above.
+ */
+typedef struct {
+ ATTR_TYPES type;
+ uchar_t *name;
+ __u32 name_len;
+ run_list_element *rl;
+ ntfs_inode *ni;
+ unsigned long state;
+} ntfs_attr;
+
extern void ntfs_reinit_attr_search_ctx(ntfs_attr_search_ctx *ctx);
extern ntfs_attr_search_ctx *ntfs_get_attr_search_ctx(ntfs_inode *ni,
|