20 #include "AsyncFile.hpp"
22 #include <signaldata/FsOpenReq.hpp>
23 #include <signaldata/FsCloseReq.hpp>
24 #include <signaldata/FsReadWriteReq.hpp>
25 #include <signaldata/FsAppendReq.hpp>
26 #include <signaldata/FsRemoveReq.hpp>
27 #include <signaldata/FsConf.hpp>
28 #include <signaldata/FsRef.hpp>
29 #include <signaldata/NdbfsContinueB.hpp>
30 #include <signaldata/DumpStateOrd.hpp>
32 #include <RefConvert.hpp>
33 #include <Configuration.hpp>
39 addRecSignal(GSN_SEND_PACKED, &VoidFs::execSEND_PACKED,
true);
40 addRecSignal(GSN_READ_CONFIG_REQ, &VoidFs::execREAD_CONFIG_REQ,
true);
41 addRecSignal(GSN_DUMP_STATE_ORD, &VoidFs::execDUMP_STATE_ORD,
true);
42 addRecSignal(GSN_STTOR, &VoidFs::execSTTOR,
true);
43 addRecSignal(GSN_FSOPENREQ, &VoidFs::execFSOPENREQ,
true);
44 addRecSignal(GSN_FSCLOSEREQ, &VoidFs::execFSCLOSEREQ,
true);
45 addRecSignal(GSN_FSWRITEREQ, &VoidFs::execFSWRITEREQ,
true);
46 addRecSignal(GSN_FSREADREQ, &VoidFs::execFSREADREQ,
true);
47 addRecSignal(GSN_FSSYNCREQ, &VoidFs::execFSSYNCREQ,
true);
48 addRecSignal(GSN_FSAPPENDREQ, &VoidFs::execFSAPPENDREQ,
true);
49 addRecSignal(GSN_FSREMOVEREQ, &VoidFs::execFSREMOVEREQ,
true);
50 addRecSignal(GSN_FSSUSPENDORD, &VoidFs::execFSSUSPENDORD,
true);
59 VoidFs::execREAD_CONFIG_REQ(
Signal* signal)
63 Uint32 ref = req->senderRef;
64 Uint32 senderData = req->senderData;
67 conf->senderRef = reference();
68 conf->senderData = senderData;
69 sendSignal(ref, GSN_READ_CONFIG_CONF, signal,
70 ReadConfigConf::SignalLength, JBB);
72 signal->theData[0] = NdbfsContinueB::ZSCAN_MEMORYCHANNEL_10MS_DELAY;
73 sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 10, 1);
77 VoidFs::execSTTOR(
Signal* signal)
81 if(signal->theData[1] == 0){
83 signal->theData[3] = 255;
84 sendSignal(NDBCNTR_REF, GSN_STTORRY, signal, 4, JBB);
91 VoidFs::execSEND_PACKED(
Signal* signal)
94 if (scanningInProgress ==
false && scanIPC(signal))
97 scanningInProgress =
true;
98 signal->theData[0] = NdbfsContinueB::ZSCAN_MEMORYCHANNEL_NO_DELAY;
99 sendSignal(reference(), GSN_CONTINUEB, signal, 1, JBB);
104 VoidFs::execFSOPENREQ(
Signal* signal)
108 const BlockReference userRef = fsOpenReq->userReference;
109 const Uint32 userPointer = fsOpenReq->userPointer;
111 Uint32
flags = fsOpenReq->fileFlags;
112 if(
flags == FsOpenReq::OM_READONLY){
114 FsRef *
const fsRef = (
FsRef *)&signal->theData[0];
116 fsRef->errorCode = FsRef::fsErrFileDoesNotExist;
117 fsRef->osErrorCode = ~0;
118 sendSignal(userRef, GSN_FSOPENREF, signal, 3, JBB);
122 if(
flags & FsOpenReq::OM_WRITEONLY ||
flags & FsOpenReq::OM_READWRITE){
123 signal->theData[0] = userPointer;
124 signal->theData[1] = c_maxFileNo++;
125 sendSignal(userRef, GSN_FSOPENCONF, signal, 2, JBB);
130 VoidFs::execFSREMOVEREQ(
Signal* signal)
134 const Uint32 userRef = req->userReference;
135 const Uint32 userPointer = req->userPointer;
137 signal->theData[0] = userPointer;
138 sendSignal(userRef, GSN_FSREMOVECONF, signal, 1, JBB);
146 VoidFs::execFSCLOSEREQ(
Signal * signal)
151 const Uint32 userRef = req->userReference;
152 const Uint32 userPointer = req->userPointer;
154 signal->theData[0] = userPointer;
155 sendSignal(userRef, GSN_FSCLOSECONF, signal, 1, JBB);
159 VoidFs::execFSWRITEREQ(
Signal* signal)
163 const Uint32 userRef = req->userReference;
164 const Uint32 userPointer = req->userPointer;
167 releaseSections(handle);
169 signal->theData[0] = userPointer;
170 sendSignal(userRef, GSN_FSWRITECONF, signal, 1, JBB);
174 VoidFs::execFSREADREQ(
Signal* signal)
179 const Uint32 userRef = req->userReference;
180 const Uint32 userPointer = req->userPointer;
183 releaseSections(handle);
185 signal->theData[0] = userPointer;
186 sendSignal(userRef, GSN_FSREADCONF, signal, 1, JBB);
188 FsRef *
const fsRef = (
FsRef *)&signal->theData[0];
190 fsRef->errorCode = FsRef::fsErrEnvironmentError;
191 fsRef->osErrorCode = ~0;
192 sendSignal(userRef, GSN_FSREADREF, signal, 3, JBB);
197 VoidFs::execFSSYNCREQ(
Signal * signal)
201 BlockReference userRef = signal->theData[1];
202 const UintR userPointer = signal->theData[2];
204 signal->theData[0] = userPointer;
205 sendSignal(userRef, GSN_FSSYNCCONF, signal, 1, JBB);
211 VoidFs::execFSAPPENDREQ(
Signal * signal)
214 const UintR userPointer = fsReq->userPointer;
215 const BlockReference userRef = fsReq->userReference;
216 const Uint32
size = fsReq->size;
218 signal->theData[0] = userPointer;
219 signal->theData[1] =
size << 2;
220 sendSignal(userRef, GSN_FSAPPENDCONF, signal, 2, JBB);
227 VoidFs::execFSSUSPENDORD(
Signal * signal)
233 VoidFs::execDUMP_STATE_ORD(
Signal* signal)