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