aboutsummaryrefslogtreecommitdiff
path: root/adb.h
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2017-10-04 15:05:40 -0700
committerMark Salyzyn <salyzyn@google.com>2017-10-13 07:31:49 -0700
commitd4bf94d72db6e6fc18f21331ed0c2d9cb0a9d472 (patch)
treea706ecb477155447b71c4ad03b8d7804e5ccdf47 /adb.h
parent299da1cf8e0c26a16617f107fa6f863ef42695e6 (diff)
downloadadb-d4bf94d72db6e6fc18f21331ed0c2d9cb0a9d472.tar.gz
adb: clang-format for adb.h and client/usb_windows.cpp
Future adjustments triggered cleanup and transition of adb/adb.h and adb/client/usb_windows.cpp to be moved to Android coding standard. Test: build Bug: 63736262 Bug: 38446744 Bug: 66912053 Change-Id: I6eb3f0665b9670b9b3d5f5397f271605b48f4ff0
Diffstat (limited to 'adb.h')
-rw-r--r--adb.h73
1 files changed, 35 insertions, 38 deletions
diff --git a/adb.h b/adb.h
index a4d233ea..3651413e 100644
--- a/adb.h
+++ b/adb.h
@@ -67,9 +67,8 @@ struct amessage {
uint32_t magic; /* command ^ 0xffffffff */
};
-struct apacket
-{
- apacket *next;
+struct apacket {
+ apacket* next;
size_t len;
char* ptr;
@@ -85,13 +84,11 @@ uint32_t calculate_apacket_checksum(const apacket* packet);
** this should be used to cleanup objects that depend on the
** transport (e.g. remote sockets, listeners, etc...)
*/
-struct adisconnect
-{
- void (*func)(void* opaque, atransport* t);
- void* opaque;
+struct adisconnect {
+ void (*func)(void* opaque, atransport* t);
+ void* opaque;
};
-
// A transport object models the connection to a remote device or emulator there
// is one transport per connected device/emulator. A "local transport" connects
// through TCP (for the emulator), while a "usb transport" through USB (for real
@@ -121,15 +118,14 @@ enum ConnectionState {
kCsUnauthorized,
};
-
-void print_packet(const char *label, apacket *p);
+void print_packet(const char* label, apacket* p);
// These use the system (v)fprintf, not the adb prefixed ones defined in sysdeps.h, so they
// shouldn't be tagged with ADB_FORMAT_ARCHETYPE.
void fatal(const char* fmt, ...) __attribute__((noreturn, format(__printf__, 1, 2)));
void fatal_errno(const char* fmt, ...) __attribute__((noreturn, format(__printf__, 1, 2)));
-void handle_packet(apacket *p, atransport *t);
+void handle_packet(apacket* p, atransport* t);
int launch_server(const std::string& socket_spec);
int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply_fd);
@@ -138,7 +134,7 @@ int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply
#if ADB_HOST
int get_available_local_transport_index();
#endif
-int init_socket_transport(atransport *t, int s, int port, int local);
+int init_socket_transport(atransport* t, int s, int port, int local);
void init_usb_transport(atransport* t, usb_handle* usb);
std::string getEmulatorSerialString(int console_port);
@@ -153,77 +149,78 @@ asocket* host_service_to_socket(const char* name, const char* serial, TransportI
#endif
#if !ADB_HOST
-int init_jdwp(void);
-asocket* create_jdwp_service_socket();
-asocket* create_jdwp_tracker_service_socket();
-int create_jdwp_connection_fd(int jdwp_pid);
+int init_jdwp(void);
+asocket* create_jdwp_service_socket();
+asocket* create_jdwp_tracker_service_socket();
+int create_jdwp_connection_fd(int jdwp_pid);
#endif
int handle_forward_request(const char* service, TransportType type, const char* serial,
TransportId transport_id, int reply_fd);
#if !ADB_HOST
-void framebuffer_service(int fd, void *cookie);
+void framebuffer_service(int fd, void* cookie);
void set_verity_enabled_state_service(int fd, void* cookie);
#endif
/* packet allocator */
-apacket *get_apacket(void);
-void put_apacket(apacket *p);
+apacket* get_apacket(void);
+void put_apacket(apacket* p);
// Define it if you want to dump packets.
#define DEBUG_PACKETS 0
#if !DEBUG_PACKETS
-#define print_packet(tag,p) do {} while (0)
+#define print_packet(tag, p) \
+ do { \
+ } while (0)
#endif
#if ADB_HOST_ON_TARGET
/* adb and adbd are coexisting on the target, so use 5038 for adb
* to avoid conflicting with adbd's usage of 5037
*/
-# define DEFAULT_ADB_PORT 5038
+#define DEFAULT_ADB_PORT 5038
#else
-# define DEFAULT_ADB_PORT 5037
+#define DEFAULT_ADB_PORT 5037
#endif
#define DEFAULT_ADB_LOCAL_TRANSPORT_PORT 5555
-#define ADB_CLASS 0xff
-#define ADB_SUBCLASS 0x42
-#define ADB_PROTOCOL 0x1
-
+#define ADB_CLASS 0xff
+#define ADB_SUBCLASS 0x42
+#define ADB_PROTOCOL 0x1
void local_init(int port);
bool local_connect(int port);
-int local_connect_arbitrary_ports(int console_port, int adb_port, std::string* error);
+int local_connect_arbitrary_ports(int console_port, int adb_port, std::string* error);
-ConnectionState connection_state(atransport *t);
+ConnectionState connection_state(atransport* t);
extern const char* adb_device_banner;
#if !ADB_HOST
extern int SHELL_EXIT_NOTIFY_FD;
-#endif // !ADB_HOST
+#endif // !ADB_HOST
-#define CHUNK_SIZE (64*1024)
+#define CHUNK_SIZE (64 * 1024)
#if !ADB_HOST
-#define USB_FFS_ADB_PATH "/dev/usb-ffs/adb/"
-#define USB_FFS_ADB_EP(x) USB_FFS_ADB_PATH#x
+#define USB_FFS_ADB_PATH "/dev/usb-ffs/adb/"
+#define USB_FFS_ADB_EP(x) USB_FFS_ADB_PATH #x
-#define USB_FFS_ADB_EP0 USB_FFS_ADB_EP(ep0)
-#define USB_FFS_ADB_OUT USB_FFS_ADB_EP(ep1)
-#define USB_FFS_ADB_IN USB_FFS_ADB_EP(ep2)
+#define USB_FFS_ADB_EP0 USB_FFS_ADB_EP(ep0)
+#define USB_FFS_ADB_OUT USB_FFS_ADB_EP(ep1)
+#define USB_FFS_ADB_IN USB_FFS_ADB_EP(ep2)
#endif
int handle_host_request(const char* service, TransportType type, const char* serial,
TransportId transport_id, int reply_fd, asocket* s);
-void handle_online(atransport *t);
-void handle_offline(atransport *t);
+void handle_online(atransport* t);
+void handle_offline(atransport* t);
-void send_connect(atransport *t);
+void send_connect(atransport* t);
void parse_banner(const std::string&, atransport* t);