kernel/team: Create a team_get_team_struct() function and utilize it.

Cleans up some lock/get/unlock sequences, and makes it possible
for external consumers to get team structs (which will be necessary
for permissions checks.)
This commit is contained in:
Augustin Cavalier
2019-07-04 16:54:33 -04:00
parent 6f6cba7c16
commit a90e9ba7b9
2 changed files with 9 additions and 2 deletions
+1
View File
@@ -38,6 +38,7 @@ struct job_control_entry* team_get_death_entry(Team *team,
thread_id child, bool* _deleteEntry);
void team_init_exit_info_on_error(Team* team);
bool team_is_valid(team_id id);
Team *team_get_team_struct(team_id id);
Team *team_get_team_struct_locked(team_id id);
int32 team_max_teams(void);
int32 team_used_teams(void);
+8 -2
View File
@@ -2918,9 +2918,15 @@ team_is_valid(team_id id)
if (id <= 0)
return false;
InterruptsReadSpinLocker teamsLocker(sTeamHashLock);
return team_get_team_struct(id) != NULL;
}
return team_get_team_struct_locked(id) != NULL;
Team*
team_get_team_struct(team_id id)
{
InterruptsReadSpinLocker teamsLocker(sTeamHashLock);
return team_get_team_struct_locked(id);
}