/*1* AppArmor security module2*3* This file contains AppArmor security identifier (sid) manipulation fns4*5* Copyright 2009-2010 Canonical Ltd.6*7* This program is free software; you can redistribute it and/or8* modify it under the terms of the GNU General Public License as9* published by the Free Software Foundation, version 2 of the10* License.11*12*13* AppArmor allocates a unique sid for every profile loaded. If a profile14* is replaced it receives the sid of the profile it is replacing.15*16* The sid value of 0 is invalid.17*/1819#include <linux/spinlock.h>20#include <linux/errno.h>21#include <linux/err.h>2223#include "include/sid.h"2425/* global counter from which sids are allocated */26static u32 global_sid;27static DEFINE_SPINLOCK(sid_lock);2829/* TODO FIXME: add sid to profile mapping, and sid recycling */3031/**32* aa_alloc_sid - allocate a new sid for a profile33*/34u32 aa_alloc_sid(void)35{36u32 sid;3738/*39* TODO FIXME: sid recycling - part of profile mapping table40*/41spin_lock(&sid_lock);42sid = (++global_sid);43spin_unlock(&sid_lock);44return sid;45}4647/**48* aa_free_sid - free a sid49* @sid: sid to free50*/51void aa_free_sid(u32 sid)52{53; /* NOP ATM */54}555657