xref: /titanic_41/usr/src/cmd/fs.d/cachefs/cfsd/cfsd_kmod.h (revision 70025d765b044c6d8594bb965a2247a61e991a99)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1994-1997,2002-2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  *
26  *			cfsd_kmod.h
27  *
28  * Include file for the cfsd_kmod class.
29  *
30  */
31 
32 #ifndef _CFSD_KMOD
33 #define	_CFSD_KMOD
34 
35 #pragma ident	"%Z%%M%	%I%	%E% SMI"
36 
37 typedef struct cfsd_kmod_object {
38 	char	i_path[MAXPATHLEN];	/* path to root of file system */
39 	int	i_fd;			/* file descriptor of i_path */
40 #ifndef DBUG_OFF
41 	char	i_fidbuf[1024];		/* for formatted fid */
42 #endif
43 }cfsd_kmod_object_t;
44 
45 cfsd_kmod_object_t *cfsd_kmod_create(void);
46 void cfsd_kmod_destroy(cfsd_kmod_object_t *kmod_object_p);
47 int kmod_setup(cfsd_kmod_object_t *kmod_object_p, const char *path);
48 void kmod_shutdown(cfsd_kmod_object_t *kmod_object_p);
49 int kmod_xwait(cfsd_kmod_object_t *kmod_object_p);
50 int kmod_stateget(cfsd_kmod_object_t *kmod_object_p);
51 int kmod_stateset(cfsd_kmod_object_t *kmod_object_p, int state);
52 int kmod_exists(cfsd_kmod_object_t *kmod_object_p, cfs_cid_t *cidp);
53 int kmod_lostfound(cfsd_kmod_object_t *kmod_object_p, cfs_cid_t *cidp,
54     const char *namep, char *newnamep);
55 int kmod_lostfoundall(cfsd_kmod_object_t *kmod_object_p);
56 int kmod_rofs(cfsd_kmod_object_t *kmod_object_p);
57 int kmod_rootfid(cfsd_kmod_object_t *kmod_object_p, cfs_fid_t *fidp);
58 int kmod_getstats(cfsd_kmod_object_t *kmod_object_p, cachefsio_getstats_t *gsp);
59 int kmod_getinfo(cfsd_kmod_object_t *kmod_object_p, cfs_cid_t *filep,
60     cachefsio_getinfo_t *infop);
61 int kmod_cidtofid(cfsd_kmod_object_t *kmod_object_p,
62     cfs_cid_t *cidp, cfs_fid_t *fidp);
63 int kmod_getattrfid(cfsd_kmod_object_t *kmod_object_p, cfs_fid_t *fidp,
64     dl_cred_t *credp, cfs_vattr_t *vattrp);
65 int kmod_getattrname(cfsd_kmod_object_t *kmod_object_p, cfs_fid_t *dirp,
66     const char *name, dl_cred_t *credp, cfs_vattr_t *vattrp, cfs_fid_t *filep);
67 int kmod_create(cfsd_kmod_object_t *kmod_object_p, cfs_fid_t *dirp,
68     const char *namep, const cfs_cid_t *cidp, cfs_vattr_t *vattrp,
69     int exclusive, int mode, dl_cred_t *credp, cfs_fid_t *newfidp,
70     timestruc_t *ctimep, timestruc_t *mtimep);
71 int kmod_pushback(cfsd_kmod_object_t *kmod_object_p, cfs_cid_t *filep,
72     cfs_fid_t *fidp, dl_cred_t *credp, timestruc_t *ctimep, timestruc_t *mtimep,
73     int update);
74 int kmod_rename(cfsd_kmod_object_t *kmod_object_p, cfs_fid_t *olddir,
75     const char *oldname, cfs_fid_t *newdir, const char *newname,
76     const cfs_cid_t *cidp, dl_cred_t *credp, timestruc_t *ctimep,
77     timestruc_t *delctimep, const cfs_cid_t *delcidp);
78 int kmod_setattr(cfsd_kmod_object_t *kmod_object_p, cfs_fid_t *fidp,
79     const cfs_cid_t *cidp, cfs_vattr_t *vattrp, int flags, dl_cred_t *credp,
80     timestruc_t *ctimep, timestruc_t *mtimep);
81 int kmod_setsecattr(cfsd_kmod_object_t *kmod_object_p, cfs_fid_t *fidp,
82     const cfs_cid_t *cidp, ulong_t mask, int aclcnt, int dfaclcnt,
83     const aclent_t *acl, dl_cred_t *credp, timestruc_t *ctimep,
84     timestruc_t *mtimep);
85 int kmod_remove(cfsd_kmod_object_t *kmod_object_p, const cfs_fid_t *fidp,
86     const cfs_cid_t *cidp, const char *namep, const dl_cred_t *credp,
87     timestruc_t *ctimep);
88 int kmod_link(cfsd_kmod_object_t *kmod_object_p, const cfs_fid_t *dirfidp,
89     const char *namep, const cfs_fid_t *filefidp, const cfs_cid_t *cidp,
90     const dl_cred_t *credp, timestruc_t *ctimep);
91 int kmod_mkdir(cfsd_kmod_object_t *kmod_object_p, const cfs_fid_t *dirfidp,
92     const char *namep, const cfs_cid_t *cidp, const cfs_vattr_t *vattrp,
93     const dl_cred_t *credp, cfs_fid_t *newfidp);
94 int kmod_rmdir(cfsd_kmod_object_t *kmod_object_p, const cfs_fid_t *dirfidp,
95     const char *namep, const dl_cred_t *credp);
96 int kmod_symlink(cfsd_kmod_object_t *kmod_object_p, const cfs_fid_t *dirfidp,
97     const char *namep, const cfs_cid_t *cidp, const char *linkvalp,
98     const cfs_vattr_t *vattrp, const dl_cred_t *credp, cfs_fid_t *newfidp,
99     timestruc_t *ctimep, timestruc_t *mtimep);
100 #ifndef DBUG_OFF
101 void kmod_format_fid(cfsd_kmod_object_t *kmod_object_p, const cfs_fid_t *fidp);
102 void kmod_print_cred(const dl_cred_t *credp);
103 void kmod_print_attr(const vattr_t *vp);
104 #else
105 #define	kmod_format_fid(A, B)	0
106 #define	kmod_print_cred(A)	0
107 #define	kmod_print_attr(A)	0
108 #endif /* DBUG_OFF */
109 int  kmod_doioctl(cfsd_kmod_object_t *kmod_object_p, enum cfsdcmd_cmds cmd,
110     void *sdata, int slen, void *rdata, int rlen);
111 
112 #endif	/* _CFSD_KMOD */
113