mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
logind: introduce macro for the last session class condition check
For all checks regarding the properties of sessoin classes we have SESSION_CLASS_CAN_XYZ() style macros. Except for one. Convert that one too.
This commit is contained in:
@@ -1835,7 +1835,7 @@ static int have_multiple_sessions(
|
||||
/* Check for other users' sessions. Greeter sessions do not
|
||||
* count, and non-login sessions do not count either. */
|
||||
HASHMAP_FOREACH(session, m->sessions)
|
||||
if (IN_SET(session->class, SESSION_USER, SESSION_USER_EARLY) &&
|
||||
if (SESSION_CLASS_IS_INHIBITOR_LIKE(session->class) &&
|
||||
session->user->user_record->uid != uid)
|
||||
return true;
|
||||
|
||||
|
||||
@@ -65,6 +65,9 @@ typedef enum SessionClass {
|
||||
/* Which session classes allow changing session types */
|
||||
#define SESSION_CLASS_CAN_CHANGE_TYPE(class) (IN_SET((class), SESSION_USER, SESSION_USER_EARLY, SESSION_GREETER, SESSION_LOCK_SCREEN))
|
||||
|
||||
/* Which session classes are taken into acccount when deciding whether shutdown shall be allowed if other users are logged in */
|
||||
#define SESSION_CLASS_IS_INHIBITOR_LIKE(class) IN_SET((class), SESSION_USER, SESSION_USER_EARLY)
|
||||
|
||||
typedef enum SessionType {
|
||||
SESSION_UNSPECIFIED,
|
||||
SESSION_TTY,
|
||||
|
||||
Reference in New Issue
Block a user