version 1.445.2.3, 2016/05/29 08:44:37 |
version 1.445.2.4, 2016/12/05 10:55:26 |
Line 76 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 76 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#include "opt_compat_43.h" |
#include "opt_compat_43.h" |
#endif |
#endif |
|
|
#define _VFS_VNODE_PRIVATE /* for vcache_print(). */ |
|
|
|
#include <sys/param.h> |
#include <sys/param.h> |
#include <sys/systm.h> |
#include <sys/systm.h> |
#include <sys/conf.h> |
#include <sys/conf.h> |
Line 85 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 83 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#include <sys/filedesc.h> |
#include <sys/filedesc.h> |
#include <sys/kernel.h> |
#include <sys/kernel.h> |
#include <sys/mount.h> |
#include <sys/mount.h> |
#include <sys/vnode.h> |
#include <sys/vnode_impl.h> |
#include <sys/stat.h> |
#include <sys/stat.h> |
#include <sys/sysctl.h> |
#include <sys/sysctl.h> |
#include <sys/namei.h> |
#include <sys/namei.h> |
Line 1058 vattr_null(struct vattr *vap) |
|
Line 1056 vattr_null(struct vattr *vap) |
|
vap->va_bytes = VNOVAL; |
vap->va_bytes = VNOVAL; |
} |
} |
|
|
|
/* |
|
* Vnode state to string. |
|
*/ |
|
const char * |
|
vstate_name(enum vnode_state state) |
|
{ |
|
|
|
switch (state) { |
|
case VS_MARKER: |
|
return "MARKER"; |
|
case VS_LOADING: |
|
return "LOADING"; |
|
case VS_ACTIVE: |
|
return "ACTIVE"; |
|
case VS_BLOCKED: |
|
return "BLOCKED"; |
|
case VS_RECLAIMING: |
|
return "RECLAIMING"; |
|
case VS_RECLAIMED: |
|
return "RECLAIMED"; |
|
default: |
|
return "ILLEGAL"; |
|
} |
|
} |
|
|
|
/* |
|
* Print a description of a vnode (common part). |
|
*/ |
|
static void |
|
vprint_common(struct vnode *vp, const char *prefix, |
|
void (*pr)(const char *, ...) __printflike(1, 2)) |
|
{ |
|
int n; |
|
char bf[96]; |
|
const uint8_t *cp; |
|
vnode_impl_t *node; |
|
const char * const vnode_tags[] = { VNODE_TAGS }; |
|
const char * const vnode_types[] = { VNODE_TYPES }; |
|
const char vnode_flagbits[] = VNODE_FLAGBITS; |
|
|
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) |
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) |
#define ARRAY_PRINT(idx, arr) \ |
#define ARRAY_PRINT(idx, arr) \ |
((unsigned int)(idx) < ARRAY_SIZE(arr) ? (arr)[(idx)] : "UNKNOWN") |
((unsigned int)(idx) < ARRAY_SIZE(arr) ? (arr)[(idx)] : "UNKNOWN") |
|
|
const char * const vnode_tags[] = { VNODE_TAGS }; |
node = VNODE_TO_VIMPL(vp); |
const char * const vnode_types[] = { VNODE_TYPES }; |
|
const char vnode_flagbits[] = VNODE_FLAGBITS; |
snprintb(bf, sizeof(bf), |
|
vnode_flagbits, vp->v_iflag | vp->v_vflag | vp->v_uflag); |
|
|
|
(*pr)("vnode %p flags %s\n", vp, bf); |
|
(*pr)("%stag %s(%d) type %s(%d) mount %p typedata %p\n", prefix, |
|
ARRAY_PRINT(vp->v_tag, vnode_tags), vp->v_tag, |
|
ARRAY_PRINT(vp->v_type, vnode_types), vp->v_type, |
|
vp->v_mount, vp->v_mountedhere); |
|
(*pr)("%susecount %d writecount %d holdcount %d\n", prefix, |
|
vp->v_usecount, vp->v_writecount, vp->v_holdcnt); |
|
(*pr)("%ssize %" PRIx64 " writesize %" PRIx64 " numoutput %d\n", |
|
prefix, vp->v_size, vp->v_writesize, vp->v_numoutput); |
|
(*pr)("%sfreelisthd %p data %p lock %p\n", prefix, |
|
vp->v_freelisthd, vp->v_data, &vp->v_lock); |
|
|
|
(*pr)("%sstate %s key(%p %zd)", prefix, vstate_name(node->vi_state), |
|
node->vi_key.vk_mount, node->vi_key.vk_key_len); |
|
n = node->vi_key.vk_key_len; |
|
cp = node->vi_key.vk_key; |
|
while (n-- > 0) |
|
(*pr)(" %02x", *cp++); |
|
(*pr)("\n"); |
|
|
|
#undef ARRAY_PRINT |
|
#undef ARRAY_SIZE |
|
} |
|
|
/* |
/* |
* Print out a description of a vnode. |
* Print out a description of a vnode. |
Line 1072 const char vnode_flagbits[] = VNODE_FLAG |
|
Line 1135 const char vnode_flagbits[] = VNODE_FLAG |
|
void |
void |
vprint(const char *label, struct vnode *vp) |
vprint(const char *label, struct vnode *vp) |
{ |
{ |
char bf[96]; |
|
int flag; |
|
|
|
flag = vp->v_iflag | vp->v_vflag | vp->v_uflag; |
|
snprintb(bf, sizeof(bf), vnode_flagbits, flag); |
|
|
|
if (label != NULL) |
if (label != NULL) |
printf("%s: ", label); |
printf("%s: ", label); |
printf("vnode @ %p, flags (%s)\n\ttag %s(%d), type %s(%d), " |
vprint_common(vp, "\t", printf); |
"usecount %d, writecount %d, holdcount %d\n" |
|
"\tfreelisthd %p, mount %p, data %p lock %p\n", |
|
vp, bf, ARRAY_PRINT(vp->v_tag, vnode_tags), vp->v_tag, |
|
ARRAY_PRINT(vp->v_type, vnode_types), vp->v_type, |
|
vp->v_usecount, vp->v_writecount, vp->v_holdcnt, |
|
vp->v_freelisthd, vp->v_mount, vp->v_data, &vp->v_lock); |
|
vcache_print(vp, "\t", printf); |
|
if (vp->v_data != NULL) { |
if (vp->v_data != NULL) { |
printf("\t"); |
printf("\t"); |
VOP_PRINT(vp); |
VOP_PRINT(vp); |
Line 1465 vfs_buf_print(struct buf *bp, int full, |
|
Line 1516 vfs_buf_print(struct buf *bp, int full, |
|
void |
void |
vfs_vnode_print(struct vnode *vp, int full, void (*pr)(const char *, ...)) |
vfs_vnode_print(struct vnode *vp, int full, void (*pr)(const char *, ...)) |
{ |
{ |
char bf[256]; |
|
|
|
uvm_object_printit(&vp->v_uobj, full, pr); |
uvm_object_printit(&vp->v_uobj, full, pr); |
snprintb(bf, sizeof(bf), |
(*pr)("\n"); |
vnode_flagbits, vp->v_iflag | vp->v_vflag | vp->v_uflag); |
vprint_common(vp, "", printf); |
(*pr)("\nVNODE flags %s\n", bf); |
|
(*pr)("mp %p numoutput %d size 0x%llx writesize 0x%llx\n", |
|
vp->v_mount, vp->v_numoutput, vp->v_size, vp->v_writesize); |
|
|
|
(*pr)("data %p writecount %ld holdcnt %ld\n", |
|
vp->v_data, vp->v_writecount, vp->v_holdcnt); |
|
|
|
(*pr)("tag %s(%d) type %s(%d) mount %p typedata %p\n", |
|
ARRAY_PRINT(vp->v_tag, vnode_tags), vp->v_tag, |
|
ARRAY_PRINT(vp->v_type, vnode_types), vp->v_type, |
|
vp->v_mount, vp->v_mountedhere); |
|
|
|
(*pr)("v_lock %p\n", &vp->v_lock); |
|
|
|
vcache_print(vp, "", pr); |
|
|
|
if (full) { |
if (full) { |
struct buf *bp; |
struct buf *bp; |
|
|