MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Filename.hpp
1 /*
2  Copyright (C) 2003-2006 MySQL AB, 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 Filename_H
20 #define Filename_H
21 
22 //===========================================================================
23 //
24 // .DESCRIPTION
25 // Takes a 128 bits value (done as a array of four longs) and
26 // makes a filename out of it acording the following schema
27 // Bits 0-31 T
28 // Bits 32-63 F
29 // Bits 64-95 S
30 // Bits 96-103 P
31 // Bits 104-111 D
32 // Bits 112-119 File Type
33 // Bits 120-127 Version number of Filename
34 //
35 // T, is used to find/create a directory. If T = 0xFFFF then the
36 // file is on top level. In that case the F is of no relevance.
37 // F, same as T.
38 // S, is used to find/create a filename. If S= 0xFFFF then it is ignored.
39 // P, same as S
40 // D, is used to find/create the root directory, this is the
41 // directory before the blockname. If D= 0xFF then it is ignored.
42 // File Type
43 // 0 => .Data
44 // 1 => .FragLog
45 // 2 => .LocLog
46 // 3 => .FragList
47 // 4 => .TableList
48 // 5 => .SchemaLog
49 // 6 => .sysfile
50 // 15=> ignored
51 // Version number of Filename, current version is 0x1, must be
52 // used for the this style of options.
53 //
54 //
55 //===========================================================================
56 
57 #include <ndb_global.h>
58 #include <kernel_types.h>
59 #include <SimulatedBlock.hpp>
60 
61 class Filename
62 {
63 public:
64  // filenumber is 64 bits but is split in to 4 32bits words
65  Filename();
66  ~Filename();
67 
68  void set(class Ndbfs*, BlockReference, const Uint32 fileno[4], bool directory,
70 
71  const char* c_str() const; // Complete name including dirname
72  const char* get_base_name() const; // Exclude fs (or backup) path
73 private:
74  char theName[PATH_MAX];
75  char * m_base_name;
76 };
77 
78 // inline methods
79 inline const char* Filename::c_str() const {
80  return theName;
81 }
82 
83 inline const char* Filename::get_base_name() const {
84  return m_base_name;
85 }
86 
87 #endif
88 
89 
90 
91