custom message type for VM_INFO
[minix3.git] / lib / libhgfs / error.c
blobb5da000bb30df65b2c776863b1903cc36464e7da
1 /* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */
3 #include "inc.h"
5 /* Not sure if all of these occur in the HGFS v1 protocol, but at least some
6 * that weren't in the original protocol, are being returned now.
7 */
8 #define NERRS 16
9 static int error_map[NERRS] = {
10 OK, /* no error */
11 ENOENT, /* no such file/directory */
12 EBADF, /* invalid handle */
13 EPERM, /* operation not permitted */
14 EEXIST, /* file already exists */
15 ENOTDIR, /* not a directory */
16 ENOTEMPTY, /* directory not empty */
17 EIO, /* protocol error */
18 EACCES, /* access denied */
19 EINVAL, /* invalid name */
20 EIO, /* generic error */
21 EIO, /* sharing violation */
22 ENOSPC, /* no space */
23 ENOSYS, /* operation not supported */
24 ENAMETOOLONG, /* name too long */
25 EINVAL, /* invalid parameter */
28 /*===========================================================================*
29 * error_convert *
30 *===========================================================================*/
31 int error_convert(int err)
33 /* Convert a HGFS error into an errno error code.
36 if (err < 0 || err >= NERRS) return EIO;
38 return error_map[err];