summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2015-06-02 13:47:22 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2015-06-02 13:47:22 +0000
commiteb26522096be83ce617da1bc89b7c1a3f16acdc0 (patch)
treef0c0d3836bda07413145c231a895eb531fbefab9
parent0fcbeb8400124082088bad5618068d7891902a05 (diff)
downloadillumos-joyent-eb26522096be83ce617da1bc89b7c1a3f16acdc0.tar.gz
OS-4360 cleanup lx_afs as a prelude for v5 work
-rw-r--r--manifest2
-rw-r--r--usr/src/lib/brand/lx/lx_brand/common/mount.c2
-rw-r--r--usr/src/lib/brand/lx/lx_brand/common/statfs.c3
-rw-r--r--usr/src/lib/brand/lx/lx_brand/sys/lx_statfs.h3
-rw-r--r--usr/src/uts/common/brand/lx/autofs/lx_autofs.c217
-rw-r--r--usr/src/uts/common/brand/lx/procfs/lx_prvnops.c19
-rw-r--r--usr/src/uts/common/brand/lx/sys/lx_autofs.h27
-rw-r--r--usr/src/uts/common/brand/lx/syscall/lx_ioctl.c9
-rw-r--r--usr/src/uts/intel/Makefile.intel2
-rw-r--r--usr/src/uts/intel/lxautofs/Makefile (renamed from usr/src/uts/intel/lx_afs/Makefile)9
-rw-r--r--usr/src/uts/intel/lxautofs/Makefile.rules (renamed from usr/src/uts/intel/lx_afs/Makefile.rules)2
11 files changed, 167 insertions, 128 deletions
diff --git a/manifest b/manifest
index 5af61d9b1f..fd04ed0ebf 100644
--- a/manifest
+++ b/manifest
@@ -4560,7 +4560,7 @@ f usr/kernel/drv/timerfd.conf 0644 root sys
d usr/kernel/fs 0755 root sys
d usr/kernel/fs/amd64 0755 root sys
f usr/kernel/fs/amd64/fdfs 0755 root sys
-f usr/kernel/fs/amd64/lx_afs 0755 root sys
+f usr/kernel/fs/amd64/lxautofs 0755 root sys
f usr/kernel/fs/amd64/lx_cgroup 0755 root sys
f usr/kernel/fs/amd64/lx_proc 0755 root sys
f usr/kernel/fs/amd64/lx_sysfs 0755 root sys
diff --git a/usr/src/lib/brand/lx/lx_brand/common/mount.c b/usr/src/lib/brand/lx/lx_brand/common/mount.c
index 58139b46ba..8a7cba4794 100644
--- a/usr/src/lib/brand/lx/lx_brand/common/mount.c
+++ b/usr/src/lib/brand/lx/lx_brand/common/mount.c
@@ -757,7 +757,7 @@ lx_mount(uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4,
} else if (strcmp(fstype, "autofs") == 0) {
- /* Translate autofs mount requests to lx_afs requests. */
+ /* Translate autofs mount requests to lxautofs requests. */
(void) strcpy(fstype, LX_AUTOFS_NAME);
/* Copy in Linux mount options. */
diff --git a/usr/src/lib/brand/lx/lx_brand/common/statfs.c b/usr/src/lib/brand/lx/lx_brand/common/statfs.c
index b3ec94bdc8..942aaf9882 100644
--- a/usr/src/lib/brand/lx/lx_brand/common/statfs.c
+++ b/usr/src/lib/brand/lx/lx_brand/common/statfs.c
@@ -21,7 +21,7 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- * Copyright 2014 Joyent, Inc. All rights reserved.
+ * Copyright 2015 Joyent, Inc. All rights reserved.
*/
#include <assert.h>
@@ -104,6 +104,7 @@ static struct lx_ftype_name {
{ "ufs", LX_UFS_MAGIC, "LX_UFS_MAGIC" },
{ "lofs", LX_EXT2_SUPER_MAGIC, "LX_EXT2_SUPER_MAGIC" },
{ "zfs", LX_EXT2_SUPER_MAGIC, "LX_EXT2_SUPER_MAGIC" },
+ { "lxautofs", LX_AUTOFS_SUPER_MAGIC, "LX_AUTOFS_SUPER_MAGIC" },
{ NULL, 0, NULL }
};
diff --git a/usr/src/lib/brand/lx/lx_brand/sys/lx_statfs.h b/usr/src/lib/brand/lx/lx_brand/sys/lx_statfs.h
index 72c4c9ebcf..dd046398c4 100644
--- a/usr/src/lib/brand/lx/lx_brand/sys/lx_statfs.h
+++ b/usr/src/lib/brand/lx/lx_brand/sys/lx_statfs.h
@@ -21,7 +21,7 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- * Copyright 2014 Joyent, Inc. All rights reserved.
+ * Copyright 2015 Joyent, Inc. All rights reserved.
*/
#ifndef _LX_STATFS_H
@@ -64,6 +64,7 @@ struct lx_statfs64 {
/*
* These magic values are taken mostly from statfs(2) or magic.h
*/
+#define LX_AUTOFS_SUPER_MAGIC 0x0187
#define LX_DEVFS_SUPER_MAGIC 0x1373
#define LX_DEVPTS_SUPER_MAGIC 0x1cd1
#define LX_EXT2_SUPER_MAGIC 0xEF53
diff --git a/usr/src/uts/common/brand/lx/autofs/lx_autofs.c b/usr/src/uts/common/brand/lx/autofs/lx_autofs.c
index d2bb03c118..58b0d9c13f 100644
--- a/usr/src/uts/common/brand/lx/autofs/lx_autofs.c
+++ b/usr/src/uts/common/brand/lx/autofs/lx_autofs.c
@@ -22,9 +22,12 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2015 Joyent, Inc.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * See the big theory statement in ../sys/lx_autofs.h
+ */
#include <fs/fs_subr.h>
#include <sys/atomic.h>
@@ -61,13 +64,13 @@ static minor_t lx_autofs_minor = 0;
* Support functions
*/
static void
-i_strfree(char *str)
+lx_autofs_strfree(char *str)
{
kmem_free(str, strlen(str) + 1);
}
static char *
-i_strdup(char *str)
+lx_autofs_strdup(char *str)
{
int n = strlen(str);
char *ptr = kmem_alloc(n + 1, KM_SLEEP);
@@ -76,7 +79,7 @@ i_strdup(char *str)
}
static int
-i_str_to_int(char *str, int *val)
+lx_autofs_str_to_int(char *str, int *val)
{
long res;
@@ -92,21 +95,21 @@ i_str_to_int(char *str, int *val)
}
static void
-i_stack_init(list_t *lp)
+ls_autofs_stack_init(list_t *lp)
{
list_create(lp,
sizeof (stack_elem_t), offsetof(stack_elem_t, se_list));
}
static void
-i_stack_fini(list_t *lp)
+lx_autofs_stack_fini(list_t *lp)
{
ASSERT(list_head(lp) == NULL);
list_destroy(lp);
}
static void
-i_stack_push(list_t *lp, caddr_t ptr1, caddr_t ptr2, caddr_t ptr3)
+lx_autofs_stack_push(list_t *lp, caddr_t ptr1, caddr_t ptr2, caddr_t ptr3)
{
stack_elem_t *se;
@@ -118,7 +121,7 @@ i_stack_push(list_t *lp, caddr_t ptr1, caddr_t ptr2, caddr_t ptr3)
}
static int
-i_stack_pop(list_t *lp, caddr_t *ptr1, caddr_t *ptr2, caddr_t *ptr3)
+lx_autofs_stack_pop(list_t *lp, caddr_t *ptr1, caddr_t *ptr2, caddr_t *ptr3)
{
stack_elem_t *se;
@@ -136,7 +139,7 @@ i_stack_pop(list_t *lp, caddr_t *ptr1, caddr_t *ptr2, caddr_t *ptr3)
}
static vnode_t *
-fifo_peer_vp(vnode_t *vp)
+lx_autofs_fifo_peer_vp(vnode_t *vp)
{
fifonode_t *fnp = VTOF(vp);
fifonode_t *fn_dest = fnp->fn_dest;
@@ -144,7 +147,7 @@ fifo_peer_vp(vnode_t *vp)
}
static vnode_t *
-i_vn_alloc(vfs_t *vfsp, vnode_t *uvp)
+lx_autofs_vn_alloc(vfs_t *vfsp, vnode_t *uvp)
{
lx_autofs_vfs_t *data = vfsp->vfs_data;
vnode_t *vp, *vp_old;
@@ -195,7 +198,7 @@ i_vn_alloc(vfs_t *vfsp, vnode_t *uvp)
}
static void
-i_vn_free(vnode_t *vp)
+lx_autofs_vn_free(vnode_t *vp)
{
vfs_t *vfsp = vp->v_vfsp;
lx_autofs_vfs_t *data = vfsp->vfs_data;
@@ -226,7 +229,7 @@ i_vn_free(vnode_t *vp)
}
static lx_autofs_lookup_req_t *
-i_lalr_alloc(lx_autofs_vfs_t *data, int *dup_request, char *nm)
+lx_autofs_lalr_alloc(lx_autofs_vfs_t *data, int *dup_request, char *nm)
{
lx_autofs_lookup_req_t *lalr, *lalr_dup;
@@ -279,7 +282,7 @@ i_lalr_alloc(lx_autofs_vfs_t *data, int *dup_request, char *nm)
(mod_hash_key_t)(uintptr_t)lalr->lalr_pkt.lap_id,
(mod_hash_val_t)lalr) == 0);
VERIFY(mod_hash_insert(data->lav_path_hash,
- (mod_hash_key_t)i_strdup(nm),
+ (mod_hash_key_t)lx_autofs_strdup(nm),
(mod_hash_val_t)lalr) == 0);
*dup_request = 0;
@@ -290,7 +293,7 @@ i_lalr_alloc(lx_autofs_vfs_t *data, int *dup_request, char *nm)
}
static lx_autofs_lookup_req_t *
-i_lalr_find(lx_autofs_vfs_t *data, int id)
+lx_autofs_lalr_find(lx_autofs_vfs_t *data, int id)
{
lx_autofs_lookup_req_t *lalr;
@@ -307,18 +310,18 @@ i_lalr_find(lx_autofs_vfs_t *data, int id)
}
static void
-i_lalr_complete(lx_autofs_vfs_t *data, lx_autofs_lookup_req_t *lalr)
+lx_autofs_lalr_complete(lx_autofs_vfs_t *data, lx_autofs_lookup_req_t *lalr)
{
lx_autofs_lookup_req_t *lalr_tmp;
/* Remove this request from the hashes so no one can look it up. */
mutex_enter(&data->lav_lock);
(void) mod_hash_remove(data->lav_id_hash,
- (mod_hash_key_t)(uintptr_t)lalr->lalr_pkt.lap_id,
- (mod_hash_val_t)&lalr_tmp);
+ (mod_hash_key_t)(uintptr_t)lalr->lalr_pkt.lap_id,
+ (mod_hash_val_t)&lalr_tmp);
(void) mod_hash_remove(data->lav_path_hash,
- (mod_hash_key_t)lalr->lalr_pkt.lap_name,
- (mod_hash_val_t)&lalr_tmp);
+ (mod_hash_key_t)lalr->lalr_pkt.lap_name,
+ (mod_hash_val_t)&lalr_tmp);
mutex_exit(&data->lav_lock);
/* Mark this requst as complete and wakeup anyone waiting on it. */
@@ -329,7 +332,7 @@ i_lalr_complete(lx_autofs_vfs_t *data, lx_autofs_lookup_req_t *lalr)
}
static void
-i_lalr_release(lx_autofs_vfs_t *data, lx_autofs_lookup_req_t *lalr)
+lx_autofs_lalr_release(lx_autofs_vfs_t *data, lx_autofs_lookup_req_t *lalr)
{
ASSERT(!MUTEX_HELD(&lalr->lalr_lock));
if (atomic_add_int_nv(&lalr->lalr_ref, -1) > 0)
@@ -340,7 +343,7 @@ i_lalr_release(lx_autofs_vfs_t *data, lx_autofs_lookup_req_t *lalr)
}
static void
-i_lalr_abort(lx_autofs_vfs_t *data, lx_autofs_lookup_req_t *lalr)
+lx_autofs_lalr_abort(lx_autofs_vfs_t *data, lx_autofs_lookup_req_t *lalr)
{
lx_autofs_lookup_req_t *lalr_tmp;
@@ -359,11 +362,11 @@ i_lalr_abort(lx_autofs_vfs_t *data, lx_autofs_lookup_req_t *lalr)
/* Remove this request from the hashes so no one can look it up. */
(void) mod_hash_remove(data->lav_id_hash,
- (mod_hash_key_t)(uintptr_t)lalr->lalr_pkt.lap_id,
- (mod_hash_val_t)&lalr_tmp);
+ (mod_hash_key_t)(uintptr_t)lalr->lalr_pkt.lap_id,
+ (mod_hash_val_t)&lalr_tmp);
(void) mod_hash_remove(data->lav_path_hash,
- (mod_hash_key_t)lalr->lalr_pkt.lap_name,
- (mod_hash_val_t)&lalr_tmp);
+ (mod_hash_key_t)lalr->lalr_pkt.lap_name,
+ (mod_hash_val_t)&lalr_tmp);
mutex_exit(&data->lav_lock);
/* It's ok to free this now because the ref count was zero. */
@@ -372,7 +375,7 @@ i_lalr_abort(lx_autofs_vfs_t *data, lx_autofs_lookup_req_t *lalr)
}
static int
-i_fifo_lookup(pid_t pgrp, int fd, file_t **fpp_wr, file_t **fpp_rd)
+lx_autofs_fifo_lookup(pid_t pgrp, int fd, file_t **fpp_wr, file_t **fpp_rd)
{
proc_t *prp;
uf_info_t *fip;
@@ -424,7 +427,7 @@ i_fifo_lookup(pid_t pgrp, int fd, file_t **fpp_wr, file_t **fpp_rd)
* explained below.) We assume that the read end of the fifo
* is in the same process as the write end.
*/
- vp_rd = fifo_peer_vp(fp_wr->f_vnode);
+ vp_rd = lx_autofs_fifo_peer_vp(fp_wr->f_vnode);
for (i = 0; i < fip->fi_nfiles; i++) {
UF_ENTER(ufp_rd, fip, i);
if (((fp_rd = ufp_rd->uf_file) != NULL) &&
@@ -483,7 +486,7 @@ i_fifo_lookup(pid_t pgrp, int fd, file_t **fpp_wr, file_t **fpp_rd)
static uint_t
/*ARGSUSED*/
-i_fifo_close_cb(mod_hash_key_t key, mod_hash_val_t *val, void *arg)
+lx_autofs_fifo_close_cb(mod_hash_key_t key, mod_hash_val_t *val, void *arg)
{
int *id = (int *)arg;
/* Return the key and terminate the walk. */
@@ -492,7 +495,7 @@ i_fifo_close_cb(mod_hash_key_t key, mod_hash_val_t *val, void *arg)
}
static void
-i_fifo_close(lx_autofs_vfs_t *data)
+lx_autofs_fifo_close(lx_autofs_vfs_t *data)
{
/*
* Close the fifo to prevent any future requests from
@@ -521,24 +524,24 @@ i_fifo_close(lx_autofs_vfs_t *data)
/* Lookup the first entry in the hash. */
id = -1;
mod_hash_walk(data->lav_id_hash,
- i_fifo_close_cb, &id);
+ lx_autofs_fifo_close_cb, &id);
if (id == -1) {
/* No more id's in the hash. */
break;
}
- if ((lalr = i_lalr_find(data, id)) == NULL) {
+ if ((lalr = lx_autofs_lalr_find(data, id)) == NULL) {
/* Someone else beat us to it. */
continue;
}
/* Mark the request as compleate and release it. */
- i_lalr_complete(data, lalr);
- i_lalr_release(data, lalr);
+ lx_autofs_lalr_complete(data, lalr);
+ lx_autofs_lalr_release(data, lalr);
}
}
static int
-i_fifo_verify_rd(lx_autofs_vfs_t *data)
+lx_autofs_fifo_verify_rd(lx_autofs_vfs_t *data)
{
proc_t *prp;
uf_info_t *fip;
@@ -554,7 +557,7 @@ i_fifo_verify_rd(lx_autofs_vfs_t *data)
ASSERT(data->lav_fifo_rd == NULL);
return (-1);
}
- vp_rd = fifo_peer_vp(data->lav_fifo_wr->f_vnode);
+ vp_rd = lx_autofs_fifo_peer_vp(data->lav_fifo_wr->f_vnode);
/*
* sprlock() is zone aware, so assuming this mount call was
@@ -607,7 +610,7 @@ i_fifo_verify_rd(lx_autofs_vfs_t *data)
}
static int
-i_fifo_write(lx_autofs_vfs_t *data, lx_autofs_pkt_t *lap)
+lx_autofs_fifo_write(lx_autofs_vfs_t *data, lx_autofs_pkt_t *lap)
{
struct uio uio;
struct iovec iov;
@@ -661,13 +664,13 @@ i_fifo_write(lx_autofs_vfs_t *data, lx_autofs_pkt_t *lap)
* these files open.
*/
mutex_enter(&data->lav_lock);
- if (i_fifo_verify_rd(data) != 0) {
+ if (lx_autofs_fifo_verify_rd(data) != 0) {
/*
* Something happened to the automounter.
* Close down the communication pipe we setup.
*/
mutex_exit(&data->lav_lock);
- i_fifo_close(data);
+ lx_autofs_fifo_close(data);
if (error != 0)
return (error);
return (ENOENT);
@@ -678,7 +681,7 @@ i_fifo_write(lx_autofs_vfs_t *data, lx_autofs_pkt_t *lap)
}
static int
-i_bs_readdir(vnode_t *dvp, list_t *dir_stack, list_t *file_stack)
+lx_autofs_bs_readdir(vnode_t *dvp, list_t *dir_stack, list_t *file_stack)
{
struct iovec iov;
struct uio uio;
@@ -720,7 +723,7 @@ i_bs_readdir(vnode_t *dvp, list_t *dir_stack, list_t *file_stack)
}
for (dp = dbuf; ((intptr_t)dp < (intptr_t)dbuf + dbuflen);
- dp = (dirent64_t *)((intptr_t)dp + dp->d_reclen)) {
+ dp = (dirent64_t *)((intptr_t)dp + dp->d_reclen)) {
nm = dp->d_name;
@@ -734,15 +737,17 @@ i_bs_readdir(vnode_t *dvp, list_t *dir_stack, list_t *file_stack)
}
if (vp->v_type == VDIR) {
if (dir_stack != NULL) {
- i_stack_push(dir_stack, (caddr_t)dvp,
- (caddr_t)vp, i_strdup(nm));
+ lx_autofs_stack_push(dir_stack,
+ (caddr_t)dvp,
+ (caddr_t)vp, lx_autofs_strdup(nm));
} else {
VN_RELE(vp);
}
} else {
if (file_stack != NULL) {
- i_stack_push(file_stack, (caddr_t)dvp,
- (caddr_t)vp, i_strdup(nm));
+ lx_autofs_stack_push(file_stack,
+ (caddr_t)dvp,
+ (caddr_t)vp, lx_autofs_strdup(nm));
} else {
VN_RELE(vp);
}
@@ -754,7 +759,7 @@ i_bs_readdir(vnode_t *dvp, list_t *dir_stack, list_t *file_stack)
}
static void
-i_bs_destroy(vnode_t *dvp, char *path)
+lx_autofs_bs_destroy(vnode_t *dvp, char *path)
{
list_t search_stack;
list_t dir_stack;
@@ -782,47 +787,49 @@ i_bs_destroy(vnode_t *dvp, char *path)
* It would have been much easier to do this recursively but kernel
* stacks are notoriously small.
*/
- i_stack_init(&search_stack);
- i_stack_init(&dir_stack);
- i_stack_init(&file_stack);
+ ls_autofs_stack_init(&search_stack);
+ ls_autofs_stack_init(&dir_stack);
+ ls_autofs_stack_init(&file_stack);
/* Save our newfound subdirectory into a list. */
- i_stack_push(&search_stack, (caddr_t)dvp, (caddr_t)vp, i_strdup(path));
+ lx_autofs_stack_push(&search_stack, (caddr_t)dvp, (caddr_t)vp,
+ lx_autofs_strdup(path));
/* Do a recursive depth first search into the subdirectories. */
- while (i_stack_pop(&search_stack,
+ while (lx_autofs_stack_pop(&search_stack,
(caddr_t *)&pdvp, (caddr_t *)&dvp, &dpath) == 0) {
/* Get a list of the subdirectories in this directory. */
- if (i_bs_readdir(dvp, &search_stack, NULL) != 0)
+ if (lx_autofs_bs_readdir(dvp, &search_stack, NULL) != 0)
goto exit;
/* Save the current directory a separate stack. */
- i_stack_push(&dir_stack, (caddr_t)pdvp, (caddr_t)dvp, dpath);
+ lx_autofs_stack_push(&dir_stack, (caddr_t)pdvp, (caddr_t)dvp,
+ dpath);
}
/*
* Now dir_stack contains a list of directories, the deepest paths
* are at the top of the list. So let's go through and process them.
*/
- while (i_stack_pop(&dir_stack,
+ while (lx_autofs_stack_pop(&dir_stack,
(caddr_t *)&pdvp, (caddr_t *)&dvp, &dpath) == 0) {
/* Get a list of the files in this directory. */
- if (i_bs_readdir(dvp, NULL, &file_stack) != 0) {
+ if (lx_autofs_bs_readdir(dvp, NULL, &file_stack) != 0) {
VN_RELE(dvp);
- i_strfree(dpath);
+ lx_autofs_strfree(dpath);
goto exit;
}
/* Delete all the files in this directory. */
- while (i_stack_pop(&file_stack,
+ while (lx_autofs_stack_pop(&file_stack,
NULL, (caddr_t *)&vp, &fpath) == 0) {
VN_RELE(vp)
ret = VOP_REMOVE(dvp, fpath, kcred, NULL, 0);
- i_strfree(fpath);
+ lx_autofs_strfree(fpath);
if (ret != 0) {
- i_strfree(dpath);
+ lx_autofs_strfree(dpath);
goto exit;
}
}
@@ -830,26 +837,29 @@ i_bs_destroy(vnode_t *dvp, char *path)
/* Delete this directory. */
VN_RELE(dvp);
ret = VOP_RMDIR(pdvp, dpath, pdvp, kcred, NULL, 0);
- i_strfree(dpath);
+ lx_autofs_strfree(dpath);
if (ret != 0)
goto exit;
}
exit:
while (
- (i_stack_pop(&search_stack, NULL, (caddr_t *)&vp, &path) == 0) ||
- (i_stack_pop(&dir_stack, NULL, (caddr_t *)&vp, &path) == 0) ||
- (i_stack_pop(&file_stack, NULL, (caddr_t *)&vp, &path) == 0)) {
+ (lx_autofs_stack_pop(&search_stack, NULL, (caddr_t *)&vp,
+ &path) == 0) ||
+ (lx_autofs_stack_pop(&dir_stack, NULL, (caddr_t *)&vp,
+ &path) == 0) ||
+ (lx_autofs_stack_pop(&file_stack, NULL, (caddr_t *)&vp,
+ &path) == 0)) {
VN_RELE(vp);
- i_strfree(path);
+ lx_autofs_strfree(path);
}
- i_stack_fini(&search_stack);
- i_stack_fini(&dir_stack);
- i_stack_fini(&file_stack);
+ lx_autofs_stack_fini(&search_stack);
+ lx_autofs_stack_fini(&dir_stack);
+ lx_autofs_stack_fini(&file_stack);
}
static vnode_t *
-i_bs_create(vnode_t *dvp, char *bs_name)
+lx_autofs_bs_create(vnode_t *dvp, char *bs_name)
{
vnode_t *vp;
vattr_t vattr;
@@ -869,7 +879,7 @@ i_bs_create(vnode_t *dvp, char *bs_name)
}
static int
-i_automounter_call(vnode_t *dvp, char *nm)
+lx_autofs_automounter_call(vnode_t *dvp, char *nm)
{
lx_autofs_lookup_req_t *lalr;
lx_autofs_vfs_t *data;
@@ -906,7 +916,7 @@ i_automounter_call(vnode_t *dvp, char *nm)
mutex_exit(&data->lav_lock);
/* Allocate an automounter request structure. */
- if ((lalr = i_lalr_alloc(data, &dup_request, nm)) == NULL)
+ if ((lalr = lx_autofs_lalr_alloc(data, &dup_request, nm)) == NULL)
return (ENOENT);
/*
@@ -914,14 +924,14 @@ i_automounter_call(vnode_t *dvp, char *nm)
* need to send it to the automounter.
*/
if ((!dup_request) &&
- ((error = i_fifo_write(data, &lalr->lalr_pkt)) != 0)) {
+ ((error = lx_autofs_fifo_write(data, &lalr->lalr_pkt)) != 0)) {
/*
* Unable to send the request to the automounter.
* Unblock any other threads waiting on the request
* and release the request.
*/
- i_lalr_complete(data, lalr);
- i_lalr_release(data, lalr);
+ lx_autofs_lalr_complete(data, lalr);
+ lx_autofs_lalr_release(data, lalr);
return (error);
}
@@ -931,18 +941,18 @@ i_automounter_call(vnode_t *dvp, char *nm)
if (cv_wait_sig(&lalr->lalr_cv, &lalr->lalr_lock) == 0) {
/* We got a signal, abort this lookup. */
mutex_exit(&lalr->lalr_lock);
- i_lalr_abort(data, lalr);
+ lx_autofs_lalr_abort(data, lalr);
return (EINTR);
}
}
mutex_exit(&lalr->lalr_lock);
- i_lalr_release(data, lalr);
+ lx_autofs_lalr_release(data, lalr);
return (0);
}
static int
-i_automounter_ioctl(vnode_t *vp, int cmd, intptr_t arg)
+lx_autofs_automounter_ioctl(vnode_t *vp, int cmd, intptr_t arg)
{
lx_autofs_vfs_t *data = (lx_autofs_vfs_t *)vp->v_vfsp->vfs_data;
@@ -965,24 +975,24 @@ i_automounter_ioctl(vnode_t *vp, int cmd, intptr_t arg)
* We don't actually care if the request failed or succeeded.
* We do the same thing either way.
*/
- if ((lalr = i_lalr_find(data, id)) == NULL)
+ if ((lalr = lx_autofs_lalr_find(data, id)) == NULL)
return (ENXIO);
/* Mark the request as compleate and release it. */
- i_lalr_complete(data, lalr);
- i_lalr_release(data, lalr);
+ lx_autofs_lalr_complete(data, lalr);
+ lx_autofs_lalr_release(data, lalr);
return (0);
}
if (cmd == LX_AUTOFS_IOC_CATATONIC) {
/* The automounter is shutting down. */
- i_fifo_close(data);
+ lx_autofs_fifo_close(data);
return (0);
}
return (ENOTSUP);
}
static int
-i_parse_mntopt(vfs_t *vfsp, lx_autofs_vfs_t *data)
+lx_autofs_parse_mntopt(vfs_t *vfsp, lx_autofs_vfs_t *data)
{
char *fd_str, *pgrp_str, *minproto_str, *maxproto_str;
int fd, pgrp, minproto, maxproto;
@@ -996,25 +1006,25 @@ i_parse_mntopt(vfs_t *vfsp, lx_autofs_vfs_t *data)
return (EINVAL);
/* Get the values for each parameter. */
- if ((i_str_to_int(fd_str, &fd) != 0) ||
- (i_str_to_int(pgrp_str, &pgrp) != 0) ||
- (i_str_to_int(minproto_str, &minproto) != 0) ||
- (i_str_to_int(maxproto_str, &maxproto) != 0))
+ if ((lx_autofs_str_to_int(fd_str, &fd) != 0) ||
+ (lx_autofs_str_to_int(pgrp_str, &pgrp) != 0) ||
+ (lx_autofs_str_to_int(minproto_str, &minproto) != 0) ||
+ (lx_autofs_str_to_int(maxproto_str, &maxproto) != 0))
return (EINVAL);
/*
- * We support v2 of the linux kernel automounter protocol.
- * Make sure the mount request we got indicates support
- * for this version of the protocol.
+ * We essentially only support v2 of the linux kernel automounter
+ * protocol, but v3 is just a slight superset which we'll accept here.
+ * We'll reject unsupported ioctls later if we get one.
*/
- if ((minproto > 2) || (maxproto < 2))
+ if ((minproto > 3) || (maxproto < 2))
return (EINVAL);
/*
* Now we need to lookup the fifos we'll be using
* to talk to the userland automounter process.
*/
- if (i_fifo_lookup(pgrp, fd, &fp_wr, &fp_rd) != 0)
+ if (lx_autofs_fifo_lookup(pgrp, fd, &fp_wr, &fp_rd) != 0)
return (EINVAL);
/* Save the mount options and fifo pointers. */
@@ -1046,7 +1056,7 @@ lx_autofs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr)
(mvp->v_count > 1 || (mvp->v_flag & VROOT)))
return (EBUSY);
- /* We don't support mountes in the global zone. */
+ /* We don't support mounts in the global zone. */
if (getzoneid() == GLOBAL_ZONEID)
return (EPERM);
@@ -1058,14 +1068,15 @@ lx_autofs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr)
data = kmem_zalloc(sizeof (lx_autofs_vfs_t), KM_SLEEP);
/* Parse mount options. */
- if ((error = i_parse_mntopt(vfsp, data)) != 0) {
+ if ((error = lx_autofs_parse_mntopt(vfsp, data)) != 0) {
kmem_free(data, sizeof (lx_autofs_vfs_t));
return (error);
}
/* Initialize the backing store. */
- i_bs_destroy(mvp, LX_AUTOFS_BS_DIR);
- if ((data->lav_bs_vp = i_bs_create(mvp, LX_AUTOFS_BS_DIR)) == NULL) {
+ lx_autofs_bs_destroy(mvp, LX_AUTOFS_BS_DIR);
+ data->lav_bs_vp = lx_autofs_bs_create(mvp, LX_AUTOFS_BS_DIR);
+ if (data->lav_bs_vp == NULL) {
kmem_free(data, sizeof (lx_autofs_vfs_t));
return (EBUSY);
}
@@ -1112,7 +1123,7 @@ lx_autofs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr)
sizeof (vnode_t));
/* Create root vnode */
- data->lav_root = i_vn_alloc(vfsp, data->lav_bs_vp);
+ data->lav_root = lx_autofs_vn_alloc(vfsp, data->lav_bs_vp);
data->lav_root->v_flag |=
VROOT | VNOCACHE | VNOMAP | VNOSWAP | VNOMOUNT;
@@ -1161,7 +1172,7 @@ lx_autofs_unmount(vfs_t *vfsp, int flag, struct cred *cr)
VN_RELE(data->lav_root);
/* Cleanup the backing store. */
- i_bs_destroy(data->lav_mvp, data->lav_bs_name);
+ lx_autofs_bs_destroy(data->lav_mvp, data->lav_bs_name);
VN_RELE(data->lav_mvp);
/* Cleanup out remaining data structures. */
@@ -1303,7 +1314,7 @@ lx_autofs_open(vnode_t **vpp, int flag, cred_t *cr, caller_context_t *ctp)
return (0);
/* Deal with clone opens by returning a new vnode. */
- *vpp = i_vn_alloc(ovp->v_vfsp, uvp);
+ *vpp = lx_autofs_vn_alloc(ovp->v_vfsp, uvp);
VN_RELE(ovp);
return (0);
}
@@ -1339,7 +1350,7 @@ lx_autofs_mkdir(vnode_t *dvp, char *nm, struct vattr *vap, vnode_t **vpp,
vap->va_fsid = dvp->v_vfsp->vfs_dev;
/* Allocate a new vnode. */
- *vpp = i_vn_alloc(dvp->v_vfsp, uvp);
+ *vpp = lx_autofs_vn_alloc(dvp->v_vfsp, uvp);
return (0);
}
@@ -1376,7 +1387,7 @@ lx_autofs_inactive(struct vnode *vp, struct cred *cr, caller_context_t *ctp)
* No one should have been blocked on this lock because we're
* about to free this vnode.
*/
- i_vn_free(vp);
+ lx_autofs_vn_free(vp);
}
static int
@@ -1391,7 +1402,7 @@ lx_autofs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp,
/* First try to lookup if this path component already exitst. */
if ((error = VOP_LOOKUP(udvp, nm, &uvp, pnp, flags, rdir, cr, ctp,
direntflags, realpnp)) == 0) {
- *vpp = i_vn_alloc(dvp->v_vfsp, uvp);
+ *vpp = lx_autofs_vn_alloc(dvp->v_vfsp, uvp);
return (0);
}
@@ -1400,13 +1411,13 @@ lx_autofs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp,
return (error);
/* Refer the lookup to the automounter. */
- if ((error = i_automounter_call(dvp, nm)) != 0)
+ if ((error = lx_autofs_automounter_call(dvp, nm)) != 0)
return (error);
/* Retry the lookup operation. */
if ((error = VOP_LOOKUP(udvp, nm, &uvp, pnp, flags, rdir, cr, ctp,
direntflags, realpnp)) == 0) {
- *vpp = i_vn_alloc(dvp->v_vfsp, uvp);
+ *vpp = lx_autofs_vn_alloc(dvp->v_vfsp, uvp);
return (0);
}
return (error);
@@ -1427,7 +1438,7 @@ lx_autofs_ioctl(vnode_t *vp, int cmd, intptr_t arg, int mode, cred_t *cr,
case LX_AUTOFS_IOC_EXPIRE:
case LX_AUTOFS_IOC_PROTOVER:
case LX_AUTOFS_IOC_SETTIMEOUT:
- return (i_automounter_ioctl(vp, cmd, arg));
+ return (lx_autofs_automounter_ioctl(vp, cmd, arg));
}
/* Pass any remaining ioctl on. */
@@ -1519,7 +1530,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
LX_AUTOFS_NAME,
lx_autofs_init,
- VSW_HASPROTO | VSW_VOLATILEDEV,
+ VSW_HASPROTO | VSW_VOLATILEDEV | VSW_ZMOUNT,
&lx_autofs_mntopts
};
diff --git a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
index ae51516293..69d21d114e 100644
--- a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
+++ b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
@@ -140,6 +140,7 @@ static void lxpr_read_cpuinfo(lxpr_node_t *, lxpr_uiobuf_t *);
static void lxpr_read_diskstats(lxpr_node_t *, lxpr_uiobuf_t *);
static void lxpr_read_isdir(lxpr_node_t *, lxpr_uiobuf_t *);
static void lxpr_read_fd(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_filesystems(lxpr_node_t *, lxpr_uiobuf_t *);
static void lxpr_read_kmsg(lxpr_node_t *, lxpr_uiobuf_t *, ldi_handle_t);
static void lxpr_read_loadavg(lxpr_node_t *, lxpr_uiobuf_t *);
static void lxpr_read_meminfo(lxpr_node_t *, lxpr_uiobuf_t *);
@@ -540,7 +541,7 @@ static void (*lxpr_read_function[LXPR_NFILES])() = {
lxpr_read_empty, /* /proc/devices */
lxpr_read_diskstats, /* /proc/diskstats */
lxpr_read_empty, /* /proc/dma */
- lxpr_read_empty, /* /proc/filesystems */
+ lxpr_read_filesystems, /* /proc/filesystems */
lxpr_read_empty, /* /proc/interrupts */
lxpr_read_empty, /* /proc/ioports */
lxpr_read_empty, /* /proc/kcore */
@@ -3871,6 +3872,22 @@ lxpr_read_fd(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
}
/*
+ * Report a list of file systems loaded in the kernel. We only report the ones
+ * which we support and which may be checked by various components to see if
+ * they are loaded.
+ */
+static void
+lxpr_read_filesystems(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ lxpr_uiobuf_printf(uiobuf, "%s\t%s\n", "nodev", "autofs");
+ lxpr_uiobuf_printf(uiobuf, "%s\t%s\n", "nodev", "cgroup");
+ lxpr_uiobuf_printf(uiobuf, "%s\t%s\n", "nodev", "nfs");
+ lxpr_uiobuf_printf(uiobuf, "%s\t%s\n", "nodev", "proc");
+ lxpr_uiobuf_printf(uiobuf, "%s\t%s\n", "nodev", "sysfs");
+ lxpr_uiobuf_printf(uiobuf, "%s\t%s\n", "nodev", "tmpfs");
+}
+
+/*
* lxpr_getattr(): Vnode operation for VOP_GETATTR()
*/
static int
diff --git a/usr/src/uts/common/brand/lx/sys/lx_autofs.h b/usr/src/uts/common/brand/lx/sys/lx_autofs.h
index a6ad86f594..bc91a36691 100644
--- a/usr/src/uts/common/brand/lx/sys/lx_autofs.h
+++ b/usr/src/uts/common/brand/lx/sys/lx_autofs.h
@@ -46,7 +46,7 @@
* kernel to the "amd" process via rpc. "amd" then looks up any information
* required to resolve the requests, mounts real NFS filesystems if
* necessary, and returns. "amd" has it's own strange configuration
- * mechanism that doesn't seem to be very compatabile with Solaris's network
+ * mechanism that doesn't seem to be very compatabile with Illumos's network
* based automounter map support.
*
* 2) "automount" is the other Linux automounter. It utilizes a kernel
@@ -86,14 +86,14 @@
* C) Autofs only intercepts vop lookup operations. Notably, it does _not_
* intercept and re-direct vop readdir operations. This means that the
* observed behavior of the Linux automounter can be considerably different
- * from that of the Solaris automounter. Specifically, on Solaris if autofs
+ * from that of the Illumos automounter. Specifically, on Illumos if autofs
* mount point is mounted _without_ the -nobrowse option then if a user does
* an ls operation (which translates into a vop readdir operation) then the
* automounter will intercept that operation and list all the possible
* directories and mount points without actually mounting any filesystems.
* Essentially, all automounter managed mount points on Linux will behave
- * like "-nobrowse" mount points on Solaris. Here's an example to
- * illustrate this. If /ws was mounted on Solaris without the -nobrowse
+ * like "-nobrowse" mount points on Illumos. Here's an example to
+ * illustrate this. If /ws was mounted on Illumos without the -nobrowse
* option and an auto_ws yp map was setup as the backing store for this
* mount point, then an "ls /ws" would list all the keys in the map as
* valid directories, but an "ls /ws" on Linux would list an emptry
@@ -176,12 +176,13 @@
* it's requested. For the purposes of discussion, we'll call the underlying
* filesystem the "backing store."
*
- * The backing store is actually directory called ".lx_afs" which is created in
- * the directory where the lx_autofs filesystem is mounted. When the lx_autofs
- * filesystem is unmounted this backing store directory is deleted. If this
- * directory exists at mount time (perhaps the system crashed while a previous
- * lx_autofs instance was mounted at the same location) it will be deleted.
- * There are a few implications of using a backing store worth mentioning.
+ * The backing store is actually directory called ".lxautoafs" which is created
+ * in the directory where the lx_autofs filesystem is mounted. When the
+ * lx_autofs filesystem is unmounted this backing store directory is deleted.
+ * If this directory exists at mount time (perhaps the system crashed while a
+ * previous lx_autofs instance was mounted at the same location) it will be
+ * deleted. There are a few implications of using a backing store worth
+ * mentioning.
*
* 2.1) lx_autofs can't be mounted on a read only filesystem. If this
* proves to be a problem we can probably move the location of the
@@ -217,11 +218,11 @@ extern "C" {
#endif
/*
- * Note that the name of the actual Solaris filesystem is lx_afs and not
+ * Note that the name of the actual Illumos filesystem is lxautofs and not
* lx_autofs. This is becase filesystem names are stupidly limited to 8
* characters.
*/
-#define LX_AUTOFS_NAME "lx_afs"
+#define LX_AUTOFS_NAME "lxautofs"
/*
* Mount options supported.
@@ -284,7 +285,7 @@ typedef struct lx_autofs_pkt {
* had passed the autofs filesystem would let the automounter know that
* "mcescher" could be unmounted. (Note the granularity of notification
* is directories in the root of the autofs filesystem.) Here's two
- * ideas for how this functionality could be implemented on Solaris:
+ * ideas for how this functionality could be implemented on Illumos:
*
* 2.1) The easy incomplete way. Don't do any in-use detection. Simply
* tell the automounter it can try to unmount the filesystem every time
diff --git a/usr/src/uts/common/brand/lx/syscall/lx_ioctl.c b/usr/src/uts/common/brand/lx/syscall/lx_ioctl.c
index b9c24198f9..f7e51386d9 100644
--- a/usr/src/uts/common/brand/lx/syscall/lx_ioctl.c
+++ b/usr/src/uts/common/brand/lx/syscall/lx_ioctl.c
@@ -44,6 +44,7 @@
#include <sys/dtrace.h>
#include <sys/ethernet.h>
#include <sys/dlpi.h>
+#include <sys/lx_autofs.h>
/*
* Supported ioctls
@@ -1159,6 +1160,14 @@ static ioc_cmd_translator_t ioc_translators[] = {
IOC_CMD_TRANSLATOR_PTHRU(DTRACEHIOC_REMOVE)
IOC_CMD_TRANSLATOR_PTHRU(DTRACEHIOC_ADDDOF)
+ /* lxautofs related - included here since no fd interpretation */
+ IOC_CMD_TRANSLATOR_PTHRU(LX_AUTOFS_IOC_READY)
+ IOC_CMD_TRANSLATOR_PTHRU(LX_AUTOFS_IOC_FAIL)
+ IOC_CMD_TRANSLATOR_PTHRU(LX_AUTOFS_IOC_CATATONIC)
+ IOC_CMD_TRANSLATOR_PTHRU(LX_AUTOFS_IOC_EXPIRE)
+ IOC_CMD_TRANSLATOR_PTHRU(LX_AUTOFS_IOC_PROTOVER)
+ IOC_CMD_TRANSLATOR_PTHRU(LX_AUTOFS_IOC_SETTIMEOUT)
+
IOC_CMD_TRANSLATOR_END
};
diff --git a/usr/src/uts/intel/Makefile.intel b/usr/src/uts/intel/Makefile.intel
index 6a64f3708c..cdc0da3940 100644
--- a/usr/src/uts/intel/Makefile.intel
+++ b/usr/src/uts/intel/Makefile.intel
@@ -537,7 +537,7 @@ SCHED_KMODS += IA RT TS RT_DPTBL TS_DPTBL FSS FX FX_DPTBL SDC
# File System Modules (/kernel/fs):
#
FS_KMODS += autofs cachefs ctfs dcfs dev devfs fdfs fifofs hsfs hyprlofs
-FS_KMODS += lofs lx_afs lx_proc lxprocfs mntfs namefs nfs objfs zfs zut
+FS_KMODS += lofs lxautofs lx_proc lxprocfs mntfs namefs nfs objfs zfs zut
FS_KMODS += pcfs procfs sockfs specfs tmpfs udfs ufs sharefs lx_sysfs
FS_KMODS += smbfs bootfs lx_cgroup
diff --git a/usr/src/uts/intel/lx_afs/Makefile b/usr/src/uts/intel/lxautofs/Makefile
index 657ce7f4f0..d91b8b1b23 100644
--- a/usr/src/uts/intel/lx_afs/Makefile
+++ b/usr/src/uts/intel/lxautofs/Makefile
@@ -22,10 +22,11 @@
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+# Copyright 2015 Joyent, Inc.
#
#
-# This makefile drives the production of the lxproc file system
+# This makefile drives the production of the lxautofs file system
# kernel module.
#
# i86 architecture dependent
@@ -39,11 +40,11 @@ UTSBASE = ../..
#
# Define the module and object file sets.
#
-# Note that the name of the actual filesystem is lx_afs and
+# Note that the name of the actual filesystem is lxautofs and
# not lx_autofs. This is becase filesystem names are stupidly
# limited to 8 characters.
#
-MODULE = lx_afs
+MODULE = lxautofs
OBJECTS = $(LX_AUTOFS_OBJS:%=$(OBJS_DIR)/%)
LINTS = $(LX_AUTOFS_OBJS:%.o=$(LINTS_DIR)/%.ln)
ROOTMODULE = $(USR_FS_DIR)/$(MODULE)
@@ -105,4 +106,4 @@ include $(UTSBASE)/intel/Makefile.targ
# Include brand-specific rules
#
-include $(UTSBASE)/intel/lx_afs/Makefile.rules
+include $(UTSBASE)/intel/lxautofs/Makefile.rules
diff --git a/usr/src/uts/intel/lx_afs/Makefile.rules b/usr/src/uts/intel/lxautofs/Makefile.rules
index 2793fedaa4..474743ce9d 100644
--- a/usr/src/uts/intel/lx_afs/Makefile.rules
+++ b/usr/src/uts/intel/lxautofs/Makefile.rules
@@ -23,8 +23,6 @@
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
#
# Section 1a: C object build rules