external: support foreach function for external storages
[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.deviced"
29 #define STORAGE_EXT_PATH                  "/Org/Tizen/System/DeviceD/Block"
30 #define STORAGE_EXT_PATH_DEVICES          STORAGE_EXT_PATH"/Devices"
31 #define STORAGE_EXT_PATH_MANAGER          STORAGE_EXT_PATH"/Manager"
32 #define STORAGE_EXT_IFACE                 STORAGE_EXT_BUS_NAME".Block"
33 #define STORAGE_EXT_IFACE_MANAGER         STORAGE_EXT_BUS_NAME".BlockManager"
34
35 enum mount_state {
36         STORAGE_EXT_UNMOUNTED,
37         STORAGE_EXT_MOUNTED,
38 };
39
40 enum storage_ext_state {
41         STORAGE_EXT_REMOVED,
42         STORAGE_EXT_ADDED,
43         STORAGE_EXT_CHANGED,
44 };
45
46 enum storage_ext_type {
47         STORAGE_EXT_SCSI,
48         STORAGE_EXT_MMC,
49 };
50
51 enum storage_ext_flags {
52         FLAG_NONE        = 0,
53         UNMOUNT_UNSAFE   = 1 << 0,
54         FS_BROKEN        = 1 << 1,
55         FS_EMPTY         = 1 << 2,
56         FS_NOT_SUPPORTED = 1 << 3,
57         MOUNT_READONLY   = 1 << 4,
58 };
59
60 typedef struct _storage_ext_device {
61         enum storage_ext_type type;
62         char *devnode;
63         char *syspath;
64         char *fs_usage;
65         char *fs_type;
66         char *fs_version;
67         char *fs_uuid;
68         bool readonly;
69         char *mount_point;
70         enum mount_state state;
71         bool primary;   /* the first partition */
72         int flags;
73         int storage_id;
74 } storage_ext_device;
75
76 void storage_ext_release_device(storage_ext_device **dev);
77 void storage_ext_release_list(dd_list **list);
78 int storage_ext_get_list(dd_list **list);
79
80 #endif /* __STORAGE_EXTERNAL_DBUS_H__ */