simfs: Handle optional EF paths
authorDenis Kenzior <denkenz@gmail.com>
Fri, 23 Nov 2012 12:40:55 +0000 (06:40 -0600)
committerDenis Kenzior <denkenz@gmail.com>
Fri, 23 Nov 2012 13:22:25 +0000 (07:22 -0600)
src/simfs.c
src/simfs.h

index 6b54f43..03c8c9e 100644 (file)
@@ -66,6 +66,8 @@ struct sim_fs_op {
        int length;
        int record_length;
        int current;
+       unsigned char path[6];
+       unsigned char path_len;
        gconstpointer cb;
        gboolean is_read;
        void *userdata;
@@ -472,7 +474,8 @@ static gboolean sim_fs_op_read_block(gpointer user_data)
        fs->driver->read_file_transparent(fs->sim, op->id,
                                                op->current * 256,
                                                read_bytes,
-                                               NULL, 0,
+                                               op->path_len ? op->path : NULL,
+                                               op->path_len,
                                                sim_fs_op_read_block_cb, fs);
 
        return FALSE;
@@ -821,7 +824,9 @@ static gboolean sim_fs_op_next(gpointer user_data)
                if (sim_fs_op_check_cached(fs))
                        return FALSE;
 
-               driver->read_file_info(fs->sim, op->id, NULL, 0,
+               driver->read_file_info(fs->sim, op->id,
+                                       op->path_len ? op->path : NULL,
+                                       op->path_len,
                                        sim_fs_op_info_cb, fs);
        } else {
                switch (op->structure) {
@@ -894,6 +899,7 @@ int sim_fs_read_info(struct ofono_sim_context *context, int id,
 int sim_fs_read(struct ofono_sim_context *context, int id,
                enum ofono_sim_file_structure expected_type,
                unsigned short offset, unsigned short num_bytes,
+               const unsigned char *path, unsigned int path_len,
                ofono_sim_file_read_cb_t cb, void *data)
 {
        struct sim_fs *fs = context->fs;
@@ -926,6 +932,8 @@ int sim_fs_read(struct ofono_sim_context *context, int id,
        op->num_bytes = num_bytes;
        op->info_only = FALSE;
        op->context = context;
+       memcpy(op->path, path, path_len);
+       op->path_len = path_len;
 
        g_queue_push_tail(fs->op_q, op);
 
index 92e8fdb..bb3ab0f 100644 (file)
@@ -42,6 +42,7 @@ void sim_fs_notify_file_watches(struct sim_fs *fs, int id);
 int sim_fs_read(struct ofono_sim_context *context, int id,
                enum ofono_sim_file_structure expected_type,
                unsigned short offset, unsigned short num_bytes,
+               const unsigned char *path, unsigned int len,
                ofono_sim_file_read_cb_t cb, void *data);
 
 int sim_fs_read_info(struct ofono_sim_context *context, int id,