New stat structure.
* VFS and installed MFSes must be in sync before and after this change * Use struct stat from NetBSD. It requires adding new STAT, FSTAT and LSTAT syscalls. Libc modification is both backward and forward compatible. Also new struct stat uses modern field sizes to avoid ABI incompatibility, when we update uid_t, gid_t and company. Exceptions are ino_t and off_t in old libc (though paddings added).
This commit is contained in:
@@ -263,10 +263,15 @@ __bt_open(const char *fname, int flags, mode_t mode, const BTREEINFO *openinfo,
|
||||
*/
|
||||
if (b.psize == 0) {
|
||||
#ifdef __minix
|
||||
b.psize = MINIX_ST_BLKSIZE;
|
||||
#else
|
||||
b.psize = sb.st_blksize;
|
||||
if (sb.st_blksize == 0) {
|
||||
/* 0 in 2 cases: upgrade from old to new struct stat or
|
||||
* there is a bug in underlying fs.
|
||||
*/
|
||||
b.psize = MINIX_ST_BLKSIZE;
|
||||
} else
|
||||
#endif
|
||||
b.psize = sb.st_blksize;
|
||||
|
||||
if (b.psize < MINPSIZE)
|
||||
b.psize = MINPSIZE;
|
||||
if (b.psize > MAX_PAGE_OFFSET + 1)
|
||||
|
||||
@@ -302,10 +302,15 @@ init_hash(HTAB *hashp, const char *file, const HASHINFO *info)
|
||||
if (stat(file, &statbuf))
|
||||
return (NULL);
|
||||
#ifdef __minix
|
||||
hashp->BSIZE = MIN(MINIX_ST_BLKSIZE, MAX_BSIZE);
|
||||
#else
|
||||
hashp->BSIZE = MIN(statbuf.st_blksize, MAX_BSIZE);
|
||||
if (statbuf.st_blksize == 0) {
|
||||
/* 0 in 2 cases: upgrade from old to new struct stat or
|
||||
* there is a bug in underlying fs.
|
||||
*/
|
||||
hashp->BSIZE = MIN(MINIX_ST_BLKSIZE, MAX_BSIZE);
|
||||
} else
|
||||
#endif
|
||||
hashp->BSIZE = MIN(statbuf.st_blksize, MAX_BSIZE);
|
||||
|
||||
hashp->BSHIFT = __log2((uint32_t)hashp->BSIZE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user