Import 2.2.8pre2
[davej-history.git] / fs / ntfs / struct.h
blob2b032d7444b25844bb918aaaf5f614cf40a7c089
1 /*
2 * struct.h
3 * Structure definitions
5 * Copyright (C) 1997 RĂ©gis Duchesne
6 */
8 /* Necessary forward definition */
9 struct ntfs_inode;
11 #ifdef __FreeBSD__
12 #include <sys/queue.h>
13 /* Define the struct ntfs_head type */
14 LIST_HEAD(ntfs_head,ntfs_inode);
15 #endif
17 /* which files should be returned from a director listing */
18 /* only short names, no hidden files */
19 #define ngt_dos 1
20 /* only long names, all-uppercase becomes all-lowercase, no hidden files */
21 #define ngt_nt 2
22 /* all names except hidden files */
23 #define ngt_posix 3
24 /* all entries */
25 #define ngt_full 4
27 #ifdef NTFS_IN_LINUX_KERNEL
28 typedef struct ntfs_sb_info ntfs_volume;
29 #else
30 typedef struct _ntfs_volume{
31 /* NTFS_SB_INFO_START */
32 /* Configuration provided by user at mount time */
33 ntfs_uid_t uid;
34 ntfs_gid_t gid;
35 ntmode_t umask;
36 unsigned int nct;
37 void *nls_map;
38 unsigned int ngt;
39 /* Configuration provided by user with ntfstools */
40 ntfs_size_t partition_bias; /* for access to underlying device */
41 /* Attribute definitions */
42 ntfs_u32 at_standard_information;
43 ntfs_u32 at_attribute_list;
44 ntfs_u32 at_file_name;
45 ntfs_u32 at_security_descriptor;
46 ntfs_u32 at_data;
47 ntfs_u32 at_index_root;
48 ntfs_u32 at_index_allocation;
49 ntfs_u32 at_bitmap;
50 ntfs_u32 at_symlink; /* aka SYMBOLIC_LINK or REPARSE_POINT */
51 /* Data read from the boot file */
52 int blocksize;
53 int clusterfactor;
54 int clustersize;
55 int mft_recordsize;
56 int mft_clusters_per_record;
57 int index_recordsize;
58 int index_clusters_per_record;
59 int mft_cluster;
60 /* data read from special files */
61 unsigned char *mft;
62 unsigned short *upcase;
63 unsigned int upcase_length;
64 /* inodes we always hold onto */
65 struct ntfs_inode *mft_ino;
66 struct ntfs_inode *mftmirr;
67 struct ntfs_inode *bitmap;
68 /* NTFS_SB_INFO_END */
69 union{
70 int fd; /* file descriptor for the tools */
71 void *sb; /* pointer to super block for the kernel */
72 }u;
73 #ifdef __FreeBSD__
74 dev_t rdev;
75 struct vnode *devvp;
76 struct ntfs_head *inode_hash; /* not really a hash */
77 #endif
78 }ntfs_volume;
79 #endif
81 typedef struct {
82 ntfs_cluster_t cluster;
83 ntfs_cluster_t len;
84 }ntfs_runlist;
86 typedef struct ntfs_attribute{
87 int type;
88 ntfs_u16 *name;
89 int namelen;
90 int attrno;
91 int size,allocated,initialized,compsize;
92 int compressed,resident,indexed;
93 int cengine;
94 union{
95 void *data; /* if resident */
96 struct {
97 ntfs_runlist *runlist;
98 int len;
99 }r;
101 }ntfs_attribute;
103 /* Structure to define IO to user buffer. do_read means that
104 the destination has to be written using fn_put, do_write means
105 that the destination has to read using fn_get. So, do_read is
106 from a user's point of view, while put and get are from the driver's
107 point of view. The first argument is always the destination of the IO
109 #ifdef NTFS_IN_LINUX_KERNEL
110 typedef struct ntfs_inode_info ntfs_inode;
111 #else
112 typedef struct ntfs_inode{
113 ntfs_volume *vol;
114 /* NTFS_INODE_INFO_START */
115 int i_number; /* should be really 48 bits */
116 unsigned sequence_number;
117 unsigned char* attr; /* array of the attributes */
118 int attr_count; /* size of attrs[] */
119 struct ntfs_attribute *attrs;
120 int record_count; /* size of records[] */
121 /* array of the record numbers of the MFT
122 whose attributes have been inserted in the inode */
123 int *records;
124 union{
125 struct{
126 int recordsize;
127 int clusters_per_record;
128 }index;
129 } u;
130 /* NTFS_INODE_INFO_END */
131 #ifdef __FreeBSD__
132 struct vnode *vp;
133 LIST_ENTRY(ntfs_inode) h_next;
134 #endif
135 }ntfs_inode;
136 #endif
138 typedef struct ntfs_io{
139 int do_read;
140 void (*fn_put)(struct ntfs_io *dest, void *buf, ntfs_size_t);
141 void (*fn_get)(void *buf, struct ntfs_io *src, ntfs_size_t len);
142 void *param;
143 int size;
144 }ntfs_io;
146 #if 0
147 typedef struct {
148 ntfs_volume *vol;
149 ntfs_inode *ino;
150 int type;
151 char *name;
152 int mftno;
153 int start_vcn;
154 } ntfs_attrlist_item;
155 #endif