summaryrefslogtreecommitdiffstats
path: root/fuse_sdcard_provider.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-07-19 17:40:37 +0200
committerTao Bao <tbao@google.com>2015-07-24 20:22:05 +0200
commit0d4e002670064157aa34ba8c391184151b7d402a (patch)
treee9f4b33d1ffa2c30c371abf40453d52690e1403c /fuse_sdcard_provider.cpp
parentam 6e9dda70: uncrypt: Support file level encryption. (diff)
downloadandroid_bootable_recovery-0d4e002670064157aa34ba8c391184151b7d402a.tar
android_bootable_recovery-0d4e002670064157aa34ba8c391184151b7d402a.tar.gz
android_bootable_recovery-0d4e002670064157aa34ba8c391184151b7d402a.tar.bz2
android_bootable_recovery-0d4e002670064157aa34ba8c391184151b7d402a.tar.lz
android_bootable_recovery-0d4e002670064157aa34ba8c391184151b7d402a.tar.xz
android_bootable_recovery-0d4e002670064157aa34ba8c391184151b7d402a.tar.zst
android_bootable_recovery-0d4e002670064157aa34ba8c391184151b7d402a.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;
}