Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / common / solaris_errno.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4  * Ceph - scalable distributed file system
5  *
6  * Copyright (C) 2011 New Dream Network
7  *
8  * This is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License version 2.1, as published by the Free Software
11  * Foundation.  See file COPYING.
12  *
13  */
14
15 #include "include/types.h"
16
17
18 // converts from linux errno values to host values
19 __s32 ceph_to_hostos_errno(__s32 r) 
20 {
21   if (r < -34) {
22     switch (r) {
23       case -35:
24         return -EDEADLK;
25       case -36:
26         return -ENAMETOOLONG;
27       case -37:
28         return -ENOLCK;
29       case -38:
30         return -ENOSYS;
31       case -39:
32         return -ENOTEMPTY;
33       case -40:
34         return -ELOOP;
35       case -42:
36         return -ENOMSG;
37       case -43:
38         return -EIDRM;
39       case -44:
40         return -ECHRNG;
41       case -45:
42         return -EL2NSYNC;
43       case -46:
44         return -EL3HLT;
45       case -47:
46         return -EL3RST;
47       case -48:
48         return -ELNRNG;
49       case -49:
50         return -EUNATCH;
51       case -50:
52         return -ENOCSI;
53       case -51:
54         return -EL2HLT;
55       case -52:
56         return -EBADE;
57       case -53:
58         return -EBADR;
59       case -54:
60         return -EXFULL;
61       case -55:
62         return -ENOANO;
63       case -56:
64         return -EBADRQC;
65       case -57:
66         return -EBADSLT;
67       case -59:
68         return -EBFONT;
69       case -60:
70         return -ENOSTR;
71       case -61:
72         return -ENODATA;
73       case -62:
74         return -ETIME;
75       case -63:
76         return -ENOSR;
77       //case -64:
78       //  return -EPERM; //TODO ENONET
79       //case -65:
80       //  return -EPERM; //TODO ENOPKG
81       //case -66:
82       //  return -EREMOTE;
83       //case -67:
84       //  return -ENOLINK;
85       //case -68:
86       //  return -EPERM; //TODO EADV 
87       //case -69:
88       //  return -EPERM; //TODO ESRMNT 
89       //case -70:
90       //  return -EPERM; //TODO ECOMM
91       case -71:
92         return -EPROTO;
93       case -72:
94         return -EMULTIHOP;
95       case -73:
96         return -EPERM; //TODO EDOTDOT 
97       case -74:
98         return -EBADMSG;
99       case -75:
100         return -EOVERFLOW;
101       case -76:
102         return -ENOTUNIQ;
103       case -77:
104         return -EBADFD;
105       case -78:
106         return -EREMCHG;
107       case -79:
108         return -ELIBACC;
109       case -80:
110         return -ELIBBAD;
111       case -81:
112         return -ELIBSCN;
113       case -82:
114         return -ELIBMAX;
115       case -83:
116         return -ELIBEXEC;
117       case -84:
118         return -EILSEQ;
119       case -85:
120         return -ERESTART;
121       case -86:
122         return -ESTRPIPE; 
123       case -87:
124         return -EUSERS;
125       case -88:
126         return -ENOTSOCK;
127       case -89:
128         return -EDESTADDRREQ;
129       case -90:
130         return -EMSGSIZE;
131       case -91:
132         return -EPROTOTYPE;
133       case -92:
134         return -ENOPROTOOPT;
135       case -93:
136         return -EPROTONOSUPPORT;
137       case -94:
138         return -ESOCKTNOSUPPORT;
139       case -95:
140         return -EOPNOTSUPP;
141       case -96:
142         return -EPFNOSUPPORT;
143       case -97:
144         return -EAFNOSUPPORT;
145       case -98:
146         return -EADDRINUSE;
147       case -99:
148         return -EADDRNOTAVAIL;
149       case -100:
150         return -ENETDOWN;
151       case -101:
152         return -ENETUNREACH;
153       case -102:
154         return -ENETRESET;
155       case -103:
156         return -ECONNABORTED;
157       case -104:
158         return -ECONNRESET;
159       case -105:
160         return -ENOBUFS;
161       case -106:
162         return -EISCONN;
163       case -107:
164         return -ENOTCONN;
165       case -108:
166         return -ESHUTDOWN;
167       case -109:
168         return -ETOOMANYREFS;
169       case -110:
170         return -ETIMEDOUT;
171       case -111:
172         return -ECONNREFUSED;
173       case -112:
174         return -EHOSTDOWN;
175       case -113:
176         return -EHOSTUNREACH;
177       case -114:
178         return -EALREADY;
179       case -115:
180         return -EINPROGRESS;
181       case -116:
182         return -ESTALE;
183       case -117:
184         return -EPERM; //TODO EUCLEAN 
185       case -118:
186         return -EPERM; //TODO ENOTNAM
187       case -119:
188         return -EPERM; //TODO ENAVAIL
189       case -120:
190         return -EPERM; //TODO EISNAM
191       case -121:
192         return -EPERM; //TODO EREMOTEIO
193       case -122:
194         return -EDQUOT;
195       case -123:
196         return -EPERM; //TODO ENOMEDIUM
197       case -124:
198         return -EPERM; //TODO EMEDIUMTYPE - not used
199       case -125:
200         return -ECANCELED;
201       case -126:
202         return -EPERM; //TODO ENOKEY
203       case -127:
204         return -EPERM; //TODO EKEYEXPIRED
205       case -128:
206         return -EPERM; //TODO EKEYREVOKED
207       case -129:
208         return -EPERM; //TODO EKEYREJECTED
209       case -130:
210         return -EOWNERDEAD;
211       case -131:
212         return -ENOTRECOVERABLE;
213       case -132:
214         return -EPERM; //TODO ERFKILL
215       case -133:
216         return -EPERM; //TODO EHWPOISON
217
218       default: { 
219         break;
220       }
221     }
222   } 
223   return r; // otherwise return original value
224 }
225
226 // converts Host OS errno values to linux/Ceph values
227 // XXX Currently not worked out
228 __s32 hostos_to_ceph_errno(__s32 r)
229 {
230   return r;
231 }
232
233