Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/include
In directory usw-pr-cvs1:/tmp/cvs-serv18654/include
Modified Files:
attrib.h
Log Message:
New API for compressing run lists into mapping pairs arrays and adapt mkntfs to that API. Addition of ntfs_walk_attrs().
Index: attrib.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/attrib.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -U2 -r1.41 -r1.42
--- attrib.h 2 Jul 2002 23:47:10 -0000 1.41
+++ attrib.h 6 Jul 2002 20:07:59 -0000 1.42
@@ -83,4 +83,34 @@
/**
+ * ntfs_walk_attrs - syntactic sugar for walking all attributes in an inode
+ * @ctx: initialised attribute search context
+ *
+ * Syntactic sugar for walking attributes in an inode.
+ *
+ * Return 0 on success and -1 on error with errno set to the error code from
+ * ntfs_lookup_attr().
+ *
+ * Example: When you want to enumerate all attributes in an open ntfs inode
+ * @ni, you can simply do:
+ *
+ * int err;
+ * ntfs_attr_search_ctx *ctx = ntfs_get_attr_search_ctx(ni, NULL);
+ * if (!ctx)
+ * // Error code is in errno. Handle this case.
+ * while (!(err = ntfs_walk_attrs(ctx))) {
+ * ATTR_RECORD *attr = ctx->attr;
+ * // attr now contains the next attribute. Do whatever you want
+ * // with it and then just continue with the while loop.
+ * }
+ * if (err && errno != ENOENT)
+ * // Ooops. An error occured! You should handle this case.
+ * // Now finished with all attributes in the inode.
+ */
+static __inline__ int ntfs_walk_attrs(ntfs_attr_search_ctx *ctx)
+{
+ return ntfs_lookup_attr(0, NULL, 0, 0, 0, NULL, 0, ctx);
+}
+
+/**
* ntfs_attr_state_bits - bits for the state field in the ntfs_attr structure
*/
@@ -199,4 +229,13 @@
extern LCN ntfs_attr_vcn_to_lcn(ntfs_attr *na, const VCN vcn);
extern run_list_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn);
+
+extern int ntfs_get_nr_significant_bytes(const s64 n);
+extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol,
+ const run_list_element *rl);
+
+extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max,
+ const s64 n);
+extern int ntfs_build_mapping_pairs(const ntfs_volume *vol, s8 *dst,
+ const int dst_len, const run_list_element *rl);
// FIXME / TODO: Above here the file is cleaned up. (AIA)
|