From: Jörgen Sigvardsson <jorgen.sigvardsson@kau.se>
Subject: The ultimate ACI-interface?
Date: Sat, 24 Mar 2001 14:50:52 +0100
Next Article (by Subject): Re: The ultimate ACI-interface? Amon Ott
Previous Article (by Subject): temporary patch homepage Jörgen Sigvardsson
Next in Thread: Re: The ultimate ACI-interface? Amon Ott
Articles sorted by: [Date]
[Author]
[Subject]
--------------Boundary-00=_SSFPHCHTWLWMSTPJ6Y85 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I have just finished implementing persistance using ACI in my REG-module. I think I have come with a pretty nice design which could be refitted into a very general ACI-list interface. I just thought of the discussion some weeks ago.. :) This is how I do persistance: For any list, I write two pieces of information to disk: Version and size. Size is used so that reading the list from disk is easy. The version is a simple byte-tuple consisting of a major and a minor version. This is for maintaining backward compability when a decision module evolves over time. Of course, when the list is serialized again the newest version will be used. Anyhow, version and size are on the disk. Now I just write my elements to disk one at a time. I guess this does not differ a whole lot from how it is done now. Now the inverse: reading information from disk. Now the version-tuple is utilized. By using this information a deserializer-function is located which can handle data with this version. I am using a table of struct { __u16 from_version, upto_version; deserializer_t deserializer; }; So when my reading method finds the list on disk, it will scan through the table to find a deserializer which can handle version x, where from_version <= x < upto_version. This is an interface that I'd love to use: /* Describes a deserializer function which can deserialize one element of version x, where from_version <= x < upto_version */ typedef struct deserializer_info { const __u16 from_version, upto_version; int (*deserialize)(struct file*, void** element); } deserializer_info_t; /* Describes serialization in general. Note that serialization (writing) is not version-dependent. It is assumed that the serialize function always writes data using the newest version. This way a simple list update will convert the entire ACI file. Neat when upgrading decision modules. */ typedef struct serialization_info { int automatic_serialization; /* Should RSBAC serialize automatically? */ int (*serialize)(struct file*, void* element); /* Writes to disk */ const __u16 cur_version; deserializer_t* deserializers; } serialization_info_t; /* General list info. I could probably come up with more, but this is enough to show what I mean. */ typedef struct list_info { int (*cmp)(void* cur_element, void* search_key); /* for searching in list */ serialization_info_t serialization_info; } list_info_t; /* symbolic_name = basename of ACI file */ int aci_list_register(const char* symbolic_name, list_info_t* info); int aci_list_unregister(const char* symbolic_name) - OR - int aci_list_unregister(aci_list_desc_t ld); + the various add/remove/find/....-functions. (aci_list internal datastructure left as an exercise for the reader) All modifiying functions mark the list as dirty if automatic serialization has been requested. On each rsbacd pulse, all dirty lists are serialized. Overall benefits: 1) RSBAC does not know anything about the data being stored. At all. 2) Flexible versioning. In the end, all ACI information will be "upgraded" 3) Less to think about for the user (kernel locking, semaphore ups and downs can be done by RSBAC) 4) Since everything is hidden for the user in terms of structures, the underlying datastructure may very well be an AVL-tree instead of a list. 5) 1) Gives a mechanism rather than a policy which is good - the UNIX way. Attached is a piece of code which hints at how this could be implemented. This is of course very raw - it's not finished yet (which the #warning-directives hints at ;) - -- Jörgen Sigvardsson, B. Sc. (M. Sc. Really soon now :) 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 iD8DBQE6vKY8JtcD8rikkmwRAuLoAKCQO3MorguX5KL3tRpVqeypc8l3KQCdGVTQ eE+zEK/ICTcb3GA8BUS3mCQ= =QGBX -----END PGP SIGNATURE----- --------------Boundary-00=_SSFPHCHTWLWMSTPJ6Y85 Content-Type: text/x-c; name="eac_binver_aci.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="eac_binver_aci.c" I2luY2x1ZGUgPGxpbnV4L2tlcm5lbC5oPgoKI2RlZmluZSBfX05PX1ZFUlNJT05fXwojaW5jbHVk ZSA8bGludXgvbW9kdWxlLmg+CiNpbmNsdWRlIDxsaW51eC9mcy5oPgojaW5jbHVkZSA8bGludXgv c21wX2xvY2suaD4KI2luY2x1ZGUgPGxpbnV4L3NjaGVkLmg+CiNpbmNsdWRlIDxsaW51eC9zbGFi Lmg+CiNpbmNsdWRlIDxhc20vdWFjY2Vzcy5oPgojaW5jbHVkZSA8ZW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90IG51bSk7CgoKLyogCiAq IFdlaXJkIGFuZCB3b25kZXJmdWwgY3BwLWhhY2tzLgogKiBQdXJwb3NlIG9mIHRoZXNlPyBUbyBt YWtlIHRoZSBhZGRpdGlvbiBvZiBhIG5ldyBkZXNlcmlhbGl6YXRpb24gcm91dGluZQogKiBhcyBl YXN5IGFzIHBvc3NpYmxlLgogKi8KLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwovKiBNQUNSTy1IQUNL UyBTVEFSVFMgSEVSRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICovCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KI2RlZmluZSBURVNUX0VSUihlcnJfY29k ZSwgZXhfbGVuZ3RoLCBlcnJfbGFiZWwsIGVycl9uZXdfdmFsKSBcCmRvIHsgaWYoZXJyX2NvZGUg PCBleF9sZW5ndGgpIHsgZ290byBlcnJfbGFiZWw7IGVycl9jb2RlID0gZXJyX25ld192YWw7IH0g fSB3aGlsZSgwKQoKdHlwZWRlZiBpbnQgKCpkZXNlcmlhbGl6ZXJfdCkoZWFjX3RzaV9saXN0X2l0 ZW1fdCoqLCBzdHJ1Y3QgZmlsZSopOwoKI2RlZmluZSBERVNFUklBTElaRVJfTkFNRShtYWosIG1p biwgdW1haiwgdW1pbikgXApkZXNlcmlhbGl6ZXJfIyNtYWojI18jI21pbiMjX18jI3VtYWojI18j I3VtaW4KCiNkZWZpbmUgREVTRVJJQUxJWkVSKG1haiwgbWluLCB1bWFqLCB1bWluKSAJCQkJCQkJ XAppbnQgZGVzZXJpYWxpemVyXyMjbWFqIyNfIyNtaW4jI19fIyN1bWFqIyNfIyN1bWluKGVhY190 c2lfbGlzdF9pdGVtX3QqKiBwcGl0ZW0sIFwKc3RydWN0IGZpbGUqIGZpbGUpCgojZGVmaW5lIEVO VFJZKGZyb21fbWFqLCBmcm9tX21pbiwgdXB0b19tYWosIHVwdG9fbWluKSAJICAgICAgICAgICAg XAp7IE1LX1ZFUihmcm9tX21haiwgZnJvbV9taW4pLCBNS19WRVIodXB0b19tYWosIHVwdG9fbWlu KSwgICAgICAgICAgIFwKICBERVNFUklBTElaRVJfTkFNRShmcm9tX21haiwgZnJvbV9taW4sIHVw dG9fbWFqLCB1cHRvX21pbikgfQoKI2RlZmluZSBOVUxMX0VOVFJZICAgICAgeyBNS19WRVIoMCwg MCksIE1LX1ZFUigwLCAwKSwgTlVMTCB9CgovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi8qIE1BQ1JP LUhBQ0tTIEVORFMgSEVSRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgKi8KLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwoKCi8qIERlc2VyaWFsaXplciBm b3IgdmVyc2lvbiAoMCwgMSkgPD0geCA8ICgwLCAyKQogKi8Kc3RhdGljIERFU0VSSUFMSVpFUigw LCAxLCAwLCAyKTsKCnN0YXRpYyBzdHJ1Y3QgewoJX191MTYJCQkJZnJvbV92ZXJzaW9uOwoJX191 MTYJCQkJdXB0b192ZXJzaW9uOwoJZGVzZXJpYWxpemVyX3QJCWRlc2VyaWFsaXplcjsKfSBkZXNl cmlhbGl6ZXJzW10gPSB7CglFTlRSWSgwLCAxLCAwLCAyKSwKCU5VTExfRU5UUlkgICAgICAgICAg ICAgICAgICAgICAgIC8qIE1VU1QgQkUgTEFTVCAqLwp9OwoKCi8qKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq 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lkICov CgkJaWYoKGVyciA9IHNlcmlhbGl6ZV9zdHJpbmcoJmZpbGUsIGl0ZW0tPmlkLCBpdGVtLT5pZF9s ZW5ndGgpKSA8IDApIHsKCQkJZXJyID0gLVJTQkFDX0VXUklURUZBSUxFRDsKCQkJZ290byBlcnJv cl9vdXQ7CgkJfQoKCQlpZigoZXJyID0gc2VyaWFsaXplX21weigmZmlsZSwgaXRlbS0+bikpIDwg MCkgewoJCQllcnIgPSAtUlNCQUNfRVdSSVRFRkFJTEVEOwoJCQlnb3RvIGVycm9yX291dDsKCQl9 CgoJCWlmKChlcnIgPSBzZXJpYWxpemVfbXB6KCZmaWxlLCBpdGVtLT5lKSkgPCAwKSB7CgkJCWVy ciA9IC1SU0JBQ19FV1JJVEVGQUlMRUQ7CgkJCWdvdG8gZXJyb3Jfb3V0OwoJCX0KCX0KCgllcnIg PSAxOyAvKiAxIGxpc3Qgd3JpdHRlbiAqLwogZXJyb3Jfb3V0OgoJCglzZXRfZnMob2xkZnMpOwoJ CgkvKiBDbG9zZSBBQ0kgZmlsZSAqLwoJaWYoZmlsZV9vcGVuZWQpCgkJcnNiYWNfd3JpdGVfY2xv c2UoJmZpbGUpOwoKCXVwKCZyc2JhY193cml0ZV9zZW0pOwoKCWlmKGxvY2tfbGlzdCkKCQlyc2Jh Y19yZWFkX3VubG9jaygmdHNpX2RiLT5sb2NrLCAmbG9ja19mbGFncyk7CgkKCWlmKGxvY2tfa2Vy bikKCQl1bmxvY2tfa2VybmVsKCk7CiAgICByZXR1cm4gZXJyOwp9Cg== --------------Boundary-00=_SSFPHCHTWLWMSTPJ6Y85-- - 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 Subject): Re: The ultimate ACI-interface? Amon Ott
Previous Article (by Subject): temporary patch homepage Jörgen Sigvardsson
Next in Thread: Re: The ultimate ACI-interface? Amon Ott
Articles sorted by: [Date]
[Author]
[Subject]