view include/error.h @ 70:3b73044b740f

I think I have just about all of the FS code using errcodes There may be some of the FS code that messes up with error handling, I will examine more after my exam. I probably should have been studying for that just now...
author Jonathan Pevarnek <pevarnj@gmail.com>
date Mon, 25 Apr 2011 10:15:56 -0400
parents 19000e354e36
children 7f312eb75ec0
line wrap: on
line source

#ifndef __ERROR_H
#define __ERROR_H

#define mkError(mod,code,sev) (((mod) << 12) | ((code) << 2) | (sev))
#define isError(code) (((code) & 3) == ERROR)
#define errCode(code) (((code) >> 2) & 1023)
#define makeWarn(code) ((((code) >> 2) << 2) | WARN) //convert an error into a warning

//Severities
#define INFO 0
#define WARN 1
#define ERROR 2

//Modules
#define MODFS 1 //stuff in the file system
#define MODTOD 2 //Time of date

#define NOERROR 0 //General error code for not an error

//Codes: filesystem
#define ALLOCFAIL 1 //a general code for a malloc failing
#define OUTOFRANGE 2 //
#define MUGGLE 3 //The magic code in the superblock was not set correctly
#define BLKREADFAIL 4 //failure for reading a filesystem block
#define NOTFILE 5
#define BLKWRITEFAIL 6 //failure to write a filesystem block
#define SIZETOOLARGE 7 //the user requested a size that is too large to be set for a file
#define NOTINCACHE 8

//Codes: Time of date
#define UPTIME 1 //the actual time of date was not set in the system
#define INVALID 2


typedef u32 ErrCode;

#endif //__ERROR_H