[PATCH] record mount time and expose it in /proc/self/mounts

From: Sean Neakums
Date: Thu Oct 02 2003 - 02:15:08 EST


Not sure if this is even useful, never mind implemented correctly.
Against 2.6.0-test6.


diff -urN --exclude '*~' --exclude '*.orig' T6/fs/namespace.c edited/fs/namespace.c
--- T6/fs/namespace.c 2003-07-28 10:22:18.000000000 +0100
+++ edited/fs/namespace.c 2003-10-01 20:17:18.000000000 +0100
@@ -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;
}
diff -urN --exclude '*~' --exclude '*.orig' T6/fs/super.c edited/fs/super.c
--- T6/fs/super.c 2003-10-01 18:50:21.000000000 +0100
+++ edited/fs/super.c 2003-10-01 20:17:18.000000000 +0100
@@ -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);
diff -urN --exclude '*~' --exclude '*.orig' T6/include/linux/mount.h edited/include/linux/mount.h
--- T6/include/linux/mount.h 2003-07-14 04:30:35.000000000 +0100
+++ edited/include/linux/mount.h 2003-10-01 20:17:18.000000000 +0100
@@ -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;
};

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/