tdb/common/error.c

説明を見る。
00001  /* 
00002    Unix SMB/CIFS implementation.
00003 
00004    trivial database library
00005 
00006    Copyright (C) Andrew Tridgell              1999-2005
00007    Copyright (C) Paul `Rusty' Russell              2000
00008    Copyright (C) Jeremy Allison                    2000-2003
00009    
00010      ** NOTE! The following LGPL license applies to the tdb
00011      ** library. This does NOT imply that all of Samba is released
00012      ** under the LGPL
00013    
00014    This library is free software; you can redistribute it and/or
00015    modify it under the terms of the GNU Lesser General Public
00016    License as published by the Free Software Foundation; either
00017    version 2 of the License, or (at your option) any later version.
00018 
00019    This library is distributed in the hope that it will be useful,
00020    but WITHOUT ANY WARRANTY; without even the implied warranty of
00021    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022    Lesser General Public License for more details.
00023 
00024    You should have received a copy of the GNU Lesser General Public
00025    License along with this library; if not, write to the Free Software
00026    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027 */
00028 
00029 #include "tdb_private.h"
00030 
00031 enum TDB_ERROR tdb_error(struct tdb_context *tdb)
00032 {
00033         return tdb->ecode;
00034 }
00035 
00036 static struct tdb_errname {
00037         enum TDB_ERROR ecode; const char *estring;
00038 } emap[] = { {TDB_SUCCESS, "Success"},
00039              {TDB_ERR_CORRUPT, "Corrupt database"},
00040              {TDB_ERR_IO, "IO Error"},
00041              {TDB_ERR_LOCK, "Locking error"},
00042              {TDB_ERR_OOM, "Out of memory"},
00043              {TDB_ERR_EXISTS, "Record exists"},
00044              {TDB_ERR_NOLOCK, "Lock exists on other keys"},
00045              {TDB_ERR_EINVAL, "Invalid parameter"},
00046              {TDB_ERR_NOEXIST, "Record does not exist"},
00047              {TDB_ERR_RDONLY, "write not permitted"} };
00048 
00049 /* Error string for the last tdb error */
00050 const char *tdb_errorstr(struct tdb_context *tdb)
00051 {
00052         u32 i;
00053         for (i = 0; i < sizeof(emap) / sizeof(struct tdb_errname); i++)
00054                 if (tdb->ecode == emap[i].ecode)
00055                         return emap[i].estring;
00056         return "Invalid error code";
00057 }
00058 

Sambaに対してSat Aug 29 21:23:23 2009に生成されました。  doxygen 1.4.7