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:
@@ -38,6 +38,7 @@ struct job_control_entry* team_get_death_entry(Team *team,
|
|||||||
thread_id child, bool* _deleteEntry);
|
thread_id child, bool* _deleteEntry);
|
||||||
void team_init_exit_info_on_error(Team* team);
|
void team_init_exit_info_on_error(Team* team);
|
||||||
bool team_is_valid(team_id id);
|
bool team_is_valid(team_id id);
|
||||||
|
Team *team_get_team_struct(team_id id);
|
||||||
Team *team_get_team_struct_locked(team_id id);
|
Team *team_get_team_struct_locked(team_id id);
|
||||||
int32 team_max_teams(void);
|
int32 team_max_teams(void);
|
||||||
int32 team_used_teams(void);
|
int32 team_used_teams(void);
|
||||||
|
|||||||
@@ -2918,9 +2918,15 @@ team_is_valid(team_id id)
|
|||||||
if (id <= 0)
|
if (id <= 0)
|
||||||
return false;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user