• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright (C) 2008 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _MEDIA_H
19 #define _MEDIA_H
20 
21 #include <sys/types.h>
22 
23 #include "blkdev.h"
24 
25 typedef enum media_type {
26     media_unknown,
27     media_mmc,
28     media_devmapper,
29 } media_type_t;
30 
31 typedef struct media {
32     char           *devpath;
33     char           *name;
34     uint32_t       serial;
35     media_type_t   media_type;
36 
37     blkdev_list_t  *devs;
38 } media_t;
39 
40 typedef struct media_list {
41     media_t           *media;
42     struct media_list *next;
43 } media_list_t;
44 
45 media_t *media_create(char *devpath, char *name, char *serial, enum media_type);
46 media_t *media_lookup_by_path(char *devpath, boolean fuzzy_match);
47 media_t *media_lookup_by_dev(blkdev_t *dev);
48 void media_destroy(media_t *media);
49 int media_add_blkdev(media_t *media, blkdev_t *dev);
50 void media_remove_blkdev(media_t *media, blkdev_t *dev);
51 #endif
52