[apparmor] [patch 11/12] Refactor add_new_state into two version, one that splits anodes from nnodes, and one for use when anodes and nnodes are presplit

Steve Beattie steve at nxnw.org
Wed Aug 20 08:15:19 UTC 2014


On Fri, Aug 15, 2014 at 12:20:46PM -0700, john.johansen at canonical.com wrote:
> Signed-off-by: John Johansen <john.johansen at canonical.com>

Acked-by: Steve Beattie <steve at nxnw.org>

> === modified file 'parser/libapparmor_re/hfa.cc'
> ---
>  parser/libapparmor_re/hfa.cc |   20 ++++++++++++++------
>  parser/libapparmor_re/hfa.h  |    1 +
>  2 files changed, 15 insertions(+), 6 deletions(-)
> 
> --- parser/libapparmor_re/hfa.cc.orig
> +++ parser/libapparmor_re/hfa.cc
> @@ -278,14 +278,9 @@
>  	*nnodes = nodes;
>  }
>  
> -State *DFA::add_new_state(NodeSet *nodes, State *other)
> +State *DFA::add_new_state(NodeSet *anodes, NodeSet *nnodes, State *other)
>  {
> -	/* The splitting of nodes should probably get pushed down into
> -	 * follow(), ie. put in separate lists from the start
> -	 */
> -	NodeSet *anodes, *nnodes;
>  	hashedNodeVec *nnodev;
> -	split_node_types(nodes, &anodes, &nnodes);
>  	nnodev = nnodes_cache.insert(nnodes);
>  	anodes = anodes_cache.insert(anodes);
>  
> @@ -303,6 +298,19 @@
>  	return x.first->second;
>  }
>  
> +State *DFA::add_new_state(NodeSet *nodes, State *other)
> +{
> +	/* The splitting of nodes should probably get pushed down into
> +	 * follow(), ie. put in separate lists from the start
> +	 */
> +	NodeSet *anodes, *nnodes;
> +	split_node_types(nodes, &anodes, &nnodes);
> +
> +	State *state = add_new_state(anodes, nnodes, other);
> +
> +	return state;
> +}
> +
>  void DFA::update_state_transitions(State *state)
>  {
>  	/* Compute possible transitions for state->nodes.  This is done by
> --- parser/libapparmor_re/hfa.h.orig
> +++ parser/libapparmor_re/hfa.h
> @@ -291,6 +291,7 @@
>  class DFA {
>  	void dump_node_to_dfa(void);
>  	State *add_new_state(NodeSet *nodes, State *other);
> +	State *add_new_state(NodeSet *anodes, NodeSet *nnodes, State *other);
>  	void update_state_transitions(State *state);
>  	void process_work_queue(const char *header, dfaflags_t);
>  	void dump_diff_chain(ostream &os, map<State *, Partition> &relmap,

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20140820/61fdc713/attachment.pgp>


More information about the AppArmor mailing list