Write state of SMS assembly to disk and restore on startup.

Andrzej Zaborowski andrew.zaborowski at intel.com
Fri Sep 4 22:24:44 PDT 2009


2009/9/1 Denis Kenzior <denkenz at gmail.com>:
> On Fri, Aug 21, 2009 at 9:40 PM, Andrzej Zaborowski
> <andrew.zaborowski at intel.com> wrote:
>> This way we can continue receiving segmented messages over a reset or
>> crash.
>> ---
>>  src/common.c     |   29 +++++++
>>  src/common.h     |   10 +++
>>  src/sim.c        |   34 --------
>>  src/sms.c        |   14 +++-
>>  src/smsutil.c    |  237
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++-
>>  src/smsutil.h    |    3 +-
>>  unit/Makefile.am |    6 +-
>>  unit/test-sms.c  |    4 +-
>>  8 files changed, 293 insertions(+), 44 deletions(-)
>>
>
>> +int create_dirs(const char *filename, const mode_t mode)
>> +{
>
> Can we move this part to storage.c instead of common.c to be more consistent
> with connman & bluez?

Ok, I moved the common part of the file reading / writing to storage.c
but some of the file access in sim.c is still doing it manually
because there's lseeking in the middle.

>> +
>> +               if (r > 0 && sms_deserialize(buf, &segment, r)) {
>> +                       if (sms_assembly_add_fragment_backup(assembly,
>> +                                               &segment,
>> +                                               segment_stat.st_mtime,
>> +                                               &addr, ref, max, seq,
>> FALSE)) {
>> +                               /* This can't happen */
>> +                       }
>
> We read it from the backup store and almost immediately overwrite the backup
> store?  Seems inefficient.

The FALSE in the last parameter tells the function not to write the
backup, I had renamed the function to sms_assembly_add_fragment_backup
and made a wrapper under the old name.  I agree the naming is poor.

Sending updated patches in attachments.

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Move-create_dirs-to-storage.c-add-file-read-write-u.patch
Type: text/x-patch
Size: 7658 bytes
Desc: not available
URL: <http://lists.ofono.org/pipermail/ofono/attachments/20090905/2fdedc32/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Write-state-of-SMS-assembly-to-disk-and-restore-on-s.patch
Type: text/x-patch
Size: 12009 bytes
Desc: not available
URL: <http://lists.ofono.org/pipermail/ofono/attachments/20090905/2fdedc32/attachment-0003.bin>


More information about the ofono mailing list