Supporting Internal Media Path Compatibility
[platform/core/system/libstorage.git] / src / storage-external-dbus.h
1 /*
2  * libstorage
3  *
4  * Copyright (c) 2016 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 __STORAGE_EXTERNAL_DBUS_H__
21 #define __STORAGE_EXTERNAL_DBUS_H__
22
23 #include <stdbool.h>
24 #include <glib.h>
25 #include <gio/gio.h>
26 #include "list.h"
27
28 #define STORAGE_EXT_BUS_NAME              "org.tizen.system.storage"
29 #define STORAGE_EXT_PATH_MANAGER          "/Org/Tizen/System/Storage/Block/Manager"
30 #define STORAGE_EXT_IFACE_MANAGER         STORAGE_EXT_BUS_NAME".BlockManager"
31
32 enum mount_state {
33         STORAGE_EXT_UNMOUNTED,
34         STORAGE_EXT_MOUNTED,
35 };
36
37 enum storage_ext_state {
38         STORAGE_EXT_REMOVED,
39         STORAGE_EXT_ADDED,
40         STORAGE_EXT_CHANGED,
41 };
42
43 enum storage_ext_type {
44         STORAGE_EXT_SCSI,
45         STORAGE_EXT_MMC,
46 };
47
48 enum storage_ext_flags {
49         FLAG_NONE        = 0,
50         UNMOUNT_UNSAFE   = 1 << 0,
51         FS_BROKEN        = 1 << 1,
52         FS_EMPTY         = 1 << 2,
53         FS_NOT_SUPPORTED = 1 << 3,
54         MOUNT_READONLY   = 1 << 4,
55 };
56
57 typedef struct _storage_ext_device {
58         enum storage_ext_type type;
59         char *devnode;
60         char *syspath;
61         char *fs_usage;
62         char *fs_type;
63         char *fs_version;
64         char *fs_uuid;
65         bool readonly;
66         char *mount_point;
67         enum mount_state state;
68         bool primary;   /* the first partition */
69         int flags;
70         int storage_id;
71 } storage_ext_device;
72
73 typedef int (*storage_ext_changed_cb)(storage_ext_device *dev, enum storage_ext_state state, void *data);
74
75 void storage_ext_release_device(storage_ext_device **dev);
76 void storage_ext_release_list(dd_list **list);
77 int storage_ext_get_list(dd_list **list);
78
79 int storage_ext_register_device_change(storage_ext_changed_cb func, void *data);
80 void storage_ext_unregister_device_change(storage_ext_changed_cb func);
81
82 int storage_ext_get_device_info(int storage_id, storage_ext_device *info);
83
84 /* storage-internal.c */
85 GVariant *dbus_method_call_sync(const gchar *dest, const gchar *path,
86                 const gchar *iface, const gchar *method, GVariant *param);
87
88 #endif /* __STORAGE_EXTERNAL_DBUS_H__ */