PERFORCE change 150211 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Sun Sep 21 14:48:29 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=150211
Change 150211 by hselasky at hselasky_laptop001 on 2008/09/21 14:48:19
We need to call "vnops.fo_close()" at close, because
the file-ops were already equal to the bad file ops at
open.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_core.h#21 edit
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_dev.c#35 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_core.h#21 (text+ko) ====
@@ -50,6 +50,14 @@
#define USB_PROC_GET_GID(td) (td)->p_pgid
#endif
+#ifndef USB_VNOPS_FO_CLOSE
+#define USB_VNOPS_FO_CLOSE(fp, td, perr) do { \
+ (td)->td_fpop = (fp); \
+ *(perr) = vnops.fo_close(fp, td); \
+ (td)->td_fpop = NULL; \
+} while (0)
+#endif
+
#ifndef USB_VNOPS_FO_STAT
#define USB_VNOPS_FO_STAT(fp, sb, cred, td) \
vnops.fo_stat(fp, sb, cred, td)
==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_dev.c#35 (text+ko) ====
@@ -1234,11 +1234,11 @@
}
}
/*
- * Magic: Take over the file so that we get all the callbacks
+ * Take over the file so that we get all the callbacks
* directly and don't have to create another device:
*/
- fp->f_ops = &usb2_ops_f;
- fp->f_data = ((uint8_t *)0) + devloc;
+ finit(fp, fp->f_flag, DTYPE_VNODE,
+ ((uint8_t *)0) + devloc, &usb2_ops_f);
usb2_unref_device(&loc);
@@ -1253,6 +1253,7 @@
static int
usb2_close(struct cdev *dev, int flag, int mode, struct thread *p)
{
+ DPRINTF("\n");
return (0); /* nothing to do */
}
@@ -1461,7 +1462,9 @@
done:
/* call old close method */
- return (fp->f_ops->fo_close) (fp, td);
+ USB_VNOPS_FO_CLOSE(fp, td, &err);
+
+ return (err);
}
static int
More information about the p4-projects
mailing list