From 25d384a97f6ffa1b31c5248d1f25df74c686b891 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Wed, 3 Jul 2013 16:23:00 +0200 Subject: Remove file read functions from ipc_util Change-Id: I24fcb86335ce2676fa5d88e6298aa002b7257bfe Signed-off-by: Paul Kocialkowski --- samsung-ipc/ipc_util.c | 92 -------------------------------------------------- samsung-ipc/util.c | 1 - 2 files changed, 93 deletions(-) (limited to 'samsung-ipc') diff --git a/samsung-ipc/ipc_util.c b/samsung-ipc/ipc_util.c index 6ec54f2..f8b7fe9 100644 --- a/samsung-ipc/ipc_util.c +++ b/samsung-ipc/ipc_util.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include "ipc.h" @@ -473,95 +472,4 @@ void ipc_message_info_fill(struct ipc_header *header, struct ipc_message_info *m message->data = NULL; } -void *ipc_client_mtd_read(struct ipc_client *client, char *mtd_name, int size, - int block_size) -{ - void *mtd_p=NULL; - uint8_t *data_p=NULL; - - loff_t offs; - int fd; - int i; - - if (mtd_name == NULL || size <= 0 || block_size <= 0) - goto error; - - ipc_client_log(client, "ipc_client_mtd_read: reading 0x%x bytes from %s with 0x%x bytes block size\n", size, mtd_name, block_size); - - fd=open(mtd_name, O_RDONLY); - if (fd < 0) - goto error; - - mtd_p=malloc(size); - if (mtd_p == NULL) - goto error; - - memset(mtd_p, 0, size); - - data_p=(uint8_t *) mtd_p; - - for (i=0; i < size / block_size; i++) - { - offs = i * block_size; - if (ioctl(fd, MEMGETBADBLOCK, &offs) == 1) - { - ipc_client_log(client, "ipc_client_mtd_read: warning: bad block at offset %lld\n", (long long int) offs); - data_p+=block_size; - continue; - } - - read(fd, data_p, block_size); - data_p+=block_size; - } - - close(fd); - - return mtd_p; - -error: - ipc_client_log(client, "ipc_client_mtd_read: something went wrong\n"); - return NULL; -} - -void *ipc_client_file_read(struct ipc_client *client, char *file_name, int size, - int block_size) -{ - void *file_p=NULL; - uint8_t *data_p=NULL; - - int fd; - int i; - - if (file_name == NULL || size <= 0 || block_size <= 0) - goto error; - - ipc_client_log(client, "ipc_client_file_read: reading 0x%x bytes from %s with 0x%x bytes block size\n", size, file_name, block_size); - - fd=open(file_name, O_RDONLY); - if (fd < 0) - goto error; - - file_p=malloc(size); - if (file_p == NULL) - goto error; - - memset(file_p, 0, size); - - data_p=(uint8_t *) file_p; - - for (i=0; i < size / block_size; i++) - { - read(fd, data_p, block_size); - data_p+=block_size; - } - - close(fd); - - return file_p; - -error: - ipc_client_log(client, "ipc_client_file_read: something went wrong\n"); - return NULL; -} - // vim:ts=4:sw=4:expandtab diff --git a/samsung-ipc/util.c b/samsung-ipc/util.c index 85fffcb..e7bfb01 100644 --- a/samsung-ipc/util.c +++ b/samsung-ipc/util.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include -- cgit v1.1