|
|
6bbd11 |
autofs-5.0.9 - amd lookup add nfsl and linkx fs types
|
|
|
6bbd11 |
|
|
|
6bbd11 |
From: Ian Kent <raven@themaw.net>
|
|
|
6bbd11 |
|
|
|
6bbd11 |
|
|
|
6bbd11 |
---
|
|
|
6bbd11 |
modules/amd_parse.y | 8 ++++++--
|
|
|
6bbd11 |
modules/parse_amd.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
6bbd11 |
2 files changed, 60 insertions(+), 2 deletions(-)
|
|
|
6bbd11 |
|
|
|
6bbd11 |
diff --git a/modules/amd_parse.y b/modules/amd_parse.y
|
|
|
6bbd11 |
index 77adbe5..1d4a0a3 100644
|
|
|
6bbd11 |
--- a/modules/amd_parse.y
|
|
|
6bbd11 |
+++ b/modules/amd_parse.y
|
|
|
6bbd11 |
@@ -246,9 +246,15 @@ option_assignment: MAP_OPTION OPTION_ASSIGN FS_TYPE
|
|
|
6bbd11 |
!strcmp($3, "nfs4")) {
|
|
|
6bbd11 |
entry.flags |= AMD_MOUNT_TYPE_NFS;
|
|
|
6bbd11 |
entry.type = amd_strdup($3);
|
|
|
6bbd11 |
+ } else if (!strcmp($3, "nfsl")) {
|
|
|
6bbd11 |
+ entry.flags |= AMD_MOUNT_TYPE_NFSL;
|
|
|
6bbd11 |
+ entry.type = amd_strdup($3);
|
|
|
6bbd11 |
} else if (!strcmp($3, "link")) {
|
|
|
6bbd11 |
entry.flags |= AMD_MOUNT_TYPE_LINK;
|
|
|
6bbd11 |
entry.type = amd_strdup($3);
|
|
|
6bbd11 |
+ } else if (!strcmp($3, "linkx")) {
|
|
|
6bbd11 |
+ entry.flags |= AMD_MOUNT_TYPE_LINKX;
|
|
|
6bbd11 |
+ entry.type = amd_strdup($3);
|
|
|
6bbd11 |
} else if (!strcmp($3, "host")) {
|
|
|
6bbd11 |
entry.flags |= AMD_MOUNT_TYPE_HOST;
|
|
|
6bbd11 |
entry.type = amd_strdup($3);
|
|
|
6bbd11 |
@@ -264,9 +270,7 @@ option_assignment: MAP_OPTION OPTION_ASSIGN FS_TYPE
|
|
|
6bbd11 |
entry.flags |= AMD_MOUNT_TYPE_EXT;
|
|
|
6bbd11 |
entry.type = amd_strdup($3);
|
|
|
6bbd11 |
} else if (!strcmp($3, "jfs") ||
|
|
|
6bbd11 |
- !strcmp($3, "linkx") ||
|
|
|
6bbd11 |
!strcmp($3, "nfsx") ||
|
|
|
6bbd11 |
- !strcmp($3, "nfsl") ||
|
|
|
6bbd11 |
!strcmp($3, "program") ||
|
|
|
6bbd11 |
!strcmp($3, "lustre") ||
|
|
|
6bbd11 |
!strcmp($3, "direct")) {
|
|
|
6bbd11 |
diff --git a/modules/parse_amd.c b/modules/parse_amd.c
|
|
|
6bbd11 |
index 4cebce8..7e04beb 100644
|
|
|
6bbd11 |
--- a/modules/parse_amd.c
|
|
|
6bbd11 |
+++ b/modules/parse_amd.c
|
|
|
6bbd11 |
@@ -955,6 +955,23 @@ out:
|
|
|
6bbd11 |
return ret;
|
|
|
6bbd11 |
}
|
|
|
6bbd11 |
|
|
|
6bbd11 |
+static int do_linkx_mount(struct autofs_point *ap, const char *name,
|
|
|
6bbd11 |
+ struct amd_entry *entry, unsigned int flags)
|
|
|
6bbd11 |
+{
|
|
|
6bbd11 |
+ struct stat st;
|
|
|
6bbd11 |
+ char *target;
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
+ if (entry->sublink)
|
|
|
6bbd11 |
+ target = entry->sublink;
|
|
|
6bbd11 |
+ else
|
|
|
6bbd11 |
+ target = entry->fs;
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
+ if (lstat(target, &st) < 0)
|
|
|
6bbd11 |
+ return errno;
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
+ return do_link_mount(ap, name, entry, flags);
|
|
|
6bbd11 |
+}
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
static int do_generic_mount(struct autofs_point *ap, const char *name,
|
|
|
6bbd11 |
struct amd_entry *entry, const char *target,
|
|
|
6bbd11 |
unsigned int flags)
|
|
|
6bbd11 |
@@ -1020,6 +1037,35 @@ out:
|
|
|
6bbd11 |
return ret;
|
|
|
6bbd11 |
}
|
|
|
6bbd11 |
|
|
|
6bbd11 |
+static int do_nfsl_mount(struct autofs_point *ap, const char *name,
|
|
|
6bbd11 |
+ struct amd_entry *entry, struct substvar *sv,
|
|
|
6bbd11 |
+ unsigned int flags)
|
|
|
6bbd11 |
+{
|
|
|
6bbd11 |
+ const struct substvar *host, *hostd;
|
|
|
6bbd11 |
+ struct stat st;
|
|
|
6bbd11 |
+ char *target;
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
+ host = macro_findvar(sv, "host", 4);
|
|
|
6bbd11 |
+ if (!host)
|
|
|
6bbd11 |
+ return do_nfs_mount(ap, name, entry, flags);
|
|
|
6bbd11 |
+ hostd = macro_findvar(sv, "hostd", 5);
|
|
|
6bbd11 |
+ if (!hostd || !*hostd->val)
|
|
|
6bbd11 |
+ return do_nfs_mount(ap, name, entry, flags);
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
+ if (entry->sublink)
|
|
|
6bbd11 |
+ target = entry->sublink;
|
|
|
6bbd11 |
+ else
|
|
|
6bbd11 |
+ target = entry->fs;
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
+ if (strcasecmp(host->val, entry->rhost) ||
|
|
|
6bbd11 |
+ strcasecmp(hostd->val, entry->rhost))
|
|
|
6bbd11 |
+ return do_nfs_mount(ap, name, entry, flags);
|
|
|
6bbd11 |
+ else if (lstat(target, &st) < 0)
|
|
|
6bbd11 |
+ return do_nfs_mount(ap, name, entry, flags);
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
+ return do_link_mount(ap, name, entry, flags);
|
|
|
6bbd11 |
+}
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
static int do_host_mount(struct autofs_point *ap, const char *name,
|
|
|
6bbd11 |
struct amd_entry *entry, struct map_source *source,
|
|
|
6bbd11 |
unsigned int flags)
|
|
|
6bbd11 |
@@ -1078,10 +1124,18 @@ static int amd_mount(struct autofs_point *ap, const char *name,
|
|
|
6bbd11 |
ret = do_nfs_mount(ap, name, entry, flags);
|
|
|
6bbd11 |
break;
|
|
|
6bbd11 |
|
|
|
6bbd11 |
+ case AMD_MOUNT_TYPE_NFSL:
|
|
|
6bbd11 |
+ ret = do_nfsl_mount(ap, name, entry, sv, flags);
|
|
|
6bbd11 |
+ break;
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
case AMD_MOUNT_TYPE_LINK:
|
|
|
6bbd11 |
ret = do_link_mount(ap, name, entry, flags);
|
|
|
6bbd11 |
break;
|
|
|
6bbd11 |
|
|
|
6bbd11 |
+ case AMD_MOUNT_TYPE_LINKX:
|
|
|
6bbd11 |
+ ret = do_linkx_mount(ap, name, entry, flags);
|
|
|
6bbd11 |
+ break;
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
case AMD_MOUNT_TYPE_HOST:
|
|
|
6bbd11 |
ret = do_host_mount(ap, name, entry, source, flags);
|
|
|
6bbd11 |
break;
|