blob: 82638054801aa3e02a957e3808d99ad8d1f2a325 [file] [log] [blame]
San Mehatf1b736b2009-10-10 17:22:08 -07001/*
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 _VOLUMEMANAGER_H
18#define _VOLUMEMANAGER_H
19
20#include <pthread.h>
21
22#include <utils/List.h>
23#include <sysutils/SocketListener.h>
24
25#include "BlockDevice.h"
26#include "Volume.h"
27
28class VolumeManager {
29private:
30 static VolumeManager *sInstance;
31
32private:
33 SocketListener *mBroadcaster;
34 BlockDeviceCollection *mBlockDevices;
35
36 VolumeCollection *mVolumes;
37
38public:
39 virtual ~VolumeManager();
40
41 int start();
42 int stop();
43
44 void handleDiskInserted(const char *devpath, int maj, int min,
45 int nr_parts);
46 void handleDiskRemoved(int maj, int min);
47
48 void handlePartCreated(const char *devpath, int maj, int min,
49 int part_no);
50 void handlePartRemoved(int maj, int min);
51
52 int addVolume(Volume *v);
53
54 int listVolumes(SocketClient *cli);
55
56 void setBroadcaster(SocketListener *sl) { mBroadcaster = sl; }
57 SocketListener *getBroadcaster() { return mBroadcaster; }
58
59 static VolumeManager *Instance();
60
61private:
62 VolumeManager();
63};
64#endif