chiark / gitweb /
logind: rename 'pos' to 'position'
authorDavid Herrmann <dh.herrmann@gmail.com>
Fri, 10 Jul 2015 13:08:24 +0000 (15:08 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:06:05 +0000 (10:06 +0100)
Spell out the proper name. Use 'pos' over 'position', and also update the
logind state file to do the same. Note that this breaks live updates.
However, we only save 'POSITION' on non-seat0, so this shouldn't bother
anyone for real. If you run multi-seat setups, you better restart a
machine on updates, anyway.

src/login/logind-seat.c
src/login/logind-session.c
src/login/logind-session.h

index 887de47f314dbf67dc05420abe088d134fe99174..72bcfc4a52b89ac0c4a7ac4fad7a216d62b2968c 100644 (file)
@@ -262,8 +262,8 @@ int seat_switch_to_next(Seat *s) {
                 return -EINVAL;
 
         start = 1;
                 return -EINVAL;
 
         start = 1;
-        if (s->active && s->active->pos > 0)
-                start = s->active->pos;
+        if (s->active && s->active->position > 0)
+                start = s->active->position;
 
         for (i = start + 1; i < s->position_count; ++i)
                 if (s->positions[i])
 
         for (i = start + 1; i < s->position_count; ++i)
                 if (s->positions[i])
@@ -283,8 +283,8 @@ int seat_switch_to_previous(Seat *s) {
                 return -EINVAL;
 
         start = 1;
                 return -EINVAL;
 
         start = 1;
-        if (s->active && s->active->pos > 0)
-                start = s->active->pos;
+        if (s->active && s->active->position > 0)
+                start = s->active->position;
 
         for (i = start - 1; i > 0; --i)
                 if (s->positions[i])
 
         for (i = start - 1; i > 0; --i)
                 if (s->positions[i])
@@ -440,9 +440,9 @@ int seat_stop_sessions(Seat *s, bool force) {
 
 void seat_evict_position(Seat *s, Session *session) {
         Session *iter;
 
 void seat_evict_position(Seat *s, Session *session) {
         Session *iter;
-        unsigned int pos = session->pos;
+        unsigned int pos = session->position;
 
 
-        session->pos = 0;
+        session->position = 0;
 
         if (pos == 0)
                 return;
 
         if (pos == 0)
                 return;
@@ -454,7 +454,7 @@ void seat_evict_position(Seat *s, Session *session) {
                  * position (eg., during gdm->session transition), so let's look
                  * for it and set it on the free slot. */
                 LIST_FOREACH(sessions_by_seat, iter, s->sessions) {
                  * position (eg., during gdm->session transition), so let's look
                  * for it and set it on the free slot. */
                 LIST_FOREACH(sessions_by_seat, iter, s->sessions) {
-                        if (iter->pos == pos) {
+                        if (iter->position == pos) {
                                 s->positions[pos] = iter;
                                 break;
                         }
                                 s->positions[pos] = iter;
                                 break;
                         }
@@ -472,7 +472,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) {
 
         seat_evict_position(s, session);
 
 
         seat_evict_position(s, session);
 
-        session->pos = pos;
+        session->position = pos;
         if (pos > 0 && !s->positions[pos])
                 s->positions[pos] = session;
 }
         if (pos > 0 && !s->positions[pos])
                 s->positions[pos] = session;
 }
@@ -480,7 +480,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) {
 static void seat_assign_position(Seat *s, Session *session) {
         unsigned int pos;
 
 static void seat_assign_position(Seat *s, Session *session) {
         unsigned int pos;
 
-        if (session->pos > 0)
+        if (session->position > 0)
                 return;
 
         for (pos = 1; pos < s->position_count; ++pos)
                 return;
 
         for (pos = 1; pos < s->position_count; ++pos)
index 108139ce399043d6a58640303c767a880a149d31..8950c719058c3f6737cbb8393d22e042df7f796f 100644 (file)
@@ -264,7 +264,7 @@ int session_save(Session *s) {
                 fprintf(f, "VTNR=%u\n", s->vtnr);
 
         if (!s->vtnr)
                 fprintf(f, "VTNR=%u\n", s->vtnr);
 
         if (!s->vtnr)
-                fprintf(f, "POS=%u\n", s->pos);
+                fprintf(f, "POSITION=%u\n", s->position);
 
         if (s->leader > 0)
                 fprintf(f, "LEADER="PID_FMT"\n", s->leader);
 
         if (s->leader > 0)
                 fprintf(f, "LEADER="PID_FMT"\n", s->leader);
@@ -302,7 +302,7 @@ int session_load(Session *s) {
                 *seat = NULL,
                 *vtnr = NULL,
                 *state = NULL,
                 *seat = NULL,
                 *vtnr = NULL,
                 *state = NULL,
-                *pos = NULL,
+                *position = NULL,
                 *leader = NULL,
                 *type = NULL,
                 *class = NULL,
                 *leader = NULL,
                 *type = NULL,
                 *class = NULL,
@@ -329,7 +329,7 @@ int session_load(Session *s) {
                            "DESKTOP",        &s->desktop,
                            "VTNR",           &vtnr,
                            "STATE",          &state,
                            "DESKTOP",        &s->desktop,
                            "VTNR",           &vtnr,
                            "STATE",          &state,
-                           "POS",            &pos,
+                           "POSITION",       &position,
                            "LEADER",         &leader,
                            "TYPE",           &type,
                            "CLASS",          &class,
                            "LEADER",         &leader,
                            "TYPE",           &type,
                            "CLASS",          &class,
@@ -388,10 +388,10 @@ int session_load(Session *s) {
         if (!s->seat || !seat_has_vts(s->seat))
                 s->vtnr = 0;
 
         if (!s->seat || !seat_has_vts(s->seat))
                 s->vtnr = 0;
 
-        if (pos && s->seat) {
+        if (position && s->seat) {
                 unsigned int npos;
 
                 unsigned int npos;
 
-                safe_atou(pos, &npos);
+                safe_atou(position, &npos);
                 seat_claim_position(s->seat, s, npos);
         }
 
                 seat_claim_position(s->seat, s, npos);
         }
 
index e09c95a8619da3421f6b40f274f3e0f9639fd7b1..dffe5a9aa18d19d5ace6d4c1def7d29206fac3a2 100644 (file)
@@ -70,7 +70,7 @@ struct Session {
         Manager *manager;
 
         const char *id;
         Manager *manager;
 
         const char *id;
-        unsigned int pos;
+        unsigned int position;
         SessionType type;
         SessionClass class;
 
         SessionType type;
         SessionClass class;