San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef _DEVICEVOLUME_H |
| 18 | #define _DEVICEVOLUME_H |
| 19 | |
| 20 | #include <utils/List.h> |
| 21 | |
| 22 | #include "Volume.h" |
| 23 | |
| 24 | typedef android::List<char *> PathCollection; |
| 25 | |
San Mehat | ae10b91 | 2009-10-12 14:57:05 -0700 | [diff] [blame] | 26 | class DirectVolume : public Volume { |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 27 | protected: |
| 28 | PathCollection *mPaths; |
| 29 | int mPartIdx; |
| 30 | int mDiskMaj; |
| 31 | int mDiskNumParts; |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 32 | unsigned char mPendingPartMap; |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 33 | |
| 34 | public: |
San Mehat | ae10b91 | 2009-10-12 14:57:05 -0700 | [diff] [blame] | 35 | DirectVolume(const char *label, const char *mount_point, int partIdx); |
| 36 | virtual ~DirectVolume(); |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 37 | |
| 38 | int addPath(const char *path); |
| 39 | |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 40 | int handleBlockEvent(NetlinkEvent *evt); |
San Mehat | 49e2bce | 2009-10-12 16:29:01 -0700 | [diff] [blame^] | 41 | protected: |
| 42 | int prepareToMount(int *major, int *minor); |
San Mehat | fd7f587 | 2009-10-12 11:32:47 -0700 | [diff] [blame] | 43 | |
| 44 | private: |
| 45 | void handleDiskAdded(const char *devpath, NetlinkEvent *evt); |
| 46 | void handleDiskRemoved(const char *devpath, NetlinkEvent *evt); |
| 47 | void handlePartitionAdded(const char *devpath, NetlinkEvent *evt); |
| 48 | void handlePartitionRemoved(const char *devpath, NetlinkEvent *evt); |
San Mehat | 49e2bce | 2009-10-12 16:29:01 -0700 | [diff] [blame^] | 49 | |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 50 | }; |
| 51 | |
San Mehat | ae10b91 | 2009-10-12 14:57:05 -0700 | [diff] [blame] | 52 | typedef android::List<DirectVolume *> DirectVolumeCollection; |
San Mehat | f1b736b | 2009-10-10 17:22:08 -0700 | [diff] [blame] | 53 | |
| 54 | #endif |