Code Sync up from tizen_2.4
[platform/core/connectivity/mtp-responder.git] / include / mtp_inoti_handler.h
1 /*
2  * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef _MTP_INOTI_HANDLER_H_
18 #define _MTP_INOTI_HANDLER_H_
19
20 #include "mtp_config.h"
21 #ifdef MTP_SUPPORT_OBJECTADDDELETE_EVENT
22 #include <sys/inotify.h>
23 #include <limits.h>
24 #include "mtp_datatype.h"
25
26 #define INOTI_EVENT_SIZE        (sizeof(struct inotify_event))
27 #define INOTI_BUF_LEN           (INOTI_EVENT_SIZE + NAME_MAX + 1)
28 #define INOTI_FOLDER_COUNT_MAX  (1024)
29
30 typedef struct {
31         mtp_int32 wd;
32         mtp_char *forlder_name;
33 } inoti_watches_t;
34
35 typedef struct _open_files_info {
36         mtp_char *name;
37         mtp_int32 wd;
38         struct _open_files_info* previous;
39         struct _open_files_info* next;
40 } open_files_info_t;
41
42 void *_thread_inoti(void *arg);
43 void _inoti_add_watch_for_fs_events(mtp_char *path);
44 mtp_bool _inoti_init_filesystem_evnts();
45 void _inoti_deinit_filesystem_events();
46 #endif /* MTP_SUPPORT_OBJECTADDDELETE_EVENT */
47
48 #endif /* _MTP_INOTI_HANDLER_H_ */