summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2019-05-24 11:55:38 -0500
committerDenis Kenzior <denkenz@gmail.com>2019-05-24 11:55:38 -0500
commit765c6655f26304c45adfdb92081448d797ce3092 (patch)
tree8d3e4e7963ba11b6f677934f0cff3f6525e87b33 /src
parent8bde9f095af8450cf9e8af5b31f316975f08f2f6 (diff)
downloadofono-765c6655f26304c45adfdb92081448d797ce3092.tar.gz
treewide: Use L_TFR macro
Diffstat (limited to 'src')
-rw-r--r--src/simfs.c32
-rw-r--r--src/storage.c13
-rw-r--r--src/storage.h6
3 files changed, 23 insertions, 28 deletions
diff --git a/src/simfs.c b/src/simfs.c
index 0100d415..a42dee3a 100644
--- a/src/simfs.c
+++ b/src/simfs.c
@@ -274,7 +274,7 @@ static void sim_fs_end_current(struct sim_fs *fs)
__ofono_sim_remove_session_watch(fs->session, fs->watch_id);
if (fs->fd != -1) {
- TFR(close(fs->fd));
+ L_TFR(close(fs->fd));
fs->fd = -1;
}
@@ -320,7 +320,7 @@ static gboolean cache_block(struct sim_fs *fs, int block, int block_len,
SIM_CACHE_HEADER_SIZE, SEEK_SET) == (off_t) -1)
return FALSE;
- r = TFR(write(fs->fd, data, num_bytes));
+ r = L_TFR(write(fs->fd, data, num_bytes));
if (r != num_bytes)
return FALSE;
@@ -335,7 +335,7 @@ static gboolean cache_block(struct sim_fs *fs, int block, int block_len,
b = fs->bitmap[offset];
b |= 1 << bit;
- r = TFR(write(fs->fd, &b, sizeof(b)));
+ r = L_TFR(write(fs->fd, &b, sizeof(b)));
if (r != sizeof(b))
return FALSE;
@@ -477,7 +477,7 @@ static gboolean sim_fs_op_read_block(gpointer user_data)
if (lseek(fs->fd, seekoff, SEEK_SET) == (off_t) -1)
break;
- if (TFR(read(fs->fd, op->buffer + bufoff, toread)) != toread)
+ if (L_TFR(read(fs->fd, op->buffer + bufoff, toread)) != toread)
break;
op->current += 1;
@@ -569,7 +569,7 @@ static gboolean sim_fs_op_read_record(gpointer user)
SIM_CACHE_HEADER_SIZE, SEEK_SET) == (off_t) -1)
break;
- if (TFR(read(fs->fd, buf, op->record_length)) !=
+ if (L_TFR(read(fs->fd, buf, op->record_length)) !=
op->record_length)
break;
@@ -660,17 +660,17 @@ static void sim_fs_op_cache_fileinfo(struct sim_fs *fs,
fileinfo[6] = file_status;
path = g_strdup_printf(SIM_CACHE_PATH, imsi, phase, op->id);
- fs->fd = TFR(open(path, O_WRONLY | O_CREAT | O_TRUNC, SIM_CACHE_MODE));
+ fs->fd = L_TFR(open(path, O_WRONLY | O_CREAT | O_TRUNC, SIM_CACHE_MODE));
g_free(path);
if (fs->fd == -1)
return;
- if (TFR(write(fs->fd, fileinfo, SIM_CACHE_HEADER_SIZE)) ==
+ if (L_TFR(write(fs->fd, fileinfo, SIM_CACHE_HEADER_SIZE)) ==
SIM_CACHE_HEADER_SIZE)
return;
- TFR(close(fs->fd));
+ L_TFR(close(fs->fd));
fs->fd = -1;
}
@@ -761,7 +761,7 @@ static gboolean sim_fs_op_check_cached(struct sim_fs *fs)
if (path == NULL)
return FALSE;
- fd = TFR(open(path, O_RDWR));
+ fd = L_TFR(open(path, O_RDWR));
g_free(path);
if (fd == -1) {
@@ -773,7 +773,7 @@ static gboolean sim_fs_op_check_cached(struct sim_fs *fs)
return FALSE;
}
- len = TFR(read(fd, fileinfo, SIM_CACHE_HEADER_SIZE));
+ len = L_TFR(read(fd, fileinfo, SIM_CACHE_HEADER_SIZE));
if (len != SIM_CACHE_HEADER_SIZE)
goto error;
@@ -827,7 +827,7 @@ static gboolean sim_fs_op_check_cached(struct sim_fs *fs)
return TRUE;
error:
- TFR(close(fd));
+ L_TFR(close(fd));
return FALSE;
}
@@ -1187,8 +1187,8 @@ char *sim_fs_get_cached_image(struct sim_fs *fs, int id)
path = g_strdup_printf(SIM_IMAGE_CACHE_PATH, imsi, phase, id);
- TFR(stat(path, &st_buf));
- fd = TFR(open(path, O_RDONLY));
+ L_TFR(stat(path, &st_buf));
+ fd = L_TFR(open(path, O_RDONLY));
g_free(path);
if (fd < 0)
@@ -1198,12 +1198,12 @@ char *sim_fs_get_cached_image(struct sim_fs *fs, int id)
buffer = g_try_new0(char, image_length + 1);
if (buffer == NULL) {
- TFR(close(fd));
+ L_TFR(close(fd));
return NULL;
}
- len = TFR(read(fd, buffer, image_length));
- TFR(close(fd));
+ len = L_TFR(read(fd, buffer, image_length));
+ L_TFR(close(fd));
if (len != image_length) {
g_free(buffer);
diff --git a/src/storage.c b/src/storage.c
index 6dce04ea..05d9b88a 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -33,6 +33,7 @@
#include <errno.h>
#include <glib.h>
+#include <ell/ell.h>
#include "storage.h"
@@ -95,16 +96,16 @@ ssize_t read_file(unsigned char *buffer, size_t len,
path = g_strdup_vprintf(path_fmt, ap);
va_end(ap);
- fd = TFR(open(path, O_RDONLY));
+ fd = L_TFR(open(path, O_RDONLY));
g_free(path);
if (fd == -1)
return -1;
- r = TFR(read(fd, buffer, len));
+ r = L_TFR(read(fd, buffer, len));
- TFR(close(fd));
+ L_TFR(close(fd));
return r;
}
@@ -137,13 +138,13 @@ ssize_t write_file(const unsigned char *buffer, size_t len, mode_t mode,
if (create_dirs(path, mode | S_IXUSR) != 0)
goto error_create_dirs;
- fd = TFR(g_mkstemp_full(tmp_path, O_WRONLY | O_CREAT | O_TRUNC, mode));
+ fd = L_TFR(g_mkstemp_full(tmp_path, O_WRONLY | O_CREAT | O_TRUNC, mode));
if (fd == -1)
goto error_mkstemp_full;
- r = TFR(write(fd, buffer, len));
+ r = L_TFR(write(fd, buffer, len));
- TFR(close(fd));
+ L_TFR(close(fd));
if (r != (ssize_t) len) {
r = -1;
diff --git a/src/storage.h b/src/storage.h
index 70446ad8..4dc792cc 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -19,12 +19,6 @@
*
*/
-#ifdef TEMP_FAILURE_RETRY
-#define TFR TEMP_FAILURE_RETRY
-#else
-#define TFR
-#endif
-
#include <fcntl.h>
#include <sys/types.h>