[Haiku-commits] r30961 - haiku/trunk/src/system/kernel/device_manager
axeld at BerliOS
axeld at mail.berlios.de
Thu Jun 4 23:06:07 CEST 2009
Author: axeld
Date: 2009-06-04 23:06:06 +0200 (Thu, 04 Jun 2009)
New Revision: 30961
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=30961&view=rev
Modified:
haiku/trunk/src/system/kernel/device_manager/devfs.cpp
Log:
* Only call Removed() on the device if the device actually got removed, not if
only one of its partitions went away. This should fix #3983.
* Minor cleanup.
Modified: haiku/trunk/src/system/kernel/device_manager/devfs.cpp
===================================================================
--- haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2009-06-04 12:29:15 UTC (rev 30960)
+++ haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2009-06-04 21:06:06 UTC (rev 30961)
@@ -252,15 +252,14 @@
hash_remove(fs->vnode_hash, vnode);
if (S_ISCHR(vnode->stream.type)) {
- // pass the call through to the underlying device
- vnode->stream.u.dev.device->Removed();
-
- // for partitions, we have to release the raw device but must
- // not free the device info as it was inherited from the raw
- // device and is still in use there
- if (vnode->stream.u.dev.partition) {
- put_vnode(fs->volume,
- vnode->stream.u.dev.partition->raw_device->id);
+ if (vnode->stream.u.dev.partition == NULL) {
+ // pass the call through to the underlying device
+ vnode->stream.u.dev.device->Removed();
+ } else {
+ // for partitions, we have to release the raw device but must
+ // not free the device info as it was inherited from the raw
+ // device and is still in use there
+ put_vnode(fs->volume, vnode->stream.u.dev.partition->raw_device->id);
}
}
@@ -385,7 +384,7 @@
return B_BAD_VALUE;
// we don't support nested partitions
- if (device->stream.u.dev.partition)
+ if (device->stream.u.dev.partition != NULL)
return B_BAD_VALUE;
// reduce checks to a minimum - things like negative offsets could be useful
@@ -1225,11 +1224,11 @@
if (pos < 0)
return B_BAD_VALUE;
- if (vnode->stream.u.dev.partition) {
+ if (vnode->stream.u.dev.partition != NULL) {
if (pos >= vnode->stream.u.dev.partition->info.size)
return B_BAD_VALUE;
- translate_partition_access(vnode->stream.u.dev.partition, pos,
- *_length);
+
+ translate_partition_access(vnode->stream.u.dev.partition, pos, *_length);
}
if (*_length == 0)
@@ -1257,11 +1256,11 @@
if (pos < 0)
return B_BAD_VALUE;
- if (vnode->stream.u.dev.partition) {
+ if (vnode->stream.u.dev.partition != NULL) {
if (pos >= vnode->stream.u.dev.partition->info.size)
return B_BAD_VALUE;
- translate_partition_access(vnode->stream.u.dev.partition, pos,
- *_length);
+
+ translate_partition_access(vnode->stream.u.dev.partition, pos, *_length);
}
if (*_length == 0)
@@ -1458,7 +1457,7 @@
switch (op) {
case B_GET_GEOMETRY:
{
- struct devfs_partition *partition
+ struct devfs_partition* partition
= vnode->stream.u.dev.partition;
if (partition == NULL)
break;
@@ -1498,7 +1497,7 @@
case B_GET_PARTITION_INFO:
{
- struct devfs_partition *partition
+ struct devfs_partition* partition
= vnode->stream.u.dev.partition;
if (!S_ISCHR(vnode->stream.type)
|| partition == NULL
@@ -1638,9 +1637,10 @@
if (pos < 0)
return B_BAD_VALUE;
- if (vnode->stream.u.dev.partition) {
+ if (vnode->stream.u.dev.partition != NULL) {
if (pos >= vnode->stream.u.dev.partition->info.size)
return B_BAD_VALUE;
+
translate_partition_access(vnode->stream.u.dev.partition, pos,
*_numBytes);
}
@@ -1696,9 +1696,10 @@
if (pos < 0)
return B_BAD_VALUE;
- if (vnode->stream.u.dev.partition) {
+ if (vnode->stream.u.dev.partition != NULL) {
if (pos >= vnode->stream.u.dev.partition->info.size)
return B_BAD_VALUE;
+
translate_partition_access(vnode->stream.u.dev.partition, pos,
*_numBytes);
}
@@ -1755,7 +1756,7 @@
return B_NOT_ALLOWED;
}
- if (vnode->stream.u.dev.partition) {
+ if (vnode->stream.u.dev.partition != NULL) {
if (request->Offset() + request->Length()
>= vnode->stream.u.dev.partition->info.size) {
return B_BAD_VALUE;
More information about the Haiku-commits
mailing list