Style cleanup.
Some more useful default levels for the debug output (only wrapper.h, the values actually used were okay). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10303 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -9,6 +9,7 @@
|
||||
Device management.
|
||||
*/
|
||||
|
||||
|
||||
#include "scsi_dsk_int.h"
|
||||
|
||||
#include <pnp_devfs.h>
|
||||
@@ -139,8 +140,7 @@ das_device_added(pnp_node_handle node)
|
||||
|
||||
// ready to register
|
||||
{
|
||||
pnp_node_attr attrs[] =
|
||||
{
|
||||
pnp_node_attr attrs[] = {
|
||||
{ PNP_DRIVER_DRIVER, B_STRING_TYPE, { string: SCSI_DSK_MODULE_NAME }},
|
||||
{ PNP_DRIVER_TYPE, B_STRING_TYPE, { string: BLKDEV_TYPE_NAME }},
|
||||
// we always want blkdev on top of us
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -9,11 +9,14 @@
|
||||
File handle management.
|
||||
*/
|
||||
|
||||
|
||||
#include "scsi_dsk_int.h"
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
status_t das_open( das_device_info *device, das_handle_info **handle_out )
|
||||
|
||||
status_t
|
||||
das_open(das_device_info *device, das_handle_info **handle_out)
|
||||
{
|
||||
das_handle_info *handle;
|
||||
int res;
|
||||
@@ -40,7 +43,9 @@ status_t das_open( das_device_info *device, das_handle_info **handle_out )
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t das_close( das_handle_info *handle )
|
||||
|
||||
status_t
|
||||
das_close(das_handle_info *handle)
|
||||
{
|
||||
SHOW_FLOW0(3, "");
|
||||
|
||||
@@ -51,7 +56,9 @@ status_t das_close( das_handle_info *handle )
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t das_free( das_handle_info *handle )
|
||||
|
||||
status_t
|
||||
das_free(das_handle_info *handle)
|
||||
{
|
||||
SHOW_FLOW0(3, "");
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -9,6 +9,7 @@
|
||||
Everything doing the real input/output stuff.
|
||||
*/
|
||||
|
||||
|
||||
#include "scsi_dsk_int.h"
|
||||
|
||||
#define DAS_STD_TIMEOUT 10
|
||||
@@ -20,26 +21,29 @@ static int das_read_write( das_handle_info *handle, const phys_vecs *vecs,
|
||||
bool write);
|
||||
|
||||
|
||||
status_t das_read( das_handle_info *handle, const phys_vecs *vecs,
|
||||
off_t pos, size_t num_blocks, uint32 block_size, size_t *bytes_transferred )
|
||||
status_t
|
||||
das_read(das_handle_info *handle, const phys_vecs *vecs, off_t pos, size_t numBlocks,
|
||||
uint32 blockSize, size_t *bytesTransferred)
|
||||
{
|
||||
return das_read_write( handle, vecs, pos,
|
||||
num_blocks, block_size, bytes_transferred, false );
|
||||
return das_read_write(handle, vecs, pos, numBlocks, blockSize,
|
||||
bytesTransferred, false);
|
||||
}
|
||||
|
||||
|
||||
status_t das_write( das_handle_info *handle, const phys_vecs *vecs,
|
||||
off_t pos, size_t num_blocks, uint32 block_size, size_t *bytes_transferred )
|
||||
status_t
|
||||
das_write(das_handle_info *handle, const phys_vecs *vecs, off_t pos, size_t numBlocks,
|
||||
uint32 blockSize, size_t *bytesTransferred)
|
||||
{
|
||||
return das_read_write( handle, vecs, pos,
|
||||
num_blocks, block_size, bytes_transferred, true );
|
||||
return das_read_write(handle, vecs, pos, numBlocks, blockSize,
|
||||
bytesTransferred, true);
|
||||
}
|
||||
|
||||
|
||||
// universal read/write function
|
||||
static int das_read_write( das_handle_info *handle, const phys_vecs *vecs,
|
||||
off_t pos64, size_t num_blocks, uint32 block_size, size_t *bytes_transferred,
|
||||
bool write )
|
||||
/** universal read/write function */
|
||||
|
||||
static int
|
||||
das_read_write(das_handle_info *handle, const phys_vecs *vecs, off_t pos64,
|
||||
size_t num_blocks, uint32 block_size, size_t *bytes_transferred, bool write)
|
||||
{
|
||||
das_device_info *device = handle->device;
|
||||
scsi_ccb *request;
|
||||
@@ -50,7 +54,6 @@ static int das_read_write( das_handle_info *handle, const phys_vecs *vecs,
|
||||
|
||||
// don't test rw10_enabled restrictions - this flag may get changed
|
||||
request = device->scsi->alloc_ccb(device->scsi_device);
|
||||
|
||||
if (request == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
@@ -132,7 +135,6 @@ static int das_read_write( das_handle_info *handle, const phys_vecs *vecs,
|
||||
|
||||
// last chance to detect errors that occured during concurrent accesses
|
||||
err = handle->pending_error;
|
||||
|
||||
if (err)
|
||||
goto abort;
|
||||
|
||||
@@ -149,8 +151,8 @@ static int das_read_write( das_handle_info *handle, const phys_vecs *vecs,
|
||||
break;
|
||||
|
||||
case err_act_start:
|
||||
res = scsi_periph->send_start_stop(
|
||||
device->scsi_periph_device, request, 1, device->removable );
|
||||
res = scsi_periph->send_start_stop(device->scsi_periph_device,
|
||||
request, 1, device->removable);
|
||||
if (res.action == err_act_ok)
|
||||
res.action = err_act_retry;
|
||||
break;
|
||||
@@ -165,10 +167,8 @@ static int das_read_write( das_handle_info *handle, const phys_vecs *vecs,
|
||||
res.action = err_act_fail;
|
||||
break;
|
||||
}
|
||||
|
||||
} while(
|
||||
(res.action == err_act_retry && retries++ < 3) ||
|
||||
(res.action == err_act_many_retries && retries++ < 30 ));
|
||||
} while ((res.action == err_act_retry && retries++ < 3)
|
||||
|| (res.action == err_act_many_retries && retries++ < 30));
|
||||
|
||||
device->scsi->free_ccb(request);
|
||||
|
||||
@@ -176,7 +176,7 @@ static int das_read_write( das_handle_info *handle, const phys_vecs *vecs,
|
||||
// map them to "write" errors if this was a write request
|
||||
if (res.error_code == B_DEV_READ_ERROR && write)
|
||||
return B_DEV_WRITE_ERROR;
|
||||
else
|
||||
|
||||
return res.error_code;
|
||||
|
||||
abort:
|
||||
@@ -187,25 +187,31 @@ abort:
|
||||
|
||||
|
||||
|
||||
// kernel daemon
|
||||
// once in a minute, it sets a flag so that the next command is executed
|
||||
// ordered; this way, we avoid starvation of SCSI commands inside the
|
||||
// SCSI queuing system - the ordered command waits for all previous
|
||||
// commands and thus no command can starve longer then a minute
|
||||
void das_sync_queue_daemon( void *arg, int iteration )
|
||||
/** kernel daemon
|
||||
* once in a minute, it sets a flag so that the next command is executed
|
||||
* ordered; this way, we avoid starvation of SCSI commands inside the
|
||||
* SCSI queuing system - the ordered command waits for all previous
|
||||
* commands and thus no command can starve longer then a minute
|
||||
*/
|
||||
|
||||
void
|
||||
das_sync_queue_daemon(void *arg, int iteration)
|
||||
{
|
||||
das_device_info *device = (das_device_info *)arg;
|
||||
|
||||
atomic_or(&device->next_tag_action, SCSI_ORDERED_QTAG);
|
||||
}
|
||||
|
||||
void das_handle_set_error( das_handle_info *handle, status_t error_code )
|
||||
|
||||
void
|
||||
das_handle_set_error(das_handle_info *handle, status_t errorCode)
|
||||
{
|
||||
handle->pending_error = error_code;
|
||||
handle->pending_error = errorCode;
|
||||
}
|
||||
|
||||
|
||||
status_t das_handle_get_error( das_handle_info *handle )
|
||||
status_t
|
||||
das_handle_get_error(das_handle_info *handle)
|
||||
{
|
||||
return handle->pending_error;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef debug_level_flow
|
||||
# define debug_level_flow 3
|
||||
# define debug_level_flow 1
|
||||
#endif
|
||||
|
||||
#ifndef debug_level_info
|
||||
@@ -51,7 +51,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef debug_level_error
|
||||
# define debug_level_error 1
|
||||
# define debug_level_error 3
|
||||
#endif
|
||||
|
||||
#define FUNC_NAME DEBUG_MSG_PREFIX __FUNCTION__ ": "
|
||||
|
||||
Reference in New Issue
Block a user