2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 #include "mtp_object.h"
27 /* First six members of SStorageInfo structure */
28 #define FIXED_LENGTH_MEMBERS_MTPSTORE_SIZE \
29 (sizeof(mtp_uint16) * 3 + sizeof(mtp_uint64) * 2 + sizeof(mtp_uint32))
32 MTPSTORE_WMPINFO_PHONE = 1,
34 } store_special_obj_t;
38 * This structure stores store information for each store
41 mtp_uint16 store_type; /*storage type*/
42 mtp_uint16 fs_type; /*file system type*/
43 mtp_uint16 access; /*access capability(read/write)*/
44 mtp_uint64 capacity; /*maximum capacity in bytes*/
45 mtp_uint64 free_space; /*free space in bytes*/
46 mtp_uint32 free_space_in_objs; /*free space in objects*/
47 ptp_string_t store_desc;
48 ptp_string_t vol_label; /*optional volume label: variable length*/
52 * MTP store structure.
53 * This structure is instantiated for each store within the MTP device.
56 mtp_char *root_path; /* Root path of the store */
58 store_info_t store_info;
60 mtp_bool is_hidden; /*for hidden storage*/
66 ptp_array_t child_data;
67 } missing_child_data_t;
70 MTP_INTERNAL_STORE_ID = 0x10001,
71 MTP_EXTERNAL_STORE_ID = 0x20001
81 void _entity_update_store_info_run_time(store_info_t *info,
83 mtp_bool _entity_get_store_path_by_id(mtp_uint32 store_id, mtp_char *path);
84 mtp_uint32 _entity_get_store_info_size(store_info_t *info);
85 mtp_uint32 _entity_pack_store_info(store_info_t *info, mtp_uchar *buf,
87 mtp_uint32 _entity_get_store_id_by_path(const mtp_char *path_name);
88 mtp_bool _entity_init_mtp_store(mtp_store_t *store, mtp_uint32 store_id,
89 mtp_char *store_path);
90 mtp_obj_t *_entity_add_file_to_store(mtp_store_t *store, mtp_uint32 h_parent,
91 mtp_char *file_path, mtp_char *file_name, dir_entry_t *file_info);
92 mtp_obj_t *_entity_add_folder_to_store(mtp_store_t *store, mtp_uint32 h_parent,
93 mtp_char *file_path, mtp_char *file_name, dir_entry_t *file_info);
94 mtp_bool _entity_add_object_to_store(mtp_store_t *store, mtp_obj_t *obj);
95 mtp_obj_t *_entity_get_object_from_store(mtp_store_t *store, mtp_uint32 handle);
96 mtp_obj_t *_entity_get_last_object_from_store(mtp_store_t *store,
98 mtp_obj_t *_entity_get_object_from_store_by_path(mtp_store_t *store,
100 mtp_uint32 _entity_get_objects_from_store(mtp_store_t *store,
101 mtp_uint32 obj_handle, mtp_uint32 fmt, ptp_array_t *obj_arr);
102 mtp_uint32 _entity_get_objects_from_store_till_depth(mtp_store_t *store,
103 mtp_uint32 obj_handle, mtp_uint32 fmt_code, mtp_uint32 depth,
104 ptp_array_t *obj_arr);
105 mtp_uint32 _entity_get_objects_from_store_by_format(mtp_store_t *store,
106 mtp_uint32 format, ptp_array_t *obj_arr);
107 mtp_uint32 _entity_get_num_object_with_same_format(mtp_store_t *store,
109 mtp_uint32 _entity_get_num_children(mtp_store_t *store, mtp_uint32 h_parent,
111 mtp_uint32 _entity_get_child_handles(mtp_store_t *store, mtp_uint32 h_parent,
112 ptp_array_t *child_arr);
113 mtp_uint32 _entity_get_child_handles_with_same_format(mtp_store_t *store,
114 mtp_uint32 h_parent, mtp_uint32 format, ptp_array_t *child_arr);
115 mtp_bool _entity_remove_object_mtp_store(mtp_store_t *store, mtp_obj_t *obj,
116 mtp_uint32 format, mtp_uint16 *response, mtp_bool *atleast_one,
118 mtp_uint16 _entity_delete_obj_mtp_store(mtp_store_t *store,
119 mtp_uint32 obj_handle, mtp_uint32 fmt, mtp_bool read_only);
120 mtp_uint32 _entity_get_object_tree_size(mtp_store_t *store, mtp_obj_t *obj);
121 mtp_bool _entity_check_if_B_parent_of_A(mtp_store_t *store,
122 mtp_uint32 handleA, mtp_uint32 handleB);
123 mtp_uint32 _entity_generate_next_obj_handle(void);
124 mtp_uint16 _entity_format_store(mtp_store_t *store, mtp_uint32 fs_format);
125 void _entity_destroy_mtp_store(mtp_store_t *store);
126 void _entity_store_recursive_enum_folder_objects(mtp_store_t *store,
128 void _entity_list_modified_files(mtp_uint32 minutes);
129 void _entity_copy_store_data(mtp_store_t *dst, mtp_store_t *src);
135 #endif /* _MTP_STORE_H_ */