OSDN Git Service

Merge "statically link adb and fastboot against libc++"
[android-x86/system-core.git] / adb / file_sync_service.h
1 /*
2  * Copyright (C) 2007 The Android Open Source Project
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 _FILE_SYNC_SERVICE_H_
18 #define _FILE_SYNC_SERVICE_H_
19
20 #define htoll(x) (x)
21 #define ltohl(x) (x)
22
23 #define MKID(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
24
25 #define ID_STAT MKID('S','T','A','T')
26 #define ID_LIST MKID('L','I','S','T')
27 #define ID_ULNK MKID('U','L','N','K')
28 #define ID_SEND MKID('S','E','N','D')
29 #define ID_RECV MKID('R','E','C','V')
30 #define ID_DENT MKID('D','E','N','T')
31 #define ID_DONE MKID('D','O','N','E')
32 #define ID_DATA MKID('D','A','T','A')
33 #define ID_OKAY MKID('O','K','A','Y')
34 #define ID_FAIL MKID('F','A','I','L')
35 #define ID_QUIT MKID('Q','U','I','T')
36
37 union syncmsg {
38     unsigned id;
39     struct {
40         unsigned id;
41         unsigned namelen;
42     } req;
43     struct {
44         unsigned id;
45         unsigned mode;
46         unsigned size;
47         unsigned time;
48     } stat;
49     struct {
50         unsigned id;
51         unsigned mode;
52         unsigned size;
53         unsigned time;
54         unsigned namelen;
55     } dent;
56     struct {
57         unsigned id;
58         unsigned size;
59     } data;
60     struct {
61         unsigned id;
62         unsigned msglen;
63     } status;
64 } ;
65
66
67 void file_sync_service(int fd, void *cookie);
68 int do_sync_ls(const char *path);
69 int do_sync_push(const char *lpath, const char *rpath, int show_progress);
70 int do_sync_sync(const char *lpath, const char *rpath, int listonly);
71 int do_sync_pull(const char *rpath, const char *lpath, int show_progress, int pullTime);
72
73 #define SYNC_DATA_MAX (64*1024)
74
75 #endif