* BaseDevice didn't initialize the fInitialized member, and thus causing bug

#2265.
* Device::InitDevice()/UninitDevice() are called from outside of the device
  manager, so they better lock it.
* Turned off debug output in devfs and the device manager.
* Fixed debug output in devfs to print the actual vnode/cookie values, instead
  of the structures the VFS passes in now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25670 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-05-27 12:04:09 +00:00
parent ce2ba4187b
commit 2976912a51
3 changed files with 10 additions and 6 deletions

View File

@ -10,6 +10,7 @@
BaseDevice::BaseDevice()
:
fNode(NULL),
fInitialized(0),
fDeviceModule(NULL),
fDeviceData(NULL)
{

View File

@ -40,7 +40,7 @@
#include "legacy_drivers.h"
#define TRACE_DEVFS
//#define TRACE_DEVFS
#ifdef TRACE_DEVFS
# define TRACE(x) dprintf x
#else
@ -1140,12 +1140,11 @@ devfs_open(fs_volume* _volume, fs_vnode* _vnode, int openMode,
struct devfs_cookie* cookie;
status_t status = B_OK;
TRACE(("devfs_open: vnode %p, openMode 0x%x, fs_cookie %p \n", vnode, openMode, _cookie));
cookie = (struct devfs_cookie*)malloc(sizeof(struct devfs_cookie));
if (cookie == NULL)
return B_NO_MEMORY;
TRACE(("devfs_open: vnode %p, openMode 0x%x, cookie %p\n", vnode, openMode, cookie));
cookie->device_cookie = NULL;
if (S_ISCHR(vnode->stream.type)) {
@ -1484,7 +1483,7 @@ devfs_rewind_dir(fs_volume *_volume, fs_vnode *_vnode, void *_cookie)
struct devfs_dir_cookie *cookie = (devfs_dir_cookie *)_cookie;
struct devfs *fs = (struct devfs *)_volume->private_volume;
TRACE(("devfs_rewind_dir: vnode %p, cookie %p\n", _vnode, _cookie));
TRACE(("devfs_rewind_dir: vnode %p, cookie %p\n", vnode, cookie));
if (!S_ISDIR(vnode->stream.type))
return B_BAD_VALUE;
@ -1510,7 +1509,7 @@ devfs_ioctl(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, ulong op,
struct devfs_cookie *cookie = (struct devfs_cookie *)_cookie;
TRACE(("devfs_ioctl: vnode %p, cookie %p, op %ld, buf %p, len %ld\n",
_vnode, _cookie, op, buffer, length));
vnode, cookie, op, buffer, length));
// we are actually checking for a *device* here, we don't make the
// distinction between char and block devices

View File

@ -32,7 +32,7 @@
#include "io_resources.h"
#define TRACE_DEVICE_MANAGER
//#define TRACE_DEVICE_MANAGER
#ifdef TRACE_DEVICE_MANAGER
# define TRACE(a) dprintf a
#else
@ -1000,6 +1000,8 @@ Device::InitCheck() const
status_t
Device::InitDevice()
{
RecursiveLocker _(sLock);
if ((fNode->Flags() & NODE_FLAG_DEVICE_REMOVED) != 0) {
// TODO: maybe the device should be unlinked in devfs, too
return ENODEV;
@ -1042,6 +1044,8 @@ Device::InitDevice()
void
Device::UninitDevice()
{
RecursiveLocker _(sLock);
if (fInitialized-- > 1) {
fNode->UninitDriver();
return;