/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright (c) 2015 Joyent, Inc.
*/
#include <sys/vfs_opreg.h>
#include <sys/id_space.h>
#include <sys/sysmacros.h>
/*
* While booting, additional types of modules and files can be passed in to the
* loader. These include the familiar boot archive, as well as, a module hash
* and additional modules that are interpreted as files. As part of the handoff
* in early boot, information about these modules are saved as properties on the
* root of the devinfo tree, similar to other boot-time properties.
*
* This file system provides a read-only view of those additional files. Due to
* its limited scope, it has a slightly simpler construction than several other
* file systems. When mounted, it looks for the corresponding properties and
* creates bootfs_node_t's and vnodes for all of the corresponding files and
* directories that exist along the way. At this time, there are currently a
* rather small number of files passed in this way.
*
* This does lead to one behavior that folks used to other file systems might
* find peculiar. Because we are not always actively creating and destroying the
* required vnodes on demand, the count on the root vnode will not be going up
* accordingly with the existence of other vnodes. This means that a bootfs file
* system that is not in use will have all of its vnodes exist with a v_count of
* one.
*/
static int bootfs_fstype;
static int
{
int ret;
return (ret);
return (ENOTDIR);
return (EBUSY);
return (EBUSY);
}
/*
* We indicate that the backing store is bootfs. We don't want to use
* swap, because folks might think that this is putting all the data
* into memory ala tmpfs. Rather these modules are always in memory and
* there's nothing to be done about that.
*/
return (ENOMEM);
if (ret != 0) {
return (ret);
}
"fs", KSTAT_TYPE_NAMED,
sizeof (bootfs_stat_t) / sizeof (kstat_named_t),
return (ENOMEM);
}
return (0);
}
static int
{
int ret;
return (ret);
return (ENOTSUP);
return (EBUSY);
}
}
return (0);
}
static int
{
return (0);
}
static int
{
return (0);
}
};
static int
{
int ret;
ASSERT(bootfs_fstype != 0);
if (ret != 0)
return (ret);
if (ret != 0) {
(void) vfs_freevfsops_by_type(bootfs_fstype);
return (ret);
}
bootfs_major = getudev();
bootfs_major = 0;
}
bootfs_nactive = 0;
return (0);
}
0, NULL
};
"bootfs",
};
};
};
int
_init(void)
{
sizeof (bootfs_node_t), 0, bootfs_node_constructor,
return (mod_install(&bootfs_modlinkage));
}
int
{
}
int
_fini(void)
{
int err;
if (bootfs_nactive > 0) {
return (EBUSY);
}
if (err != 0)
return (err);
(void) vfs_freevfsops_by_type(bootfs_fstype);
return (err);
}