* 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
BDiskDevice::Eject(bool update)
{
/* // get path
const char* path = Path();
status_t error = (path ? B_OK : B_NO_INIT);
if (fDeviceData == NULL)
return B_NO_INIT;
// check whether the device media is removable
if (error == B_OK && !IsRemovable())
error = B_BAD_VALUE;
if (!IsRemovableMedia())
return B_BAD_VALUE;
// open, eject and close the device
if (error == B_OK) {
int fd = open(path, O_RDONLY);
if (fd < 0 || ioctl(fd, B_EJECT_DEVICE) != 0)
error = errno;
if (fd >= 0)
close(fd);
}
if (error == B_OK && update)
error = Update();
return error;
*/
// not implemented
return B_ERROR;
int fd = open(fDeviceData->path, O_RDONLY);
if (fd < 0)
return errno;
status_t status = B_OK;
if (ioctl(fd, B_EJECT_DEVICE) != 0)
status = errno;
close(fd);
if (status == B_OK && update)
status = Update();
return status;
}