summaryrefslogtreecommitdiffstats
path: root/fuse_sdcard_provider.c
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-07-19 17:40:37 +0200
committerTao Bao <tbao@google.com>2015-07-20 20:57:40 +0200
commit71dc365f25676cfb3f62dbb7163697a8c3c5243d (patch)
tree9ebde999e6c52f8b6e6f8ca47b4bdb59b94a3aed /fuse_sdcard_provider.c
parentMerge "Clean up LOG functions." (diff)
downloadandroid_bootable_recovery-71dc365f25676cfb3f62dbb7163697a8c3c5243d.tar
android_bootable_recovery-71dc365f25676cfb3f62dbb7163697a8c3c5243d.tar.gz
android_bootable_recovery-71dc365f25676cfb3f62dbb7163697a8c3c5243d.tar.bz2
android_bootable_recovery-71dc365f25676cfb3f62dbb7163697a8c3c5243d.tar.lz
android_bootable_recovery-71dc365f25676cfb3f62dbb7163697a8c3c5243d.tar.xz
android_bootable_recovery-71dc365f25676cfb3f62dbb7163697a8c3c5243d.tar.zst
android_bootable_recovery-71dc365f25676cfb3f62dbb7163697a8c3c5243d.zip
Diffstat (limited to '')
-rw-r--r--fuse_sdcard_provider.cpp (renamed from fuse_sdcard_provider.c)12
1 files changed, 6 insertions, 6 deletions
diff --git a/fuse_sdcard_provider.c b/fuse_sdcard_provider.cpp
index 4565c7b5b..eb6454f1d 100644
--- a/fuse_sdcard_provider.c
+++ b/fuse_sdcard_provider.cpp
@@ -34,7 +34,7 @@ struct file_data {
};
static int read_block_file(void* cookie, uint32_t block, uint8_t* buffer, uint32_t fetch_size) {
- struct file_data* fd = (struct file_data*)cookie;
+ file_data* fd = reinterpret_cast<file_data*>(cookie);
off64_t offset = ((off64_t) block) * fd->block_size;
if (TEMP_FAILURE_RETRY(lseek64(fd->fd, offset, SEEK_SET)) == -1) {
@@ -56,7 +56,7 @@ static int read_block_file(void* cookie, uint32_t block, uint8_t* buffer, uint32
}
static void close_file(void* cookie) {
- struct file_data* fd = (struct file_data*)cookie;
+ file_data* fd = reinterpret_cast<file_data*>(cookie);
close(fd->fd);
}
@@ -67,7 +67,7 @@ struct token {
};
static void* run_sdcard_fuse(void* cookie) {
- struct token* t = (struct token*)cookie;
+ token* t = reinterpret_cast<token*>(cookie);
struct stat sb;
if (stat(t->path, &sb) < 0) {
@@ -100,7 +100,7 @@ static void* run_sdcard_fuse(void* cookie) {
#define SDCARD_INSTALL_TIMEOUT 10
void* start_sdcard_fuse(const char* path) {
- struct token* t = malloc(sizeof(struct token));
+ token* t = new token;
t->path = path;
pthread_create(&(t->th), NULL, run_sdcard_fuse, t);
@@ -128,7 +128,7 @@ void* start_sdcard_fuse(const char* path) {
void finish_sdcard_fuse(void* cookie) {
if (cookie == NULL) return;
- struct token* t = (struct token*)cookie;
+ token* t = reinterpret_cast<token*>(cookie);
// Calling stat() on this magic filename signals the fuse
// filesystem to shut down.
@@ -136,5 +136,5 @@ void finish_sdcard_fuse(void* cookie) {
stat(FUSE_SIDELOAD_HOST_EXIT_PATHNAME, &st);
pthread_join(t->th, NULL);
- free(t);
+ delete t;
}