1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335
|
/* Copyright (c) 2003-2007 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
#ifndef FS_OPEN_REQ_H
#define FS_OPEN_REQ_H
#include "SignalData.hpp"
/**
*
* SENDER:
* RECIVER: Ndbfs
*/
class FsOpenReq {
/**
* Reciver(s)
*/
friend class Ndbfs; // Reciver
friend class AsyncFile; // Uses FsOpenReq to decode file open flags
friend class Filename;
friend class VoidFs;
/**
* Sender(s)
*/
friend class Backup;
friend class Dbdict;
friend class Ndbcntr; // For initial start...
friend class Dbdih;
friend class Lgman;
friend class Tsman;
friend class Restore;
friend class Dblqh;
friend class Dbtup;
/**
* For printing
*/
friend bool printFSOPENREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
public:
/**
* Length of signal
*/
STATIC_CONST( SignalLength = 11 );
SECTION( FILENAME = 0 );
private:
/**
* DATA VARIABLES
*/
UintR userReference; // DATA 0
UintR userPointer; // DATA 1
UintR fileNumber[4]; // DATA 2 - 5
UintR fileFlags; // DATA 6
Uint32 page_size;
Uint32 file_size_hi;
Uint32 file_size_lo;
Uint32 auto_sync_size; // In bytes
STATIC_CONST( OM_READONLY = 0 );
STATIC_CONST( OM_WRITEONLY = 1 );
STATIC_CONST( OM_READWRITE = 2 );
STATIC_CONST( OM_APPEND = 0x8 ); // Not Implemented on W2k
STATIC_CONST( OM_SYNC = 0x10 );
STATIC_CONST( OM_CREATE = 0x100 );
STATIC_CONST( OM_TRUNCATE = 0x200 );
STATIC_CONST( OM_AUTOSYNC = 0x400 );
STATIC_CONST( OM_CREATE_IF_NONE = 0x0800 );
STATIC_CONST( OM_INIT = 0x1000 ); //
STATIC_CONST( OM_CHECK_SIZE = 0x2000 );
STATIC_CONST( OM_DIRECT = 0x4000 );
enum Suffixes {
S_DATA = 0,
S_FRAGLOG = 1,
S_LOGLOG = 2,
S_FRAGLIST = 3,
S_TABLELIST = 4,
S_SCHEMALOG = 5,
S_SYSFILE = 6,
S_LOG = 7,
S_CTL = 8
};
static Uint32 getVersion(const Uint32 fileNumber[]);
static Uint32 getSuffix(const Uint32 fileNumber[]);
static void setVersion(Uint32 fileNumber[], Uint8 val);
static void setSuffix(Uint32 fileNumber[], Uint8 val);
/**
* V1
*/
static Uint32 v1_getDisk(const Uint32 fileNumber[]);
static Uint32 v1_getTable(const Uint32 fileNumber[]);
static Uint32 v1_getFragment(const Uint32 fileNumber[]);
static Uint32 v1_getS(const Uint32 fileNumber[]);
static Uint32 v1_getP(const Uint32 fileNumber[]);
static void v1_setDisk(Uint32 fileNumber[], Uint8 val);
static void v1_setTable(Uint32 fileNumber[], Uint32 val);
static void v1_setFragment(Uint32 fileNumber[], Uint32 val);
static void v1_setS(Uint32 fileNumber[], Uint32 val);
static void v1_setP(Uint32 fileNumber[], Uint8 val);
/**
* V2 - Backup
*/
static Uint32 v2_getSequence(const Uint32 fileNumber[]);
static Uint32 v2_getNodeId(const Uint32 fileNumber[]);
static Uint32 v2_getCount(const Uint32 fileNumber[]);
static void v2_setSequence(Uint32 fileNumber[], Uint32 no);
static void v2_setNodeId(Uint32 fileNumber[], Uint32 no);
static void v2_setCount(Uint32 fileNumber[], Uint32 no);
/**
* V4 - LCP
*/
static Uint32 v5_getLcpNo(const Uint32 fileNumber[]);
static Uint32 v5_getTableId(const Uint32 fileNumber[]);
static Uint32 v5_getFragmentId(const Uint32 fileNumber[]);
static void v5_setLcpNo(Uint32 fileNumber[], Uint32 no);
static void v5_setTableId(Uint32 fileNumber[], Uint32 no);
static void v5_setFragmentId(Uint32 fileNumber[], Uint32 no);
};
/**
* File flags (set according to solaris standard)
*
o = Open mode - 2 Bits -> max 3
c = create new file - 1 Bit
t = truncate existing - 1 Bit
1111111111222222222233
01234567890123456789012345678901
oo ct
*/
/**
* -- v1 --
* File number[0] = Table
* File number[1] = Fragment
* File number[2] = S-value
* File number[3] =
* p = v1_P 0 - 7
* d = v1_disk 8 - 15
* s = v1_suffix 16 - 23
* v = version 24 - 31
*
* 1111111111222222222233
* 01234567890123456789012345678901
* ppppppppddddddddssssssssvvvvvvvv
*
* -- v2 --
* File number[0] = Backup Sequence Number
* File number[1] = Node Id
* File number[3] =
* v = version 24 - 31
* s = v1_suffix 16 - 23
*
* 1111111111222222222233
* 01234567890123456789012345678901
* ssssssssvvvvvvvv
*
* -- v3 --
* File number[0] = Table
* File number[1] = LcpNo
* File number[2] =
* File number[3] =
* v = version 24 - 31
* s = v1_suffix 16 - 23
*
* 1111111111222222222233
* 01234567890123456789012345678901
* ssssssssvvvvvvvv
*/
inline
Uint32 FsOpenReq::getVersion(const Uint32 fileNumber[]){
return (fileNumber[3] >> 24) & 0xff;
}
inline
void FsOpenReq::setVersion(Uint32 fileNumber[], Uint8 val){
const Uint32 t = fileNumber[3];
fileNumber[3] = t & 0x00FFFFFF | (((Uint32)val) << 24);
}
inline
Uint32 FsOpenReq::getSuffix(const Uint32 fileNumber[]){
return (fileNumber[3] >> 16)& 0xff;
}
inline
void FsOpenReq::setSuffix(Uint32 fileNumber[], Uint8 val){
const Uint32 t = fileNumber[3];
fileNumber[3] = t & 0xFF00FFFF | (((Uint32)val) << 16);
}
inline
Uint32 FsOpenReq::v1_getDisk(const Uint32 fileNumber[]){
return (fileNumber[3]>>8) & 0xff;
}
inline
void FsOpenReq::v1_setDisk(Uint32 fileNumber[], Uint8 val){
const Uint32 t = fileNumber[3];
fileNumber[3] = t & 0xFFFF00FF | (((Uint32)val) << 8);
}
inline
Uint32 FsOpenReq::v1_getTable(const Uint32 fileNumber[]){
return fileNumber[0];
}
inline
void FsOpenReq::v1_setTable(Uint32 fileNumber[], Uint32 val){
fileNumber[0] = val;
}
inline
Uint32 FsOpenReq::v1_getFragment(const Uint32 fileNumber[]){
return fileNumber[1];
}
inline
void FsOpenReq::v1_setFragment(Uint32 fileNumber[], Uint32 val){
fileNumber[1] = val;
}
inline
Uint32 FsOpenReq::v1_getS(const Uint32 fileNumber[]){
return fileNumber[2];
}
inline
void FsOpenReq::v1_setS(Uint32 fileNumber[], Uint32 val){
fileNumber[2] = val;
}
inline
Uint32 FsOpenReq::v1_getP(const Uint32 fileNumber[]){
return fileNumber[3] & 0xff;
}
inline
void FsOpenReq::v1_setP(Uint32 fileNumber[], Uint8 val){
const Uint32 t = fileNumber[3];
fileNumber[3] = t & 0xFFFFFF00 | val;
}
/****************/
inline
Uint32 FsOpenReq::v2_getSequence(const Uint32 fileNumber[]){
return fileNumber[0];
}
inline
void FsOpenReq::v2_setSequence(Uint32 fileNumber[], Uint32 val){
fileNumber[0] = val;
}
inline
Uint32 FsOpenReq::v2_getNodeId(const Uint32 fileNumber[]){
return fileNumber[1];
}
inline
void FsOpenReq::v2_setNodeId(Uint32 fileNumber[], Uint32 val){
fileNumber[1] = val;
}
inline
Uint32 FsOpenReq::v2_getCount(const Uint32 fileNumber[]){
return fileNumber[2];
}
inline
void FsOpenReq::v2_setCount(Uint32 fileNumber[], Uint32 val){
fileNumber[2] = val;
}
/****************/
inline
Uint32 FsOpenReq::v5_getTableId(const Uint32 fileNumber[]){
return fileNumber[0];
}
inline
void FsOpenReq::v5_setTableId(Uint32 fileNumber[], Uint32 val){
fileNumber[0] = val;
}
inline
Uint32 FsOpenReq::v5_getLcpNo(const Uint32 fileNumber[]){
return fileNumber[1];
}
inline
void FsOpenReq::v5_setLcpNo(Uint32 fileNumber[], Uint32 val){
fileNumber[1] = val;
}
inline
Uint32 FsOpenReq::v5_getFragmentId(const Uint32 fileNumber[]){
return fileNumber[2];
}
inline
void FsOpenReq::v5_setFragmentId(Uint32 fileNumber[], Uint32 val){
fileNumber[2] = val;
}
#endif
|