|
|
306fa1 |
autofs-5.1.5 - log mount call arguments if mount_verbose is set
|
|
|
306fa1 |
|
|
|
306fa1 |
From: Lars R. Damerow <lars@pixar.com>
|
|
|
306fa1 |
|
|
|
306fa1 |
Override the debug log only setting if mount_verbose is set so that
|
|
|
306fa1 |
mount parameter information is logged on mount.
|
|
|
306fa1 |
|
|
|
306fa1 |
Signed-off-by: Lars R. Damerow <lars@pixar.com>
|
|
|
306fa1 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
306fa1 |
---
|
|
|
306fa1 |
CHANGELOG | 1 +
|
|
|
306fa1 |
modules/mount_afs.c | 6 +++++-
|
|
|
306fa1 |
modules/mount_bind.c | 11 +++++++----
|
|
|
306fa1 |
modules/mount_ext2.c | 16 ++++++++++------
|
|
|
306fa1 |
modules/mount_generic.c | 14 +++++++++-----
|
|
|
306fa1 |
modules/mount_nfs.c | 29 +++++++++++++++++------------
|
|
|
306fa1 |
6 files changed, 49 insertions(+), 28 deletions(-)
|
|
|
306fa1 |
|
|
|
306fa1 |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
306fa1 |
+++ autofs-5.0.7/CHANGELOG
|
|
|
306fa1 |
@@ -321,6 +321,7 @@
|
|
|
306fa1 |
- use malloc(3) in spawn.c.
|
|
|
306fa1 |
- add mount_verbose configuration option.
|
|
|
306fa1 |
- optionally log mount requestor process info.
|
|
|
306fa1 |
+- log mount call arguments if mount_verbose is set.
|
|
|
306fa1 |
|
|
|
306fa1 |
25/07/2012 autofs-5.0.7
|
|
|
306fa1 |
=======================
|
|
|
306fa1 |
--- autofs-5.0.7.orig/modules/mount_afs.c
|
|
|
306fa1 |
+++ autofs-5.0.7/modules/mount_afs.c
|
|
|
306fa1 |
@@ -37,10 +37,14 @@ int mount_mount(struct autofs_point *ap,
|
|
|
306fa1 |
char dest[PATH_MAX + 1];
|
|
|
306fa1 |
size_t r_len = strlen(root);
|
|
|
306fa1 |
size_t d_len = r_len + name_len + 2;
|
|
|
306fa1 |
+ void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
|
|
|
306fa1 |
|
|
|
306fa1 |
if (ap->flags & MOUNT_FLAG_REMOUNT)
|
|
|
306fa1 |
return 0;
|
|
|
306fa1 |
|
|
|
306fa1 |
+ if (defaults_get_mount_verbose())
|
|
|
306fa1 |
+ mountlog = &log_info;
|
|
|
306fa1 |
+
|
|
|
306fa1 |
if (d_len > PATH_MAX)
|
|
|
306fa1 |
return 1;
|
|
|
306fa1 |
|
|
|
306fa1 |
@@ -53,7 +57,7 @@ int mount_mount(struct autofs_point *ap,
|
|
|
306fa1 |
if (dest[strlen(dest)-1] == '/')
|
|
|
306fa1 |
dest[strlen(dest)-1] = '\0';
|
|
|
306fa1 |
|
|
|
306fa1 |
- debug(ap->logopt, MODPREFIX "mounting AFS %s -> %s", dest, what);
|
|
|
306fa1 |
+ mountlog(ap->logopt, MODPREFIX "mounting AFS %s -> %s", dest, what);
|
|
|
306fa1 |
|
|
|
306fa1 |
return symlink(what, dest); /* Try it. If it fails, return the error. */
|
|
|
306fa1 |
}
|
|
|
306fa1 |
--- autofs-5.0.7.orig/modules/mount_bind.c
|
|
|
306fa1 |
+++ autofs-5.0.7/modules/mount_bind.c
|
|
|
306fa1 |
@@ -81,10 +81,14 @@ int mount_mount(struct autofs_point *ap,
|
|
|
306fa1 |
int err;
|
|
|
306fa1 |
int i, len;
|
|
|
306fa1 |
int symlnk = (*name != '/' && (ap->flags & MOUNT_FLAG_SYMLINK));
|
|
|
306fa1 |
+ void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
|
|
|
306fa1 |
|
|
|
306fa1 |
if (ap->flags & MOUNT_FLAG_REMOUNT)
|
|
|
306fa1 |
return 0;
|
|
|
306fa1 |
|
|
|
306fa1 |
+ if (defaults_get_mount_verbose())
|
|
|
306fa1 |
+ mountlog = &log_info;
|
|
|
306fa1 |
+
|
|
|
306fa1 |
/* Extract "symlink" pseudo-option which forces local filesystems
|
|
|
306fa1 |
* to be symlinked instead of bound.
|
|
|
306fa1 |
*/
|
|
|
306fa1 |
@@ -164,10 +168,9 @@ int mount_mount(struct autofs_point *ap,
|
|
|
306fa1 |
if (!status)
|
|
|
306fa1 |
existed = 0;
|
|
|
306fa1 |
|
|
|
306fa1 |
- debug(ap->logopt,
|
|
|
306fa1 |
- MODPREFIX
|
|
|
306fa1 |
- "calling mount --bind " SLOPPY " -o %s %s %s",
|
|
|
306fa1 |
- options, what, fullpath);
|
|
|
306fa1 |
+ mountlog(ap->logopt, MODPREFIX
|
|
|
306fa1 |
+ "calling mount --bind " SLOPPY " -o %s %s %s",
|
|
|
306fa1 |
+ options, what, fullpath);
|
|
|
306fa1 |
|
|
|
306fa1 |
err = spawn_bind_mount(ap->logopt,
|
|
|
306fa1 |
SLOPPYOPT "-o", options, what, fullpath, NULL);
|
|
|
306fa1 |
--- autofs-5.0.7.orig/modules/mount_ext2.c
|
|
|
306fa1 |
+++ autofs-5.0.7/modules/mount_ext2.c
|
|
|
306fa1 |
@@ -47,10 +47,14 @@ int mount_mount(struct autofs_point *ap,
|
|
|
306fa1 |
int err, ro = 0;
|
|
|
306fa1 |
const char *fsck_prog;
|
|
|
306fa1 |
int len, status, existed = 1;
|
|
|
306fa1 |
+ void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
|
|
|
306fa1 |
|
|
|
306fa1 |
if (ap->flags & MOUNT_FLAG_REMOUNT)
|
|
|
306fa1 |
return 0;
|
|
|
306fa1 |
|
|
|
306fa1 |
+ if (defaults_get_mount_verbose())
|
|
|
306fa1 |
+ mountlog = &log_info;
|
|
|
306fa1 |
+
|
|
|
306fa1 |
/* Root offset of multi-mount */
|
|
|
306fa1 |
len = strlen(root);
|
|
|
306fa1 |
if (root[len - 1] == '/') {
|
|
|
306fa1 |
@@ -121,15 +125,15 @@ int mount_mount(struct autofs_point *ap,
|
|
|
306fa1 |
}
|
|
|
306fa1 |
|
|
|
306fa1 |
if (options) {
|
|
|
306fa1 |
- debug(ap->logopt,
|
|
|
306fa1 |
- MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
|
|
|
306fa1 |
- fstype, options, what, fullpath);
|
|
|
306fa1 |
+ mountlog(ap->logopt, MODPREFIX
|
|
|
306fa1 |
+ "calling mount -t %s " SLOPPY "-o %s %s %s",
|
|
|
306fa1 |
+ fstype, options, what, fullpath);
|
|
|
306fa1 |
err = spawn_mount(ap->logopt, "-t", fstype,
|
|
|
306fa1 |
SLOPPYOPT "-o", options, what, fullpath, NULL);
|
|
|
306fa1 |
} else {
|
|
|
306fa1 |
- debug(ap->logopt,
|
|
|
306fa1 |
- MODPREFIX "calling mount -t %s %s %s",
|
|
|
306fa1 |
- fstype, what, fullpath);
|
|
|
306fa1 |
+ mountlog(ap->logopt,
|
|
|
306fa1 |
+ MODPREFIX "calling mount -t %s %s %s",
|
|
|
306fa1 |
+ fstype, what, fullpath);
|
|
|
306fa1 |
err = spawn_mount(ap->logopt, "-t", fstype, what, fullpath, NULL);
|
|
|
306fa1 |
}
|
|
|
306fa1 |
|
|
|
306fa1 |
--- autofs-5.0.7.orig/modules/mount_generic.c
|
|
|
306fa1 |
+++ autofs-5.0.7/modules/mount_generic.c
|
|
|
306fa1 |
@@ -46,10 +46,14 @@ int mount_mount(struct autofs_point *ap,
|
|
|
306fa1 |
char buf[MAX_ERR_BUF];
|
|
|
306fa1 |
int err;
|
|
|
306fa1 |
int len, status, existed = 1;
|
|
|
306fa1 |
+ void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
|
|
|
306fa1 |
|
|
|
306fa1 |
if (ap->flags & MOUNT_FLAG_REMOUNT)
|
|
|
306fa1 |
return 0;
|
|
|
306fa1 |
|
|
|
306fa1 |
+ if (defaults_get_mount_verbose())
|
|
|
306fa1 |
+ mountlog = &log_info;
|
|
|
306fa1 |
+
|
|
|
306fa1 |
/* Root offset of multi-mount */
|
|
|
306fa1 |
len = strlen(root);
|
|
|
306fa1 |
if (root[len - 1] == '/') {
|
|
|
306fa1 |
@@ -80,15 +84,15 @@ int mount_mount(struct autofs_point *ap,
|
|
|
306fa1 |
existed = 0;
|
|
|
306fa1 |
|
|
|
306fa1 |
if (options && options[0]) {
|
|
|
306fa1 |
- debug(ap->logopt,
|
|
|
306fa1 |
- MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
|
|
|
306fa1 |
- fstype, options, what, fullpath);
|
|
|
306fa1 |
+ mountlog(ap->logopt,
|
|
|
306fa1 |
+ MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
|
|
|
306fa1 |
+ fstype, options, what, fullpath);
|
|
|
306fa1 |
|
|
|
306fa1 |
err = spawn_mount(ap->logopt, "-t", fstype,
|
|
|
306fa1 |
SLOPPYOPT "-o", options, what, fullpath, NULL);
|
|
|
306fa1 |
} else {
|
|
|
306fa1 |
- debug(ap->logopt, MODPREFIX "calling mount -t %s %s %s",
|
|
|
306fa1 |
- fstype, what, fullpath);
|
|
|
306fa1 |
+ mountlog(ap->logopt, MODPREFIX "calling mount -t %s %s %s",
|
|
|
306fa1 |
+ fstype, what, fullpath);
|
|
|
306fa1 |
err = spawn_mount(ap->logopt, "-t", fstype, what, fullpath, NULL);
|
|
|
306fa1 |
}
|
|
|
306fa1 |
|
|
|
306fa1 |
--- autofs-5.0.7.orig/modules/mount_nfs.c
|
|
|
306fa1 |
+++ autofs-5.0.7/modules/mount_nfs.c
|
|
|
306fa1 |
@@ -77,13 +77,17 @@ int mount_mount(struct autofs_point *ap,
|
|
|
306fa1 |
int port = -1;
|
|
|
306fa1 |
int ro = 0; /* Set if mount bind should be read-only */
|
|
|
306fa1 |
int rdma = 0;
|
|
|
306fa1 |
+ void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
|
|
|
306fa1 |
|
|
|
306fa1 |
if (ap->flags & MOUNT_FLAG_REMOUNT)
|
|
|
306fa1 |
return 0;
|
|
|
306fa1 |
|
|
|
306fa1 |
- debug(ap->logopt,
|
|
|
306fa1 |
- MODPREFIX "root=%s name=%s what=%s, fstype=%s, options=%s",
|
|
|
306fa1 |
- root, name, what, fstype, options);
|
|
|
306fa1 |
+ if (defaults_get_mount_verbose())
|
|
|
306fa1 |
+ mountlog = &log_info;
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ mountlog(ap->logopt,
|
|
|
306fa1 |
+ MODPREFIX "root=%s name=%s what=%s, fstype=%s, options=%s",
|
|
|
306fa1 |
+ root, name, what, fstype, options);
|
|
|
306fa1 |
|
|
|
306fa1 |
mount_default_proto = defaults_get_mount_nfs_default_proto();
|
|
|
306fa1 |
vers = NFS_VERS_MASK | NFS_PROTO_MASK;
|
|
|
306fa1 |
@@ -193,9 +197,9 @@ int mount_mount(struct autofs_point *ap,
|
|
|
306fa1 |
if ((vers & NFS_PROTO_MASK) == 0)
|
|
|
306fa1 |
vers |= NFS_PROTO_MASK;
|
|
|
306fa1 |
|
|
|
306fa1 |
- debug(ap->logopt, MODPREFIX
|
|
|
306fa1 |
- "nfs options=\"%s\", nobind=%d, nosymlink=%d, ro=%d",
|
|
|
306fa1 |
- nfsoptions, nobind, nosymlink, ro);
|
|
|
306fa1 |
+ mountlog(ap->logopt, MODPREFIX
|
|
|
306fa1 |
+ "nfs options=\"%s\", nobind=%d, nosymlink=%d, ro=%d",
|
|
|
306fa1 |
+ nfsoptions, nobind, nosymlink, ro);
|
|
|
306fa1 |
}
|
|
|
306fa1 |
|
|
|
306fa1 |
if (!parse_location(ap->logopt, &hosts, what, flags)) {
|
|
|
306fa1 |
@@ -370,17 +374,18 @@ dont_probe:
|
|
|
306fa1 |
}
|
|
|
306fa1 |
|
|
|
306fa1 |
if (nfsoptions && *nfsoptions) {
|
|
|
306fa1 |
- debug(ap->logopt,
|
|
|
306fa1 |
- MODPREFIX "calling mount -t %s " SLOPPY
|
|
|
306fa1 |
- "-o %s %s %s", fstype, nfsoptions, loc, fullpath);
|
|
|
306fa1 |
+ mountlog(ap->logopt,
|
|
|
306fa1 |
+ MODPREFIX "calling mount -t %s " SLOPPY
|
|
|
306fa1 |
+ "-o %s %s %s", fstype, nfsoptions, loc,
|
|
|
306fa1 |
+ fullpath);
|
|
|
306fa1 |
|
|
|
306fa1 |
err = spawn_mount(ap->logopt,
|
|
|
306fa1 |
"-t", fstype, SLOPPYOPT "-o",
|
|
|
306fa1 |
nfsoptions, loc, fullpath, NULL);
|
|
|
306fa1 |
} else {
|
|
|
306fa1 |
- debug(ap->logopt,
|
|
|
306fa1 |
- MODPREFIX "calling mount -t %s %s %s",
|
|
|
306fa1 |
- fstype, loc, fullpath);
|
|
|
306fa1 |
+ mountlog(ap->logopt,
|
|
|
306fa1 |
+ MODPREFIX "calling mount -t %s %s %s",
|
|
|
306fa1 |
+ fstype, loc, fullpath);
|
|
|
306fa1 |
err = spawn_mount(ap->logopt,
|
|
|
306fa1 |
"-t", fstype, loc, fullpath, NULL);
|
|
|
306fa1 |
}
|