Added and implemented job related syscalls.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4137 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
c34b4f49f4
commit
fe05b0ac95
@ -199,15 +199,17 @@ status_t _kern_create_child_partition(partition_id partitionID,
|
|||||||
partition_id *childID);
|
partition_id *childID);
|
||||||
status_t _kern_delete_partition(partition_id partitionID, int32 changeCounter);
|
status_t _kern_delete_partition(partition_id partitionID, int32 changeCounter);
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
// jobs
|
// jobs
|
||||||
status_t get_next_disk_device_job_info(user_disk_device_job_info *info,
|
status_t _kern_get_next_disk_device_job_info(int32 *cookie,
|
||||||
int32 *cookie);
|
user_disk_device_job_info *info);
|
||||||
status_t get_disk_device_job_info(disk_job_id id,
|
status_t _kern_get_disk_device_job_info(disk_job_id id,
|
||||||
user_disk_device_job_info *info);
|
user_disk_device_job_info *info);
|
||||||
status_t get_disk_device_job_status(disk_job_id id, uint32 *status,
|
status_t _kern_get_disk_device_job_progress_info(disk_job_id id,
|
||||||
float *progress);
|
disk_device_job_progress_info *info);
|
||||||
|
status_t _kern_pause_disk_device_job(disk_job_id id);
|
||||||
|
status_t _kern_cancel_disk_device_job(disk_job_id id, bool reverse);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
// watching
|
// watching
|
||||||
status_t start_disk_device_watching(port_id, int32 token, uint32 flags);
|
status_t start_disk_device_watching(port_id, int32 token, uint32 flags);
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
// ddm_userland_interface.cpp
|
// ddm_userland_interface.cpp
|
||||||
|
|
||||||
|
#include <ddm_userland_interface.h>
|
||||||
#include <KDiskDevice.h>
|
#include <KDiskDevice.h>
|
||||||
|
#include <KDiskDeviceJob.h>
|
||||||
|
#include <KDiskDeviceJobQueue.h>
|
||||||
#include <KDiskDeviceManager.h>
|
#include <KDiskDeviceManager.h>
|
||||||
#include <KDiskDeviceUtils.h>
|
#include <KDiskDeviceUtils.h>
|
||||||
#include <KDiskSystem.h>
|
#include <KDiskSystem.h>
|
||||||
#include <KFileDiskDevice.h>
|
#include <KFileDiskDevice.h>
|
||||||
#include <KShadowPartition.h>
|
#include <KShadowPartition.h>
|
||||||
|
|
||||||
#include "ddm_userland_interface.h"
|
|
||||||
#include "UserDataWriter.h"
|
#include "UserDataWriter.h"
|
||||||
|
|
||||||
// get_current_team
|
// get_current_team
|
||||||
@ -1659,3 +1661,99 @@ _kern_delete_partition(partition_id partitionID, int32 changeCounter)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// _kern_get_next_disk_device_job_info
|
||||||
|
status_t
|
||||||
|
_kern_get_next_disk_device_job_info(int32 *cookie,
|
||||||
|
user_disk_device_job_info *info)
|
||||||
|
{
|
||||||
|
if (!cookie || !info)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||||
|
if (ManagerLocker locker = manager) {
|
||||||
|
// get the next job and an info
|
||||||
|
while (KDiskDeviceJob *job = manager->NextJob(cookie)) {
|
||||||
|
// return info only on job scheduled or in progress
|
||||||
|
switch (job->Status()) {
|
||||||
|
case B_DISK_DEVICE_JOB_SCHEDULED:
|
||||||
|
case B_DISK_DEVICE_JOB_IN_PROGRESS:
|
||||||
|
return job->GetInfo(info);
|
||||||
|
case B_DISK_DEVICE_JOB_UNINITIALIZED:
|
||||||
|
case B_DISK_DEVICE_JOB_SUCCEEDED:
|
||||||
|
case B_DISK_DEVICE_JOB_FAILED:
|
||||||
|
case B_DISK_DEVICE_JOB_CANCELED:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
// _kern_get_disk_device_job_info
|
||||||
|
status_t
|
||||||
|
_kern_get_disk_device_job_info(disk_job_id id, user_disk_device_job_info *info)
|
||||||
|
{
|
||||||
|
if (!info)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||||
|
if (ManagerLocker locker = manager) {
|
||||||
|
// find the job and get the info
|
||||||
|
if (KDiskDeviceJob *job = manager->FindJob(id))
|
||||||
|
return job->GetInfo(info);
|
||||||
|
}
|
||||||
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
// _kern_get_disk_device_job_status
|
||||||
|
status_t
|
||||||
|
_kern_get_disk_device_job_progress_info(disk_job_id id,
|
||||||
|
disk_device_job_progress_info *info)
|
||||||
|
{
|
||||||
|
if (!info)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||||
|
if (ManagerLocker locker = manager) {
|
||||||
|
// find the job and get the info
|
||||||
|
if (KDiskDeviceJob *job = manager->FindJob(id))
|
||||||
|
return job->GetProgressInfo(info);
|
||||||
|
}
|
||||||
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
// _kern_pause_disk_device_job
|
||||||
|
status_t
|
||||||
|
_kern_pause_disk_device_job(disk_job_id id)
|
||||||
|
{
|
||||||
|
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||||
|
if (ManagerLocker locker = manager) {
|
||||||
|
// get the job and the respective job queue
|
||||||
|
if (KDiskDeviceJob *job = manager->FindJob(id)) {
|
||||||
|
if (KDiskDeviceJobQueue *jobQueue = job->JobQueue()) {
|
||||||
|
// only the active job in progress can be paused
|
||||||
|
if (jobQueue->ActiveJob() != job)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
return jobQueue->Pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
// _kern_cancel_disk_device_job
|
||||||
|
status_t
|
||||||
|
_kern_cancel_disk_device_job(disk_job_id id, bool reverse)
|
||||||
|
{
|
||||||
|
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||||
|
if (ManagerLocker locker = manager) {
|
||||||
|
// get the job and the respective job queue
|
||||||
|
if (KDiskDeviceJob *job = manager->FindJob(id)) {
|
||||||
|
if (KDiskDeviceJobQueue *jobQueue = job->JobQueue()) {
|
||||||
|
// only the active job in progress can be canceled
|
||||||
|
if (jobQueue->ActiveJob() != job)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
return jobQueue->Cancel(reverse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user