| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-10.3-src/usr/src/sys/compat/linprocfs/linprocfs.c freebsd-10.3/usr/src/sys/compat/linprocfs/linprocfs.c |
| --- /var/tmp/freebsd-10.3-src/usr/src/sys/compat/linprocfs/linprocfs.c 2016-03-25 09:09:43.000000000 +0800 |
| +++ freebsd-10.3/usr/src/sys/compat/linprocfs/linprocfs.c 2019-03-11 23:22:36.152973611 +0800 |
| @@ -39,6 +39,11 @@ |
| * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94 |
| */ |
| |
| +#include "linprocfs_version.h" |
| +#ifndef LINPROCFS_VERSION |
| +#define LINPROCFS_VERSION LINRPOCFS_VERSION_BUILD_VERSION " " LINPROCFS_VERSION_BUILD_TIME |
| +#endif |
| + |
| #include <sys/cdefs.h> |
| __FBSDID("$FreeBSD: releng/10.3/sys/compat/linprocfs/linprocfs.c 295951 2016-02-24 02:34:11Z araujo $"); |
| |
| @@ -355,20 +362,17 @@ |
| /* determine fs type */ |
| fstype = mp->mnt_stat.f_fstypename; |
| if (strcmp(fstype, pn->pn_info->pi_name) == 0) |
| - mntfrom = fstype = "proc"; |
| + fstype = "proc"; |
| else if (strcmp(fstype, "procfs") == 0) |
| continue; |
| - |
| - if (strcmp(fstype, "linsysfs") == 0) { |
| - sbuf_printf(sb, "/sys %s sysfs %s", mntto, |
| - mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); |
| - } else { |
| + else if(strcmp(fstype, "linsysfs") == 0) { |
| + fstype = "sysfs"; |
| + } else if (strcmp(fstype, "msdosfs") == 0) { |
| /* For Linux msdosfs is called vfat */ |
| - if (strcmp(fstype, "msdosfs") == 0) |
| - fstype = "vfat"; |
| - sbuf_printf(sb, "%s %s %s %s", mntfrom, mntto, fstype, |
| - mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); |
| + fstype = "vfat"; |
| } |
| + sbuf_printf(sb, "%s %s %s %s", mntfrom, mntto, fstype, |
| + mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); |
| #define ADD_OPTION(opt, name) \ |
| if (mp->mnt_stat.f_flags & (opt)) sbuf_printf(sb, "," name); |
| ADD_OPTION(MNT_SYNCHRONOUS, "sync"); |
| @@ -540,7 +544,8 @@ |
| sbuf_printf(sb, "%s%s", cp1, cp2 + 1); |
| else |
| #endif |
| - sbuf_cat(sb, "#4 Sun Dec 18 04:30:00 CET 1977"); |
| + // sbuf_cat(sb, "#4 Sun Dec 18 04:30:00 CET 1977"); |
| + sbuf_cat(sb, LINPROCFS_VERSION); |
| } |
| |
| /* |
| @@ -565,7 +570,8 @@ |
| sbuf_cat(sb, builder); |
| else |
| #endif |
| - sbuf_cat(sb, "des@freebsd.org"); |
| + // sbuf_cat(sb, "des@freebsd.org"); |
| + sbuf_cat(sb, LINPROCFS_VERSION_BUILD_BY); |
| } |
| |
| /* |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-10.3-src/usr/src/sys/modules/linprocfs/Makefile freebsd-10.3/usr/src/sys/modules/linprocfs/Makefile |
| --- /var/tmp/freebsd-10.3-src/usr/src/sys/modules/linprocfs/Makefile 2016-03-25 09:09:40.000000000 +0800 |
| +++ freebsd-10.3/usr/src/sys/modules/linprocfs/Makefile 2019-03-11 23:24:52.186951270 +0800 |
| @@ -5,6 +5,12 @@ |
| KMOD= linprocfs |
| SRCS= vnode_if.h \ |
| device_if.h bus_if.h \ |
| - linprocfs.c |
| + linprocfs.c \ |
| + linprocfs_version.h |
| + |
| +CLEANFILES += linprocfs_version.h .linprocfs_build_version |
| + |
| +linprocfs_version.h: generate-linprocfs-version.sh linprocfs.c |
| + sh ${.CURDIR}/generate-linprocfs-version.sh > $@ |
| |
| .include <bsd.kmod.mk> |
| --- /dev/null 2019-03-11 23:15:58.000000000 +0800 |
| +++ freebsd-10.3/usr/src/sys/modules/linprocfs/generate-linprocfs-version.sh 2019-03-11 22:53:03.201092505 +0800 |
| @@ -0,0 +1,13 @@ |
| +#!/bin/sh |
| + |
| +export LANG=C |
| +if [ -f .linprocfs_build_version ]; then |
| + build_version="`cat .linprocfs_build_version`" |
| +else |
| + build_version=1 |
| +fi |
| +printf '#define LINRPOCFS_VERSION_BUILD_VERSION "#%s"\n' "$build_version" |
| +printf '#define LINPROCFS_VERSION_BUILD_TIME "%s"\n' "`date`" |
| +printf '#define LINPROCFS_VERSION LINRPOCFS_VERSION_BUILD_VERSION " " LINPROCFS_VERSION_BUILD_TIME\n' |
| +printf '#define LINPROCFS_VERSION_BUILD_BY "%s@%s"\n' "`whoami`" "`hostname`" |
| +echo $((build_version+1)) > .linprocfs_build_version |