tizen 2.3 release
[framework/system/deviced.git] / src / mmc / mmc-handler.h
1 /*
2  * deviced
3  *
4  * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the License);
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19
20 #ifndef __MMC_HANDLER_H__
21 #define __MMC_HANDLER_H__
22
23 #include <stdbool.h>
24
25 #define SMACKFS_MOUNT_OPT       "smackfsroot=system::ext_storage,smackfsdef=system::ext_storage"
26 #define MMC_MOUNT_POINT         "/opt/storage/sdcard"
27
28 #define BUF_LEN         20
29 #define RETRY_COUNT     10
30
31 #define MMC_POPUP_NAME          "mmc-syspopup"
32 #define MMC_POPUP_APP_KEY       "_APP_NAME_"
33 #define MMC_POPUP_SMACK_VALUE   "checksmack"
34
35 enum mmc_fs_type {
36         FS_TYPE_VFAT = 0,
37         FS_TYPE_EXFAT,
38         FS_TYPE_EXT4,
39 };
40
41 struct mmc_fs_ops {
42         enum mmc_fs_type type;
43         const char *name;
44         bool (*match) (const char *);
45         int (*check) (const char *);
46         int (*mount) (bool, const char *, const char *);
47         int (*format) (const char *);
48 };
49
50 struct fs_check {
51         int type;
52         char *name;
53         unsigned int offset;
54         unsigned int magic_sz;
55         char magic[4];
56 };
57
58 void add_fs(const struct mmc_fs_ops *fs);
59 void remove_fs(const struct mmc_fs_ops *fs);
60 int get_mmc_devpath(char devpath[]);
61 bool mmc_check_mounted(const char *mount_point);
62
63 int mmc_uevent_start(void);
64 int mmc_uevent_stop(void);
65 int get_block_number(void);
66
67 void mmc_mount_done(void);
68 #endif /* __MMC_HANDLER_H__ */