The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 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 | |
Dan Albert | 07c7881 | 2015-02-18 00:18:25 -0800 | [diff] [blame] | 20 | #ifdef __cplusplus |
| 21 | extern "C" { |
| 22 | #endif |
| 23 | |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 24 | #define htoll(x) (x) |
| 25 | #define ltohl(x) (x) |
Elliott Hughes | 74ca428 | 2014-11-21 23:01:59 -0800 | [diff] [blame] | 26 | |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 27 | #define MKID(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24)) |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 28 | |
| 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 | |
| 41 | typedef 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 Lindner | 9f9d145 | 2014-03-11 17:55:59 -0700 | [diff] [blame] | 67 | } status; |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 68 | } syncmsg; |
| 69 | |
| 70 | |
| 71 | void file_sync_service(int fd, void *cookie); |
| 72 | int do_sync_ls(const char *path); |
Jeff Sharkey | 0e0d251 | 2014-06-09 17:30:57 -0700 | [diff] [blame] | 73 | int do_sync_push(const char *lpath, const char *rpath, int show_progress); |
Anthony Newnam | dd2db14 | 2010-02-22 08:36:49 -0600 | [diff] [blame] | 74 | int do_sync_sync(const char *lpath, const char *rpath, int listonly); |
Lajos Molnar | 4e23e3c | 2013-04-19 12:41:09 -0700 | [diff] [blame] | 75 | int do_sync_pull(const char *rpath, const char *lpath, int show_progress, int pullTime); |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 76 | |
| 77 | #define SYNC_DATA_MAX (64*1024) |
| 78 | |
Dan Albert | 07c7881 | 2015-02-18 00:18:25 -0800 | [diff] [blame] | 79 | #ifdef __cplusplus |
| 80 | } |
| 81 | #endif |
| 82 | |
The Android Open Source Project | 9ca14dc | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 83 | #endif |