GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / security / apparmor / sid.c
bloba5e4d549363a01263614d49406b35d4e4a1a2b3d
1 /*
2 * AppArmor security module
4 * This file contains AppArmor security identifier (sid) manipulation fns
6 * Copyright 2009-2010 Canonical Ltd.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation, version 2 of the
11 * License.
14 * AppArmor allocates a unique sid for every profile loaded. If a profile
15 * is replaced it receives the sid of the profile it is replacing.
17 * The sid value of 0 is invalid.
20 #include <linux/spinlock.h>
21 #include <linux/errno.h>
22 #include <linux/err.h>
24 #include "include/sid.h"
26 /* global counter from which sids are allocated */
27 static u32 global_sid;
28 static DEFINE_SPINLOCK(sid_lock);
31 /**
32 * aa_alloc_sid - allocate a new sid for a profile
34 u32 aa_alloc_sid(void)
36 u32 sid;
38 spin_lock(&sid_lock);
39 sid = (++global_sid);
40 spin_unlock(&sid_lock);
41 return sid;
44 /**
45 * aa_free_sid - free a sid
46 * @sid: sid to free
48 void aa_free_sid(u32 sid)
50 ; /* NOP ATM */