Re: Lists


From: Jörgen Sigvardsson <jorgen.sigvardsson@kau.se>
Subject: Re: Lists
Date: Tue, 20 Feb 2001 15:01:24 +0100

Next Article (by Date): Re: Lists Amon Ott
Previous Article (by Date): Re: Lists Amon Ott
Top of Thread: Lists Jörgen Sigvardsson
Next in Thread: Re: Lists Amon Ott
Articles sorted by: [Date] [Author] [Subject]


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 20 February 2001 14:04, you wrote:
> 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
I couldn't deal with the id. The id in my case is a free form character 
identifier. I am planning on using a scheme similar to that of X.509 (where 
an id looks like: "param=value param=value param=value" and etc) and PGP. 
Those are my id's. So whenever I want to request the public key for some id, 
I don't know how to query the list. I could maintain a list of listid <-> 
myid mappings, but than I'm back to the initial problem.

If however you make the id on the following form: (int id_length, void* id) 
then the id could be anything from integers to strings to structures. Now 
that would be really neat. But now that we're talking a keyed data structure, 
a list could be a performance bottle neck - perhaps an AVL-tree or red-black 
tree would be in order? 

Also when it comes to serialization to disk, I would like some sort of custom 
callback that performs the actual I/O. Perhaps a callback on the form:

int callback(file* f, void* data, u_long curoffset, u_long* data_written) 

Where the f is the opened ACI-file, curoffset is the file pointer (if I can 
remember correctly, "kernel files" don't manage a file pointer). When the 
callback is finished, it updates the *data_written with how many bytes was 
actually written to disk. if any errors occur, an -Exxx code is returned or 0 
for success. 

I am however curious if such a scheme would work for items which vary in 
size. Such a database would be hard to "optimize".

And I am not very keen on setting an upper limit on id's and public keys. 
2048 bit key size may seem much today, but may seem utterly small tomorrow.

- -- 
Jörgen Sigvardsson, B. Sc.
Lecturer, Computer Science Dept. Karlstad University
Tel: +46-(0)54-700 1786
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.3 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6kni0JtcD8rikkmwRAoCyAJwIp7Abg+3r6hH5NIAPj0HKEViFyQCdHbu7
PSkXRaE6y8JfBo/Nho7gwe4=
=D6NQ
-----END PGP SIGNATURE-----
-
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 Amon Ott
Previous Article (by Date): Re: Lists Amon Ott
Top of Thread: Lists Jörgen Sigvardsson
Next in Thread: Re: Lists Amon Ott
Articles sorted by: [Date] [Author] [Subject]


Go to Compuniverse LWGate Home Page.