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