4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
28 #include <sys/fs_subr.h>
31 #include <sys/modctl.h>
32 #include <sys/objfs.h>
33 #include <sys/objfs_impl.h>
37 static const struct vnodeops objfs_ops_odir
;
39 static gfs_dirent_t objfs_odir_entries
[] = {
40 { "object", objfs_create_data
, 0 },
46 objfs_odir_do_inode(vnode_t
*vp
, int index
)
48 objfs_odirnode_t
*odir
= vp
->v_data
;
50 return (OBJFS_INO_DATA(odir
->objfs_odir_modctl
->mod_id
));
54 objfs_create_odirnode(vnode_t
*pvp
, struct modctl
*mp
)
56 vnode_t
*vp
= gfs_dir_create(sizeof (objfs_odirnode_t
), pvp
,
57 &objfs_ops_odir
, objfs_odir_entries
, objfs_odir_do_inode
,
58 OBJFS_NAME_MAX
, NULL
, NULL
);
59 objfs_odirnode_t
*onode
= vp
->v_data
;
61 onode
->objfs_odir_modctl
= mp
;
68 objfs_odir_getattr(vnode_t
*vp
, vattr_t
*vap
, int flags
, cred_t
*cr
,
74 vap
->va_mode
= S_IRUSR
| S_IXUSR
| S_IRGRP
| S_IXGRP
|
76 vap
->va_nodeid
= gfs_file_inode(vp
);
77 vap
->va_nlink
= vap
->va_size
= 2;
79 vap
->va_atime
= vap
->va_ctime
= vap
->va_mtime
= now
;
80 return (objfs_common_getattr(vp
, vap
));
83 static const struct vnodeops objfs_ops_odir
= {
84 .vnop_name
= "objfs object directory",
85 .vop_open
= objfs_dir_open
,
86 .vop_close
= objfs_common_close
,
87 .vop_ioctl
= fs_inval
,
88 .vop_getattr
= objfs_odir_getattr
,
89 .vop_access
= objfs_dir_access
,
90 .vop_readdir
= gfs_vop_readdir
,
91 .vop_lookup
= gfs_vop_lookup
,
93 .vop_inactive
= gfs_vop_inactive
,