blob: 5b69a6363d0ebd0fe2ea8fe4295fea2eeaa0dcbf [file] [log] [blame]
The Android Open Source Project9ca14dc2009-03-03 19:32:55 -08001/*
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
Dan Albert07c78812015-02-18 00:18:25 -080020#ifdef __cplusplus
21extern "C" {
22#endif
23
The Android Open Source Project9ca14dc2009-03-03 19:32:55 -080024#define htoll(x) (x)
25#define ltohl(x) (x)
Elliott Hughes74ca4282014-11-21 23:01:59 -080026
The Android Open Source Project9ca14dc2009-03-03 19:32:55 -080027#define MKID(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
The Android Open Source Project9ca14dc2009-03-03 19:32:55 -080028
29#define ID_STAT MKID('S','T','A','T')
30#define ID_LIST MKID('L','I','S','T')
31#define ID_ULNK MKID('U','L','N','K')
32#define ID_SEND MKID('S','E','N','D')
33#define ID_RECV MKID('R','E','C','V')
34#define ID_DENT MKID('D','E','N','T')
35#define ID_DONE MKID('D','O','N','E')
36#define ID_DATA MKID('D','A','T','A')
37#define ID_OKAY MKID('O','K','A','Y')
38#define ID_FAIL MKID('F','A','I','L')
39#define ID_QUIT MKID('Q','U','I','T')
40
41typedef union {
42 unsigned id;
43 struct {
44 unsigned id;
45 unsigned namelen;
46 } req;
47 struct {
48 unsigned id;
49 unsigned mode;
50 unsigned size;
51 unsigned time;
52 } stat;
53 struct {
54 unsigned id;
55 unsigned mode;
56 unsigned size;
57 unsigned time;
58 unsigned namelen;
59 } dent;
60 struct {
61 unsigned id;
62 unsigned size;
63 } data;
64 struct {
65 unsigned id;
66 unsigned msglen;
Mark Lindner9f9d1452014-03-11 17:55:59 -070067 } status;
The Android Open Source Project9ca14dc2009-03-03 19:32:55 -080068} syncmsg;
69
70
71void file_sync_service(int fd, void *cookie);
72int do_sync_ls(const char *path);
Jeff Sharkey0e0d2512014-06-09 17:30:57 -070073int do_sync_push(const char *lpath, const char *rpath, int show_progress);
Anthony Newnamdd2db142010-02-22 08:36:49 -060074int do_sync_sync(const char *lpath, const char *rpath, int listonly);
Lajos Molnar4e23e3c2013-04-19 12:41:09 -070075int do_sync_pull(const char *rpath, const char *lpath, int show_progress, int pullTime);
The Android Open Source Project9ca14dc2009-03-03 19:32:55 -080076
77#define SYNC_DATA_MAX (64*1024)
78
Dan Albert07c78812015-02-18 00:18:25 -080079#ifdef __cplusplus
80}
81#endif
82
The Android Open Source Project9ca14dc2009-03-03 19:32:55 -080083#endif