aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb/*
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * CDDL HEADER START
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb *
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * The contents of this file are subject to the terms of the
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * Common Development and Distribution License (the "License").
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * You may not use this file except in compliance with the License.
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb *
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * or http://www.opensolaris.org/os/licensing.
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * See the License for the specific language governing permissions
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * and limitations under the License.
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb *
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * When distributing Covered Code, include this CDDL HEADER in each
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * If applicable, add the following below this CDDL HEADER, with the
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * fields enclosed by brackets "[]" replaced with your own identifying
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * information: Portions Copyright [yyyy] [name of copyright owner]
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb *
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * CDDL HEADER END
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb/*
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * Use is subject to license terms.
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb#ifndef _SYS_VFS_OPREG_H
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb#define _SYS_VFS_OPREG_H
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb#pragma ident "%Z%%M% %I% %E% SMI"
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb#include <sys/vfs.h>
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb#include <sys/fem.h>
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb#ifdef __cplusplus
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbextern "C" {
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb#endif
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb#ifdef _KERNEL
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb/*
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * The following union allows us to use C99's "designated initializer"
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * feature so that we can have strong typechecking for the operations
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * used in the the fs_operation_def structures.
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbtypedef union fs_func {
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb fs_generic_func_p fs_generic; /* Generic function signature */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb int (*error)(); /* Signature of error function */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb VFS_OPS; /* Signatures of all vfs operations (vfsops) */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb VNODE_OPS; /* Signatures of all vnode operations (vops) */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb FEM_OPS; /* Signatures of all FEM operations (femops) */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb FSEM_OPS; /* Signatures of all FSEM ops (fsemops) */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb} fs_func_p;
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb/*
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * File systems use arrays of fs_operation_def structures to form
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * name/value pairs of operations. These arrays get passed to:
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb *
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * - vn_make_ops() to create vnodeops
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * - vfs_makefsops()/vfs_setfsops() to create vfsops.
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbtypedef struct fs_operation_def {
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb char *name; /* name of operation (NULL at end) */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb fs_func_p func; /* function implementing operation */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb} fs_operation_def_t;
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb/*
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * The operation registration mechanism uses two master tables of operations:
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * one for vnode operations (vn_ops_table[]) and one for vfs operations
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * (vfs_ops_table[]). These tables are arrays of fs_operation_trans_def
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * structures. They contain all of the information necessary for the system
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * to populate an operations structure (e.g., vnodeops, vfsops).
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb *
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * File systems call registration routines (vfs_setfsops(), vfs_makefsops(),
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * and vn_make_ops()) and pass in their operations specification tables
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * (arrays of fs_operation_def structures). These routines use the master
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * table(s) of operations to build a vnodeops or vfsops structure.
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbtypedef struct fs_operation_trans_def {
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb char *name; /* name of operation (NULL at end) */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb int offset; /* byte offset within ops vector */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb fs_generic_func_p defaultFunc; /* default function */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb fs_generic_func_p errorFunc; /* error function */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb} fs_operation_trans_def_t;
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb/*
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * Generic operations vector types (used for vfs/vnode ops registration).
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbextern int fs_default(); /* "default" function placeholder */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbextern int fs_error(); /* "error" function placeholder */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbint fs_build_vector(void *vector, int *unused_ops,
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb const fs_operation_trans_def_t *translation,
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb const fs_operation_def_t *operations);
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb/*
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb * Public operations.
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbint vn_make_ops(const char *, const struct fs_operation_def *,
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb vnodeops_t **);
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbvoid vn_freevnodeops(vnodeops_t *);
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbint vfs_setfsops(int, const fs_operation_def_t *, vfsops_t **);
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbint vfs_makefsops(const fs_operation_def_t *, vfsops_t **);
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbvoid vfs_freevfsops(vfsops_t *);
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsbint vfs_freevfsops_by_type(int);
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb#endif /* _KERNEL */
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb#ifdef __cplusplus
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb}
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb#endif
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb
aa59c4cb15a6ac5d4e585dadf7a055b580abf579rsb#endif /* _SYS_VFS_OPREG_H */