10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*5331Samw * Common Development and Distribution License (the "License"). 6*5331Samw * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*5331Samw * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _OBJFS_IMPL_H 270Sstevel@tonic-gate #define _OBJFS_IMPL_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate #include <sys/modctl.h> 320Sstevel@tonic-gate #include <sys/vfs.h> 330Sstevel@tonic-gate #include <sys/vnode.h> 340Sstevel@tonic-gate #include <sys/gfs.h> 350Sstevel@tonic-gate #include <sys/objfs.h> 360Sstevel@tonic-gate 370Sstevel@tonic-gate #ifdef __cplusplus 380Sstevel@tonic-gate extern "C" { 390Sstevel@tonic-gate #endif 400Sstevel@tonic-gate 410Sstevel@tonic-gate /* 420Sstevel@tonic-gate * VFS data object 430Sstevel@tonic-gate */ 440Sstevel@tonic-gate typedef struct objfs_vfs { 450Sstevel@tonic-gate vnode_t *objfs_vfs_root; 460Sstevel@tonic-gate } objfs_vfs_t; 470Sstevel@tonic-gate 480Sstevel@tonic-gate /* 490Sstevel@tonic-gate * Common vop_ entry points 500Sstevel@tonic-gate */ 51*5331Samw extern int objfs_dir_open(vnode_t **, int, cred_t *, caller_context_t *); 52*5331Samw extern int objfs_dir_access(vnode_t *, int, int, cred_t *, 53*5331Samw caller_context_t *); 54*5331Samw extern int objfs_common_close(vnode_t *, int, int, offset_t, cred_t *, 55*5331Samw caller_context_t *); 560Sstevel@tonic-gate 570Sstevel@tonic-gate /* 580Sstevel@tonic-gate * Common vop_ support functions 590Sstevel@tonic-gate */ 600Sstevel@tonic-gate extern int objfs_common_getattr(vnode_t *, vattr_t *); 610Sstevel@tonic-gate 620Sstevel@tonic-gate /* 630Sstevel@tonic-gate * Miscellaneous support functions 640Sstevel@tonic-gate */ 650Sstevel@tonic-gate extern int objfs_nobjs(void); 660Sstevel@tonic-gate 670Sstevel@tonic-gate #define OBJFS_NAME_MAX MAXNAMELEN 680Sstevel@tonic-gate 690Sstevel@tonic-gate /* 700Sstevel@tonic-gate * The root vnode has an inode number of 0xffffffff. All other vnodes have an 710Sstevel@tonic-gate * inode that is an OR of the module id with the type of vnode. 720Sstevel@tonic-gate * 730Sstevel@tonic-gate * ---------------------------------------- 740Sstevel@tonic-gate * | type | mod_id | 750Sstevel@tonic-gate * ---------------------------------------- 760Sstevel@tonic-gate * 63 31 0 770Sstevel@tonic-gate * 780Sstevel@tonic-gate * This way, module directories will have an inode value equal to their module 790Sstevel@tonic-gate * id. 800Sstevel@tonic-gate */ 810Sstevel@tonic-gate 820Sstevel@tonic-gate #define OBJFS_INO(modid, type) \ 830Sstevel@tonic-gate (((uint64_t)(type) << 32) | (modid)) 840Sstevel@tonic-gate 850Sstevel@tonic-gate /* 860Sstevel@tonic-gate * Root directory 870Sstevel@tonic-gate */ 880Sstevel@tonic-gate typedef gfs_dir_t objfs_rootnode_t; 890Sstevel@tonic-gate 900Sstevel@tonic-gate #define OBJFS_INO_ROOT 0xffffffff 910Sstevel@tonic-gate 920Sstevel@tonic-gate extern const fs_operation_def_t objfs_tops_root[]; 930Sstevel@tonic-gate extern vnodeops_t *objfs_ops_root; 940Sstevel@tonic-gate 950Sstevel@tonic-gate extern vnode_t *objfs_create_root(vfs_t *); 960Sstevel@tonic-gate 970Sstevel@tonic-gate /* 980Sstevel@tonic-gate * Object directory 990Sstevel@tonic-gate */ 1000Sstevel@tonic-gate 1010Sstevel@tonic-gate typedef struct objfs_odirnode { 1020Sstevel@tonic-gate gfs_dir_t objfs_odir_dir; /* gfs dir */ 1030Sstevel@tonic-gate struct modctl *objfs_odir_modctl; /* modctl pointer */ 1040Sstevel@tonic-gate } objfs_odirnode_t; 1050Sstevel@tonic-gate 1060Sstevel@tonic-gate #define OBJFS_INO_ODIR(modid) OBJFS_INO(modid, 0) 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate extern const fs_operation_def_t objfs_tops_odir[]; 1090Sstevel@tonic-gate extern vnodeops_t *objfs_ops_odir; 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate extern vnode_t *objfs_create_odirnode(vnode_t *, struct modctl *); 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate /* 1140Sstevel@tonic-gate * Data file 1150Sstevel@tonic-gate */ 1160Sstevel@tonic-gate typedef struct objfs_datanode { 1170Sstevel@tonic-gate gfs_file_t objfs_data_file; /* gfs file */ 1180Sstevel@tonic-gate objfs_info_t objfs_data_info; 1190Sstevel@tonic-gate int objfs_data_gencount; /* gen when opened */ 1200Sstevel@tonic-gate } objfs_datanode_t; 1210Sstevel@tonic-gate 1220Sstevel@tonic-gate #define OBJFS_INO_DATA(modid) OBJFS_INO(modid, 1) 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate extern const fs_operation_def_t objfs_tops_data[]; 1250Sstevel@tonic-gate extern vnodeops_t *objfs_ops_data; 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate extern void objfs_data_init(void); 1280Sstevel@tonic-gate extern vnode_t *objfs_create_data(vnode_t *); 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate #ifdef __cplusplus 1310Sstevel@tonic-gate } 1320Sstevel@tonic-gate #endif 1330Sstevel@tonic-gate 1340Sstevel@tonic-gate #endif /* _OBJFS_IMPL_H */ 135