Hi Scott.

   Managing libcurl for the http filesystem and RIA will require
   pthreads, and the initialization and cleanup of some http-
   filesystem-wide resources (worker thread, libcurl resources).
   There are currently no filesystem init or cleanup routines
   defined (that I could find anyhow).

   Is there any reason not to add a filesystem init/cleanup pair
   of functions to the filesystem interface?

We could add two more callbacks to the pdf_fsys_impl_s structure to
initialize and cleanup some private data of the filesystem
implementation:

struct pdf_fsys_s
{
  void *data;        /* Private data used by the filesystem
                        implementation.  */
  ...
};

typedef pdf_status_t (*pdf_fsys_init_fn_t) (void **data);
typedef pdf_status_t (*pdf_fsys_cleanup_fn_t) (void *data);

/* Filesystem implementation */
struct pdf_fsys_impl_s
{
  /* Filesystem interface callbacks.  */
  pdf_fsys_init_fn_t init_fn;
  pdf_fsys_cleanup_fn_t cleanup_fn;
  ...

  /* File interface callbacks.  */
  ...
};

And then call those callbacks in the existing pdf_fsys_create and
pdf_fsys_destroy.  Stateless filesystems (such as the disk filesystem)
would not define those callbacks.

Would this fit your needs?

-- 
Jose E. Marchesi    [email protected]
GNU Project         http://www.gnu.org


Reply via email to