minor simplification.
[AROS.git] / rom / partition / writepartitiondata.c
blob774ea524c22ef7c6586371512a0324583c5b2f29
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/libcall.h>
7 #include <proto/exec.h>
9 #include "partition_intern.h"
10 #include "partition_support.h"
12 /*****************************************************************************
14 NAME */
15 AROS_LH3QUAD1(LONG, WritePartitionDataQ,
17 /* SYNOPSIS */
18 AROS_LHA(struct PartitionHandle *, Partition , A0),
19 AROS_LHA(APTR , Buffer , A1),
20 AROS_LHA(ULONG , DataSize , D0),
21 AROS_LHAQUAD(UQUAD , StartBlock, D1, D2),
23 /* LOCATION */
24 struct Library *, PartitionBase, 26, Partition)
26 /* FUNCTION
27 Write raw data to the partition.
29 INPUTS
30 Partition - a handle to a partition to read from
31 Buffer - a pointer to a data buffer
32 DataSize - Size of data to read in bytes. This size must be a
33 multiple of block size in order to ensure correct
34 operation.
35 StartBlock - Number of the first block to start writing from.
37 RESULT
38 Return code of DoIO() function which was used to write the data.
40 NOTES
42 EXAMPLE
44 BUGS
46 SEE ALSO
48 INTERNALS
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
54 UQUAD offset = (getStartBlock(Partition) + StartBlock) * (Partition->de.de_SizeBlock << 2);
55 struct IOExtTD *ioreq = Partition->bd->ioreq;
57 ioreq->iotd_Req.io_Command = Partition->bd->cmdwrite;
58 ioreq->iotd_Req.io_Length = DataSize;
59 ioreq->iotd_Req.io_Data = Buffer;
60 ioreq->iotd_Req.io_Offset = offset;
61 ioreq->iotd_Req.io_Actual = offset >> 32;
63 return DoIO((struct IORequest *)ioreq);
65 AROS_LIBFUNC_EXIT