All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Carter <jwcart2@tycho.nsa.gov>
To: Steve Lawrence <slawrence@tresys.com>, selinux@tycho.nsa.gov
Subject: Re: [PATCH 5/6] libsepol/cil: Remove path field from cil_tree_node struct
Date: Wed, 20 Apr 2016 15:36:23 -0400	[thread overview]
Message-ID: <5717DA37.3010408@tycho.nsa.gov> (raw)
In-Reply-To: <571796AD.3090000@tresys.com>

On 04/20/2016 10:48 AM, Steve Lawrence wrote:
> On 04/19/2016 10:26 AM, James Carter wrote:
>> Remove path field from cil_tree_node struct and all references
>> to it in CIL. This will reduce memory usage by 5%.
>>
>> Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
>> ---
>>   libsepol/cil/src/cil_binary.c    | 14 +++++++++++++-
>>   libsepol/cil/src/cil_build_ast.c |  2 --
>>   libsepol/cil/src/cil_copy_ast.c  |  1 -
>>   libsepol/cil/src/cil_parser.c    | 23 +++++++++++------------
>>   libsepol/cil/src/cil_tree.c      |  1 -
>>   libsepol/cil/src/cil_tree.h      |  1 -
>>   6 files changed, 24 insertions(+), 18 deletions(-)
>>
>> diff --git a/libsepol/cil/src/cil_binary.c b/libsepol/cil/src/cil_binary.c
>> index 0a98ecd..9db42d5 100644
>> --- a/libsepol/cil/src/cil_binary.c
>> +++ b/libsepol/cil/src/cil_binary.c
>> @@ -4227,6 +4227,9 @@ exit:
>>   static avrule_t *__cil_init_sepol_avrule(uint32_t kind, struct cil_tree_node *node)
>>   {
>>   	avrule_t *avrule;
>> +	struct cil_tree_node *source_node;
>> +	char *source_path;
>> +	int is_cil;
>>
>>   	avrule = cil_malloc(sizeof(avrule_t));
>>   	avrule->specified = kind;
>> @@ -4235,8 +4238,17 @@ static avrule_t *__cil_init_sepol_avrule(uint32_t kind, struct cil_tree_node *no
>>   	__cil_init_sepol_type_set(&avrule->ttypes);
>>   	avrule->perms = NULL;
>>   	avrule->line = node->line;
>> -	avrule->source_filename = node->path;
>> +
>> +	avrule->source_filename = NULL;
>>   	avrule->source_line = node->line;
>> +	source_node = cil_tree_get_next_path(node, &source_path, &is_cil);
>> +	if (source_node) {
>> +		avrule->source_filename = source_path;
>> +		if (!is_cil) {
>> +			avrule->source_line = node->hll_line;
>
> Can we not use ->line instead of ->hll_live when is_cil is true?
>

Actually, neither source_filename nor source_line will be used because CIL is 
using its own functions to print error messages.

>> +		}
>> +	}
>> +
>>   	avrule->next = NULL;
>>   	return avrule;
>>   }


-- 
James Carter <jwcart2@tycho.nsa.gov>
National Security Agency

  reply	other threads:[~2016-04-20 19:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 14:25 [PATCH 0/6] ibsepol/cil: Add high-level language line marking support James Carter
2016-04-19 14:26 ` [PATCH 1/6] libsepol/cil: " James Carter
2016-04-20 14:42   ` Steve Lawrence
2016-04-20 18:40     ` James Carter
2016-04-19 14:26 ` [PATCH 2/6] libsepol/cil: Store CIL filename in parse tree and AST James Carter
2016-04-19 14:26 ` [PATCH 3/6] libsepol/cil: Add cil_tree_log() and supporting functions James Carter
2016-04-20 14:47   ` Steve Lawrence
2016-04-20 19:10     ` James Carter
2016-04-19 14:26 ` [PATCH 4/6] libsepol/cil: Replace cil_log() calls with cil_tree_log() James Carter
2016-04-19 14:26 ` [PATCH 5/6] libsepol/cil: Remove path field from cil_tree_node struct James Carter
2016-04-20 14:48   ` Steve Lawrence
2016-04-20 19:36     ` James Carter [this message]
2016-04-19 14:26 ` [PATCH 6/6] libsepol: When generating CIL use HLL line mark for neverallows James Carter

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=5717DA37.3010408@tycho.nsa.gov \
    --to=jwcart2@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    --cc=slawrence@tresys.com \
    /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.