diff options
author | ram@mysql.r18.ru <> | 2002-10-30 15:57:05 +0400 |
---|---|---|
committer | ram@mysql.r18.ru <> | 2002-10-30 15:57:05 +0400 |
commit | 5e09392faa62ea38baa4bd46de5e4183da538e79 (patch) | |
tree | 6881a3cca88bea0bb9eeffd5aae34be437152786 /bdb/os_vxworks | |
parent | 1c0f1712ca4869b537ada297930ef01dcb039bb9 (diff) | |
download | mariadb-git-5e09392faa62ea38baa4bd46de5e4183da538e79.tar.gz |
BDB 4.1.24
Diffstat (limited to 'bdb/os_vxworks')
-rw-r--r-- | bdb/os_vxworks/os_finit.c | 57 | ||||
-rw-r--r-- | bdb/os_vxworks/os_vx_abs.c (renamed from bdb/os_vxworks/os_abs.c) | 12 | ||||
-rw-r--r-- | bdb/os_vxworks/os_vx_config.c | 31 | ||||
-rw-r--r-- | bdb/os_vxworks/os_vx_map.c (renamed from bdb/os_vxworks/os_map.c) | 25 |
4 files changed, 50 insertions, 75 deletions
diff --git a/bdb/os_vxworks/os_finit.c b/bdb/os_vxworks/os_finit.c deleted file mode 100644 index 305f52f0996..00000000000 --- a/bdb/os_vxworks/os_finit.c +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1999, 2000 - * Sleepycat Software. All rights reserved. - */ - -#include "db_config.h" - -#ifndef lint -static const char revid[] = "$Id: os_finit.c,v 1.1 2000/06/21 20:05:18 sue Exp $"; -#endif /* not lint */ - -#include "db_int.h" - -/* - * __os_fpinit -- - * Initialize a page in a regular file. - * - * PUBLIC: int __os_fpinit __P((DB_ENV *, DB_FH *, db_pgno_t, int, int)); - */ -int -__os_fpinit(dbenv, fhp, pgno, pagecount, pagesize) - DB_ENV *dbenv; - DB_FH *fhp; - db_pgno_t pgno; - int pagecount, pagesize; -{ - size_t nw, totalbytes, curbytes; - int ret; - char buf[1024]; - - /* - * Some VxWorks FS drivers do not zero-fill pages that were never - * explicitly written to the file, they give you random garbage, - * and that breaks DB. - */ - if ((ret = __os_seek(dbenv, - fhp, pagesize, pgno, 0, 0, DB_OS_SEEK_SET)) != 0) - return (ret); - - memset(buf, 0, sizeof(buf)); - totalbytes = pagecount * pagesize; - - while (totalbytes > 0) { - if (totalbytes > sizeof(buf)) - curbytes = sizeof(buf); - else - curbytes = totalbytes; - if ((ret = __os_write(dbenv, fhp, buf, curbytes, &nw)) != 0) - return (ret); - if (nw != curbytes) - return (EIO); - totalbytes -= curbytes; - } - return (0); -} diff --git a/bdb/os_vxworks/os_abs.c b/bdb/os_vxworks/os_vx_abs.c index 162a556d3fa..93e9be7269b 100644 --- a/bdb/os_vxworks/os_abs.c +++ b/bdb/os_vxworks/os_vx_abs.c @@ -1,14 +1,14 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1997, 1998, 1999, 2000 + * Copyright (c) 1997-2002 * Sleepycat Software. All rights reserved. */ #include "db_config.h" #ifndef lint -static const char revid[] = "$Id: os_abs.c,v 1.4 2000/08/09 19:09:48 sue Exp $"; +static const char revid[] = "$Id: os_vx_abs.c,v 1.7 2002/01/11 15:53:02 bostic Exp $"; #endif /* not lint */ #include "db_int.h" @@ -32,11 +32,11 @@ __os_abspath(path) if ((dummy = iosDevFind((char *)path, &ptail)) == NULL) return (0); /* - * If the routine used the default device, then we are not - * an abs path. + * If the routine used a device, then ptail points to the + * rest and we are an abs path. */ - if (ptail == path) - return (0); + if (ptail != path) + return (1); /* * If the path starts with a '/', then we are an absolute path, * using the host machine, otherwise we are not. diff --git a/bdb/os_vxworks/os_vx_config.c b/bdb/os_vxworks/os_vx_config.c new file mode 100644 index 00000000000..810983b38ff --- /dev/null +++ b/bdb/os_vxworks/os_vx_config.c @@ -0,0 +1,31 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 1999-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "$Id: os_vx_config.c,v 1.4 2002/01/11 15:53:03 bostic Exp $"; +#endif /* not lint */ + +#include "db_int.h" + +/* + * __os_fs_notzero -- + * Return 1 if allocated filesystem blocks are not zeroed. + * + * PUBLIC: int __os_fs_notzero __P((void)); + */ +int +__os_fs_notzero() +{ + /* + * Some VxWorks FS drivers do not zero-fill pages that were never + * explicitly written to the file, they give you random garbage, + * and that breaks Berkeley DB. + */ + return (1); +} diff --git a/bdb/os_vxworks/os_map.c b/bdb/os_vxworks/os_vx_map.c index 7397995d1d1..8ad4f0765ce 100644 --- a/bdb/os_vxworks/os_map.c +++ b/bdb/os_vxworks/os_vx_map.c @@ -1,7 +1,7 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 1998, 1999, 2000 + * Copyright (c) 1998-2002 * Sleepycat Software. All rights reserved. * * This code is derived from software contributed to Sleepycat Software by @@ -11,7 +11,7 @@ #include "db_config.h" #ifndef lint -static const char revid[] = "$Id: os_map.c,v 1.14 2000/12/04 19:01:43 sue Exp $"; +static const char revid[] = "$Id: os_vx_map.c,v 1.21 2002/03/06 19:36:58 margo Exp $"; #endif /* not lint */ #ifndef NO_SYSTEM_INCLUDES @@ -20,7 +20,6 @@ static const char revid[] = "$Id: os_map.c,v 1.14 2000/12/04 19:01:43 sue Exp $" #endif #include "db_int.h" -#include "common_ext.h" /* * DB uses memory-mapped files for two things: @@ -187,6 +186,7 @@ __os_unmapfile(dbenv, addr, len) size_t len; { /* We cannot map in regular files in VxWorks. */ + COMPQUIET(dbenv, NULL); COMPQUIET(addr, NULL); COMPQUIET(len, 0); return (EINVAL); @@ -226,10 +226,11 @@ __os_segdata_init(dbenv) * Currently not called. This function should be called if the * user creates a function to unload or shutdown. * - * PUBLIC: int __os_segdata_destroy __P((void)); + * PUBLIC: int __os_segdata_destroy __P((DB_ENV *)); */ int -__os_segdata_destroy() +__os_segdata_destroy(dbenv) + DB_ENV *dbenv; { os_segdata_t *p; int i; @@ -241,17 +242,17 @@ __os_segdata_destroy() for (i = 0; i < __os_segdata_size; i++) { p = &__os_segdata[i]; if (p->name != NULL) { - __os_freestr(p->name); + __os_free(dbenv, p->name); p->name = NULL; } if (p->segment != NULL) { - __os_free(p->segment, p->size); + __os_free(dbenv, p->segment); p->segment = NULL; } p->size = 0; } - __os_free(__os_segdata, __os_segdata_size * sizeof(os_segdata_t)); + __os_free(dbenv, __os_segdata); __os_segdata = NULL; __os_segdata_size = 0; DB_END_SINGLE_THREAD; @@ -283,7 +284,7 @@ __os_segdata_allocate(dbenv, name, infop, rp) if ((ret = __os_calloc(dbenv, 1, rp->size, &p->segment)) != 0) return (ret); if ((ret = __os_strdup(dbenv, name, &p->name)) != 0) { - __os_free(p->segment, rp->size); + __os_free(dbenv, p->segment); p->segment = NULL; return (ret); } @@ -329,7 +330,7 @@ __os_segdata_new(dbenv, segidp) */ newsize = __os_segdata_size + OS_SEGDATA_INCREMENT; if ((ret = __os_realloc(dbenv, newsize * sizeof(os_segdata_t), - NULL, &__os_segdata)) != 0) + &__os_segdata)) != 0) return (ret); memset(&__os_segdata[__os_segdata_size], 0, OS_SEGDATA_INCREMENT * sizeof(os_segdata_t)); @@ -423,11 +424,11 @@ __os_segdata_release(dbenv, rp, is_locked) DB_BEGIN_SINGLE_THREAD; p = &__os_segdata[rp->segid]; if (p->name != NULL) { - __os_freestr(p->name); + __os_free(dbenv, p->name); p->name = NULL; } if (p->segment != NULL) { - __os_free(p->segment, p->size); + __os_free(dbenv, p->segment); p->segment = NULL; } p->size = 0; |