record mount time and expose it in /proc/self/mounts
PATCH 1/1 record mount time and expose it in /proc/self/mounts
Not sure if this is even useful, never mind implemented correctly. Against 2.6.0-test6.
fs/namespace.c +3 -0
@@ -21,6 +21,7 @@#include <linux/namei.h> #include <linux/security.h> #include <linux/mount.h> +#include <linux/time.h> #include <asm/uaccess.h> extern int __init init_rootfs (void );
@@ -152,6 +153,7 @@ mnt->mnt_root =dget (root); mnt->mnt_mountpoint = mnt->mnt_root; mnt->mnt_parent = mnt; +do_gettimeofday (&mnt->mnt_when); }return mnt; }
@@ -236,6 +238,7 @@ }if (mnt->mnt_sb->s_op->show_options) err = mnt->mnt_sb->s_op->show_options (m, mnt); +seq_printf (m,",when=%ld" , (long )mnt->mnt_when.tv_sec);seq_puts (m," 0 0\n" );return err; }
fs/super.c +2 -0
@@ -32,6 +32,7 @@#include <linux/security.h> #include <linux/vfs.h> #include <linux/writeback.h> /* for the emergency remount stuff */ +#include <linux/time.h> #include <asm/uaccess.h>
@@ -693,6 +694,7 @@ mnt->mnt_parent = mnt;up_write (&sb->s_umount);put_filesystem (type); +do_gettimeofday (&mnt->mnt_when);return mnt; out_sb:up_write (&sb->s_umount);
include/linux/mount.h +2 -0
@@ -13,6 +13,7 @@#ifdef __KERNEL__#include <linux/list.h> +#include <linux/time.h> #define MNT_NOSUID 1#define MNT_NODEV 2
@@ -30,6 +31,7 @@atomic_t mnt_count;int mnt_flags;char *mnt_devname;/* Name of device e.g. /dev/dsk/hda1 */ +struct timeval mnt_when;struct list_head mnt_list; };