tty: convert to new timestamp accessors
authorJeff Layton <jlayton@kernel.org>
Wed, 4 Oct 2023 18:51:56 +0000 (14:51 -0400)
committerChristian Brauner <brauner@kernel.org>
Wed, 18 Oct 2023 11:26:17 +0000 (13:26 +0200)
Convert to using the new inode timestamp accessor functions.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20231004185347.80880-9-jlayton@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
drivers/tty/tty_io.c

index 8a94e5a43c6d2e64e4e24181a6acbc65deb0fbc6..d13d2f2e76c7095a73d86a4391cb23f513ac8b5a 100644 (file)
@@ -818,7 +818,7 @@ static void tty_update_time(struct tty_struct *tty, bool mtime)
        spin_lock(&tty->files_lock);
        list_for_each_entry(priv, &tty->tty_files, list) {
                struct inode *inode = file_inode(priv->file);
-               struct timespec64 *time = mtime ? &inode->i_mtime : &inode->i_atime;
+               struct timespec64 time = mtime ? inode_get_mtime(inode) : inode_get_atime(inode);
 
                /*
                 * We only care if the two values differ in anything other than the
@@ -826,8 +826,12 @@ static void tty_update_time(struct tty_struct *tty, bool mtime)
                 * the time of the tty device, otherwise it could be construded as a
                 * security leak to let userspace know the exact timing of the tty.
                 */
-               if ((sec ^ time->tv_sec) & ~7)
-                       time->tv_sec = sec;
+               if ((sec ^ time.tv_sec) & ~7) {
+                       if (mtime)
+                               inode_set_mtime(inode, sec, 0);
+                       else
+                               inode_set_atime(inode, sec, 0);
+               }
        }
        spin_unlock(&tty->files_lock);
 }