Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/miscfs/deadfs Add missing operations that unlock or dere...
details: https://anonhg.NetBSD.org/src/rev/bafa916a021b
branches: trunk
changeset: 791166:bafa916a021b
user: hannken <hannken%NetBSD.org@localhost>
date: Thu Nov 07 09:45:53 2013 +0000
description:
Add missing operations that unlock or dereference their arguments.
Stop checking for a vnode state change -- dead vnodes never change state.
diffstat:
sys/miscfs/deadfs/dead_vnops.c | 323 ++++++++++++++++++++++++++++------------
1 files changed, 223 insertions(+), 100 deletions(-)
diffs (truncated from 468 to 300 lines):
diff -r ac8d647a0515 -r bafa916a021b sys/miscfs/deadfs/dead_vnops.c
--- a/sys/miscfs/deadfs/dead_vnops.c Thu Nov 07 06:54:48 2013 +0000
+++ b/sys/miscfs/deadfs/dead_vnops.c Thu Nov 07 09:45:53 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dead_vnops.c,v 1.51 2011/06/12 03:35:57 rmind Exp $ */
+/* $NetBSD: dead_vnops.c,v 1.52 2013/11/07 09:45:53 hannken Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dead_vnops.c,v 1.51 2011/06/12 03:35:57 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dead_vnops.c,v 1.52 2013/11/07 09:45:53 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -48,6 +48,10 @@
/*
* Prototypes for dead operations on vnodes.
*/
+#define dead_bwrite genfs_nullop
+int dead_lookup(void *);
+int dead_create(void *);
+int dead_mknod(void *);
int dead_open(void *);
#define dead_close genfs_nullop
int dead_read(void *);
@@ -55,28 +59,36 @@
#define dead_fcntl genfs_nullop
int dead_ioctl(void *);
int dead_poll(void *);
+int dead_remove(void *);
+int dead_link(void *);
+int dead_rename(void *);
+int dead_mkdir(void *);
+int dead_rmdir(void *);
+int dead_symlink(void *);
#define dead_fsync genfs_nullop
#define dead_seek genfs_nullop
-#define dead_inactive genfs_nullop
+int dead_inactive(void *);
#define dead_reclaim genfs_nullop
-int dead_lock(void *);
+#define dead_lock genfs_lock
#define dead_unlock genfs_unlock
int dead_bmap(void *);
int dead_strategy(void *);
int dead_print(void *);
#define dead_islocked genfs_islocked
-#define dead_bwrite genfs_nullop
#define dead_revoke genfs_nullop
int dead_getpages(void *);
-#define dead_putpages genfs_null_putpages
+int dead_putpages(void *);
-int chkvnlock(struct vnode *);
int dead_default_error(void *);
int (**dead_vnodeop_p)(void *);
const struct vnodeopv_entry_desc dead_vnodeop_entries[] = {
{ &vop_default_desc, dead_default_error },
+ { &vop_bwrite_desc, dead_bwrite }, /* bwrite */
+ { &vop_lookup_desc, dead_lookup }, /* lookup */
+ { &vop_create_desc, dead_create }, /* create */
+ { &vop_mknod_desc, dead_mknod }, /* mknod */
{ &vop_open_desc, dead_open }, /* open */
{ &vop_close_desc, dead_close }, /* close */
{ &vop_read_desc, dead_read }, /* read */
@@ -84,7 +96,12 @@
{ &vop_fcntl_desc, dead_fcntl }, /* fcntl */
{ &vop_ioctl_desc, dead_ioctl }, /* ioctl */
{ &vop_poll_desc, dead_poll }, /* poll */
- { &vop_revoke_desc, dead_revoke }, /* revoke */
+ { &vop_remove_desc, dead_remove }, /* remove */
+ { &vop_link_desc, dead_link }, /* link */
+ { &vop_rename_desc, dead_rename }, /* rename */
+ { &vop_mkdir_desc, dead_mkdir }, /* mkdir */
+ { &vop_rmdir_desc, dead_rmdir }, /* rmdir */
+ { &vop_symlink_desc, dead_symlink }, /* symlink */
{ &vop_fsync_desc, dead_fsync }, /* fsync */
{ &vop_seek_desc, dead_seek }, /* seek */
{ &vop_inactive_desc, dead_inactive }, /* inactive */
@@ -95,7 +112,7 @@
{ &vop_strategy_desc, dead_strategy }, /* strategy */
{ &vop_print_desc, dead_print }, /* print */
{ &vop_islocked_desc, dead_islocked }, /* islocked */
- { &vop_bwrite_desc, dead_bwrite }, /* bwrite */
+ { &vop_revoke_desc, dead_revoke }, /* revoke */
{ &vop_getpages_desc, dead_getpages }, /* getpages */
{ &vop_putpages_desc, dead_putpages }, /* putpages */
{ NULL, NULL }
@@ -103,6 +120,7 @@
const struct vnodeopv_desc dead_vnodeop_opv_desc =
{ &dead_vnodeop_p, dead_vnodeop_entries };
+/* ARGSUSED */
int
dead_default_error(void *v)
{
@@ -110,21 +128,78 @@
return EBADF;
}
-/*
- * Open always fails as if device did not exist.
- */
+/* ARGSUSED */
+int
+dead_bmap(void *v)
+{
+ /* struct vop_bmap_args {
+ struct vnode *a_vp;
+ daddr_t a_bn;
+ struct vnode **a_vpp;
+ daddr_t *a_bnp;
+ int *a_runp;
+ } *ap = v; */
+
+ return (EIO);
+}
+
+int
+dead_lookup(void *v)
+{
+ struct vop_lookup_args /* {
+ struct vnode *a_dvp;
+ struct vnode **a_vpp;
+ struct componentname *a_cnp;
+ } */ *ap = v;
+
+ *(ap->a_vpp) = NULL;
+
+ return EIO;
+}
+
+int
+dead_create(void *v)
+{
+ struct vop_create_args /* {
+ struct vnode *a_dvp;
+ struct vnode **a_vpp;
+ struct componentname *a_cnp;
+ struct vattr *a_vap;
+ } */ *ap = v;
+
+ vput(ap->a_dvp);
+
+ return EIO;
+}
+
+int
+dead_mknod(void *v)
+{
+ struct vop_mknod_args /* {
+ struct vnode *a_dvp;
+ struct vnode **a_vpp;
+ struct componentname *a_cnp;
+ struct vattr *a_vap;
+ } */ *ap = v;
+
+ vput(ap->a_dvp);
+
+ return EIO;
+}
+
/* ARGSUSED */
int
dead_open(void *v)
{
+ /* struct vop_open_args {
+ struct vnode *a_vp;
+ int a_mode;
+ kauth_cred_t a_cred;
+ } *ap = v; */
return (ENXIO);
}
-/*
- * Vnode op for read
- */
-/* ARGSUSED */
int
dead_read(void *v)
{
@@ -135,8 +210,6 @@
kauth_cred_t a_cred;
} */ *ap = v;
- if (chkvnlock(ap->a_vp))
- panic("dead_read: lock");
/*
* Return EOF for tty devices, EIO for others
*/
@@ -145,47 +218,36 @@
return (0);
}
-/*
- * Vnode op for write
- */
/* ARGSUSED */
int
dead_write(void *v)
{
- struct vop_write_args /* {
+ /* struct vop_write_args {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
kauth_cred_t a_cred;
- } */ *ap = v;
+ } *ap = v; */
- if (chkvnlock(ap->a_vp))
- panic("dead_write: lock");
return (EIO);
}
-/*
- * Device ioctl operation.
- */
/* ARGSUSED */
int
dead_ioctl(void *v)
{
- struct vop_ioctl_args /* {
+ /* struct vop_ioctl_args {
struct vnode *a_vp;
u_long a_command;
void *a_data;
int a_fflag;
kauth_cred_t a_cred;
struct lwp *a_l;
- } */ *ap = v;
+ } *ap = v; */
- if (!chkvnlock(ap->a_vp))
- return (EBADF);
- return (VCALL(ap->a_vp, VOFFSET(vop_ioctl), ap));
+ return (EBADF);
}
-/* ARGSUSED */
int
dead_poll(void *v)
{
@@ -201,68 +263,134 @@
return (ap->a_events);
}
-/*
- * Just call the device strategy routine
- */
+int
+dead_remove(void *v)
+{
+ struct vop_remove_args /* {
+ struct vnode *a_dvp;
+ struct vnode *a_vp;
+ struct componentname *a_cnp;
+ } */ *ap = v;
+
+ vput(ap->a_dvp);
+ vput(ap->a_vp);
+
+ return EIO;
+}
+
+int
+dead_link(void *v)
+{
+ struct vop_link_args /* {
+ struct vnode *a_dvp;
+ struct vnode *a_vp;
+ struct componentname *a_cnp;
+ } */ *ap = v;
+
+ vput(ap->a_dvp);
+
+ return EIO;
+}
+
+int
+dead_rename(void *v)
+{
+ struct vop_rename_args /* {
+ struct vnode *a_fdvp;
+ struct vnode *a_fvp;
+ struct componentname *a_fcnp;
+ struct vnode *a_tdvp;
+ struct vnode *a_tvp;
+ struct componentname *a_tcnp;
+ } */ *ap = v;
+
+ vrele(ap->a_fdvp);
+ vrele(ap->a_fvp);
Home |
Main Index |
Thread Index |
Old Index