Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/include
In directory usw-pr-cvs1:/tmp/cvs-serv24237/include
Modified Files:
attrib.h inode.h mft.h types.h volume.h
Log Message:
huge update!
Index: attrib.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/attrib.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -U2 -r1.36 -r1.37
--- attrib.h 29 Apr 2002 12:58:34 -0000 1.36
+++ attrib.h 1 Jun 2002 00:41:45 -0000 1.37
@@ -25,5 +25,5 @@
#define ATTRIB_H
-#include "inode.h"
+#include "types.h"
#include "unistr.h"
@@ -61,5 +61,5 @@
* matching attribute.
*/
-typedef struct {
+struct _ntfs_attr_search_ctx {
MFT_RECORD *mrec;
ATTR_RECORD *attr;
@@ -70,5 +70,5 @@
MFT_RECORD *base_mrec;
ATTR_RECORD *base_attr;
-} ntfs_attr_search_ctx;
+};
extern void ntfs_reinit_attr_search_ctx(ntfs_attr_search_ctx *ctx);
@@ -87,5 +87,9 @@
*/
typedef enum {
+ NA_Initialized, /* 1: structure is initialized. */
NA_NonResident, /* 1: Attribute is not resident. */
+ NA_Compressed, /* 1: Attribute is compressed. */
+ NA_Encrypted, /* 1: Attribute is enxrypted. */
+ NA_Sparse, /* 1: Attribute is sparse. */
} ntfs_attr_state_bits;
@@ -94,8 +98,24 @@
#define clear_nattr_flag(na, flag) clear_bit(NA_##flag, (na)->state)
+#define NAttrInitialized(na) test_nattr_flag(na, Initialized)
+#define NAttrSetInitialized(na) set_nattr_flag(na, Initialized)
+#define NAttrClearInitialized(na) clear_nattr_flag(na, Initialized)
+
#define NAttrNonResident(na) test_nattr_flag(na, NonResident)
#define NAttrSetNonResident(na) set_nattr_flag(na, NonResident)
#define NAttrClearNonResident(na) clear_nattr_flag(na, NonResident)
+#define NAttrCompressed(na) test_nattr_flag(na, Compressed)
+#define NAttrSetCompressed(na) set_nattr_flag(na, Compressed)
+#define NAttrClearCompressed(na) clear_nattr_flag(na, Compressed)
+
+#define NAttrEncrypted(na) test_nattr_flag(na, Encrypted)
+#define NAttrSetEncrypted(na) set_nattr_flag(na, Encrypted)
+#define NAttrClearEncrypted(na) clear_nattr_flag(na, Encrypted)
+
+#define NAttrSparse(na) test_nattr_flag(na, Sparse)
+#define NAttrSetSparse(na) set_nattr_flag(na, Sparse)
+#define NAttrClearSparse(na) clear_nattr_flag(na, Sparse)
+
/**
* ntfs_attr - ntfs in memory non-resident attribute structure
@@ -133,5 +153,5 @@
* structure. See ntfs_attr_state_bits above.
*/
-typedef struct {
+struct _ntfs_attr {
run_list_element *rl;
ntfs_inode *ni;
@@ -140,9 +160,22 @@
__u32 name_len;
unsigned long state;
-} ntfs_attr;
-
-extern ntfs_attr *ntfs_attr_get(ntfs_inode *ni, const ATTR_TYPES type,
- uchar_t *name, const __u32 name_len, const unsigned long state);
-extern void ntfs_attr_put(ntfs_attr *na);
+ __s64 allocated_size;
+ __s64 data_size;
+ __s64 initialized_size;
+ __s64 compressed_size;
+ __u32 compression_block_size;
+ __u8 compression_block_size_bits;
+ __u8 compression_block_clusters;
+};
+
+extern void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident,
+ const BOOL compressed, const BOOL encrypted, const BOOL sparse,
+ const __s64 allocated_size, const __s64 data_size,
+ const __s64 initialized_size, const __s64 compressed_size,
+ const __u8 compression_unit);
+
+extern ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
+ uchar_t *name, const __u32 name_len);
+extern void ntfs_attr_close(ntfs_attr *na);
extern __s64 ntfs_attr_pread(ntfs_attr *na, const __s64 pos, __s64 count,
Index: inode.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/inode.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -U2 -r1.7 -r1.8
--- inode.h 20 Apr 2002 23:09:42 -0000 1.7
+++ inode.h 1 Jun 2002 00:41:45 -0000 1.8
@@ -23,5 +23,5 @@
#define NTFS_INODE_H
-#include "volume.h"
+#include "types.h"
/*
@@ -61,6 +61,4 @@
#define NInoAttrListSetDirty(ni) set_nino_al_flag(ni, Dirty)
#define NInoAttrListClearDirty(ni) clear_nino_al_flag(ni, Dirty)
-
-typedef struct _ntfs_inode ntfs_inode;
/*
Index: mft.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/mft.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -U2 -r1.33 -r1.34
--- mft.h 27 Apr 2002 19:49:09 -0000 1.33
+++ mft.h 1 Jun 2002 00:41:45 -0000 1.34
@@ -28,5 +28,5 @@
extern int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref,
- const __s64 count, const MFT_RECORD *b);
+ const __s64 count, MFT_RECORD *b);
/**
@@ -46,5 +46,5 @@
*/
static __inline__ int ntfs_read_mft_record(const ntfs_volume *vol,
- const MFT_REF mref, const MFT_RECORD *b)
+ const MFT_REF mref, MFT_RECORD *b)
{
return ntfs_read_mft_records(vol, mref, 1, b);
@@ -55,5 +55,5 @@
extern int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref,
- const __s64 count, const MFT_RECORD *b);
+ const __s64 count, MFT_RECORD *b);
/**
@@ -73,5 +73,5 @@
*/
static __inline__ int ntfs_write_mft_record(const ntfs_volume *vol,
- const MFT_REF mref, const MFT_RECORD *b)
+ const MFT_REF mref, MFT_RECORD *b)
{
return ntfs_write_mft_records(vol, mref, 1, b);
Index: types.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/types.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -U2 -r1.8 -r1.9
--- types.h 20 Apr 2002 23:09:42 -0000 1.8
+++ types.h 1 Jun 2002 00:41:45 -0000 1.9
@@ -89,5 +89,14 @@
EFS_ATTR efs;
} attr_val;
-
+
+/*
+ * Forward definitions for the global ntfs specific structures. Avoids the big
+ * include file interdependencies mess.
+ */
+typedef struct _ntfs_volume ntfs_volume;
+typedef struct _ntfs_inode ntfs_inode;
+typedef struct _ntfs_attr ntfs_attr;
+typedef struct _ntfs_attr_search_ctx ntfs_attr_search_ctx;
+
#endif /* defined NTFS_TYPES_H */
Index: volume.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/volume.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -U2 -r1.21 -r1.22
--- volume.h 29 Apr 2002 01:53:55 -0000 1.21
+++ volume.h 1 Jun 2002 00:41:45 -0000 1.22
@@ -48,43 +48,53 @@
* ntfs_volume - structure describing an open volume in memory
*/
-typedef struct {
+struct _ntfs_volume {
int fd; /* File descriptor associated with volume. */
char *dev_name; /* Name of the device/file the volume is in. */
char *vol_name; /* Name of the volume. */
- __u8 major_ver; /* Ntfs major version of volume. */
- __u8 minor_ver; /* Ntfs minor version of volume. */
- __u16 flags; /* Bit array of VOLUME_* flags. */
- __s64 number_of_clusters;/* Volume size in clusters, hence also the
- number of bits in lcn_bitmap. */
+ __u8 major_ver; /* Ntfs major version of volume. */
+ __u8 minor_ver; /* Ntfs minor version of volume. */
+ __u16 flags; /* Bit array of VOLUME_* flags. */
+
__u32 cluster_size; /* Byte size of a cluster. */
__u32 mft_record_size; /* Byte size of a mft record. */
- __s64 mft_lcn; /* Logical cluster number of the data attribute
- for FILE_MFT. */
- __s64 mftmirr_lcn; /* Logical cluster number of the data attribute
- for FILE_MFTMirr. */
- int mftmirr_size; /* Size of the FILE_MFTMirr in mft records. */
__u8 cluster_size_bits; /* Log(2) of the byte size of a cluster. */
__u8 mft_record_size_bits;/* Log(2) of the byte size of a mft record. */
- __u8 *lcn_bitmap; /* Value of data attribute of FILE_Bitmap. Each
- bit represents a cluster on the volume, bit 0
- representing lcn 0 and so on. A set bit means
- that the cluster is in use and a zero bit
- means the cluster is free. */
- __u8 *mft_bitmap; /* Value of bitmap attribute of FILE_MFT. Has
- same interpretation as the lcn_bitmap above
- but except that it keeps track of the usage
- of the mft records rather than the lcns. */
- run_list *mft_rl; /* Decompressed run list of the data attribute
+
+ __s64 nr_clusters; /* Volume size in clusters, hence also the
+ number of bits in lcn_bitmap. */
+ ntfs_inode *lcnbmp_ni; /* ntfs_inode structure for FILE_Bitmap. */
+ ntfs_attr *lcnbmp_na; /* ntfs_attr structure for the data attribute
+ of FILE_Bitmap. Each bit represents a
+ cluster on the volume, bit 0 representing
+ lcn 0 and so on. A set bit means that the
+ cluster and vice versa. */
+
+ __s64 nr_mft_records; /* Number of records in the mft, equals the
+ number of bits in mft_bitmap. */
+ __s64 mft_lcn; /* Logical cluster number of the data attribute
+ for FILE_MFT. */
+ ntfs_inode *mft_ni; /* ntfs_inode structure for FILE_MFT. */
+ ntfs_attr *mft_na; /* ntfs_attr structure for the data attribute
of FILE_MFT. */
- run_list *mftmirr_rl; /* Decompressed run list of the data attribute
+ ntfs_attr *mftbmp_na; /* ntfs_attr structure for the bitmap attribute
+ of FILE_MFT. Each bit represents an mft
+ record in the $DATA attribute, bit 0
+ representing mft record 0 and so on. A set
+ bit means that the mft record is in use and
+ vice versa. */
+
+ int mftmirr_size; /* Size of the FILE_MFTMirr in mft records. */
+ __s64 mftmirr_lcn; /* Logical cluster number of the data attribute
+ for FILE_MFTMirr. */
+ ntfs_inode *mftmirr_ni; /* ntfs_inode structure for FILE_MFTMirr. */
+ ntfs_attr *mftmirr_na; /* ntfs_attr structure for the data attribute
of FILE_MFTMirr. */
- __s64 number_of_mft_records; /* Number of records in the mft, equals
- the number of bits in mft_bitmap. */
- uchar_t *upcase; /* Upper case equivalents of all 65536
- 2-byte Unicode characters. Obtained
- from FILE_UpCase. */
- __u32 upcase_len; /* Length in Unicode characters of the
- upcase table. */
-} ntfs_volume;
+
+ uchar_t *upcase; /* Upper case equivalents of all 65536 2-byte
+ Unicode characters. Obtained from
+ FILE_UpCase. */
+ __u32 upcase_len; /* Length in Unicode characters of the upcase
+ table. */
+};
extern ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag);
|