~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to storage/ndb/include/kernel/signaldata/FsRef.hpp

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2013-12-22 10:27:05 UTC
  • Revision ID: package-import@ubuntu.com-20131222102705-mndw7s12mz0szrcn
Tags: upstream-5.5.32
Import upstream version 5.5.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2003 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA */
 
15
 
 
16
#ifndef FS_REF_H
 
17
#define FS_REF_H
 
18
 
 
19
#include <ndbd_exit_codes.h>
 
20
#include "SignalData.hpp"
 
21
 
 
22
/**
 
23
 * FsRef - Common signal class for all REF signals sent from Ndbfs
 
24
 * GSN_FSCLOSEREF, GSN_FSOPENREF, GSN_FSWRITEREF, GSN_FSREADREF,
 
25
 * GSN_FSSYNCREF
 
26
 */
 
27
 
 
28
 
 
29
/**
 
30
 * 
 
31
 * SENDER:  Ndbfs
 
32
 * RECIVER: 
 
33
 */
 
34
struct FsRef {
 
35
 
 
36
  friend bool printFSREF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
 
37
 
 
38
  /**
 
39
   * Enum type for errorCode
 
40
   */
 
41
  STATIC_CONST( FS_ERR_BIT = 0x8000 );
 
42
 
 
43
  enum NdbfsErrorCodeType {
 
44
    fsErrNone=0,
 
45
    fsErrEnvironmentError=NDBD_EXIT_AFS_ENVIRONMENT,
 
46
    fsErrTemporaryNotAccessible=NDBD_EXIT_AFS_TEMP_NO_ACCESS,
 
47
    fsErrNoSpaceLeftOnDevice=NDBD_EXIT_AFS_DISK_FULL,
 
48
    fsErrPermissionDenied=NDBD_EXIT_AFS_PERMISSION_DENIED,
 
49
    fsErrInvalidParameters=NDBD_EXIT_AFS_INVALID_PARAM,
 
50
    fsErrUnknown=NDBD_EXIT_AFS_UNKNOWN,
 
51
    fsErrNoMoreResources=NDBD_EXIT_AFS_NO_MORE_RESOURCES,
 
52
    fsErrFileDoesNotExist=NDBD_EXIT_AFS_NO_SUCH_FILE,
 
53
    fsErrReadUnderflow = NDBD_EXIT_AFS_READ_UNDERFLOW,
 
54
    fsErrFileExists = FS_ERR_BIT |  12,
 
55
    fsErrInvalidFileSize = FS_ERR_BIT |  13,
 
56
    fsErrOutOfMemory = FS_ERR_BIT |  14,
 
57
    fsErrMax
 
58
  };
 
59
  /**
 
60
   * Length of signal
 
61
   */
 
62
  STATIC_CONST( SignalLength = 4 );
 
63
 
 
64
  /**
 
65
   * DATA VARIABLES
 
66
   */
 
67
  UintR userPointer;          // DATA 0
 
68
  UintR errorCode;            // DATA 1
 
69
  UintR osErrorCode;          // DATA 2
 
70
  UintR senderData;
 
71
 
 
72
  static NdbfsErrorCodeType getErrorCode(const UintR & errorcode);
 
73
  static void setErrorCode(UintR & errorcode, NdbfsErrorCodeType errorcodetype);
 
74
  static void setErrorCode(UintR & errorcode, UintR errorcodetype);
 
75
 
 
76
};
 
77
 
 
78
 
 
79
inline
 
80
FsRef::NdbfsErrorCodeType 
 
81
FsRef::getErrorCode(const UintR & errorcode){
 
82
  return (NdbfsErrorCodeType)errorcode;
 
83
}
 
84
 
 
85
inline
 
86
void
 
87
FsRef::setErrorCode(UintR & errorcode, NdbfsErrorCodeType errorcodetype){
 
88
  ASSERT_MAX(errorcodetype, fsErrMax, "FsRef::setErrorCode");
 
89
  errorcode = (UintR)errorcodetype;
 
90
}
 
91
 
 
92
inline
 
93
void
 
94
FsRef::setErrorCode(UintR & errorcode, UintR errorcodetype){
 
95
  ASSERT_MAX(errorcodetype, fsErrMax, "FsRef::setErrorCode");
 
96
  errorcode = errorcodetype;
 
97
}
 
98
 
 
99
#endif