MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FsOpenReq.hpp
1 /*
2  Copyright (C) 2003-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #ifndef FS_OPEN_REQ_H
20 #define FS_OPEN_REQ_H
21 
22 #include "SignalData.hpp"
23 
29 class FsOpenReq {
33  friend class Ndbfs; // Reciver
34  friend class AsyncFile; // Uses FsOpenReq to decode file open flags
35  friend class PosixAsyncFile; // FIXME
36  friend class Win32AsyncFile; // FIXME
37  friend class Filename;
38  friend class VoidFs;
39  friend class AsyncIoThread;
40 
44  friend class Backup;
45  friend class Dbdict;
46  friend class Ndbcntr; // For initial start...
47  friend class Dbdih;
48  friend class Lgman;
49  friend class Tsman;
50  friend class Restore;
51  friend class Dblqh;
52 
53  friend class Dbtup;
54 
58  friend bool printFSOPENREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
59 
60 public:
64  STATIC_CONST( SignalLength = 11 );
65  SECTION( FILENAME = 0 );
66 
67 private:
68 
73  UintR userReference; // DATA 0
74  UintR userPointer; // DATA 1
75  UintR fileNumber[4]; // DATA 2 - 5
76  UintR fileFlags; // DATA 6
77  Uint32 page_size;
78  Uint32 file_size_hi;
79  Uint32 file_size_lo;
80  Uint32 auto_sync_size; // In bytes
81 
82  STATIC_CONST( OM_READONLY = 0 );
83  STATIC_CONST( OM_WRITEONLY = 1 );
84  STATIC_CONST( OM_READWRITE = 2 );
85 
86  STATIC_CONST( OM_APPEND = 0x8 ); // Not Implemented on W2k
87  STATIC_CONST( OM_SYNC = 0x10 );
88  STATIC_CONST( OM_CREATE = 0x100 );
89  STATIC_CONST( OM_TRUNCATE = 0x200 );
90  STATIC_CONST( OM_AUTOSYNC = 0x400 );
91 
92  STATIC_CONST( OM_CREATE_IF_NONE = 0x0800 );
93  STATIC_CONST( OM_INIT = 0x1000 ); //
94  STATIC_CONST( OM_CHECK_SIZE = 0x2000 );
95  STATIC_CONST( OM_DIRECT = 0x4000 );
96  STATIC_CONST( OM_GZ = 0x8000 );
97  STATIC_CONST( OM_THREAD_POOL = 0x10000 );
98  STATIC_CONST( OM_WRITE_BUFFER = 0x20000 );
99 
100  enum Suffixes {
101  S_DATA = 0,
102  S_FRAGLOG = 1,
103  S_LOGLOG = 2,
104  S_FRAGLIST = 3,
105  S_TABLELIST = 4,
106  S_SCHEMALOG = 5,
107  S_SYSFILE = 6,
108  S_LOG = 7,
109  S_CTL = 8
110  };
111 
112  enum BasePathSpec
113  {
114  BP_FS = 0, // FileSystemPath
115  BP_BACKUP = 1, // BackupDataDir
116  BP_DD_DF = 2, // FileSystemPathDataFiles
117  BP_DD_UF = 3, // FileSystemPathUndoFiles
118  BP_MAX = 4
119  };
120 
121  static Uint32 getVersion(const Uint32 fileNumber[]);
122  static Uint32 getSuffix(const Uint32 fileNumber[]);
123 
124  static void setVersion(Uint32 fileNumber[], Uint8 val);
125  static void setSuffix(Uint32 fileNumber[], Uint8 val);
126 
130  static Uint32 v1_getDisk(const Uint32 fileNumber[]);
131  static Uint32 v1_getTable(const Uint32 fileNumber[]);
132  static Uint32 v1_getFragment(const Uint32 fileNumber[]);
133  static Uint32 v1_getS(const Uint32 fileNumber[]);
134  static Uint32 v1_getP(const Uint32 fileNumber[]);
135 
136  static void v1_setDisk(Uint32 fileNumber[], Uint8 val);
137  static void v1_setTable(Uint32 fileNumber[], Uint32 val);
138  static void v1_setFragment(Uint32 fileNumber[], Uint32 val);
139  static void v1_setS(Uint32 fileNumber[], Uint32 val);
140  static void v1_setP(Uint32 fileNumber[], Uint8 val);
141 
145  static Uint32 v2_getSequence(const Uint32 fileNumber[]);
146  static Uint32 v2_getNodeId(const Uint32 fileNumber[]);
147  static Uint32 v2_getCount(const Uint32 fileNumber[]);
148 
149  static void v2_setSequence(Uint32 fileNumber[], Uint32 no);
150  static void v2_setNodeId(Uint32 fileNumber[], Uint32 no);
151  static void v2_setCount(Uint32 fileNumber[], Uint32 no);
152 
156  static Uint32 v4_getBasePath(const Uint32 fileNumber[]) {
157  return v5_getLcpNo(fileNumber);
158  }
159  static void v4_setBasePath(Uint32 fileNumber[], Uint32 no) {
160  v5_setLcpNo(fileNumber, no);
161  }
162 
166  static Uint32 v5_getLcpNo(const Uint32 fileNumber[]);
167  static Uint32 v5_getTableId(const Uint32 fileNumber[]);
168  static Uint32 v5_getFragmentId(const Uint32 fileNumber[]);
169 
170  static void v5_setLcpNo(Uint32 fileNumber[], Uint32 no);
171  static void v5_setTableId(Uint32 fileNumber[], Uint32 no);
172  static void v5_setFragmentId(Uint32 fileNumber[], Uint32 no);
173 };
174 
226 inline
227 Uint32 FsOpenReq::getVersion(const Uint32 fileNumber[]){
228  return (fileNumber[3] >> 24) & 0xff;
229 }
230 
231 inline
232 void FsOpenReq::setVersion(Uint32 fileNumber[], Uint8 val){
233  const Uint32 t = fileNumber[3];
234  fileNumber[3] = (t & 0x00FFFFFF) | (((Uint32)val) << 24);
235 }
236 
237 inline
238 Uint32 FsOpenReq::getSuffix(const Uint32 fileNumber[]){
239  return (fileNumber[3] >> 16)& 0xff;
240 }
241 
242 inline
243 void FsOpenReq::setSuffix(Uint32 fileNumber[], Uint8 val){
244  const Uint32 t = fileNumber[3];
245  fileNumber[3] = (t & 0xFF00FFFF) | (((Uint32)val) << 16);
246 }
247 
248 inline
249 Uint32 FsOpenReq::v1_getDisk(const Uint32 fileNumber[]){
250  return (fileNumber[3]>>8) & 0xff;
251 }
252 
253 inline
254 void FsOpenReq::v1_setDisk(Uint32 fileNumber[], Uint8 val){
255  const Uint32 t = fileNumber[3];
256  fileNumber[3] = (t & 0xFFFF00FF) | (((Uint32)val) << 8);
257 }
258 
259 inline
260 Uint32 FsOpenReq::v1_getTable(const Uint32 fileNumber[]){
261  return fileNumber[0];
262 }
263 
264 inline
265 void FsOpenReq::v1_setTable(Uint32 fileNumber[], Uint32 val){
266  fileNumber[0] = val;
267 }
268 
269 inline
270 Uint32 FsOpenReq::v1_getFragment(const Uint32 fileNumber[]){
271  return fileNumber[1];
272 }
273 
274 inline
275 void FsOpenReq::v1_setFragment(Uint32 fileNumber[], Uint32 val){
276  fileNumber[1] = val;
277 }
278 
279 inline
280 Uint32 FsOpenReq::v1_getS(const Uint32 fileNumber[]){
281  return fileNumber[2];
282 }
283 
284 inline
285 void FsOpenReq::v1_setS(Uint32 fileNumber[], Uint32 val){
286  fileNumber[2] = val;
287 }
288 
289 inline
290 Uint32 FsOpenReq::v1_getP(const Uint32 fileNumber[]){
291  return fileNumber[3] & 0xff;
292 }
293 
294 inline
295 void FsOpenReq::v1_setP(Uint32 fileNumber[], Uint8 val){
296  const Uint32 t = fileNumber[3];
297  fileNumber[3] = (t & 0xFFFFFF00) | val;
298 }
299 
300 /****************/
301 inline
302 Uint32 FsOpenReq::v2_getSequence(const Uint32 fileNumber[]){
303  return fileNumber[0];
304 }
305 
306 inline
307 void FsOpenReq::v2_setSequence(Uint32 fileNumber[], Uint32 val){
308  fileNumber[0] = val;
309 }
310 
311 inline
312 Uint32 FsOpenReq::v2_getNodeId(const Uint32 fileNumber[]){
313  return fileNumber[1];
314 }
315 
316 inline
317 void FsOpenReq::v2_setNodeId(Uint32 fileNumber[], Uint32 val){
318  fileNumber[1] = val;
319 }
320 
321 inline
322 Uint32 FsOpenReq::v2_getCount(const Uint32 fileNumber[]){
323  return fileNumber[2];
324 }
325 
326 inline
327 void FsOpenReq::v2_setCount(Uint32 fileNumber[], Uint32 val){
328  fileNumber[2] = val;
329 }
330 
331 /****************/
332 inline
333 Uint32 FsOpenReq::v5_getTableId(const Uint32 fileNumber[]){
334  return fileNumber[0];
335 }
336 
337 inline
338 void FsOpenReq::v5_setTableId(Uint32 fileNumber[], Uint32 val){
339  fileNumber[0] = val;
340 }
341 
342 inline
343 Uint32 FsOpenReq::v5_getLcpNo(const Uint32 fileNumber[]){
344  return fileNumber[1];
345 }
346 
347 inline
348 void FsOpenReq::v5_setLcpNo(Uint32 fileNumber[], Uint32 val){
349  fileNumber[1] = val;
350 }
351 
352 inline
353 Uint32 FsOpenReq::v5_getFragmentId(const Uint32 fileNumber[]){
354  return fileNumber[2];
355 }
356 
357 inline
358 void FsOpenReq::v5_setFragmentId(Uint32 fileNumber[], Uint32 val){
359  fileNumber[2] = val;
360 }
361 
362 #endif
363