summaryrefslogtreecommitdiff
path: root/minix/lib/libhgfs/error.c
blob: b5da000bb30df65b2c776863b1903cc36464e7da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */

#include "inc.h"

/* Not sure if all of these occur in the HGFS v1 protocol, but at least some
 * that weren't in the original protocol, are being returned now.
 */
#define NERRS 16
static int error_map[NERRS] = {
  OK,				/* no error */
  ENOENT,			/* no such file/directory */
  EBADF,			/* invalid handle */
  EPERM,			/* operation not permitted */
  EEXIST,			/* file already exists */
  ENOTDIR,			/* not a directory */
  ENOTEMPTY,			/* directory not empty */
  EIO,				/* protocol error */
  EACCES,			/* access denied */
  EINVAL,			/* invalid name */
  EIO,				/* generic error */
  EIO,				/* sharing violation */
  ENOSPC,			/* no space */
  ENOSYS,			/* operation not supported */
  ENAMETOOLONG,			/* name too long */
  EINVAL,			/* invalid parameter */
};

/*===========================================================================*
 *				error_convert				     *
 *===========================================================================*/
int error_convert(int err)
{
/* Convert a HGFS error into an errno error code.
 */

  if (err < 0 || err >= NERRS) return EIO;

  return error_map[err];
}