Re: Lists


From: Amon Ott <ao@rsbac.org>
Subject: Re: Lists
Date: Tue, 20 Feb 2001 14:04:54 +0100

Next Article (by Date): Re: Lists Jörgen Sigvardsson
Previous Article (by Date): rsbac_{read,write}_[un]lock Jörgen Sigvardsson
Top of Thread: Lists Jörgen Sigvardsson
Next in Thread: Re: Lists Jörgen Sigvardsson
Articles sorted by: [Date] [Author] [Subject]


On Die, 20 Feb 2001 Jörgen Sigvardsson wrote:
> Ok. I give up this futile list attempt, mainly because of the semantic 
> problems that arise. A good general list ADT with type safety is hard to 
> accomplish in a safe manner. My strategy was to create some sort of generic 
> backend which could be wrapped with inline functions to provide type safety. 
> But the polymorphism required can only be accomplished with void pointers, 
> thus reference semantics is what's down the road. This may or may not work, 
> but it could imply overall design changes on RSBAC, which was not the 
> intended idea.

Still, you were right with your argument that it would be useful not to have to
reinvent list structures for every module.

I just thought about such a solution:
- REG provides a handle based, generic list structure
- Each registered data structure handle gets a list of pairs
   (u_long id, void * data)
- The space required for each data item has to be given at registration
- Data storage allocation and deallocation can be done by REG, if requested via
switch
- Access is done with
   - int rsbac_reg_ds_register(long handle, u_int item_size, boolean
      persistent); [persistence flag not yet used]
   - int rsbac_reg_ds_unregister(long handle); [all data gets cleaned up]
   - int rsbac_reg_ds_lookup_item(long handle, u_long id, void ** data_pp);
        [provides a pointer to the list data itself - dangerous to use!]
   - int rsbac_reg_ds_copy_item(long handle, u_long id, void * data_p);
        [copies the list data to data_p]
   - int rsbac_reg_ds_remove(long handle, u_long id, boolean de_allocate);
   - int rsbac_reg_ds_clear(long handle); [remove all data]
- Locking is done by REG

Would this be enough for your purposes?

Amon.
-
To unsubscribe from the rsbac list, send a mail to
majordomo@rsbac.org with
unsubscribe rsbac
as single line in the body.

Next Article (by Date): Re: Lists Jörgen Sigvardsson
Previous Article (by Date): rsbac_{read,write}_[un]lock Jörgen Sigvardsson
Top of Thread: Lists Jörgen Sigvardsson
Next in Thread: Re: Lists Jörgen Sigvardsson
Articles sorted by: [Date] [Author] [Subject]


Go to Compuniverse LWGate Home Page.