Menu

#206 tsk_init_lock and tsk_deinit_lock not exported

open
nobody
Other (13)
5
2012-11-06
2012-11-06
No

Issue concerning TSK 4.0.0 API

The functions tsk_init_lock and tsk_deinit_lock are not exported in tsk3.h but they are necessary when creating a custom Img info object as in pytsk.
Please add them or add other functions to set/release the locks for custom img info objects.

Discussion

  • Brian Carrier

    Brian Carrier - 2012-11-12

    Hi Joachim,

    The theory was that if you are extending TSK, you would use tsk_base_i.h. tsk_base.h is really just if you want to use the library from another program. Does that work?

     
  • Joachim Metz

    Joachim Metz - 2012-11-12

    The idea of pytsk is to wrap python calls in an IMG info object, and allow to extend the object in python.
    Therefore it needs to control the locks. For now I've just added the function calls. And build pytsk statically.
    This does not allow me to build against a DLL version.

     
  • Anonymous

    Anonymous - 2012-11-12

    The main problem for pytsk is that we need to be managing our own memory (so we can arrange for freeing off the python GC). TSK confounds the allocation of the memory with the initialization of the memory by putting both into the function tsk_img_malloc()/tsk_img_free() so we effectively need to reimplement the initialization done in tsk_img_malloc() again (This is ultimately why we need access to the lock initialization functions). At the moment this initialization just includes initializing locks but we will always need to duplicate this code in future which is inconvenient.

    The proper solution to the problem is to separate tsk_img_malloc() into an allocation function and an initialization function, or alternatively have tsk able to take a user supplied allocator implementation (for example like libjpeg, zlib and many other libraries do).

    The typical use case for pytsk is something like:
    typedef struct {
    TSK_IMG_INFO base;
    struct Img_Info_t *container;
    } Extended_TSK_IMG_INFO;

    e.g. we extend the basic TSK object with our object which contains more information specific to python implementation. Hence we need to allocate a bit more memory than sizeof(TSK_IMG_INFO) and then we need to get tsk to initialize its part of the struct. Then we initialize our part.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.