Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/include
In directory usw-pr-cvs1:/tmp/cvs-serv12122/include
Modified Files:
attrib.h disk_io.h mft.h
Log Message:
read/write_mft_record(s) are here
Index: attrib.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/attrib.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -U2 -r1.27 -r1.28
--- attrib.h 14 Apr 2002 13:56:45 -0000 1.27
+++ attrib.h 15 Apr 2002 17:51:26 -0000 1.28
@@ -37,4 +37,6 @@
} LCN_SPECIAL_VALUES;
+LCN vcn_to_lcn(const run_list_element *rl, const VCN vcn);
+
/**
* attr_search_context - used in attribute search functions
@@ -83,26 +85,4 @@
*/
run_list *decompress_run_list(const ATTR_RECORD *attr);
-
-/**
- * vcn_to_lcn - determine the lcn corresponding to a particular vcn
- * @rl: decompressed mapping pairs array (i.e. run list)
- * @vcn: virtucal cluster number for which to determine the lcn
- *
- * Determine the logical cluster number given the virtual cluster number @vcn
- * and the run list @rl describing the mapping between the LCNs and VCNs.
- *
- * Return values:
- *
- * > 0: The lcn corresponding to the vcn.
- *
- * 0: Check errno:
- * 0 The lcn corresponding to the vcn is really zero.
- * ENOENT We are looking for a vcn which doesn't exist.
- * EINVAL Either @rl or @vcn are invalid.
- *
- * -1: The lcn is sparse, i.e. it's contents are zero and there is no disk
- * space allocated for it.
- */
-LCN vcn_to_lcn(const run_list *rl, const VCN vcn);
/**
Index: disk_io.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/disk_io.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -U2 -r1.11 -r1.12
--- disk_io.h 15 Apr 2002 00:45:28 -0000 1.11
+++ disk_io.h 15 Apr 2002 17:51:26 -0000 1.12
@@ -27,15 +27,17 @@
#include "types.h"
-extern __s64 ntfs_pread(const int fd, const __s64 pos, __s64 count, void *b);
-extern __s64 ntfs_pwrite(int fd, const __s64 pos, __s64 count, const void *b);
+extern __s64 ntfs_pread(const int fd, const __s64 pos, __s64 count,
+ const void *b);
+extern __s64 ntfs_pwrite(const int fd, const __s64 pos, __s64 count,
+ const void *b);
extern __s64 ntfs_mst_pread(const int fd, const __s64 pos, __s64 count,
- const __u32 bksize, void *b);
-extern __s64 ntfs_mst_pwrite(int fd, const __s64 pos, const __s64 count,
+ const __u32 bksize, const void *b);
+extern __s64 ntfs_mst_pwrite(const int fd, const __s64 pos, const __s64 count,
const __u32 bksize, const void *b);
extern __s64 ntfs_read_clusters(const ntfs_volume *vol, const __s64 lcn,
- __s64 count, void *b)
-extern __s64 ntfs_write_clusters(ntfs_volume *vol, const __s64 lcn,
+ __s64 count, const void *b)
+extern __s64 ntfs_write_clusters(const ntfs_volume *vol, const __s64 lcn,
__s64 count, const void *b)
Index: mft.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/mft.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -U2 -r1.27 -r1.28
--- mft.h 15 Apr 2002 00:45:28 -0000 1.27
+++ mft.h 15 Apr 2002 17:51:26 -0000 1.28
@@ -28,4 +28,52 @@
#include "endians.h"
+extern __s64 read_mft_records(const ntfs_volume *vol, const MFT_REF mref,
+ const __s64 count, const MFT_RECORD *b);
+
+/**
+ * read_mft_record - read a record from the mft
+ * @vol: volume to read from
+ * @mref: mft record number to read
+ * @b: output data buffer
+ *
+ * Read the mft record specified by @mref from volume @vol into buffer @b.
+ * Return 1 on success or -1 on error, with errno set to the error code.
+ *
+ * The read mft record is mst deprotected and is hence ready to use. The caller
+ * should check the record with is_baad_recordp() in case mst deprotection
+ * failed.
+ *
+ * NOTE: @b has to be at least of size vol->mft_record_size.
+ */
+static __inline__ int read_mft_record(const ntfs_volume *vol,
+ const MFT_REF mref, const MFT_RECORD *b)
+{
+ return (int)read_mft_records(vol, mref, 1, b);
+}
+
+extern __s64 write_mft_records(const ntfs_volume *vol, const MFT_REF mref,
+ const __s64 count, const MFT_RECORD *b);
+
+/**
+ * write_mft_record - write an mft record to disk
+ * @vol: volume to write to
+ * @mref: mft record number to write
+ * @b: data buffer containing the mft record to write
+ *
+ * Write the mft record specified by @mref from buffer @b to volume @vol.
+ * Return 1 on success or -1 on error, with errno set to the error code.
+ *
+ * Before the mft record is written, it is mst protected. After the write, it
+ * is deprotected again, thus resulting in an increase in the update sequence
+ * number inside the buffer @b.
+ *
+ * NOTE: @b has to be at least of size vol->mft_record_size.
+ */
+static __inline__ int write_mft_record(const ntfs_volume *vol,
+ const MFT_REF mref, const MFT_RECORD *b)
+{
+ return (int)write_mft_records(vol, mref, 1, b);
+}
+
/**
* get_mft_record_data_size - return number of bytes used in mft record @b
@@ -51,16 +99,4 @@
return le32_to_cpu(b->bytes_in_use);
}
-
-extern int get_mft_records(const ntfs_volume *vol, const MFT_RECORD *mrec,
- const MFT_REF *mref, const int count);
-
-extern int get_mft_record(const ntfs_volume *vol, const MFT_RECORD *mrec,
- const MFT_REF *mref);
-
-extern int __read_file_record(const ntfs_volume *vol, const MFT_REF *mref,
- MFT_RECORD **mrec, ATTR_RECORD **attr);
-
-extern int put_mft_record(ntfs_volume *vol, const __u8 *buf,
- const MFT_REF *mref);
#endif /* defined MFT_H */
|