* Implemented Eject().

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28345 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-10-27 15:30:58 +00:00
parent 67804f25ed
commit 2ec100b72e
+20 -18
View File
@@ -110,26 +110,28 @@ BDiskDevice::IsWriteOnceMedia() const
status_t status_t
BDiskDevice::Eject(bool update) BDiskDevice::Eject(bool update)
{ {
/* // get path if (fDeviceData == NULL)
const char* path = Path(); return B_NO_INIT;
status_t error = (path ? B_OK : B_NO_INIT);
// check whether the device media is removable // check whether the device media is removable
if (error == B_OK && !IsRemovable()) if (!IsRemovableMedia())
error = B_BAD_VALUE; return B_BAD_VALUE;
// open, eject and close the device // open, eject and close the device
if (error == B_OK) { int fd = open(fDeviceData->path, O_RDONLY);
int fd = open(path, O_RDONLY); if (fd < 0)
if (fd < 0 || ioctl(fd, B_EJECT_DEVICE) != 0) return errno;
error = errno;
if (fd >= 0) status_t status = B_OK;
close(fd); if (ioctl(fd, B_EJECT_DEVICE) != 0)
} status = errno;
if (error == B_OK && update)
error = Update(); close(fd);
return error;
*/ if (status == B_OK && update)
// not implemented status = Update();
return B_ERROR;
return status;
} }