64 bit inode changes.
This commit is contained in:
parent
d2d5cc4265
commit
50f8955b6e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_sa.c,v 1.62 2005/06/06 19:56:46 jdc Exp $ */
|
||||
/* $NetBSD: kern_sa.c,v 1.63 2005/08/19 02:04:03 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2004, 2005 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sa.c,v 1.62 2005/06/06 19:56:46 jdc Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sa.c,v 1.63 2005/08/19 02:04:03 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -698,9 +698,34 @@ sa_yield(struct lwp *l)
|
||||
int
|
||||
sys_sa_preempt(struct lwp *l, void *v, register_t *retval)
|
||||
{
|
||||
struct sys_sa_preempt_args /* {
|
||||
syscallarg(lwpid_t) sa_id;
|
||||
} */ *uap = v;
|
||||
int target_lid;
|
||||
struct proc *p = l->l_proc;
|
||||
struct lwp *t;
|
||||
|
||||
/* XXX Implement me. */
|
||||
return (ENOSYS);
|
||||
target_lid = SCARG(uap, sa_id);
|
||||
|
||||
LIST_FOREACH(t, &p->p_lwps, l_sibling)
|
||||
if (t->l_lid == target_lid)
|
||||
break;
|
||||
|
||||
if (t == NULL)
|
||||
return ESRCH;
|
||||
|
||||
/* XXX: Not correct, but the best we can do for now */
|
||||
if (t != l && t->l_stat == LSONPROC && l->l_cpu != t->l_cpu) {
|
||||
#ifdef DIAGNOSTIC
|
||||
printf("reschedule %d\n", t->l_lid);
|
||||
#endif
|
||||
need_resched(t->l_cpu);
|
||||
#ifndef DIAGNOSTIC
|
||||
} else {
|
||||
printf("can't reschedule %d\n", t->l_lid);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: syscalls.c,v 1.160 2005/07/10 22:05:24 thorpej Exp $ */
|
||||
/* $NetBSD: syscalls.c,v 1.161 2005/08/19 02:04:03 christos Exp $ */
|
||||
|
||||
/*
|
||||
* System call names.
|
||||
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.160 2005/07/10 22:05:24 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.161 2005/08/19 02:04:03 christos Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ktrace.h"
|
||||
@ -391,15 +391,15 @@ const char *const syscallnames[] = {
|
||||
"#269 (unimplemented)", /* 269 = unimplemented */
|
||||
"__posix_rename", /* 270 = __posix_rename */
|
||||
"swapctl", /* 271 = swapctl */
|
||||
"getdents", /* 272 = getdents */
|
||||
"compat_30_getdents", /* 272 = compat_30 getdents */
|
||||
"minherit", /* 273 = minherit */
|
||||
"lchmod", /* 274 = lchmod */
|
||||
"lchown", /* 275 = lchown */
|
||||
"lutimes", /* 276 = lutimes */
|
||||
"__msync13", /* 277 = __msync13 */
|
||||
"__stat13", /* 278 = __stat13 */
|
||||
"__fstat13", /* 279 = __fstat13 */
|
||||
"__lstat13", /* 280 = __lstat13 */
|
||||
"compat_30___stat13", /* 278 = compat_30 __stat13 */
|
||||
"compat_30___fstat13", /* 279 = compat_30 __fstat13 */
|
||||
"compat_30___lstat13", /* 280 = compat_30 __lstat13 */
|
||||
"__sigaltstack14", /* 281 = __sigaltstack14 */
|
||||
"__vfork14", /* 282 = __vfork14 */
|
||||
"__posix_chown", /* 283 = __posix_chown */
|
||||
@ -522,4 +522,8 @@ const char *const syscallnames[] = {
|
||||
"removexattr", /* 384 = removexattr */
|
||||
"lremovexattr", /* 385 = lremovexattr */
|
||||
"fremovexattr", /* 386 = fremovexattr */
|
||||
"__stat30", /* 387 = __stat30 */
|
||||
"__fstat30", /* 388 = __fstat30 */
|
||||
"__lstat30", /* 389 = __lstat30 */
|
||||
"__getdents30", /* 390 = __getdents30 */
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
# $NetBSD: syscalls.conf,v 1.8 2004/04/21 01:05:38 christos Exp $
|
||||
# $NetBSD: syscalls.conf,v 1.9 2005/08/19 02:04:03 christos Exp $
|
||||
|
||||
sysnames="syscalls.c"
|
||||
sysnumhdr="../sys/syscall.h"
|
||||
syssw="init_sysent.c"
|
||||
sysarghdr="../sys/syscallargs.h"
|
||||
compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20"
|
||||
compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30"
|
||||
libcompatopts=""
|
||||
|
||||
switchname="sysent"
|
||||
|
@ -1,4 +1,4 @@
|
||||
$NetBSD: syscalls.master,v 1.147 2005/07/10 22:04:20 thorpej Exp $
|
||||
$NetBSD: syscalls.master,v 1.148 2005/08/19 02:04:03 christos Exp $
|
||||
|
||||
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
|
||||
|
||||
@ -562,7 +562,7 @@
|
||||
270 STD { int sys___posix_rename(const char *from, \
|
||||
const char *to); }
|
||||
271 STD { int sys_swapctl(int cmd, void *arg, int misc); }
|
||||
272 STD { int sys_getdents(int fd, char *buf, size_t count); }
|
||||
272 COMPAT_30 { int sys_getdents(int fd, char *buf, size_t count); }
|
||||
273 STD { int sys_minherit(void *addr, size_t len, \
|
||||
int inherit); }
|
||||
274 STD { int sys_lchmod(const char *path, mode_t mode); }
|
||||
@ -571,9 +571,9 @@
|
||||
276 STD { int sys_lutimes(const char *path, \
|
||||
const struct timeval *tptr); }
|
||||
277 STD { int sys___msync13(void *addr, size_t len, int flags); }
|
||||
278 STD { int sys___stat13(const char *path, struct stat *ub); }
|
||||
279 STD { int sys___fstat13(int fd, struct stat *sb); }
|
||||
280 STD { int sys___lstat13(const char *path, struct stat *ub); }
|
||||
278 COMPAT_30 { int sys___stat13(const char *path, struct stat30 *ub); }
|
||||
279 COMPAT_30 { int sys___fstat13(int fd, struct stat30 *sb); }
|
||||
280 COMPAT_30 { int sys___lstat13(const char *path, struct stat30 *ub); }
|
||||
281 STD { int sys___sigaltstack14( \
|
||||
const struct sigaltstack *nss, \
|
||||
struct sigaltstack *oss); }
|
||||
@ -778,3 +778,7 @@
|
||||
const char *name); }
|
||||
386 STD { int sys_fremovexattr(int fd, \
|
||||
const char *name); }
|
||||
387 STD { int sys___stat30(const char *path, struct stat *ub); }
|
||||
388 STD { int sys___fstat30(int fd, struct stat *sb); }
|
||||
389 STD { int sys___lstat30(const char *path, struct stat *ub); }
|
||||
390 STD { int sys___getdents30(int fd, char *buf, size_t count); }
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vfs_getcwd.c,v 1.27 2005/06/05 23:47:48 thorpej Exp $ */
|
||||
/* $NetBSD: vfs_getcwd.c,v 1.28 2005/08/19 02:04:03 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_getcwd.c,v 1.27 2005/06/05 23:47:48 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_getcwd.c,v 1.28 2005/08/19 02:04:03 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -57,8 +57,6 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_getcwd.c,v 1.27 2005/06/05 23:47:48 thorpej Exp
|
||||
#include <sys/sa.h>
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
#define DIRENT_MINSIZE (sizeof(struct dirent) - (MAXNAMLEN + 1) + 4)
|
||||
|
||||
/*
|
||||
* Vnode variable naming conventions in this file:
|
||||
*
|
||||
@ -218,7 +216,7 @@ unionread:
|
||||
reclen = dp->d_reclen;
|
||||
|
||||
/* check for malformed directory.. */
|
||||
if (reclen < DIRENT_MINSIZE) {
|
||||
if (reclen < _DIRENT_MINSIZE(dp)) {
|
||||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vfs_syscalls.c,v 1.227 2005/08/05 13:22:23 jmmv Exp $ */
|
||||
/* $NetBSD: vfs_syscalls.c,v 1.228 2005/08/19 02:04:03 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.227 2005/08/05 13:22:23 jmmv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.228 2005/08/19 02:04:03 christos Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
#include "opt_compat_43.h"
|
||||
@ -2113,9 +2113,9 @@ out:
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
sys___stat13(struct lwp *l, void *v, register_t *retval)
|
||||
sys___stat30(struct lwp *l, void *v, register_t *retval)
|
||||
{
|
||||
struct sys___stat13_args /* {
|
||||
struct sys___stat30_args /* {
|
||||
syscallarg(const char *) path;
|
||||
syscallarg(struct stat *) ub;
|
||||
} */ *uap = v;
|
||||
@ -2141,9 +2141,9 @@ sys___stat13(struct lwp *l, void *v, register_t *retval)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
sys___lstat13(struct lwp *l, void *v, register_t *retval)
|
||||
sys___lstat30(struct lwp *l, void *v, register_t *retval)
|
||||
{
|
||||
struct sys___lstat13_args /* {
|
||||
struct sys___lstat30_args /* {
|
||||
syscallarg(const char *) path;
|
||||
syscallarg(struct stat *) ub;
|
||||
} */ *uap = v;
|
||||
@ -3256,9 +3256,9 @@ out:
|
||||
* Read a block of directory entries in a file system independent format.
|
||||
*/
|
||||
int
|
||||
sys_getdents(struct lwp *l, void *v, register_t *retval)
|
||||
sys___getdents30(struct lwp *l, void *v, register_t *retval)
|
||||
{
|
||||
struct sys_getdents_args /* {
|
||||
struct sys___getdents30_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(char *) buf;
|
||||
syscallarg(size_t) count;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs.c,v 1.44 2005/02/26 22:58:57 perry Exp $ */
|
||||
/* $NetBSD: ufs.c,v 1.45 2005/08/19 02:04:03 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -134,6 +134,7 @@ struct fs {
|
||||
#ifndef indp_t
|
||||
#define indp_t uint32_t
|
||||
#endif
|
||||
typedef uint32_t ino32_t;
|
||||
#ifndef FSBTODB
|
||||
#define FSBTODB(fs, indp) fsbtodb(fs, indp)
|
||||
#endif
|
||||
@ -166,10 +167,10 @@ struct file {
|
||||
daddr_t f_buf_blkno; /* block number of data block */
|
||||
};
|
||||
|
||||
static int read_inode(ino_t, struct open_file *);
|
||||
static int read_inode(ino32_t, struct open_file *);
|
||||
static int block_map(struct open_file *, indp_t, indp_t *);
|
||||
static int buf_read_file(struct open_file *, char **, size_t *);
|
||||
static int search_directory(const char *, int, struct open_file *, ino_t *);
|
||||
static int search_directory(const char *, int, struct open_file *, ino32_t *);
|
||||
#ifdef LIBSA_FFSv1
|
||||
static void ffs_oldfscompat(struct fs *);
|
||||
#endif
|
||||
@ -182,7 +183,7 @@ static int ffs_find_superblock(struct open_file *, struct fs *);
|
||||
* Find an inode's block. Look it up in the ifile. Whee!
|
||||
*/
|
||||
static int
|
||||
find_inode_sector(ino_t inumber, struct open_file *f, daddr_t *isp)
|
||||
find_inode_sector(ino32_t inumber, struct open_file *f, daddr_t *isp)
|
||||
{
|
||||
struct file *fp = (struct file *)f->f_fsdata;
|
||||
struct fs *fs = fp->f_fs;
|
||||
@ -217,7 +218,7 @@ find_inode_sector(ino_t inumber, struct open_file *f, daddr_t *isp)
|
||||
* Read a new inode into a file structure.
|
||||
*/
|
||||
static int
|
||||
read_inode(ino_t inumber, struct open_file *f)
|
||||
read_inode(ino32_t inumber, struct open_file *f)
|
||||
{
|
||||
struct file *fp = (struct file *)f->f_fsdata;
|
||||
struct fs *fs = fp->f_fs;
|
||||
@ -440,7 +441,7 @@ buf_read_file(struct open_file *f, char **buf_p, size_t *size_p)
|
||||
*/
|
||||
static int
|
||||
search_directory(const char *name, int length, struct open_file *f,
|
||||
ino_t *inumber_p)
|
||||
ino32_t *inumber_p)
|
||||
{
|
||||
struct file *fp = (struct file *)f->f_fsdata;
|
||||
struct direct *dp;
|
||||
@ -461,7 +462,7 @@ search_directory(const char *name, int length, struct open_file *f,
|
||||
for (;dp < edp; dp = (void *)((char *)dp + dp->d_reclen)) {
|
||||
if (dp->d_reclen <= 0)
|
||||
break;
|
||||
if (dp->d_ino == (ino_t)0)
|
||||
if (dp->d_ino == (ino32_t)0)
|
||||
continue;
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
if (fp->f_fs->fs_maxsymlinklen <= 0)
|
||||
@ -518,12 +519,12 @@ ufs_open(const char *path, struct open_file *f)
|
||||
const char *cp, *ncp;
|
||||
int c;
|
||||
#endif
|
||||
ino_t inumber;
|
||||
ino32_t inumber;
|
||||
struct file *fp;
|
||||
struct fs *fs;
|
||||
int rc;
|
||||
#ifndef LIBSA_NO_FS_SYMLINK
|
||||
ino_t parent_inumber;
|
||||
ino32_t parent_inumber;
|
||||
int nlinks = 0;
|
||||
char namebuf[MAXPATHLEN+1];
|
||||
char *buf;
|
||||
@ -707,7 +708,7 @@ ufs_open(const char *path, struct open_file *f)
|
||||
if (*cp != '/')
|
||||
inumber = parent_inumber;
|
||||
else
|
||||
inumber = (ino_t)ROOTINO;
|
||||
inumber = (ino32_t)ROOTINO;
|
||||
|
||||
if ((rc = read_inode(inumber, f)) != 0)
|
||||
goto out;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_ls.c,v 1.10 2005/04/09 13:04:35 dsl Exp $ */
|
||||
/* $NetBSD: ufs_ls.c,v 1.11 2005/08/19 02:04:03 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993
|
||||
@ -65,10 +65,12 @@
|
||||
|
||||
#define NELEM(x) (sizeof (x) / sizeof(*x))
|
||||
|
||||
|
||||
typedef uint32_t ino32_t;
|
||||
typedef struct entry_t entry_t;
|
||||
struct entry_t {
|
||||
entry_t *e_next;
|
||||
ino_t e_ino;
|
||||
ino32_t e_ino;
|
||||
uint8_t e_type;
|
||||
char e_name[1];
|
||||
};
|
||||
|
@ -1,12 +1,14 @@
|
||||
# $NetBSD: Makefile.inc,v 1.4 2001/12/12 12:06:45 lukem Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.5 2005/08/19 02:04:03 christos Exp $
|
||||
|
||||
.if !defined(__SYS_LKM_MAKEFILE_INC)
|
||||
__SYS_LKM_MAKEFILE_INC= 1
|
||||
|
||||
NOMAN= # defined
|
||||
CPPFLAGS+=-DLOCKDEBUG -DDEBUG -DDIAGNOSTIC
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
WARNS?= 1
|
||||
CPPFLAGS+=-DDEBUG -DDIAGNOSTIC # -DMALLOCLOG -DLOCKDEBUG
|
||||
|
||||
.endif # __SYS_LKM_MAKEFILE_INC
|
||||
|
@ -1,8 +1,8 @@
|
||||
# $NetBSD: Makefile,v 1.3 2004/06/29 04:42:54 itojun Exp $
|
||||
# $NetBSD: Makefile,v 1.4 2005/08/19 02:04:03 christos Exp $
|
||||
|
||||
.include "../Makefile.inc"
|
||||
|
||||
CPPFLAGS+= -I$S/dist/pf -I$S -DINET6 -DINET
|
||||
CPPFLAGS+= -I$S/dist/pf -I$S -DINET
|
||||
KMOD= pf
|
||||
SRCS= if_pflog.c pf_real.c pf_ioctl.c pf_osfp.c pf_if.c \
|
||||
pf_norm.c pf_table.c pf_lkm.c
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fdesc_vnops.c,v 1.84 2005/05/29 21:55:33 christos Exp $ */
|
||||
/* $NetBSD: fdesc_vnops.c,v 1.85 2005/08/19 02:04:03 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.84 2005/05/29 21:55:33 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.85 2005/08/19 02:04:03 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -656,7 +656,6 @@ fdesc_setattr(v)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#define UIO_MX 32
|
||||
|
||||
struct fdesc_target {
|
||||
ino_t ft_fileno;
|
||||
@ -664,7 +663,6 @@ struct fdesc_target {
|
||||
u_char ft_namlen;
|
||||
const char *ft_name;
|
||||
} fdesc_targets[] = {
|
||||
/* NOTE: The name must be less than UIO_MX-16 chars in length */
|
||||
#define N(s) sizeof(s)-1, s
|
||||
{ FD_DEVFD, DT_DIR, N("fd") },
|
||||
{ FD_STDIN, DT_LNK, N("stdin") },
|
||||
@ -672,6 +670,7 @@ struct fdesc_target {
|
||||
{ FD_STDERR, DT_LNK, N("stderr") },
|
||||
{ FD_CTTY, DT_UNKNOWN, N("tty") },
|
||||
#undef N
|
||||
#define UIO_MX _DIRENT_RECLEN((struct dirent *)NULL, sizeof("stderr") - 1)
|
||||
};
|
||||
static int nfdesc_targets = sizeof(fdesc_targets) / sizeof(fdesc_targets[0]);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_bio.c,v 1.132 2005/07/21 10:39:46 yamt Exp $ */
|
||||
/* $NetBSD: nfs_bio.c,v 1.133 2005/08/19 02:04:03 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.132 2005/07/21 10:39:46 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.133 2005/08/19 02:04:03 christos Exp $");
|
||||
|
||||
#include "opt_nfs.h"
|
||||
#include "opt_ddb.h"
|
||||
@ -88,10 +88,10 @@ nfs_bioread(vp, uio, ioflag, cred, cflag)
|
||||
struct proc *p = uio->uio_procp;
|
||||
struct nfsmount *nmp = VFSTONFS(vp->v_mount);
|
||||
struct nfsdircache *ndp = NULL, *nndp = NULL;
|
||||
caddr_t baddr, ep, edp;
|
||||
caddr_t baddr;
|
||||
int got_buf = 0, error = 0, n = 0, on = 0, en, enn;
|
||||
int enough = 0;
|
||||
struct dirent *dp, *pdp;
|
||||
struct dirent *dp, *pdp, *edp, *ep;
|
||||
off_t curoff = 0;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
@ -310,11 +310,12 @@ diragain:
|
||||
en = ndp->dc_entry;
|
||||
|
||||
pdp = dp = (struct dirent *)bp->b_data;
|
||||
edp = bp->b_data + bp->b_bcount - bp->b_resid;
|
||||
edp = (struct dirent *)(void *)(bp->b_data + bp->b_bcount -
|
||||
bp->b_resid);
|
||||
enn = 0;
|
||||
while (enn < en && (caddr_t)dp < edp) {
|
||||
while (enn < en && dp < edp) {
|
||||
pdp = dp;
|
||||
dp = (struct dirent *)((caddr_t)dp + dp->d_reclen);
|
||||
dp = _DIRENT_NEXT(dp);
|
||||
enn++;
|
||||
}
|
||||
|
||||
@ -325,7 +326,7 @@ diragain:
|
||||
* stale. Flush it and try again (i.e. go to
|
||||
* the server).
|
||||
*/
|
||||
if ((caddr_t)dp >= edp || (caddr_t)dp + dp->d_reclen > edp ||
|
||||
if (dp >= edp || (struct dirent *)_DIRENT_NEXT(edp) > edp ||
|
||||
(en > 0 && NFS_GETCOOKIE(pdp) != ndp->dc_cookie)) {
|
||||
#ifdef DEBUG
|
||||
printf("invalid cache: %p %p %p off %lx %lx\n",
|
||||
@ -350,8 +351,7 @@ diragain:
|
||||
*/
|
||||
|
||||
if (en == 0 && pdp == dp) {
|
||||
dp = (struct dirent *)
|
||||
((caddr_t)dp + dp->d_reclen);
|
||||
dp = _DIRENT_NEXT(dp);
|
||||
enn++;
|
||||
}
|
||||
|
||||
@ -361,14 +361,14 @@ diragain:
|
||||
} else
|
||||
n = bp->b_bcount - bp->b_resid - on;
|
||||
|
||||
ep = bp->b_data + on + n;
|
||||
ep = (struct dirent *)(void *)(bp->b_data + on + n);
|
||||
|
||||
/*
|
||||
* Find last complete entry to copy, caching entries
|
||||
* (if requested) as we go.
|
||||
*/
|
||||
|
||||
while ((caddr_t)dp < ep && (caddr_t)dp + dp->d_reclen <= ep) {
|
||||
while (dp < ep && (struct dirent *)_DIRENT_NEXT(dp) <= ep) {
|
||||
if (cflag & NFSBIO_CACHECOOKIES) {
|
||||
nndp = nfs_enterdircache(vp, NFS_GETCOOKIE(pdp),
|
||||
ndp->dc_blkcookie, enn, bp->b_lblkno);
|
||||
@ -379,7 +379,7 @@ diragain:
|
||||
nfs_putdircache(np, nndp);
|
||||
}
|
||||
pdp = dp;
|
||||
dp = (struct dirent *)((caddr_t)dp + dp->d_reclen);
|
||||
dp = _DIRENT_NEXT(dp);
|
||||
enn++;
|
||||
}
|
||||
nfs_putdircache(np, ndp);
|
||||
@ -415,7 +415,7 @@ diragain:
|
||||
}
|
||||
}
|
||||
|
||||
n = ((caddr_t)pdp + pdp->d_reclen) - (bp->b_data + on);
|
||||
n = (char *)_DIRENT_NEXT(pdp) - (bp->b_data + on);
|
||||
|
||||
/*
|
||||
* If not eof and read aheads are enabled, start one.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_vnops.c,v 1.224 2005/07/21 10:39:46 yamt Exp $ */
|
||||
/* $NetBSD: nfs_vnops.c,v 1.225 2005/08/19 02:04:04 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -39,7 +39,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.224 2005/07/21 10:39:46 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.225 2005/08/19 02:04:04 christos Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_nfs.h"
|
||||
@ -262,7 +262,11 @@ extern u_int32_t nfs_xdrneg1;
|
||||
extern const nfstype nfsv3_type[9];
|
||||
|
||||
int nfs_numasync = 0;
|
||||
#define DIRHDSIZ (sizeof (struct dirent) - (MAXNAMLEN + 1))
|
||||
#define DIRHDSIZ _DIRENT_NAMEOFF(dp)
|
||||
#define UIO_ADVANCE(uio, siz) \
|
||||
(void)((uio)->uio_resid -= (siz), \
|
||||
(uio)->uio_iov->iov_base = (char *)(uio)->uio_iov->iov_base + (siz), \
|
||||
(uio)->uio_iov->iov_len -= (siz))
|
||||
|
||||
static void nfs_cache_enter(struct vnode *, struct vnode *,
|
||||
struct componentname *);
|
||||
@ -1443,10 +1447,8 @@ retry:
|
||||
mb = m;
|
||||
bpos = mtod(caddr_t, mb) + mb->m_len;
|
||||
#endif
|
||||
iovp->iov_base = (char *)iovp->iov_base + len;
|
||||
iovp->iov_len -= len;
|
||||
UIO_ADVANCE(uiop, len);
|
||||
uiop->uio_offset += len;
|
||||
uiop->uio_resid -= len;
|
||||
s = splvm();
|
||||
simple_lock(&ctx.nwc_slock);
|
||||
ctx.nwc_mbufcount++;
|
||||
@ -1471,12 +1473,8 @@ retry:
|
||||
break;
|
||||
} else if (rlen < len) {
|
||||
backup = len - rlen;
|
||||
uiop->uio_iov->iov_base =
|
||||
(caddr_t)uiop->uio_iov->iov_base -
|
||||
backup;
|
||||
uiop->uio_iov->iov_len += backup;
|
||||
UIO_ADVANCE(uiop, -backup);
|
||||
uiop->uio_offset -= backup;
|
||||
uiop->uio_resid += backup;
|
||||
len = rlen;
|
||||
}
|
||||
commit = fxdr_unsigned(int, *tl++);
|
||||
@ -1536,11 +1534,8 @@ retry:
|
||||
* then, we should resend them to nfsd.
|
||||
*/
|
||||
backup = origresid - tsiz;
|
||||
uiop->uio_iov->iov_base =
|
||||
(caddr_t)uiop->uio_iov->iov_base - backup;
|
||||
uiop->uio_iov->iov_len += backup;
|
||||
UIO_ADVANCE(uiop, -backup);
|
||||
uiop->uio_offset -= backup;
|
||||
uiop->uio_resid += backup;
|
||||
tsiz = origresid;
|
||||
goto retry;
|
||||
}
|
||||
@ -2557,7 +2552,7 @@ nfs_readdirrpc(vp, uiop, cred)
|
||||
struct nfsmount *nmp = VFSTONFS(vp->v_mount);
|
||||
struct nfsnode *dnp = VTONFS(vp);
|
||||
u_quad_t fileno;
|
||||
int error = 0, tlen, more_dirs = 1, blksiz = 0, bigenough = 1;
|
||||
int error = 0, more_dirs = 1, blksiz = 0, bigenough = 1;
|
||||
#ifndef NFS_V2_ONLY
|
||||
int attrflag;
|
||||
#endif
|
||||
@ -2651,47 +2646,34 @@ nfs_readdirrpc(vp, uiop, cred)
|
||||
m_freem(mrep);
|
||||
goto nfsmout;
|
||||
}
|
||||
tlen = nfsm_rndup(len);
|
||||
if (tlen == len)
|
||||
tlen += 4; /* To ensure null termination */
|
||||
tlen += sizeof (off_t) + sizeof (int);
|
||||
reclen = ALIGN(tlen + DIRHDSIZ);
|
||||
tlen = reclen - DIRHDSIZ;
|
||||
/* for cookie stashing */
|
||||
reclen = _DIRENT_RECLEN(dp, len) + 2 * sizeof(off_t);
|
||||
left = NFS_DIRFRAGSIZ - blksiz;
|
||||
if (reclen > left) {
|
||||
memset(uiop->uio_iov->iov_base, 0, left);
|
||||
dp->d_reclen += left;
|
||||
uiop->uio_iov->iov_base =
|
||||
(caddr_t)uiop->uio_iov->iov_base + left;
|
||||
uiop->uio_iov->iov_len -= left;
|
||||
uiop->uio_resid -= left;
|
||||
UIO_ADVANCE(uiop, left);
|
||||
blksiz = 0;
|
||||
NFS_STASHCOOKIE(dp, uiop->uio_offset);
|
||||
}
|
||||
if (reclen > uiop->uio_resid)
|
||||
bigenough = 0;
|
||||
if (bigenough) {
|
||||
int tlen;
|
||||
|
||||
dp = (struct dirent *)uiop->uio_iov->iov_base;
|
||||
dp->d_fileno = (int)fileno;
|
||||
dp->d_fileno = fileno;
|
||||
dp->d_namlen = len;
|
||||
dp->d_reclen = reclen;
|
||||
dp->d_type = DT_UNKNOWN;
|
||||
blksiz += dp->d_reclen;
|
||||
blksiz += reclen;
|
||||
if (blksiz == NFS_DIRFRAGSIZ)
|
||||
blksiz = 0;
|
||||
uiop->uio_resid -= DIRHDSIZ;
|
||||
uiop->uio_iov->iov_base =
|
||||
(caddr_t)uiop->uio_iov->iov_base + DIRHDSIZ;
|
||||
uiop->uio_iov->iov_len -= DIRHDSIZ;
|
||||
UIO_ADVANCE(uiop, DIRHDSIZ);
|
||||
nfsm_mtouio(uiop, len);
|
||||
tlen -= len;
|
||||
/* null terminate */
|
||||
KDASSERT(tlen > 0);
|
||||
memset(uiop->uio_iov->iov_base, 0, tlen);
|
||||
uiop->uio_iov->iov_base =
|
||||
(caddr_t)uiop->uio_iov->iov_base + tlen;
|
||||
uiop->uio_iov->iov_len -= tlen;
|
||||
uiop->uio_resid -= tlen;
|
||||
tlen = reclen - (DIRHDSIZ + len);
|
||||
(void)memset(uiop->uio_iov->iov_base, 0, tlen);
|
||||
UIO_ADVANCE(uiop, tlen);
|
||||
} else
|
||||
nfsm_adv(nfsm_rndup(len));
|
||||
#ifndef NFS_V2_ONLY
|
||||
@ -2757,10 +2739,7 @@ nfs_readdirrpc(vp, uiop, cred)
|
||||
memset(uiop->uio_iov->iov_base, 0, left);
|
||||
dp->d_reclen += left;
|
||||
NFS_STASHCOOKIE(dp, uiop->uio_offset);
|
||||
uiop->uio_iov->iov_base = (caddr_t)uiop->uio_iov->iov_base +
|
||||
left;
|
||||
uiop->uio_iov->iov_len -= left;
|
||||
uiop->uio_resid -= left;
|
||||
UIO_ADVANCE(uiop, left);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2799,7 +2778,7 @@ nfs_readdirplusrpc(vp, uiop, cred)
|
||||
struct nfsnode *dnp = VTONFS(vp), *np;
|
||||
nfsfh_t *fhp;
|
||||
u_quad_t fileno;
|
||||
int error = 0, tlen, more_dirs = 1, blksiz = 0, doit, bigenough = 1, i;
|
||||
int error = 0, more_dirs = 1, blksiz = 0, doit, bigenough = 1, i;
|
||||
int attrflag, fhsize, nrpcs = 0, reclen;
|
||||
struct nfs_fattr fattr, *fp;
|
||||
|
||||
@ -2857,12 +2836,8 @@ nfs_readdirplusrpc(vp, uiop, cred)
|
||||
m_freem(mrep);
|
||||
goto nfsmout;
|
||||
}
|
||||
tlen = nfsm_rndup(len);
|
||||
if (tlen == len)
|
||||
tlen += 4; /* To ensure null termination*/
|
||||
tlen += sizeof (off_t) + sizeof (int);
|
||||
reclen = ALIGN(tlen + DIRHDSIZ);
|
||||
tlen = reclen - DIRHDSIZ;
|
||||
/* for cookie stashing */
|
||||
reclen = _DIRENT_RECLEN(dp, len) * 2 * sizeof(off_t);
|
||||
left = NFS_DIRFRAGSIZ - blksiz;
|
||||
if (reclen > left) {
|
||||
/*
|
||||
@ -2871,40 +2846,30 @@ nfs_readdirplusrpc(vp, uiop, cred)
|
||||
*/
|
||||
memset(uiop->uio_iov->iov_base, 0, left);
|
||||
dp->d_reclen += left;
|
||||
uiop->uio_iov->iov_base =
|
||||
(caddr_t)uiop->uio_iov->iov_base + left;
|
||||
uiop->uio_iov->iov_len -= left;
|
||||
uiop->uio_resid -= left;
|
||||
UIO_ADVANCE(uiop, left);
|
||||
NFS_STASHCOOKIE(dp, uiop->uio_offset);
|
||||
blksiz = 0;
|
||||
}
|
||||
if (reclen > uiop->uio_resid)
|
||||
bigenough = 0;
|
||||
if (bigenough) {
|
||||
int tlen;
|
||||
|
||||
dp = (struct dirent *)uiop->uio_iov->iov_base;
|
||||
dp->d_fileno = (int)fileno;
|
||||
dp->d_fileno = fileno;
|
||||
dp->d_namlen = len;
|
||||
dp->d_reclen = reclen;
|
||||
dp->d_type = DT_UNKNOWN;
|
||||
blksiz += dp->d_reclen;
|
||||
blksiz += reclen;
|
||||
if (blksiz == NFS_DIRFRAGSIZ)
|
||||
blksiz = 0;
|
||||
uiop->uio_resid -= DIRHDSIZ;
|
||||
uiop->uio_iov->iov_base =
|
||||
(caddr_t)uiop->uio_iov->iov_base +
|
||||
DIRHDSIZ;
|
||||
uiop->uio_iov->iov_len -= DIRHDSIZ;
|
||||
cnp->cn_nameptr = uiop->uio_iov->iov_base;
|
||||
cnp->cn_namelen = len;
|
||||
UIO_ADVANCE(uiop, DIRHDSIZ);
|
||||
nfsm_mtouio(uiop, len);
|
||||
tlen -= len;
|
||||
/* null terminate */
|
||||
KDASSERT(tlen > 0);
|
||||
memset(uiop->uio_iov->iov_base, 0, tlen);
|
||||
uiop->uio_iov->iov_base =
|
||||
(caddr_t)uiop->uio_iov->iov_base + tlen;
|
||||
uiop->uio_iov->iov_len -= tlen;
|
||||
uiop->uio_resid -= tlen;
|
||||
tlen = reclen - (DIRHDSIZ + len);
|
||||
(void)memset(uiop->uio_iov->iov_base, 0, tlen);
|
||||
UIO_ADVANCE(uiop, tlen);
|
||||
cnp->cn_nameptr = dp->d_name;
|
||||
cnp->cn_namelen = dp->d_namlen;
|
||||
} else
|
||||
nfsm_adv(nfsm_rndup(len));
|
||||
nfsm_dissect(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
|
||||
@ -3003,10 +2968,7 @@ nfs_readdirplusrpc(vp, uiop, cred)
|
||||
memset(uiop->uio_iov->iov_base, 0, left);
|
||||
dp->d_reclen += left;
|
||||
NFS_STASHCOOKIE(dp, uiop->uio_offset);
|
||||
uiop->uio_iov->iov_base = (caddr_t)uiop->uio_iov->iov_base +
|
||||
left;
|
||||
uiop->uio_iov->iov_len -= left;
|
||||
uiop->uio_resid -= left;
|
||||
UIO_ADVANCE(uiop, left);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3480,8 +3442,8 @@ nfs_print(v)
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
|
||||
printf("tag VT_NFS, fileid %ld fsid 0x%lx",
|
||||
np->n_vattr->va_fileid, np->n_vattr->va_fsid);
|
||||
printf("tag VT_NFS, fileid %lld fsid 0x%lx",
|
||||
(unsigned long long)np->n_vattr->va_fileid, np->n_vattr->va_fsid);
|
||||
if (vp->v_type == VFIFO)
|
||||
fifo_printinfo(vp);
|
||||
printf("\n");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dirent.h,v 1.18 2004/12/30 19:43:25 bjh21 Exp $ */
|
||||
/* $NetBSD: dirent.h,v 1.19 2005/08/19 02:04:04 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
/*
|
||||
* The dirent structure defines the format of directory entries returned by
|
||||
* the getdirentries(2) system call.
|
||||
* the getdents(2) system call.
|
||||
*
|
||||
* A directory entry has a struct dirent at the front of it, containing its
|
||||
* inode number, the length of the entry, and the length of the name
|
||||
@ -46,17 +46,16 @@
|
||||
* byte boundary with null bytes. All names are guaranteed null terminated.
|
||||
* The maximum length of a name in a directory is MAXNAMLEN.
|
||||
*/
|
||||
|
||||
struct dirent {
|
||||
u_int32_t d_fileno; /* file number of entry */
|
||||
ino_t d_fileno; /* file number of entry */
|
||||
u_int16_t d_reclen; /* length of this record */
|
||||
u_int16_t d_namlen; /* length of string in d_name */
|
||||
u_int8_t d_type; /* file type, see below */
|
||||
u_int8_t d_namlen; /* length of string in d_name */
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
#define MAXNAMLEN 255
|
||||
#define MAXNAMLEN 511
|
||||
char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
|
||||
#else
|
||||
char d_name[255 + 1]; /* name must be no longer than this */
|
||||
char d_name[511 + 1]; /* name must be no longer than this */
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -74,21 +73,59 @@ struct dirent {
|
||||
#define DT_SOCK 12
|
||||
#define DT_WHT 14
|
||||
|
||||
/*
|
||||
* The _DIRENT_ALIGN macro returns the alignment of struct dirent.
|
||||
* struct direct and struct dirent12 used 4 byte alignment but
|
||||
* struct dirent uses 16. We deduce the alignment by checking the
|
||||
* size of the d_namlen field which used to be u_int8_t in the former
|
||||
* two and is u_int16_t now.
|
||||
*/
|
||||
#define _DIRENT_ALIGN(dp) \
|
||||
(/*CONSTCOND*/sizeof((dp)->d_namlen) == sizeof(uint8_t) ? 0x3 : 0xf)
|
||||
/*
|
||||
* The _DIRENT_NAMEOFF macro returns the offset of the d_name field in
|
||||
* struct dirent
|
||||
*/
|
||||
#define _DIRENT_NAMEOFF(dp) \
|
||||
((char *)(void *)&(dp)->d_name - (char *)(void *)dp)
|
||||
/*
|
||||
* The _DIRENT_RECLEN macro gives the minimum record length which will hold
|
||||
* a name of size "namlen". This requires the amount of space in struct dirent
|
||||
* without the d_name field, plus enough space for the name with a terminating
|
||||
* null byte (namlen+1), rounded up to a the appropriate byte boundary.
|
||||
*/
|
||||
#define _DIRENT_RECLEN(dp, namlen) \
|
||||
((_DIRENT_NAMEOFF(dp) + (namlen) + 1 + _DIRENT_ALIGN(dp)) & \
|
||||
~_DIRENT_ALIGN(dp))
|
||||
/*
|
||||
* The _DIRENT_SIZE macro returns the minimum record length required for
|
||||
* name name stored in the current record.
|
||||
*/
|
||||
#define _DIRENT_SIZE(dp) _DIRENT_RECLEN(dp, (dp)->d_namlen)
|
||||
/*
|
||||
* The _DIRENT_NEXT macro advances to the next dirent record.
|
||||
*/
|
||||
#define _DIRENT_NEXT(dp) ((void *)((char *)(void *)(dp) + (dp)->d_reclen))
|
||||
/*
|
||||
* The _DIRENT_MINSIZE returns the size of an empty (invalid) record.
|
||||
*/
|
||||
#define _DIRENT_MINSIZE(dp) _DIRENT_RECLEN(dp, 0)
|
||||
|
||||
/*
|
||||
* Convert between stat structure types and directory types.
|
||||
*/
|
||||
#define IFTODT(mode) (((mode) & 0170000) >> 12)
|
||||
#define DTTOIF(dirtype) ((dirtype) << 12)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The DIRENT_SIZE macro gives the minimum record length which will hold
|
||||
* the directory entry. This requires the amount of space in struct dirent
|
||||
* without the d_name field, plus enough space for the name with a terminating
|
||||
* null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
|
||||
*/
|
||||
#define DIRENT_SIZE(dp) \
|
||||
((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
|
||||
|
||||
#endif /* defined(_NETBSD_SOURCE) */
|
||||
#if defined(__LIBC12_SOURCE__) || defined(_KERNEL)
|
||||
struct dirent12 {
|
||||
u_int32_t d_fileno; /* file number of entry */
|
||||
u_int16_t d_reclen; /* length of this record */
|
||||
u_int8_t d_type; /* file type, see below */
|
||||
u_int8_t d_namlen; /* length of string in d_name */
|
||||
char d_name[255 + 1]; /* name must be no longer than this */
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* !_SYS_DIRENT_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: stat.h,v 1.48 2005/02/03 19:20:02 perry Exp $ */
|
||||
/* $NetBSD: stat.h,v 1.49 2005/08/19 02:04:04 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
@ -49,7 +49,7 @@
|
||||
#ifdef _KERNEL
|
||||
struct stat43 { /* BSD-4.3 stat struct */
|
||||
u_int16_t st_dev; /* inode's device */
|
||||
ino_t st_ino; /* inode's number */
|
||||
u_int32_t st_ino; /* inode's number */
|
||||
u_int16_t st_mode; /* inode protection mode */
|
||||
u_int16_t st_nlink; /* number of hard links */
|
||||
u_int16_t st_uid; /* user ID of the file's owner */
|
||||
@ -66,10 +66,24 @@ struct stat43 { /* BSD-4.3 stat struct */
|
||||
};
|
||||
#endif /* defined(_KERNEL) */
|
||||
|
||||
/*
|
||||
* On systems with 8 byte longs and 4 byte time_ts, padding the time_ts
|
||||
* is required in order to have a consistent ABI. This is because the
|
||||
* stat structure used to contain timespecs, which had different
|
||||
* alignment constraints than a time_t and a long alone. The padding
|
||||
* should be removed the next time the stat structure ABI is changed.
|
||||
* (This will happen whever we change to 8 byte time_t.)
|
||||
*/
|
||||
#if defined(_LP64) /* XXXX && _BSD_TIME_T_ == int */
|
||||
#define __STATPAD(x) int x;
|
||||
#else
|
||||
#define __STATPAD(x) /* nothing */
|
||||
#endif
|
||||
|
||||
#if defined(__LIBC12_SOURCE__) || defined(_KERNEL)
|
||||
struct stat12 { /* NetBSD-1.2 stat struct */
|
||||
dev_t st_dev; /* inode's device */
|
||||
ino_t st_ino; /* inode's number */
|
||||
u_int32_t st_ino; /* inode's number */
|
||||
u_int16_t st_mode; /* inode protection mode */
|
||||
u_int16_t st_nlink; /* number of hard links */
|
||||
uid_t st_uid; /* user ID of the file's owner */
|
||||
@ -86,25 +100,9 @@ struct stat12 { /* NetBSD-1.2 stat struct */
|
||||
int32_t st_lspare;
|
||||
int64_t st_qspare[2];
|
||||
};
|
||||
#endif /* defined(__LIBC12_SOURCE__) || defined(_KERNEL) */
|
||||
|
||||
/*
|
||||
* On systems with 8 byte longs and 4 byte time_ts, padding the time_ts
|
||||
* is required in order to have a consistent ABI. This is because the
|
||||
* stat structure used to contain timespecs, which had different
|
||||
* alignment constraints than a time_t and a long alone. The padding
|
||||
* should be removed the next time the stat structure ABI is changed.
|
||||
* (This will happen whever we change to 8 byte time_t.)
|
||||
*/
|
||||
#if defined(_LP64) /* XXXX && _BSD_TIME_T_ == int */
|
||||
#define __STATPAD(x) int x;
|
||||
#else
|
||||
#define __STATPAD(x) /* nothing */
|
||||
#endif
|
||||
|
||||
struct stat {
|
||||
struct stat13 {
|
||||
dev_t st_dev; /* inode's device */
|
||||
ino_t st_ino; /* inode's number */
|
||||
uint32_t st_ino; /* inode's number */
|
||||
mode_t st_mode; /* inode protection mode */
|
||||
nlink_t st_nlink; /* number of hard links */
|
||||
uid_t st_uid; /* user ID of the file's owner */
|
||||
@ -144,6 +142,45 @@ struct stat {
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* defined(__LIBC12_SOURCE__) || defined(_KERNEL) */
|
||||
|
||||
|
||||
struct stat {
|
||||
dev_t st_dev; /* inode's device */
|
||||
mode_t st_mode; /* inode protection mode */
|
||||
ino_t st_ino; /* inode's number */
|
||||
nlink_t st_nlink; /* number of hard links */
|
||||
uid_t st_uid; /* user ID of the file's owner */
|
||||
gid_t st_gid; /* group ID of the file's group */
|
||||
dev_t st_rdev; /* device type */
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
struct timespec st_atimespec;/* time of last access */
|
||||
struct timespec st_mtimespec;/* time of last data modification */
|
||||
struct timespec st_ctimespec;/* time of last file status change */
|
||||
struct timespec st_birthtimespec; /* time of creation */
|
||||
#else
|
||||
__STATPAD(__pad0)
|
||||
time_t st_atime; /* time of last access */
|
||||
__STATPAD(__pad1)
|
||||
long st_atimensec; /* nsec of last access */
|
||||
time_t st_mtime; /* time of last data modification */
|
||||
__STATPAD(__pad2)
|
||||
long st_mtimensec; /* nsec of last data modification */
|
||||
time_t st_ctime; /* time of last file status change */
|
||||
__STATPAD(__pad3)
|
||||
long st_ctimensec; /* nsec of last file status change */
|
||||
time_t st_birthtime; /* time of creation */
|
||||
__STATPAD(__pad4)
|
||||
long st_birthtimensec; /* nsec of time of creation */
|
||||
#endif
|
||||
off_t st_size; /* file size, in bytes */
|
||||
blkcnt_t st_blocks; /* blocks allocated for file */
|
||||
blksize_t st_blksize; /* optimal blocksize for I/O */
|
||||
u_int32_t st_flags; /* user defined flags for file */
|
||||
u_int32_t st_gen; /* file generation number */
|
||||
u_int32_t st_spare[2];
|
||||
};
|
||||
|
||||
#undef __STATPAD
|
||||
|
||||
#if defined(_NETBSD_SOURCE)
|
||||
@ -282,20 +319,23 @@ int mkfifo(const char *, mode_t);
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
int stat(const char *, struct stat12 *);
|
||||
int fstat(int, struct stat12 *);
|
||||
int __stat13(const char *, struct stat *);
|
||||
int __fstat13(int, struct stat *);
|
||||
int __stat13(const char *, struct stat13 *);
|
||||
int __fstat13(int, struct stat13 *);
|
||||
int __stat30(const char *, struct stat *);
|
||||
int __fstat30(int, struct stat *);
|
||||
#else
|
||||
int stat(const char *, struct stat *) __RENAME(__stat13);
|
||||
int fstat(int, struct stat *) __RENAME(__fstat13);
|
||||
int stat(const char *, struct stat *) __RENAME(__stat30);
|
||||
int fstat(int, struct stat *) __RENAME(__fstat30);
|
||||
#endif
|
||||
mode_t umask(mode_t);
|
||||
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
int fchmod(int, mode_t);
|
||||
#ifdef __LIBC12_SOURCE__
|
||||
int lstat(const char *, struct stat12 *);
|
||||
int __lstat13(const char *, struct stat *);
|
||||
int __lstat13(const char *, struct stat13 *);
|
||||
int __lstat30(const char *, struct stat *);
|
||||
#else
|
||||
int lstat(const char *, struct stat *) __RENAME(__lstat13);
|
||||
int lstat(const char *, struct stat *) __RENAME(__lstat30);
|
||||
#endif
|
||||
int mknod(const char *, mode_t, dev_t);
|
||||
#endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: syscall.h,v 1.158 2005/07/10 22:05:24 thorpej Exp $ */
|
||||
/* $NetBSD: syscall.h,v 1.159 2005/08/19 02:04:04 christos Exp $ */
|
||||
|
||||
/*
|
||||
* System call numbers.
|
||||
@ -771,8 +771,8 @@
|
||||
/* syscall: "swapctl" ret: "int" args: "int" "void *" "int" */
|
||||
#define SYS_swapctl 271
|
||||
|
||||
/* syscall: "getdents" ret: "int" args: "int" "char *" "size_t" */
|
||||
#define SYS_getdents 272
|
||||
/* syscall: "compat_30_getdents" ret: "int" args: "int" "char *" "size_t" */
|
||||
#define SYS_compat_30_getdents 272
|
||||
|
||||
/* syscall: "minherit" ret: "int" args: "void *" "size_t" "int" */
|
||||
#define SYS_minherit 273
|
||||
@ -789,14 +789,14 @@
|
||||
/* syscall: "__msync13" ret: "int" args: "void *" "size_t" "int" */
|
||||
#define SYS___msync13 277
|
||||
|
||||
/* syscall: "__stat13" ret: "int" args: "const char *" "struct stat *" */
|
||||
#define SYS___stat13 278
|
||||
/* syscall: "compat_30___stat13" ret: "int" args: "const char *" "struct stat30 *" */
|
||||
#define SYS_compat_30___stat13 278
|
||||
|
||||
/* syscall: "__fstat13" ret: "int" args: "int" "struct stat *" */
|
||||
#define SYS___fstat13 279
|
||||
/* syscall: "compat_30___fstat13" ret: "int" args: "int" "struct stat30 *" */
|
||||
#define SYS_compat_30___fstat13 279
|
||||
|
||||
/* syscall: "__lstat13" ret: "int" args: "const char *" "struct stat *" */
|
||||
#define SYS___lstat13 280
|
||||
/* syscall: "compat_30___lstat13" ret: "int" args: "const char *" "struct stat30 *" */
|
||||
#define SYS_compat_30___lstat13 280
|
||||
|
||||
/* syscall: "__sigaltstack14" ret: "int" args: "const struct sigaltstack *" "struct sigaltstack *" */
|
||||
#define SYS___sigaltstack14 281
|
||||
@ -1061,5 +1061,17 @@
|
||||
/* syscall: "fremovexattr" ret: "int" args: "int" "const char *" */
|
||||
#define SYS_fremovexattr 386
|
||||
|
||||
#define SYS_MAXSYSCALL 387
|
||||
/* syscall: "__stat30" ret: "int" args: "const char *" "struct stat *" */
|
||||
#define SYS___stat30 387
|
||||
|
||||
/* syscall: "__fstat30" ret: "int" args: "int" "struct stat *" */
|
||||
#define SYS___fstat30 388
|
||||
|
||||
/* syscall: "__lstat30" ret: "int" args: "const char *" "struct stat *" */
|
||||
#define SYS___lstat30 389
|
||||
|
||||
/* syscall: "__getdents30" ret: "int" args: "int" "char *" "size_t" */
|
||||
#define SYS___getdents30 390
|
||||
|
||||
#define SYS_MAXSYSCALL 391
|
||||
#define SYS_NSYSENT 512
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: syscallargs.h,v 1.140 2005/07/10 22:05:24 thorpej Exp $ */
|
||||
/* $NetBSD: syscallargs.h,v 1.141 2005/08/19 02:04:04 christos Exp $ */
|
||||
|
||||
/*
|
||||
* System call argument lists.
|
||||
@ -1157,7 +1157,7 @@ struct sys_swapctl_args {
|
||||
syscallarg(int) misc;
|
||||
};
|
||||
|
||||
struct sys_getdents_args {
|
||||
struct compat_30_sys_getdents_args {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(char *) buf;
|
||||
syscallarg(size_t) count;
|
||||
@ -1191,19 +1191,19 @@ struct sys___msync13_args {
|
||||
syscallarg(int) flags;
|
||||
};
|
||||
|
||||
struct sys___stat13_args {
|
||||
struct compat_30_sys___stat13_args {
|
||||
syscallarg(const char *) path;
|
||||
syscallarg(struct stat *) ub;
|
||||
syscallarg(struct stat30 *) ub;
|
||||
};
|
||||
|
||||
struct sys___fstat13_args {
|
||||
struct compat_30_sys___fstat13_args {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(struct stat *) sb;
|
||||
syscallarg(struct stat30 *) sb;
|
||||
};
|
||||
|
||||
struct sys___lstat13_args {
|
||||
struct compat_30_sys___lstat13_args {
|
||||
syscallarg(const char *) path;
|
||||
syscallarg(struct stat *) ub;
|
||||
syscallarg(struct stat30 *) ub;
|
||||
};
|
||||
|
||||
struct sys___sigaltstack14_args {
|
||||
@ -1666,6 +1666,27 @@ struct sys_fremovexattr_args {
|
||||
syscallarg(const char *) name;
|
||||
};
|
||||
|
||||
struct sys___stat30_args {
|
||||
syscallarg(const char *) path;
|
||||
syscallarg(struct stat *) ub;
|
||||
};
|
||||
|
||||
struct sys___fstat30_args {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(struct stat *) sb;
|
||||
};
|
||||
|
||||
struct sys___lstat30_args {
|
||||
syscallarg(const char *) path;
|
||||
syscallarg(struct stat *) ub;
|
||||
};
|
||||
|
||||
struct sys___getdents30_args {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(char *) buf;
|
||||
syscallarg(size_t) count;
|
||||
};
|
||||
|
||||
/*
|
||||
* System call prototypes.
|
||||
*/
|
||||
@ -2159,7 +2180,7 @@ int sys___posix_rename(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys_swapctl(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys_getdents(struct lwp *, void *, register_t *);
|
||||
int compat_30_sys_getdents(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys_minherit(struct lwp *, void *, register_t *);
|
||||
|
||||
@ -2171,11 +2192,11 @@ int sys_lutimes(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys___msync13(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys___stat13(struct lwp *, void *, register_t *);
|
||||
int compat_30_sys___stat13(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys___fstat13(struct lwp *, void *, register_t *);
|
||||
int compat_30_sys___fstat13(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys___lstat13(struct lwp *, void *, register_t *);
|
||||
int compat_30_sys___lstat13(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys___sigaltstack14(struct lwp *, void *, register_t *);
|
||||
|
||||
@ -2353,4 +2374,12 @@ int sys_lremovexattr(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys_fremovexattr(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys___stat30(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys___fstat30(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys___lstat30(struct lwp *, void *, register_t *);
|
||||
|
||||
int sys___getdents30(struct lwp *, void *, register_t *);
|
||||
|
||||
#endif /* _SYS__SYSCALLARGS_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: types.h,v 1.67 2005/05/22 12:44:24 kleink Exp $ */
|
||||
/* $NetBSD: types.h,v 1.68 2005/08/19 02:04:04 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1991, 1993, 1994
|
||||
@ -162,7 +162,7 @@ typedef __gid_t gid_t; /* group id */
|
||||
#endif
|
||||
|
||||
typedef uint32_t id_t; /* group id, process id or user id */
|
||||
typedef uint32_t ino_t; /* inode number */
|
||||
typedef uint64_t ino_t; /* inode number */
|
||||
typedef long key_t; /* IPC key (for Sys V IPC) */
|
||||
|
||||
#ifndef mode_t
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vnode.h,v 1.141 2005/07/23 12:18:41 yamt Exp $ */
|
||||
/* $NetBSD: vnode.h,v 1.142 2005/08/19 02:04:04 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -191,7 +191,7 @@ struct vattr {
|
||||
uid_t va_uid; /* owner user id */
|
||||
gid_t va_gid; /* owner group id */
|
||||
long va_fsid; /* file system id (dev for now) */
|
||||
long va_fileid; /* file id */
|
||||
ino_t va_fileid; /* file id */
|
||||
u_quad_t va_size; /* file size in bytes */
|
||||
long va_blocksize; /* blocksize preferred for i/o */
|
||||
struct timespec va_atime; /* time of last access */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs_alloc.c,v 1.24 2005/05/29 21:25:24 christos Exp $ */
|
||||
/* $NetBSD: ext2fs_alloc.c,v 1.25 2005/08/19 02:04:08 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
@ -65,7 +65,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.24 2005/05/29 21:25:24 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.25 2005/08/19 02:04:08 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -205,8 +205,9 @@ ext2fs_valloc(v)
|
||||
}
|
||||
ip = VTOI(*ap->a_vpp);
|
||||
if (ip->i_e2fs_mode && ip->i_e2fs_nlink != 0) {
|
||||
printf("mode = 0%o, nlinks %d, inum = %d, fs = %s\n",
|
||||
ip->i_e2fs_mode, ip->i_e2fs_nlink, ip->i_number, fs->e2fs_fsmnt);
|
||||
printf("mode = 0%o, nlinks %d, inum = %llu, fs = %s\n",
|
||||
ip->i_e2fs_mode, ip->i_e2fs_nlink,
|
||||
(unsigned long long)ip->i_number, fs->e2fs_fsmnt);
|
||||
panic("ext2fs_valloc: dup alloc");
|
||||
}
|
||||
|
||||
@ -537,8 +538,8 @@ ext2fs_blkfree(ip, bno)
|
||||
fs = ip->i_e2fs;
|
||||
cg = dtog(fs, bno);
|
||||
if ((u_int)bno >= fs->e2fs.e2fs_bcount) {
|
||||
printf("bad block %lld, ino %d\n", (long long)bno,
|
||||
ip->i_number);
|
||||
printf("bad block %lld, ino %llu\n", (long long)bno,
|
||||
(unsigned long long)ip->i_number);
|
||||
ext2fs_fserr(fs, ip->i_e2fs_uid, "bad block");
|
||||
return;
|
||||
}
|
||||
@ -588,8 +589,8 @@ ext2fs_vfree(v)
|
||||
pip = VTOI(ap->a_pvp);
|
||||
fs = pip->i_e2fs;
|
||||
if ((u_int)ino >= fs->e2fs.e2fs_icount || (u_int)ino < EXT2_FIRSTINO)
|
||||
panic("ifree: range: dev = 0x%x, ino = %d, fs = %s",
|
||||
pip->i_dev, ino, fs->e2fs_fsmnt);
|
||||
panic("ifree: range: dev = 0x%x, ino = %llu, fs = %s",
|
||||
pip->i_dev, (unsigned long long)ino, fs->e2fs_fsmnt);
|
||||
cg = ino_to_cg(fs, ino);
|
||||
error = bread(pip->i_devvp,
|
||||
fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap),
|
||||
@ -601,8 +602,8 @@ ext2fs_vfree(v)
|
||||
ibp = (char *)bp->b_data;
|
||||
ino = (ino - 1) % fs->e2fs.e2fs_ipg;
|
||||
if (isclr(ibp, ino)) {
|
||||
printf("dev = 0x%x, ino = %d, fs = %s\n",
|
||||
pip->i_dev, ino, fs->e2fs_fsmnt);
|
||||
printf("dev = 0x%x, ino = %llu, fs = %s\n",
|
||||
pip->i_dev, (unsigned long long)ino, fs->e2fs_fsmnt);
|
||||
if (fs->e2fs_ronly == 0)
|
||||
panic("ifree: freeing free inode");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs_lookup.c,v 1.34 2005/06/28 16:53:14 kml Exp $ */
|
||||
/* $NetBSD: ext2fs_lookup.c,v 1.35 2005/08/19 02:04:08 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Modified for NetBSD 1.2E
|
||||
@ -48,7 +48,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.34 2005/06/28 16:53:14 kml Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.35 2005/08/19 02:04:08 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -112,7 +112,7 @@ ext2fs_dirconv2ffs( e2dir, ffsdir)
|
||||
nothing anyway, we compute our own reclen according to what
|
||||
we think is right
|
||||
*/
|
||||
ffsdir->d_reclen = DIRENT_SIZE(ffsdir);
|
||||
ffsdir->d_reclen = _DIRENT_SIZE(ffsdir);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_alloc.c,v 1.85 2005/07/15 05:01:16 thorpej Exp $ */
|
||||
/* $NetBSD: ffs_alloc.c,v 1.86 2005/08/19 02:04:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Networks Associates Technology, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.85 2005/07/15 05:01:16 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.86 2005/08/19 02:04:09 christos Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -700,7 +700,8 @@ ffs_valloc(void *v)
|
||||
DIP(ip, gen), ip->i_gen);
|
||||
printf("size %llx blocks %llx\n",
|
||||
(long long)DIP(ip, size), (long long)DIP(ip, blocks));
|
||||
printf("ino %u ipref %u\n", ino, ipref);
|
||||
printf("ino %llu ipref %llu\n", (unsigned long long)ino,
|
||||
(unsigned long long)ipref);
|
||||
#if 0
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)),
|
||||
(int)fs->fs_bsize, NOCRED, &bp);
|
||||
@ -710,8 +711,8 @@ ffs_valloc(void *v)
|
||||
panic("ffs_valloc: dup alloc");
|
||||
}
|
||||
if (DIP(ip, blocks)) { /* XXX */
|
||||
printf("free inode %s/%d had %" PRId64 " blocks\n",
|
||||
fs->fs_fsmnt, ino, DIP(ip, blocks));
|
||||
printf("free inode %s/%llu had %" PRId64 " blocks\n",
|
||||
fs->fs_fsmnt, (unsigned long long)ino, DIP(ip, blocks));
|
||||
DIP_ASSIGN(ip, blocks, 0);
|
||||
}
|
||||
ip->i_flag &= ~IN_SPACECOUNTED;
|
||||
@ -1528,7 +1529,8 @@ ffs_blkfree(struct fs *fs, struct vnode *devvp, daddr_t bno, long size,
|
||||
}
|
||||
|
||||
if (bno >= fs->fs_size) {
|
||||
printf("bad block %" PRId64 ", ino %d\n", bno, inum);
|
||||
printf("bad block %" PRId64 ", ino %llu\n", bno,
|
||||
(unsigned long long)inum);
|
||||
ffs_fserr(fs, inum, "bad block");
|
||||
return;
|
||||
}
|
||||
@ -1732,8 +1734,8 @@ ffs_freefile(struct fs *fs, struct vnode *devvp, ino_t ino, int mode)
|
||||
cgbno = fsbtodb(fs, cgtod(fs, cg));
|
||||
}
|
||||
if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg)
|
||||
panic("ifree: range: dev = 0x%x, ino = %d, fs = %s",
|
||||
dev, ino, fs->fs_fsmnt);
|
||||
panic("ifree: range: dev = 0x%x, ino = %llu, fs = %s",
|
||||
dev, (unsigned long long)ino, fs->fs_fsmnt);
|
||||
error = bread(devvp, cgbno, (int)fs->fs_cgsize, NOCRED, &bp);
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
@ -1751,8 +1753,9 @@ ffs_freefile(struct fs *fs, struct vnode *devvp, ino_t ino, int mode)
|
||||
inosused = cg_inosused(cgp, needswap);
|
||||
ino %= fs->fs_ipg;
|
||||
if (isclr(inosused, ino)) {
|
||||
printf("ifree: dev = 0x%x, ino = %d, fs = %s\n",
|
||||
dev, ino + cg * fs->fs_ipg, fs->fs_fsmnt);
|
||||
printf("ifree: dev = 0x%x, ino = %llu, fs = %s\n",
|
||||
dev, (unsigned long long)ino + cg * fs->fs_ipg,
|
||||
fs->fs_fsmnt);
|
||||
if (fs->fs_ronly == 0)
|
||||
panic("ifree: freeing free inode");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_snapshot.c,v 1.18 2005/07/15 05:01:16 thorpej Exp $ */
|
||||
/* $NetBSD: ffs_snapshot.c,v 1.19 2005/08/19 02:04:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.18 2005/07/15 05:01:16 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.19 2005/08/19 02:04:09 christos Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -495,7 +495,8 @@ loop:
|
||||
VI_LOCK(devvp);
|
||||
fs->fs_snapinum[snaploc] = ip->i_number;
|
||||
if (ip->i_nextsnap.tqe_prev != 0)
|
||||
panic("ffs_snapshot: %d already on list", ip->i_number);
|
||||
panic("ffs_snapshot: %llu already on list",
|
||||
(unsigned long long)ip->i_number);
|
||||
TAILQ_INSERT_TAIL(&ump->um_snapshots, ip, i_nextsnap);
|
||||
VI_UNLOCK(devvp);
|
||||
if (xp == NULL)
|
||||
@ -1325,8 +1326,8 @@ ffs_snapgone(struct inode *ip)
|
||||
vrele(ITOV(ip));
|
||||
#ifdef DEBUG
|
||||
else if (snapdebug)
|
||||
printf("ffs_snapgone: lost snapshot vnode %d\n",
|
||||
ip->i_number);
|
||||
printf("ffs_snapgone: lost snapshot vnode %llu\n",
|
||||
(unsigned long long)ip->i_number);
|
||||
#endif
|
||||
/*
|
||||
* Delete snapshot inode from superblock. Keep list dense.
|
||||
@ -1562,9 +1563,11 @@ retry:
|
||||
if (size == fs->fs_bsize) {
|
||||
#ifdef DEBUG
|
||||
if (snapdebug)
|
||||
printf("%s %d lbn %" PRId64 " from inum %d\n",
|
||||
"Grabonremove: snapino", ip->i_number,
|
||||
lbn, inum);
|
||||
printf("%s %llu lbn %" PRId64
|
||||
"from inum %llu\n",
|
||||
"Grabonremove: snapino",
|
||||
(unsigned long long)ip->i_number,
|
||||
lbn, (unsigned long long)inum);
|
||||
#endif
|
||||
if (lbn < NDADDR) {
|
||||
db_assign(ip, lbn, bno);
|
||||
@ -1581,9 +1584,10 @@ retry:
|
||||
brelse(ibp);
|
||||
#ifdef DEBUG
|
||||
if (snapdebug)
|
||||
printf("%s%d lbn %" PRId64 " %s %d size %ld\n",
|
||||
"Copyonremove: snapino ", ip->i_number,
|
||||
lbn, "for inum", inum, size);
|
||||
printf("%s%llu lbn %" PRId64 " %s %llu size %ld\n",
|
||||
"Copyonremove: snapino ",
|
||||
(unsigned long long)ip->i_number,
|
||||
lbn, "for inum", (unsigned long long)inum, size);
|
||||
#endif
|
||||
/*
|
||||
* If we have already read the old block contents, then
|
||||
@ -1747,8 +1751,8 @@ ffs_snapshot_mount(struct mount *mp)
|
||||
*/
|
||||
VI_LOCK(devvp);
|
||||
if (ip->i_nextsnap.tqe_prev != 0)
|
||||
panic("ffs_snapshot_mount: %d already on list",
|
||||
ip->i_number);
|
||||
panic("ffs_snapshot_mount: %llu already on list",
|
||||
(unsigned long long)ip->i_number);
|
||||
else
|
||||
TAILQ_INSERT_TAIL(&ump->um_snapshots, ip, i_nextsnap);
|
||||
vp->v_flag |= VSYSTEM;
|
||||
@ -1924,12 +1928,13 @@ retry:
|
||||
snapshot_locked = 1;
|
||||
#ifdef DEBUG
|
||||
if (snapdebug) {
|
||||
printf("Copyonwrite: snapino %d lbn %" PRId64 " for ",
|
||||
ip->i_number, lbn);
|
||||
printf("Copyonwrite: snapino %llu lbn %" PRId64 " for ",
|
||||
(unsigned long long)ip->i_number, lbn);
|
||||
if (bp->b_vp == devvp)
|
||||
printf("fs metadata");
|
||||
else
|
||||
printf("inum %d", VTOI(bp->b_vp)->i_number);
|
||||
printf("inum %llu", (unsigned long long)
|
||||
VTOI(bp->b_vp)->i_number);
|
||||
printf(" lblkno %" PRId64 "\n", bp->b_lblkno);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_softdep.c,v 1.66 2005/05/30 22:13:22 christos Exp $ */
|
||||
/* $NetBSD: ffs_softdep.c,v 1.67 2005/08/19 02:04:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1998 Marshall Kirk McKusick. All Rights Reserved.
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.66 2005/05/30 22:13:22 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.67 2005/08/19 02:04:09 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
@ -3051,8 +3051,9 @@ newdirrem(bp, dp, ip, isrmdir, prevdirremp)
|
||||
if ((dap->da_state & ATTACHED) == 0)
|
||||
panic("newdirrem: not ATTACHED");
|
||||
if (dap->da_newinum != ip->i_number)
|
||||
panic("newdirrem: inum %d should be %d",
|
||||
ip->i_number, dap->da_newinum);
|
||||
panic("newdirrem: inum %llu should be %llu",
|
||||
(unsigned long long)ip->i_number,
|
||||
(unsigned long long)dap->da_newinum);
|
||||
/*
|
||||
* If we are deleting a changed name that never made it to disk,
|
||||
* then return the dirrem describing the previous inode (which
|
||||
@ -3517,10 +3518,10 @@ initiate_write_filepage(pagedep, bp)
|
||||
ep = (struct direct *)
|
||||
((char *)bp->b_data + dap->da_offset);
|
||||
if (ufs_rw32(ep->d_ino, needswap) != dap->da_newinum)
|
||||
panic("%s: dir inum %d != new %d",
|
||||
panic("%s: dir inum %d != new %llu",
|
||||
"initiate_write_filepage",
|
||||
ufs_rw32(ep->d_ino, needswap),
|
||||
dap->da_newinum);
|
||||
(unsigned long long)dap->da_newinum);
|
||||
if (dap->da_state & DIRCHG)
|
||||
ep->d_ino =
|
||||
ufs_rw32(dap->da_previous->dm_oldinum,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_alloc.c,v 1.83 2005/05/29 21:25:24 christos Exp $ */
|
||||
/* $NetBSD: lfs_alloc.c,v 1.84 2005/08/19 02:04:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.83 2005/05/29 21:25:24 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.84 2005/08/19 02:04:09 christos Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -328,7 +328,8 @@ lfs_valloc(void *v)
|
||||
*/
|
||||
LFS_IENTRY(ifp, fs, new_ino, bp);
|
||||
if (ifp->if_daddr != LFS_UNUSED_DADDR)
|
||||
panic("lfs_valloc: inuse inode %d on the free list", new_ino);
|
||||
panic("lfs_valloc: inuse inode %llu on the free list",
|
||||
(unsigned long long)new_ino);
|
||||
LFS_PUT_HEADFREE(fs, cip, cbp, ifp->if_nextfree);
|
||||
DLOG((DLOG_ALLOC, "lfs_valloc: headfree %d -> %d\n", new_ino,
|
||||
ifp->if_nextfree));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_debug.c,v 1.31 2005/05/29 21:25:24 christos Exp $ */
|
||||
/* $NetBSD: lfs_debug.c,v 1.32 2005/08/19 02:04:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
@ -71,7 +71,7 @@
|
||||
#include <machine/stdarg.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.31 2005/05/29 21:25:24 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.32 2005/08/19 02:04:09 christos Exp $");
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/namei.h>
|
||||
@ -292,11 +292,13 @@ lfs_check_bpp(struct lfs *fs, struct segment *sp, char *file, int line)
|
||||
(*bpp)->b_blkno,
|
||||
blkno);
|
||||
} else {
|
||||
printf("%s:%d: misplace ino %d lbn %" PRId64
|
||||
printf("%s:%d: misplace ino %llu lbn %" PRId64
|
||||
" at 0x%" PRIx64 " instead of "
|
||||
"0x%" PRIx64 "\n",
|
||||
file, line,
|
||||
VTOI((*bpp)->b_vp)->i_number, (*bpp)->b_lblkno,
|
||||
(unsigned long long)
|
||||
VTOI((*bpp)->b_vp)->i_number,
|
||||
(*bpp)->b_lblkno,
|
||||
blkno,
|
||||
(*bpp)->b_blkno);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_segment.c,v 1.164 2005/05/29 21:25:24 christos Exp $ */
|
||||
/* $NetBSD: lfs_segment.c,v 1.165 2005/08/19 02:04:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.164 2005/05/29 21:25:24 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.165 2005/08/19 02:04:09 christos Exp $");
|
||||
|
||||
#ifdef DEBUG
|
||||
# define vndebug(vp, str) do { \
|
||||
@ -1333,9 +1333,9 @@ lfs_update_single(struct lfs *fs, struct segment *sp, struct vnode *vp,
|
||||
(int64_t)osize -
|
||||
(sizeof (struct ufs1_dinode) * ndupino +
|
||||
sup->su_nbytes));
|
||||
printf("lfs_updatemeta: ino %d, lbn %" PRId64
|
||||
printf("lfs_updatemeta: ino %llu, lbn %" PRId64
|
||||
", addr = 0x%" PRIx64 "\n",
|
||||
ip->i_number, lbn, daddr);
|
||||
(unsigned long long)ip->i_number, lbn, daddr);
|
||||
printf("lfs_updatemeta: ndupino=%d\n", ndupino);
|
||||
panic("lfs_updatemeta: negative bytes");
|
||||
sup->su_nbytes = osize -
|
||||
@ -2501,7 +2501,8 @@ lfs_vunref(struct vnode *vp)
|
||||
simple_lock(&vp->v_interlock);
|
||||
#ifdef DIAGNOSTIC
|
||||
if (vp->v_usecount <= 0) {
|
||||
printf("lfs_vunref: inum is %d\n", VTOI(vp)->i_number);
|
||||
printf("lfs_vunref: inum is %llu\n", (unsigned long long)
|
||||
VTOI(vp)->i_number);
|
||||
printf("lfs_vunref: flags are 0x%lx\n", (u_long)vp->v_flag);
|
||||
printf("lfs_vunref: usecount = %ld\n", (long)vp->v_usecount);
|
||||
panic("lfs_vunref: v_usecount < 0");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.184 2005/07/23 12:18:41 yamt Exp $ */
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.185 2005/08/19 02:04:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.184 2005/07/23 12:18:41 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.185 2005/08/19 02:04:09 christos Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -2289,8 +2289,9 @@ inconsistent:
|
||||
# ifdef DEBUG
|
||||
lfs_dump_dinode(ip->i_din.ffs1_din);
|
||||
# endif
|
||||
panic("lfs_vinit: ino %d is type VNON! (ifmt=%o)\n",
|
||||
ip->i_number, (ip->i_mode & IFMT) >> 12);
|
||||
panic("lfs_vinit: ino %llu is type VNON! (ifmt=%o)\n",
|
||||
(unsigned long long)ip->i_number,
|
||||
(ip->i_mode & IFMT) >> 12);
|
||||
}
|
||||
#endif /* DIAGNOSTIC */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_vnops.c,v 1.152 2005/05/29 21:25:24 christos Exp $ */
|
||||
/* $NetBSD: lfs_vnops.c,v 1.153 2005/08/19 02:04:09 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.152 2005/05/29 21:25:24 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.153 2005/08/19 02:04:09 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -635,7 +635,8 @@ lfs_mknod(void *v)
|
||||
*/
|
||||
if ((error = VOP_FSYNC(*vpp, NOCRED, FSYNC_WAIT, 0, 0,
|
||||
curproc)) != 0) {
|
||||
panic("lfs_mknod: couldn't fsync (ino %d)", ino);
|
||||
panic("lfs_mknod: couldn't fsync (ino %llu)",
|
||||
(unsigned long long)ino);
|
||||
/* return (error); */
|
||||
}
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: inode.h,v 1.41 2005/02/26 22:32:20 perry Exp $ */
|
||||
/* $NetBSD: inode.h,v 1.42 2005/08/19 02:04:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1989, 1993
|
||||
@ -325,7 +325,7 @@ struct indir {
|
||||
struct ufid {
|
||||
u_int16_t ufid_len; /* Length of structure. */
|
||||
u_int16_t ufid_pad; /* Force 32-bit alignment. */
|
||||
ino_t ufid_ino; /* File number (ino). */
|
||||
u_int32_t ufid_ino; /* File number (ino). */
|
||||
int32_t ufid_gen; /* Generation number. */
|
||||
};
|
||||
#endif /* _KERNEL */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_lookup.c,v 1.65 2005/07/10 01:08:52 thorpej Exp $ */
|
||||
/* $NetBSD: ufs_lookup.c,v 1.66 2005/08/19 02:04:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.65 2005/07/10 01:08:52 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.66 2005/08/19 02:04:09 christos Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_ffs.h"
|
||||
@ -656,8 +656,9 @@ ufs_dirbad(struct inode *ip, doff_t offset, const char *how)
|
||||
struct mount *mp;
|
||||
|
||||
mp = ITOV(ip)->v_mount;
|
||||
printf("%s: bad dir ino %d at offset %d: %s\n",
|
||||
mp->mnt_stat.f_mntonname, ip->i_number, offset, how);
|
||||
printf("%s: bad dir ino %llu at offset %d: %s\n",
|
||||
mp->mnt_stat.f_mntonname, (unsigned long long)ip->i_number,
|
||||
offset, how);
|
||||
if ((mp->mnt_stat.f_flag & MNT_RDONLY) == 0)
|
||||
panic("bad dir");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_vnops.c,v 1.129 2005/07/23 12:18:41 yamt Exp $ */
|
||||
/* $NetBSD: ufs_vnops.c,v 1.130 2005/08/19 02:04:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993, 1995
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.129 2005/07/23 12:18:41 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.130 2005/08/19 02:04:09 christos Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -79,7 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.129 2005/07/23 12:18:41 yamt Exp $")
|
||||
|
||||
static int ufs_chmod(struct vnode *, int, struct ucred *, struct proc *);
|
||||
static int ufs_chown(struct vnode *, uid_t, gid_t, struct ucred *,
|
||||
struct proc *);
|
||||
struct proc *);
|
||||
|
||||
/*
|
||||
* A virgin directory (no blushing please).
|
||||
@ -1556,11 +1556,9 @@ ufs_symlink(void *v)
|
||||
/*
|
||||
* Vnode op for reading directories.
|
||||
*
|
||||
* The routine below assumes that the on-disk format of a directory
|
||||
* is the same as that defined by <sys/dirent.h>. If the on-disk
|
||||
* format changes, then it will be necessary to do a conversion
|
||||
* from the on-disk format that read returns to the format defined
|
||||
* by <sys/dirent.h>.
|
||||
* This routine handles converting from the on-disk directory format
|
||||
* "struct direct" to the in-memory format "struct dirent" as well as
|
||||
* byte swapping the entries if necessary.
|
||||
*/
|
||||
int
|
||||
ufs_readdir(void *v)
|
||||
@ -1574,115 +1572,113 @@ ufs_readdir(void *v)
|
||||
int *ncookies;
|
||||
} */ *ap = v;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct uio *uio;
|
||||
struct direct *cdp, *ecdp;
|
||||
struct dirent *ndp;
|
||||
char *cdbuf, *ndbuf, *endp;
|
||||
struct uio auio, *uio;
|
||||
struct iovec aiov;
|
||||
int error;
|
||||
size_t count, lost;
|
||||
off_t off;
|
||||
size_t count, ccount, rcount;
|
||||
off_t off, *ccp;
|
||||
struct ufsmount *ump = VFSTOUFS(vp->v_mount);
|
||||
int dirblksiz = ump->um_dirblksiz;
|
||||
|
||||
int nswap = UFS_MPNEEDSWAP(ump);
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
int needswap = ump->um_maxsymlinklen <= 0 && nswap == 0;
|
||||
#else
|
||||
int needswap = ump->um_maxsymlinklen <= 0 && nswap != 0;
|
||||
#endif
|
||||
uio = ap->a_uio;
|
||||
off = uio->uio_offset;
|
||||
count = uio->uio_resid;
|
||||
/* Make sure we don't return partial entries. */
|
||||
count -= (uio->uio_offset + count) & (dirblksiz -1);
|
||||
if (count <= 0)
|
||||
return (EINVAL);
|
||||
lost = uio->uio_resid - count;
|
||||
uio->uio_resid = count;
|
||||
uio->uio_iov->iov_len = count;
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
if (ump->um_maxsymlinklen > 0 && UFS_MPNEEDSWAP(ump) == 0)
|
||||
#else
|
||||
if (UFS_MPNEEDSWAP(ump) == 0)
|
||||
#endif
|
||||
{
|
||||
error = VOP_READ(vp, uio, 0, ap->a_cred);
|
||||
rcount = count - ((uio->uio_offset + count) & (ump->um_dirblksiz - 1));
|
||||
|
||||
if (rcount < _DIRENT_MINSIZE(cdp) || count < _DIRENT_MINSIZE(ndp))
|
||||
return EINVAL;
|
||||
|
||||
auio.uio_iov = &aiov;
|
||||
auio.uio_iovcnt = 1;
|
||||
auio.uio_offset = uio->uio_offset;
|
||||
auio.uio_resid = rcount;
|
||||
auio.uio_segflg = UIO_SYSSPACE;
|
||||
auio.uio_rw = UIO_READ;
|
||||
cdbuf = malloc(rcount, M_TEMP, M_WAITOK);
|
||||
aiov.iov_base = cdbuf;
|
||||
aiov.iov_len = rcount;
|
||||
error = VOP_READ(vp, &auio, 0, ap->a_cred);
|
||||
if (error != 0) {
|
||||
free(cdbuf, M_TEMP);
|
||||
return error;
|
||||
}
|
||||
|
||||
rcount = rcount - auio.uio_resid;
|
||||
|
||||
cdp = (struct direct *)(void *)cdbuf;
|
||||
ecdp = (struct direct *)(void *)&cdbuf[rcount];
|
||||
|
||||
ndbuf = malloc(count, M_TEMP, M_WAITOK);
|
||||
ndp = (struct dirent *)(void *)ndbuf;
|
||||
endp = &ndbuf[count];
|
||||
|
||||
off = uio->uio_offset;
|
||||
if (ap->a_cookies) {
|
||||
ccount = rcount / 4;
|
||||
ccp = *(ap->a_cookies) = malloc(ccount * sizeof(*ccp),
|
||||
M_TEMP, M_WAITOK);
|
||||
} else {
|
||||
struct dirent *dp, *edp;
|
||||
struct uio auio;
|
||||
struct iovec aiov;
|
||||
caddr_t dirbuf;
|
||||
int readcnt;
|
||||
u_char tmp;
|
||||
|
||||
auio = *uio;
|
||||
auio.uio_iov = &aiov;
|
||||
auio.uio_iovcnt = 1;
|
||||
auio.uio_segflg = UIO_SYSSPACE;
|
||||
aiov.iov_len = count;
|
||||
MALLOC(dirbuf, caddr_t, count, M_TEMP, M_WAITOK);
|
||||
aiov.iov_base = dirbuf;
|
||||
error = VOP_READ(vp, &auio, 0, ap->a_cred);
|
||||
if (error == 0) {
|
||||
readcnt = count - auio.uio_resid;
|
||||
edp = (struct dirent *)&dirbuf[readcnt];
|
||||
for (dp = (struct dirent *)dirbuf; dp < edp; ) {
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
if (ump->um_maxsymlinklen <= 0 &&
|
||||
UFS_MPNEEDSWAP(ump) == 0)
|
||||
#else
|
||||
if (ump->um_maxsymlinklen <= 0 &&
|
||||
UFS_MPNEEDSWAP(ump) != 0)
|
||||
#endif
|
||||
{
|
||||
tmp = dp->d_namlen;
|
||||
dp->d_namlen = dp->d_type;
|
||||
dp->d_type = tmp;
|
||||
}
|
||||
dp->d_fileno = ufs_rw32(dp->d_fileno,
|
||||
UFS_MPNEEDSWAP(ump));
|
||||
dp->d_reclen = ufs_rw16(dp->d_reclen,
|
||||
UFS_MPNEEDSWAP(ump));
|
||||
if (dp->d_reclen > 0) {
|
||||
dp = (struct dirent *)
|
||||
((char *)dp + dp->d_reclen);
|
||||
} else {
|
||||
error = EIO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dp >= edp)
|
||||
error = uiomove(dirbuf, readcnt, uio);
|
||||
}
|
||||
FREE(dirbuf, M_TEMP);
|
||||
/* XXX: GCC */
|
||||
ccount = 0;
|
||||
ccp = NULL;
|
||||
}
|
||||
if (!error && ap->a_ncookies) {
|
||||
struct dirent *dp, *dpstart;
|
||||
off_t *cookies, offstart;
|
||||
int ncookies;
|
||||
|
||||
/*
|
||||
* Only the NFS server and emulations use cookies, and they
|
||||
* load the directory block into system space, so we can
|
||||
* just look at it directly.
|
||||
*/
|
||||
if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1)
|
||||
panic("ufs_readdir: lost in space");
|
||||
dpstart = (struct dirent *)
|
||||
((caddr_t)uio->uio_iov->iov_base - (uio->uio_offset - off));
|
||||
offstart = off;
|
||||
for (dp = dpstart, ncookies = 0; off < uio->uio_offset; ) {
|
||||
if (dp->d_reclen == 0)
|
||||
break;
|
||||
off += dp->d_reclen;
|
||||
ncookies++;
|
||||
dp = (struct dirent *)((caddr_t)dp + dp->d_reclen);
|
||||
while (cdp < ecdp) {
|
||||
cdp->d_reclen = ufs_rw16(cdp->d_reclen, nswap);
|
||||
if (cdp->d_reclen == 0) {
|
||||
struct dirent *ondp = ndp;
|
||||
ndp->d_reclen = _DIRENT_MINSIZE(ndp);
|
||||
ndp = _DIRENT_NEXT(ndp);
|
||||
ondp->d_reclen = 0;
|
||||
cdp = ecdp;
|
||||
break;
|
||||
}
|
||||
lost += uio->uio_offset - off;
|
||||
cookies = malloc(ncookies * sizeof(off_t), M_TEMP, M_WAITOK);
|
||||
uio->uio_offset = off;
|
||||
*ap->a_ncookies = ncookies;
|
||||
*ap->a_cookies = cookies;
|
||||
for (off = offstart, dp = dpstart; off < uio->uio_offset; ) {
|
||||
off += dp->d_reclen;
|
||||
*(cookies++) = off;
|
||||
dp = (struct dirent *)((caddr_t)dp + dp->d_reclen);
|
||||
if (needswap) {
|
||||
ndp->d_type = cdp->d_namlen;
|
||||
ndp->d_namlen = cdp->d_type;
|
||||
} else {
|
||||
ndp->d_type = cdp->d_type;
|
||||
ndp->d_namlen = cdp->d_namlen;
|
||||
}
|
||||
ndp->d_reclen = _DIRENT_RECLEN(ndp, ndp->d_namlen);
|
||||
if ((char *)(void *)ndp + ndp->d_reclen +
|
||||
_DIRENT_MINSIZE(ndp) > endp)
|
||||
break;
|
||||
ndp->d_fileno = ufs_rw32(cdp->d_ino, nswap);
|
||||
(void)memcpy(ndp->d_name, cdp->d_name, ndp->d_namlen);
|
||||
ndp->d_name[ndp->d_namlen] = '\0';
|
||||
off += cdp->d_reclen;
|
||||
if (ap->a_cookies) {
|
||||
KASSERT(ccp - *(ap->a_cookies) < ccount);
|
||||
*(ccp++) = off;
|
||||
}
|
||||
ndp = _DIRENT_NEXT(ndp);
|
||||
cdp = _DIRENT_NEXT(cdp);
|
||||
}
|
||||
uio->uio_resid += lost;
|
||||
|
||||
if (cdp >= ecdp)
|
||||
off = uio->uio_offset + rcount;
|
||||
|
||||
count = ((char *)(void *)ndp - ndbuf);
|
||||
error = uiomove(ndbuf, count, uio);
|
||||
|
||||
if (ap->a_cookies) {
|
||||
if (error)
|
||||
free(*(ap->a_cookies), M_TEMP);
|
||||
else
|
||||
*ap->a_ncookies = ccp - *(ap->a_cookies);
|
||||
}
|
||||
uio->uio_offset = off;
|
||||
free(ndbuf, M_TEMP);
|
||||
free(cdbuf, M_TEMP);
|
||||
*ap->a_eofflag = VTOI(vp)->i_size <= uio->uio_offset;
|
||||
return (error);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1766,7 +1762,8 @@ ufs_print(void *v)
|
||||
|
||||
vp = ap->a_vp;
|
||||
ip = VTOI(vp);
|
||||
printf("tag VT_UFS, ino %d, on dev %d, %d", ip->i_number,
|
||||
printf("tag VT_UFS, ino %llu, on dev %d, %d",
|
||||
(unsigned long long)ip->i_number,
|
||||
major(ip->i_dev), minor(ip->i_dev));
|
||||
printf(" flags 0x%x, effnlink %d, nlink %d\n",
|
||||
ip->i_flag, ip->i_ffs_effnlink, ip->i_nlink);
|
||||
|
Loading…
Reference in New Issue
Block a user