Whamcloud - gitweb
LU-11549 mdd: set LUSTRE_ORPHAN_FL for non-dirs
[fs/lustre-release.git] / lustre / include / lustre_errno.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.gnu.org/licenses/gpl-2.0.txt
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (C) 2011 FUJITSU LIMITED.  All rights reserved.
24  *
25  * Copyright (c) 2013, Intel Corporation.
26  */
27
28 #ifndef LUSTRE_ERRNO_H
29 #define LUSTRE_ERRNO_H
30
31 /*
32  * Only "network" errnos, which are defined below, are allowed on wire (or on
33  * disk).  Generic routines exist to help translate between these and a subset
34  * of the "host" errnos.  Some host errnos (e.g., EDEADLOCK) are intentionally
35  * left out.  See also the comment on lustre_errno_hton_mapping[].
36  *
37  * To maintain compatibility with existing x86 clients and servers, each of
38  * these network errnos has the same numerical value as its corresponding host
39  * errno on x86.
40  */
41 #define LUSTRE_EPERM            1       /* Operation not permitted */
42 #define LUSTRE_ENOENT           2       /* No such file or directory */
43 #define LUSTRE_ESRCH            3       /* No such process */
44 #define LUSTRE_EINTR            4       /* Interrupted system call */
45 #define LUSTRE_EIO              5       /* I/O error */
46 #define LUSTRE_ENXIO            6       /* No such device or address */
47 #define LUSTRE_E2BIG            7       /* Argument list too long */
48 #define LUSTRE_ENOEXEC          8       /* Exec format error */
49 #define LUSTRE_EBADF            9       /* Bad file number */
50 #define LUSTRE_ECHILD           10      /* No child processes */
51 #define LUSTRE_EAGAIN           11      /* Try again */
52 #define LUSTRE_ENOMEM           12      /* Out of memory */
53 #define LUSTRE_EACCES           13      /* Permission denied */
54 #define LUSTRE_EFAULT           14      /* Bad address */
55 #define LUSTRE_ENOTBLK          15      /* Block device required */
56 #define LUSTRE_EBUSY            16      /* Device or resource busy */
57 #define LUSTRE_EEXIST           17      /* File exists */
58 #define LUSTRE_EXDEV            18      /* Cross-device link */
59 #define LUSTRE_ENODEV           19      /* No such device */
60 #define LUSTRE_ENOTDIR          20      /* Not a directory */
61 #define LUSTRE_EISDIR           21      /* Is a directory */
62 #define LUSTRE_EINVAL           22      /* Invalid argument */
63 #define LUSTRE_ENFILE           23      /* File table overflow */
64 #define LUSTRE_EMFILE           24      /* Too many open files */
65 #define LUSTRE_ENOTTY           25      /* Not a typewriter */
66 #define LUSTRE_ETXTBSY          26      /* Text file busy */
67 #define LUSTRE_EFBIG            27      /* File too large */
68 #define LUSTRE_ENOSPC           28      /* No space left on device */
69 #define LUSTRE_ESPIPE           29      /* Illegal seek */
70 #define LUSTRE_EROFS            30      /* Read-only file system */
71 #define LUSTRE_EMLINK           31      /* Too many links */
72 #define LUSTRE_EPIPE            32      /* Broken pipe */
73 #define LUSTRE_EDOM             33      /* Math argument out of domain of
74                                            func */
75 #define LUSTRE_ERANGE           34      /* Math result not representable */
76 #define LUSTRE_EDEADLK          35      /* Resource deadlock would occur */
77 #define LUSTRE_ENAMETOOLONG     36      /* File name too long */
78 #define LUSTRE_ENOLCK           37      /* No record locks available */
79 #define LUSTRE_ENOSYS           38      /* Function not implemented */
80 #define LUSTRE_ENOTEMPTY        39      /* Directory not empty */
81 #define LUSTRE_ELOOP            40      /* Too many symbolic links
82                                            encountered */
83 #define LUSTRE_ENOMSG           42      /* No message of desired type */
84 #define LUSTRE_EIDRM            43      /* Identifier removed */
85 #define LUSTRE_ECHRNG           44      /* Channel number out of range */
86 #define LUSTRE_EL2NSYNC         45      /* Level 2 not synchronized */
87 #define LUSTRE_EL3HLT           46      /* Level 3 halted */
88 #define LUSTRE_EL3RST           47      /* Level 3 reset */
89 #define LUSTRE_ELNRNG           48      /* Link number out of range */
90 #define LUSTRE_EUNATCH          49      /* Protocol driver not attached */
91 #define LUSTRE_ENOCSI           50      /* No CSI structure available */
92 #define LUSTRE_EL2HLT           51      /* Level 2 halted */
93 #define LUSTRE_EBADE            52      /* Invalid exchange */
94 #define LUSTRE_EBADR            53      /* Invalid request descriptor */
95 #define LUSTRE_EXFULL           54      /* Exchange full */
96 #define LUSTRE_ENOANO           55      /* No anode */
97 #define LUSTRE_EBADRQC          56      /* Invalid request code */
98 #define LUSTRE_EBADSLT          57      /* Invalid slot */
99 #define LUSTRE_EBFONT           59      /* Bad font file format */
100 #define LUSTRE_ENOSTR           60      /* Device not a stream */
101 #define LUSTRE_ENODATA          61      /* No data available */
102 #define LUSTRE_ETIME            62      /* Timer expired */
103 #define LUSTRE_ENOSR            63      /* Out of streams resources */
104 #define LUSTRE_ENONET           64      /* Machine is not on the network */
105 #define LUSTRE_ENOPKG           65      /* Package not installed */
106 #define LUSTRE_EREMOTE          66      /* Object is remote */
107 #define LUSTRE_ENOLINK          67      /* Link has been severed */
108 #define LUSTRE_EADV             68      /* Advertise error */
109 #define LUSTRE_ESRMNT           69      /* Srmount error */
110 #define LUSTRE_ECOMM            70      /* Communication error on send */
111 #define LUSTRE_EPROTO           71      /* Protocol error */
112 #define LUSTRE_EMULTIHOP        72      /* Multihop attempted */
113 #define LUSTRE_EDOTDOT          73      /* RFS specific error */
114 #define LUSTRE_EBADMSG          74      /* Not a data message */
115 #define LUSTRE_EOVERFLOW        75      /* Value too large for defined data
116                                            type */
117 #define LUSTRE_ENOTUNIQ         76      /* Name not unique on network */
118 #define LUSTRE_EBADFD           77      /* File descriptor in bad state */
119 #define LUSTRE_EREMCHG          78      /* Remote address changed */
120 #define LUSTRE_ELIBACC          79      /* Can not access a needed shared
121                                            library */
122 #define LUSTRE_ELIBBAD          80      /* Accessing a corrupted shared
123                                            library */
124 #define LUSTRE_ELIBSCN          81      /* .lib section in a.out corrupted */
125 #define LUSTRE_ELIBMAX          82      /* Attempting to link in too many shared
126                                            libraries */
127 #define LUSTRE_ELIBEXEC         83      /* Cannot exec a shared library
128                                            directly */
129 #define LUSTRE_EILSEQ           84      /* Illegal byte sequence */
130 #define LUSTRE_ERESTART         85      /* Interrupted system call should be
131                                            restarted */
132 #define LUSTRE_ESTRPIPE         86      /* Streams pipe error */
133 #define LUSTRE_EUSERS           87      /* Too many users */
134 #define LUSTRE_ENOTSOCK         88      /* Socket operation on non-socket */
135 #define LUSTRE_EDESTADDRREQ     89      /* Destination address required */
136 #define LUSTRE_EMSGSIZE         90      /* Message too long */
137 #define LUSTRE_EPROTOTYPE       91      /* Protocol wrong type for socket */
138 #define LUSTRE_ENOPROTOOPT      92      /* Protocol not available */
139 #define LUSTRE_EPROTONOSUPPORT  93      /* Protocol not supported */
140 #define LUSTRE_ESOCKTNOSUPPORT  94      /* Socket type not supported */
141 #define LUSTRE_EOPNOTSUPP       95      /* Operation not supported on transport
142                                            endpoint */
143 #define LUSTRE_EPFNOSUPPORT     96      /* Protocol family not supported */
144 #define LUSTRE_EAFNOSUPPORT     97      /* Address family not supported by
145                                            protocol */
146 #define LUSTRE_EADDRINUSE       98      /* Address already in use */
147 #define LUSTRE_EADDRNOTAVAIL    99      /* Cannot assign requested address */
148 #define LUSTRE_ENETDOWN         100     /* Network is down */
149 #define LUSTRE_ENETUNREACH      101     /* Network is unreachable */
150 #define LUSTRE_ENETRESET        102     /* Network dropped connection because of
151                                            reset */
152 #define LUSTRE_ECONNABORTED     103     /* Software caused connection abort */
153 #define LUSTRE_ECONNRESET       104     /* Connection reset by peer */
154 #define LUSTRE_ENOBUFS          105     /* No buffer space available */
155 #define LUSTRE_EISCONN          106     /* Transport endpoint is already
156                                            connected */
157 #define LUSTRE_ENOTCONN         107     /* Transport endpoint is not
158                                            connected */
159 #define LUSTRE_ESHUTDOWN        108     /* Cannot send after transport endpoint
160                                            shutdown */
161 #define LUSTRE_ETOOMANYREFS     109     /* Too many references: cannot splice */
162 #define LUSTRE_ETIMEDOUT        110     /* Connection timed out */
163 #define LUSTRE_ECONNREFUSED     111     /* Connection refused */
164 #define LUSTRE_EHOSTDOWN        112     /* Host is down */
165 #define LUSTRE_EHOSTUNREACH     113     /* No route to host */
166 #define LUSTRE_EALREADY         114     /* Operation already in progress */
167 #define LUSTRE_EINPROGRESS      115     /* Operation now in progress */
168 #define LUSTRE_ESTALE           116     /* Stale NFS file handle */
169 #define LUSTRE_EUCLEAN          117     /* Structure needs cleaning */
170 #define LUSTRE_ENOTNAM          118     /* Not a XENIX named type file */
171 #define LUSTRE_ENAVAIL          119     /* No XENIX semaphores available */
172 #define LUSTRE_EISNAM           120     /* Is a named type file */
173 #define LUSTRE_EREMOTEIO        121     /* Remote I/O error */
174 #define LUSTRE_EDQUOT           122     /* Quota exceeded */
175 #define LUSTRE_ENOMEDIUM        123     /* No medium found */
176 #define LUSTRE_EMEDIUMTYPE      124     /* Wrong medium type */
177 #define LUSTRE_ECANCELED        125     /* Operation Canceled */
178 #define LUSTRE_ENOKEY           126     /* Required key not available */
179 #define LUSTRE_EKEYEXPIRED      127     /* Key has expired */
180 #define LUSTRE_EKEYREVOKED      128     /* Key has been revoked */
181 #define LUSTRE_EKEYREJECTED     129     /* Key was rejected by service */
182 #define LUSTRE_EOWNERDEAD       130     /* Owner died */
183 #define LUSTRE_ENOTRECOVERABLE  131     /* State not recoverable */
184 #define LUSTRE_ERESTARTSYS      512
185 #define LUSTRE_ERESTARTNOINTR   513
186 #define LUSTRE_ERESTARTNOHAND   514     /* restart if no handler.. */
187 #define LUSTRE_ENOIOCTLCMD      515     /* No ioctl command */
188 #define LUSTRE_ERESTART_RESTARTBLOCK 516 /* restart by calling
189                                             sys_restart_syscall */
190 #define LUSTRE_EBADHANDLE       521     /* Illegal NFS file handle */
191 #define LUSTRE_ENOTSYNC         522     /* Update synchronization mismatch */
192 #define LUSTRE_EBADCOOKIE       523     /* Cookie is stale */
193 #define LUSTRE_ENOTSUPP         524     /* Operation is not supported */
194 #define LUSTRE_ETOOSMALL        525     /* Buffer or request is too small */
195 #define LUSTRE_ESERVERFAULT     526     /* An untranslatable error occurred */
196 #define LUSTRE_EBADTYPE         527     /* Type not supported by server */
197 #define LUSTRE_EJUKEBOX         528     /* Request initiated, but will not
198                                            complete before timeout */
199 #define LUSTRE_EIOCBQUEUED      529     /* iocb queued, will get completion
200                                            event */
201
202 /*
203  * Translations are optimized away on x86.  Host errnos that shouldn't be put
204  * on wire could leak through as a result.  Do not count on this side effect.
205  */
206 #if !defined(__x86_64__) && !defined(__i386__)
207 #define LUSTRE_TRANSLATE_ERRNOS
208 #endif
209
210 #ifdef LUSTRE_TRANSLATE_ERRNOS
211 unsigned int lustre_errno_hton(unsigned int h);
212 unsigned int lustre_errno_ntoh(unsigned int n);
213 #else
214 #define lustre_errno_hton(h) (h)
215 #define lustre_errno_ntoh(n) (n)
216 #endif
217
218 #endif /* LUSTRE_ERRNO_H */