/*
 * AppArmor security module
 *
 * This file contains AppArmor security identifier (sid) manipulation fns
 *
 * Copyright 2009-2010 Canonical Ltd.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, version 2 of the
 * License.
 *
 *
 * AppArmor allocates a unique sid for every profile loaded.  If a profile
 * is replaced it receives the sid of the profile it is replacing.
 *
 * The sid value of 0 is invalid.
 */

#include <linux/spinlock.h>
#include <linux/errno.h>
#include <linux/err.h>

#include "include/sid.h"

/* global counter from which sids are allocated */
static u32 global_sid;
static DEFINE_SPINLOCK(sid_lock);

/* TODO FIXME: add sid to profile mapping, and sid recycling */

/**
 * aa_alloc_sid - allocate a new sid for a profile
 */
u32 aa_alloc_sid(void)
{
	u32 sid;

	/*
	 * TODO FIXME: sid recycling - part of profile mapping table
	 */
	spin_lock(&sid_lock);
	sid = (++global_sid);
	spin_unlock(&sid_lock);
	return sid;
}

/**
 * aa_free_sid - free a sid
 * @sid: sid to free
 */
void aa_free_sid(u32 sid)
{
	;			/* NOP ATM */
}
s-private-remove</option>
<option value='packet-loop-back'>packet-loop-back</option>
<option value='packet-rx-pump-back'>packet-rx-pump-back</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/?h=nds-private-remove'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?h=nds-private-remove&amp;id=a076d1bdc678a2b9157660af8bd691322c0ba3dd'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/include/sound/cs8427.h?h=nds-private-remove'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/include/sound/cs8427.h?h=nds-private-remove&amp;id=a076d1bdc678a2b9157660af8bd691322c0ba3dd'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/include/sound/cs8427.h?h=nds-private-remove&amp;id=a076d1bdc678a2b9157660af8bd691322c0ba3dd'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/include/sound/cs8427.h?h=nds-private-remove&amp;id=a076d1bdc678a2b9157660af8bd691322c0ba3dd'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/include/sound/cs8427.h'>
<input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='a076d1bdc678a2b9157660af8bd691322c0ba3dd'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?h=nds-private-remove&amp;id=a076d1bdc678a2b9157660af8bd691322c0ba3dd'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/include?h=nds-private-remove&amp;id=a076d1bdc678a2b9157660af8bd691322c0ba3dd'>include</a>/<a href='/cgit.cgi/linux/net-next.git/log/include/sound?h=nds-private-remove&amp;id=a076d1bdc678a2b9157660af8bd691322c0ba3dd'>sound</a>/<a href='/cgit.cgi/linux/net-next.git/log/include/sound/cs8427.h?h=nds-private-remove&amp;id=a076d1bdc678a2b9157660af8bd691322c0ba3dd'>cs8427.h</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/include/sound/cs8427.h?h=nds-private-remove&amp;id=a076d1bdc678a2b9157660af8bd691322c0ba3dd&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>