1168404Spjd/*-
2168404Spjd * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3168404Spjd * All rights reserved.
4168404Spjd *
5168404Spjd * Redistribution and use in source and binary forms, with or without
6168404Spjd * modification, are permitted provided that the following conditions
7168404Spjd * are met:
8168404Spjd * 1. Redistributions of source code must retain the above copyright
9168404Spjd *    notice, this list of conditions and the following disclaimer.
10168404Spjd * 2. Redistributions in binary form must reproduce the above copyright
11168404Spjd *    notice, this list of conditions and the following disclaimer in the
12168404Spjd *    documentation and/or other materials provided with the distribution.
13168404Spjd *
14168404Spjd * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
15168404Spjd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16168404Spjd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17168404Spjd * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
18168404Spjd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19168404Spjd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20168404Spjd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21168404Spjd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22168404Spjd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23168404Spjd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24168404Spjd * SUCH DAMAGE.
25168404Spjd *
26168404Spjd * $FreeBSD$
27168404Spjd */
28168404Spjd
29168404Spjd#ifndef _OPENSOLARIS_SYS_KOBJ_H_
30168404Spjd#define	_OPENSOLARIS_SYS_KOBJ_H_
31168404Spjd
32168404Spjd#include <sys/types.h>
33168404Spjd#include <sys/kmem.h>
34168508Spjd#include_next <sys/kobj.h>
35168508Spjd#ifdef AT_UID
36168508Spjd#undef AT_UID
37168508Spjd#endif
38168508Spjd#ifdef AT_GID
39168508Spjd#undef AT_GID
40168508Spjd#endif
41168404Spjd#include <sys/vnode.h>
42168404Spjd
43168404Spjd#define	KM_NOWAIT	0x01
44168404Spjd#define	KM_TMP		0x02
45168404Spjd
46168404Spjdvoid kobj_free(void *address, size_t size);
47168404Spjdvoid *kobj_alloc(size_t size, int flag);
48168404Spjdvoid *kobj_zalloc(size_t size, int flag);
49168404Spjd
50168404Spjdstruct _buf {
51168508Spjd	void *ptr;
52168508Spjd	int mounted;
53168404Spjd};
54168404Spjd
55168404Spjdstruct _buf *kobj_open_file(const char *path);
56168404Spjdint kobj_get_filesize(struct _buf *file, uint64_t *size);
57168404Spjdint kobj_read_file(struct _buf *file, char *buf, unsigned size, unsigned off);
58168404Spjdvoid kobj_close_file(struct _buf *file);
59168404Spjd
60168404Spjd#endif	/* _OPENSOLARIS_SYS_KOBJ_H_ */
61