summaryrefslogtreecommitdiffstats
path: root/minadbd/services.c
diff options
context:
space:
mode:
Diffstat (limited to 'minadbd/services.c')
-rw-r--r--minadbd/services.c56
1 files changed, 10 insertions, 46 deletions
diff --git a/minadbd/services.c b/minadbd/services.c
index 218b84a38..581d847fc 100644
--- a/minadbd/services.c
+++ b/minadbd/services.c
@@ -14,18 +14,19 @@
* limitations under the License.
*/
-#include <stdlib.h>
+#include <errno.h>
+#include <inttypes.h>
#include <stdio.h>
-#include <unistd.h>
+#include <stdlib.h>
#include <string.h>
-#include <errno.h>
+#include <unistd.h>
#include "sysdeps.h"
-#include "fdevent.h"
-#include "fuse_adb_provider.h"
#define TRACE_TAG TRACE_SERVICES
#include "adb.h"
+#include "fdevent.h"
+#include "fuse_adb_provider.h"
typedef struct stinfo stinfo;
@@ -47,12 +48,13 @@ void *service_bootstrap_func(void *x)
static void sideload_host_service(int sfd, void* cookie)
{
char* saveptr;
- const char* s = strtok_r(cookie, ":", &saveptr);
+ const char* s = adb_strtok_r(cookie, ":", &saveptr);
uint64_t file_size = strtoull(s, NULL, 10);
- s = strtok_r(NULL, ":", &saveptr);
+ s = adb_strtok_r(NULL, ":", &saveptr);
uint32_t block_size = strtoul(s, NULL, 10);
- printf("sideload-host file size %llu block size %lu\n", file_size, block_size);
+ printf("sideload-host file size %" PRIu64 " block size %" PRIu32 "\n",
+ file_size, block_size);
int result = run_adb_fuse(sfd, file_size, block_size);
@@ -61,40 +63,6 @@ static void sideload_host_service(int sfd, void* cookie)
exit(result == 0 ? 0 : 1);
}
-#if 0
-static void echo_service(int fd, void *cookie)
-{
- char buf[4096];
- int r;
- char *p;
- int c;
-
- for(;;) {
- r = read(fd, buf, 4096);
- if(r == 0) goto done;
- if(r < 0) {
- if(errno == EINTR) continue;
- else goto done;
- }
-
- c = r;
- p = buf;
- while(c > 0) {
- r = write(fd, p, c);
- if(r > 0) {
- c -= r;
- p += r;
- continue;
- }
- if((r < 0) && (errno == EINTR)) continue;
- goto done;
- }
- }
-done:
- close(fd);
-}
-#endif
-
static int create_service_thread(void (*func)(int, void *), void *cookie)
{
stinfo *sti;
@@ -135,10 +103,6 @@ int service_to_fd(const char *name)
exit(3);
} else if (!strncmp(name, "sideload-host:", 14)) {
ret = create_service_thread(sideload_host_service, (void*)(name + 14));
-#if 0
- } else if(!strncmp(name, "echo:", 5)){
- ret = create_service_thread(echo_service, 0);
-#endif
}
if (ret >= 0) {
close_on_exec(ret);