~ubuntu-branches/ubuntu/trusty/mysql-5.6/trusty

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-12 11:54:27 UTC
  • Revision ID: package-import@ubuntu.com-20140212115427-oq6tfsqxl1wuwehi
Tags: upstream-5.6.15
ImportĀ upstreamĀ versionĀ 5.6.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   Copyright (C) 2003, 2005, 2006 MySQL AB
 
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 FS_REF_H
 
20
#define FS_REF_H
 
21
 
 
22
#include <ndbd_exit_codes.h>
 
23
#include "SignalData.hpp"
 
24
 
 
25
/**
 
26
 * FsRef - Common signal class for all REF signals sent from Ndbfs
 
27
 * GSN_FSCLOSEREF, GSN_FSOPENREF, GSN_FSWRITEREF, GSN_FSREADREF,
 
28
 * GSN_FSSYNCREF
 
29
 */
 
30
 
 
31
 
 
32
/**
 
33
 * 
 
34
 * SENDER:  Ndbfs
 
35
 * RECIVER: 
 
36
 */
 
37
struct FsRef {
 
38
 
 
39
  friend bool printFSREF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
 
40
 
 
41
  /**
 
42
   * Enum type for errorCode
 
43
   */
 
44
  STATIC_CONST( FS_ERR_BIT = 0x8000 );
 
45
 
 
46
  enum NdbfsErrorCodeType {
 
47
    fsErrNone=0,
 
48
    fsErrEnvironmentError=NDBD_EXIT_AFS_ENVIRONMENT,
 
49
    fsErrTemporaryNotAccessible=NDBD_EXIT_AFS_TEMP_NO_ACCESS,
 
50
    fsErrNoSpaceLeftOnDevice=NDBD_EXIT_AFS_DISK_FULL,
 
51
    fsErrPermissionDenied=NDBD_EXIT_AFS_PERMISSION_DENIED,
 
52
    fsErrInvalidParameters=NDBD_EXIT_AFS_INVALID_PARAM,
 
53
    fsErrUnknown=NDBD_EXIT_AFS_UNKNOWN,
 
54
    fsErrNoMoreResources=NDBD_EXIT_AFS_NO_MORE_RESOURCES,
 
55
    fsErrFileDoesNotExist=NDBD_EXIT_AFS_NO_SUCH_FILE,
 
56
    fsErrReadUnderflow = NDBD_EXIT_AFS_READ_UNDERFLOW,
 
57
    fsErrFileExists = FS_ERR_BIT |  12,
 
58
    fsErrInvalidFileSize = FS_ERR_BIT |  13,
 
59
    fsErrOutOfMemory = FS_ERR_BIT |  14,
 
60
    fsErrMax
 
61
  };
 
62
  /**
 
63
   * Length of signal
 
64
   */
 
65
  STATIC_CONST( SignalLength = 4 );
 
66
 
 
67
  /**
 
68
   * DATA VARIABLES
 
69
   */
 
70
  UintR userPointer;          // DATA 0
 
71
  UintR errorCode;            // DATA 1
 
72
  UintR osErrorCode;          // DATA 2
 
73
  UintR senderData;
 
74
 
 
75
  static NdbfsErrorCodeType getErrorCode(const UintR & errorcode);
 
76
  static void setErrorCode(UintR & errorcode, NdbfsErrorCodeType errorcodetype);
 
77
  static void setErrorCode(UintR & errorcode, UintR errorcodetype);
 
78
 
 
79
};
 
80
 
 
81
 
 
82
inline
 
83
FsRef::NdbfsErrorCodeType 
 
84
FsRef::getErrorCode(const UintR & errorcode){
 
85
  return (NdbfsErrorCodeType)errorcode;
 
86
}
 
87
 
 
88
inline
 
89
void
 
90
FsRef::setErrorCode(UintR & errorcode, NdbfsErrorCodeType errorcodetype){
 
91
  ASSERT_MAX(errorcodetype, fsErrMax, "FsRef::setErrorCode");
 
92
  errorcode = (UintR)errorcodetype;
 
93
}
 
94
 
 
95
inline
 
96
void
 
97
FsRef::setErrorCode(UintR & errorcode, UintR errorcodetype){
 
98
  ASSERT_MAX(errorcodetype, fsErrMax, "FsRef::setErrorCode");
 
99
  errorcode = errorcodetype;
 
100
}
 
101
 
 
102
#endif