1 /*
2 Copyright (c) 2003, 2021, Oracle and/or its affiliates.
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, version 2.0,
7 as published by the Free Software Foundation.
8
9 This program is also distributed with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation. The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have included with MySQL.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License, version 2.0, for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26
27
28 #include <signaldata/FsOpenReq.hpp>
29
30 bool
printFSOPENREQ(FILE * output,const Uint32 * theData,Uint32 len,Uint16 receiverBlockNo)31 printFSOPENREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){
32
33 const FsOpenReq * const sig = (FsOpenReq *) theData;
34
35
36 fprintf(output, " UserReference: H\'%.8x, userPointer: H\'%.8x\n",
37 sig->userReference, sig->userPointer);
38 fprintf(output, " FileNumber[1-4]: H\'%.8x H\'%.8x H\'%.8x H\'%.8x\n",
39 sig->fileNumber[0], sig->fileNumber[1], sig->fileNumber[2], sig->fileNumber[3]);
40 fprintf(output, " FileFlags: H\'%.8x ",
41 sig->fileFlags);
42
43 // File open mode must be one of ReadOnly, WriteOnly or ReadWrite
44 const Uint32 flags = sig->fileFlags;
45 switch(flags & 3){
46 case FsOpenReq::OM_READONLY:
47 fprintf(output, "Open read only");
48 break;
49 case FsOpenReq::OM_WRITEONLY:
50 fprintf(output, "Open write only");
51 break;
52 case FsOpenReq::OM_READWRITE:
53 fprintf(output, "Open read and write");
54 break;
55 default:
56 fprintf(output, "Open mode unknown!");
57 }
58
59 if (flags & FsOpenReq::OM_APPEND)
60 fprintf(output, ", Append");
61 if (flags & FsOpenReq::OM_SYNC)
62 fprintf(output, ", Sync");
63 if (flags & FsOpenReq::OM_CREATE)
64 fprintf(output, ", Create new file");
65 if (flags & FsOpenReq::OM_TRUNCATE)
66 fprintf(output, ", Truncate existing file");
67 if (flags & FsOpenReq::OM_AUTOSYNC)
68 fprintf(output, ", Auto Sync");
69
70 if (flags & FsOpenReq::OM_CREATE_IF_NONE)
71 fprintf(output, ", Create if None");
72 if (flags & FsOpenReq::OM_INIT)
73 fprintf(output, ", Initialise");
74 if (flags & FsOpenReq::OM_CHECK_SIZE)
75 fprintf(output, ", Check Size");
76 if (flags & FsOpenReq::OM_DIRECT)
77 fprintf(output, ", O_DIRECT");
78 if (flags & FsOpenReq::OM_GZ)
79 fprintf(output, ", gz compressed");
80
81 fprintf(output, "\n");
82 return true;
83 }
84