General userfs fleshing out work. Abstract out construction and
[dragonfly.git] / sys / vfs / userfs / userfs_elms.c
1 /*
2  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
3  * 
4  * This code is derived from software contributed to The DragonFly Project
5  * by Matthew Dillon <dillon@backplane.com>
6  * 
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  * 3. Neither the name of The DragonFly Project nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific, prior written permission.
20  * 
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  * 
34  * $DragonFly: src/sys/vfs/userfs/userfs_elms.c,v 1.2 2007/09/07 21:42:59 dillon Exp $
35  */
36
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/kernel.h>
40 #include <sys/fcntl.h>
41 #include <sys/namecache.h>
42 #include <sys/vnode.h>
43 #include <sys/lockf.h>
44 #include <sys/event.h>
45 #include <sys/stat.h>
46 #include <sys/syslink.h>
47 #include <sys/syslink_vfs.h>
48 #include "userfs.h"
49
50 void
51 user_elm_push_vnode(struct syslink_elm *par, struct vnode *vp)
52 {
53         struct syslink_elm *elm;
54
55         elm = sl_elm_make(par, SLVFS_ELM_VNODE, sizeof(int64_t));
56         /* XXX vnode id */
57 }
58
59 void
60 user_elm_push_offset(struct syslink_elm *par, off_t offset)
61 {
62         struct syslink_elm *elm;
63
64         elm = sl_elm_make(par, SLVFS_ELM_OFFSET, sizeof(int64_t));
65         *(int64_t *)(elm + 1) = offset;
66 }
67
68 void
69 user_elm_push_bio(struct syslink_elm *par, int cmd, int bcount)
70 {
71         sl_elm_make_aux(par, SLVFS_ELM_IOCMD, cmd);
72         sl_elm_make_aux(par, SLVFS_ELM_IOCOUNT, bcount);
73 }
74
75 void
76 user_elm_push_mode(struct syslink_elm *par, mode_t mode)
77 {
78         panic("user_elm_push_mode: not implemented yet");
79 }
80
81 void
82 user_elm_push_cred(struct syslink_elm *par, struct ucred *cred)
83 {
84         panic("user_elm_push_cred: not implemented yet");
85 }
86
87 void
88 user_elm_push_nch(struct syslink_elm *par, struct nchandle *nch)
89 {
90         panic("user_elm_push_nch: not implemented yet");
91 }
92
93 void
94 user_elm_push_vattr(struct syslink_elm *par, struct vattr *vat)
95 {
96         panic("user_elm_push_nch: not implemented yet");
97 }
98
99 int
100 user_elm_parse_vattr(struct syslink_elm *par, struct vattr *vat)
101 {
102         panic("user_elm_parse_vattr: not implemented yet");
103 }
104