Something went wrong. Try again.
Pure Erlang implementation of 9p2000 protocol
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159-module(e9p_err).
-export([normalize/1, error/1]).
-define(eundef, 16#FFFFFFFF).
-include("e9p_internal.hrl").
error(Atom) when is_atom(Atom) -> {Errno, Msg} = normalize(Atom), #rerror{msg = Msg, errno = Errno};error({Msg, Atom}) when is_atom(Atom) -> {Errno, _Msg} = normalize(Atom), #rerror{msg = Msg, errno = Errno};error(Msg) -> #rerror{msg = Msg, errno = ?eundef}.
-spec normalize(file:posix() | eundef) -> {non_neg_integer(), binary()}.normalize(eperm) -> {1, ~"Operation not permitted"};normalize(enoent) -> {2, ~"No such file or directory"};normalize(esrch) -> {3, ~"No such process"};normalize(eintr) -> {4, ~"Interrupted system call"};normalize(eio) -> {5, ~"Input/output error"};normalize(enxio) -> {6, ~"No such device or address"};% normalize(e2big) -> {7, ~"Argument list too long"};% normalize(enoexec) -> {8, ~"Exec format error"};normalize(ebadf) -> {9, ~"Bad file descriptor"};% normalize(echild) -> {10, ~"No child processes"};normalize(eagain) -> {11, ~"Resource temporarily unavailable"};normalize(enomem) -> {12, ~"Cannot allocate memory"};normalize(eacces) -> {13, ~"Permission denied"};normalize(efault) -> {14, ~"Bad address"};normalize(enotblk) -> {15, ~"Block device required"};normalize(ebusy) -> {16, ~"Device or resource busy"};normalize(eexist) -> {17, ~"File exists"};normalize(exdev) -> {18, ~"Invalid cross-device link"};normalize(enodev) -> {19, ~"No such device"};normalize(enotdir) -> {20, ~"Not a directory"};normalize(eisdir) -> {21, ~"Is a directory"};normalize(einval) -> {22, ~"Invalid argument"};normalize(enfile) -> {23, ~"Too many open files in system"};normalize(emfile) -> {24, ~"Too many open files"};% normalize(enotty) -> {25, ~"Inappropriate ioctl for device"};normalize(etxtbsy) -> {26, ~"Text file busy"};normalize(efbig) -> {27, ~"File too large"};normalize(enospc) -> {28, ~"No space left on device"};normalize(espipe) -> {29, ~"Illegal seek"};normalize(erofs) -> {30, ~"Read-only file system"};normalize(emlink) -> {31, ~"Too many links"};normalize(epipe) -> {32, ~"Broken pipe"};% normalize(edom) -> {33, ~"Numerical argument out of domain"};normalize(erange) -> {34, ~"Numerical result out of range"};normalize(edeadlk) -> {35, ~"Resource deadlock avoided"};normalize(enametoolong) -> {36, ~"File name too long"};normalize(enolck) -> {37, ~"No locks available"};normalize(enosys) -> {38, ~"Function not implemented"};% normalize(enotempty) -> {39, ~"Directory not empty"};normalize(eloop) -> {40, ~"Too many levels of symbolic links"};% normalize(enomsg) -> {42, ~"No message of desired type"};% normalize(eidrm) -> {43, ~"Identifier removed"};% normalize(echrng) -> {44, ~"Channel number out of range"};% normalize(el2nsync) -> {45, ~"Level 2 not synchronized"};% normalize(el3hlt) -> {46, ~"Level 3 halted"};% normalize(el3rst) -> {47, ~"Level 3 reset"};% normalize(elnrng) -> {48, ~"Link number out of range"};% normalize(eunatch) -> {49, ~"Protocol driver not attached"};% normalize(enocsi) -> {50, ~"No CSI structure available"};% normalize(el2hlt) -> {51, ~"Level 2 halted"};% normalize(ebade) -> {52, ~"Invalid exchange"};% normalize(ebadr) -> {53, ~"Invalid request descriptor"};% normalize(exfull) -> {54, ~"Exchange full"};% normalize(enoano) -> {55, ~"No anode"};% normalize(ebadrqc) -> {56, ~"Invalid request code"};% normalize(ebadslt) -> {57, ~"Invalid slot"};% normalize(ebfont) -> {59, ~"Bad font file format"};normalize(enostr) -> {60, ~"Device not a stream"};% normalize(enodata) -> {61, ~"No data available"};% normalize(etime) -> {62, ~"Timer expired"};normalize(enosr) -> {63, ~"Out of streams resources"};% normalize(enonet) -> {64, ~"Machine is not on the network"};% normalize(enopkg) -> {65, ~"Package not installed"};% normalize(eremote) -> {66, ~"Object is remote"};normalize(enolink) -> {67, ~"Link has been severed"};% normalize(eadv) -> {68, ~"Advertise error"};% normalize(esrmnt) -> {69, ~"Srmount error"};% normalize(ecomm) -> {70, ~"Communication error on send"};% normalize(eproto) -> {71, ~"Protocol error"};normalize(emultihop) -> {72, ~"Multihop attempted"};% normalize(edotdot) -> {73, ~"RFS specific error"};normalize(ebadmsg) -> {74, ~"Bad message"};normalize(eoverflow) -> {75, ~"Value too large for defined data type"};% normalize(enotuniq) -> {76, ~"Name not unique on network"};% normalize(ebadfd) -> {77, ~"File descriptor in bad state"};% normalize(eremchg) -> {78, ~"Remote address changed"};% normalize(elibacc) -> {79, ~"Can not access a needed shared library"};% normalize(elibbad) -> {80, ~"Accessing a corrupted shared library"};% normalize(elibscn) -> {81, ~".lib section in a.out corrupted"};% normalize(elibmax) -> {82, ~"Attempting to link in too many shared libraries"};% normalize(elibexec) -> {83, ~"Cannot exec a shared library directly"};% normalize(eilseq) -> {84, ~"Invalid or incomplete multibyte or wide character"};% normalize(erestart) -> {85, ~"Interrupted system call should be restarted"};% normalize(estrpipe) -> {86, ~"Streams pipe error"};% normalize(eusers) -> {87, ~"Too many users"};% normalize(enotsock) -> {88, ~"Socket operation on non-socket"};% normalize(edestaddrreq) -> {89, ~"Destination address required"};% normalize(emsgsize) -> {90, ~"Message too long"};% normalize(eprototype) -> {91, ~"Protocol wrong type for socket"};% normalize(enoprotoopt) -> {92, ~"Protocol not available"};% normalize(eprotonosupport) -> {93, ~"Protocol not supported"};% normalize(esocktnosupport) -> {94, ~"Socket type not supported"};normalize(eopnotsupp) -> {95, ~"Operation not supported"};% normalize(epfnosupport) -> {96, ~"Protocol family not supported"};% normalize(eafnosupport) -> {97, ~"Address family not supported by protocol"};% normalize(eaddrinuse) -> {98, ~"Address already in use"};% normalize(eaddrnotavail) -> {99, ~"Cannot assign requested address"};% normalize(enetdown) -> {100, ~"Network is down"};% normalize(enetunreach) -> {101, ~"Network is unreachable"};% normalize(enetreset) -> {102, ~"Network dropped connection on reset"};% normalize(econnaborted) -> {103, ~"Software caused connection abort"};% normalize(econnreset) -> {104, ~"Connection reset by peer"};normalize(enobufs) -> {105, ~"No buffer space available"};% normalize(eisconn) -> {106, ~"Transport endpoint is already connected"};% normalize(enotconn) -> {107, ~"Transport endpoint is not connected"};% normalize(eshutdown) -> {108, ~"Cannot send after transport endpoint shutdown"};% normalize(etoomanyrefs) -> {109, ~"Too many references: cannot splice"};% normalize(etimedout) -> {110, ~"Connection timed out"};% normalize(econnrefused) -> {111, ~"Connection refused"};% normalize(ehostdown) -> {112, ~"Host is down"};% normalize(ehostunreach) -> {113, ~"No route to host"};% normalize(ealready) -> {114, ~"Operation already in progress"};% normalize(einprogress) -> {115, ~"Operation now in progress"};normalize(estale) -> {116, ~"Stale file handle"};% normalize(euclean) -> {117, ~"Structure needs cleaning"};% normalize(enotnam) -> {118, ~"Not a Xenix named type file"};% normalize(enavail) -> {119, ~"No Xenix semaphores available"};% normalize(eisnam) -> {120, ~"Is a named type file"};% normalize(eremoteio) -> {121, ~"Remote I/O error"};normalize(edquot) -> {122, ~"Disk quota exceeded"};% normalize(enomedium) -> {123, ~"No medium found"};% normalize(emediumtype) -> {124, ~"Wrong medium type"};% normalize(ecanceled) -> {125, ~"Operation canceled"};% normalize(enokey) -> {126, ~"Required key not available"};% normalize(ekeyexpired) -> {127, ~"Key has expired"};% normalize(ekeyrevoked) -> {128, ~"Key has been revoked"};% normalize(ekeyrejected) -> {129, ~"Key was rejected by service"};% normalize(eownerdead) -> {130, ~"Owner died"};% normalize(enotrecoverable) -> {131, ~"State not recoverable"};% normalize(erfkill) -> {132, ~"Operation not possible due to RF-kill"};% normalize(ehwpoison) -> {133, ~"Memory page has hardware error"};normalize(enotsup) -> {134, ~"Not supported parameter or option"};% normalize(enomedium) -> {135, ~"Missing media"};% normalize(eilseq) -> {138, ~"Invalid multibyte sequence"};% normalize(eoverflow) -> {139, ~"Value too large"}; % Duplicated% normalize(ecanceled) -> {140, ~"Asynchronous operation stopped before normal completion"};% normalize(enotrecoverable) -> {141, ~"State not recoverable"};% normalize(eownerdead) -> {142, ~"Previous owner died"};% normalize(estrpipe) -> {143, ~"Streams pipe error"};normalize(_Other) -> {?eundef, ~"Unknown error"}.