All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Gyurdiev <ivg2@cornell.edu>
To: selinux@tycho.nsa.gov
Cc: Joshua Brindle <jbrindle@tresys.com>
Subject: Record keys
Date: Fri, 14 Oct 2005 03:30:20 -0400	[thread overview]
Message-ID: <434F5E8C.1050708@cornell.edu> (raw)
In-Reply-To: <434F5E3A.5030003@cornell.edu>

(resent with correct list address this time)
> Please help me decide what to do with the record key for the record 
> structures which I've added into libsepol and libsemanage. Stephen has 
> now exported those functions into the shared library, so after an 
> official release, it would be good not to be changing those APIs.
>
> The job of the key is to identify a record uniquely among a collection 
> of the same record type.
> They do this by the record.compare(key) function. Currently the key is 
> required to be a subset of the record fields (so it has to be 
> contained within the record...does that make it useless? could this 
> change in the future, and how?)
>
> ================
> I added the key structure, because it just seemed wrong to pass an 
> "incomplete" record structure containing just the key fields 
> into..say...a query() handler. Note that the key constructor forces 
> the caller to specify all the fields (since this is a key, all fields 
> are required), while splitting this up into set calls to a record 
> structure could result in invalid keys.
>
> Currently keys are contained _within_ the record - they're a subset of 
> the record's fields. That's the primary reason why I ask whether keys 
> should be kept or not - a method called extract_key is supported....If 
> the key can be extracted from the record, you can use that on 
> modify(), and add() to pass a single argument (the record). That also 
> makes it easier for the caller (specify key fields in only one place, 
> instead of both in key and record). It's easy to just add the record, 
> but then the API just *looks* wrong..  also that prevents use of keys 
> that are not contained within the record in the future... but I'm not 
> clear as to whether this will ever change.
>
> If such "external" keys are to be used, then the extract_key method 
> can't be used (but there's nothing to require this method
> for each record - it's just expected internally to be implemented - 
> internals can easily change to fit what's required). Basically, I'm 
> trying to imagine a scenario where the key would not be contained 
> within the record, and what would be required to support that.
>


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

       reply	other threads:[~2005-10-14  7:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <434F5E3A.5030003@cornell.edu>
2005-10-14  7:30 ` Ivan Gyurdiev [this message]
2005-10-15  9:33   ` Record keys Ivan Gyurdiev
2005-10-19 14:02   ` Joshua Brindle
2005-10-19 16:50     ` Ivan Gyurdiev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=434F5E8C.1050708@cornell.edu \
    --to=ivg2@cornell.edu \
    --cc=jbrindle@tresys.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.