Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Xen/Xentools 3.3 Domain-Unnamed



On Tue, Aug 19, 2008 at 02:44:10PM +0200, Christoph Egger wrote:
> > Not yet. I'd rather take the whole macro list and see what the differences
> > are.
> 
> Attached is xen's errno file from the source.
> In the source, this is: xen/include/xen/errno.h
> 
> It is basically a merge of Linux'  asm-generic/errno-generic.h and
> asm-generic/errno.h

OK, so what about using the attached function then ?
It should convert all common error types, and warn if an unkown error is
returned.

-- 
Manuel Bouyer, LIP6, Universite Paris VI.           
Manuel.Bouyer%lip6.fr@localhost
     NetBSD: 26 ans d'experience feront toujours la difference
--
static int
privcmd_xen2bsd_errno(int error)
{
        /*
         * Xen uses System V error codes.
         * In order to keep bloat as minimal as possible,
         * only convert what really impact us.
         */

        switch(-error) {
        case 1:
                return EPERM;
        case 2:
                return ENOENT;
        case 3:
                return ESRCH;
        case 4:
                return EINTR;
        case 5:
                return EIO;
        case 6:
                return ENXIO;
        case 7:
                return E2BIG;
        case 8:
                return ENOEXEC;
        case 9:
                return EBADF;
        case 10:
                return ECHILD;
        case 11:
                return EAGAIN;
        case 12:
                return ENOMEM;
        case 13:
                return EACCES;
        case 14:
                return EFAULT;
        case 15:
                return ENOTBLK;
        case 16:
                return EBUSY;
        case 17:
                return EEXIST;
        case 18:
                return EXDEV;
        case 19:
                return ENODEV;
        case 20:
                return ENOTDIR;
        case 21:
                return EISDIR;
        case 22:
                return EINVAL;
        case 23:
                return ENFILE;
        case 24:
                return EMFILE;
        case 25:
                return ENOTTY;
        case 26:
                return ETXTBSY;
        case 27:
                return EFBIG;
        case 28:
                return ENOSPC;
        case 29:
                return ESPIPE;
        case 30:
                return EROFS;
        case 31:
                return EMLINK;
        case 32:
                return EPIPE;
        case 33:
                return EDOM;
        case 34:
                return ERANGE;
        case 35:
                return EDEADLK;
        case 36:
                return ENAMETOOLONG;
        case 37:
                return ENOLCK;
        case 38:
                return ENOSYS;
        case 39:
                return ENOTEMPTY;
        case 40:
                return ELOOP;
        case 42:
                return ENOMSG;
        case 43:
                return EIDRM;
        case 60:
                return ENOSTR;
        case 61:
                return ENODATA;
        case 62:
                return ETIME;
        case 63:
                return ENOSR;
        case 66:
                return EREMOTE;
        case 74:
                return EBADMSG;
        case 75:
                return EOVERFLOW;
        case 84:
                return EILSEQ;
        case 87:
                return EUSERS;
        case 88:
                return ENOTSOCK;
        case 89:
                return EDESTADDRREQ;
        case 90:
                return EMSGSIZE;
        case 91:
                return EPROTOTYPE;
        case 92:
                return ENOPROTOOPT;
        case 93:
                return EPROTONOSUPPORT;
        case 94:
                return ESOCKTNOSUPPORT;
        case 95:
                return EOPNOTSUPP;
        case 96:
                return EPFNOSUPPORT;
        case 97:
                return EAFNOSUPPORT;
        case 98:
                return EADDRINUSE;
        case 99:
                return EADDRNOTAVAIL;
        case 100:
                return ENETDOWN;
        case 101:
                return ENETUNREACH;
        case 102:
                return ENETRESET;
        case 103:
                return ECONNABORTED;
        case 104:
                return ECONNRESET;
        case 105:
                return ENOBUFS;
        case 106:
                return EISCONN;
        case 107:
                return ENOTCONN;
        case 108:
                return ESHUTDOWN;
        case 109:
                return ETOOMANYREFS;
        case 110:
                return ETIMEDOUT;
        case 111:
                return ECONNREFUSED;
        case 112:
                return EHOSTDOWN;
        case 113:
                return EHOSTUNREACH;
        case 114:
                return EALREADY;
        case 115:
                return EINPROGRESS;
        case 116:
                return ESTALE;
        case 122:
                return EDQUOT;
        default:
                printf("unknown xen error code %d\n", -error);
                return -error;
        }
}


Home | Main Index | Thread Index | Old Index