Beispiel #1
0
struct root_hold_token *
root_mount_hold(const char *identifier)
{
	struct root_hold_token *h;

	if (root_mounted())
		return (NULL);

	h = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK);
	h->who = identifier;
	mtx_lock(&mountlist_mtx);
	LIST_INSERT_HEAD(&root_holds, h, list);
	mtx_unlock(&mountlist_mtx);
	return (h);
}
struct _buf *
kobj_open_file(const char *file)
{
	struct _buf *out;

	out = kmem_alloc(sizeof(*out), KM_SLEEP);
	out->mounted = root_mounted();
	/*
	 * If root is already mounted we read file using file system,
	 * if not, we use loader.
	 */
	if (out->mounted)
		out->ptr = kobj_open_file_vnode(file);
	else
		out->ptr = kobj_open_file_loader(file);
	if (out->ptr == NULL) {
		kmem_free(out, sizeof(*out));
		return ((struct _buf *)-1);
	}
	return (out);
}