1/*
2 * Copyright (c) 2001-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License").  You may not use this file except in compliance with the
9 * License.  Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23
24#ifndef _APPLERAIDSTRIPESET_H
25#define _APPLERAIDSTRIPESET_H
26
27#define kAppleRAIDLevelNameStripe "Stripe"
28
29#ifdef KERNEL
30
31class AppleRAIDStripeSet : public AppleRAIDSet
32{
33    OSDeclareDefaultStructors(AppleRAIDStripeSet);
34
35 protected:
36    virtual bool init();
37    virtual void free();
38
39 public:
40    static AppleRAIDSet * createRAIDSet(AppleRAIDMember * firstMember);
41    virtual bool addSpare(AppleRAIDMember * member);
42    virtual bool addMember(AppleRAIDMember * member);
43    virtual bool startSet(void);
44
45    virtual AppleRAIDMemoryDescriptor * allocateMemoryDescriptor(AppleRAIDStorageRequest *storageRequest, UInt32 memberIndex);
46};
47
48
49
50class AppleRAIDStripeMemoryDescriptor : public AppleRAIDMemoryDescriptor
51{
52    OSDeclareDefaultStructors(AppleRAIDStripeMemoryDescriptor);
53
54private:
55    UInt32		mdMemberCount;
56    UInt32		mdSetBlockSize;
57    UInt32		mdSetBlockStart;
58    UInt32		mdSetBlockOffset;
59
60protected:
61    virtual bool initWithStorageRequest(AppleRAIDStorageRequest *storageRequest, UInt32 memberIndex);
62    virtual bool configureForMemoryDescriptor(IOMemoryDescriptor *memoryDescriptor, UInt64 byteStart, UInt32 activeIndex);
63
64 public:
65    static AppleRAIDMemoryDescriptor *withStorageRequest(AppleRAIDStorageRequest *storageRequest, UInt32 memberIndex);
66    virtual addr64_t getPhysicalSegment(IOByteCount offset, IOByteCount * length, IOOptionBits options = 0);
67};
68
69#endif KERNEL
70
71#endif /* ! _APPLERAIDSTRIPESET_H */
72