xref: /onnv-gate/usr/src/head/rpcsvc/ufs_prot.x (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  *	Copyright 1994 by Sun Microsystems, Inc.
24*0Sstevel@tonic-gate  *	  All Rights Reserved
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate %#pragma ident	"%Z%%M%	%I%	%E% SMI"
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate %#include <sys/fs/ufs_fs.h>
30*0Sstevel@tonic-gate %#include <sys/types.h>
31*0Sstevel@tonic-gate %#include <sys/errno.h>
32*0Sstevel@tonic-gate 
33*0Sstevel@tonic-gate enum ufsdrc_t {
34*0Sstevel@tonic-gate 	UFSDRC_OK	= 0,
35*0Sstevel@tonic-gate 	UFSDRC_NOENT	= ENOENT,	/* can't find fsck */
36*0Sstevel@tonic-gate 	UFSDRC_PERM	= EPERM,	/* no permissions */
37*0Sstevel@tonic-gate 	UFSDRC_INVAL	= EINVAL,	/* poorly formed args */
38*0Sstevel@tonic-gate 	UFSDRC_NOEXEC	= ENOEXEC,	/* can't exec fsck */
39*0Sstevel@tonic-gate 	UFSDRC_NODEV	= ENODEV,	/* invalid file system id */
40*0Sstevel@tonic-gate 	UFSDRC_NXIO	= ENXIO,	/* bad special device */
41*0Sstevel@tonic-gate 	UFSDRC_BUSY	= EBUSY,	/* another fsck in progress */
42*0Sstevel@tonic-gate 	UFSDRC_OPNOTSUP	= EOPNOTSUPP,	/* daemons mode makes this unfeasible */
43*0Sstevel@tonic-gate 	UFSDRC_EXECERR	= 254,		/* fsck/child ran but had an error */
44*0Sstevel@tonic-gate 	UFSDRC_ERR	= 255		/* generic error */
45*0Sstevel@tonic-gate };
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate struct fs_identity_t {
48*0Sstevel@tonic-gate 	dev_t		fs_dev;
49*0Sstevel@tonic-gate 	string		fs_name<MAXMNTLEN>;
50*0Sstevel@tonic-gate };
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate struct ufsd_repairfs_args_t {
53*0Sstevel@tonic-gate 	fs_identity_t	ua_fsid;
54*0Sstevel@tonic-gate 	unsigned int	ua_attempts;
55*0Sstevel@tonic-gate };
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate struct ufsd_repairfs_list_t {
58*0Sstevel@tonic-gate 	int			 ual_listlen;
59*0Sstevel@tonic-gate 	ufsd_repairfs_args_t	*ual_list;
60*0Sstevel@tonic-gate };
61*0Sstevel@tonic-gate 
62*0Sstevel@tonic-gate enum ufsd_event_t {
63*0Sstevel@tonic-gate 	UFSDEV_NONE = 0,
64*0Sstevel@tonic-gate 	UFSDEV_REBOOT,
65*0Sstevel@tonic-gate 	UFSDEV_FSCK,
66*0Sstevel@tonic-gate 	UFSDEV_LOG_OP
67*0Sstevel@tonic-gate };
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate enum ufsd_boot_type_t {
70*0Sstevel@tonic-gate 	UFSDB_NONE = 0,
71*0Sstevel@tonic-gate 	UFSDB_CLEAN,
72*0Sstevel@tonic-gate 	UFSDB_POSTPANIC
73*0Sstevel@tonic-gate };
74*0Sstevel@tonic-gate 
75*0Sstevel@tonic-gate enum ufsd_log_op_t {
76*0Sstevel@tonic-gate 	UFSDLO_NONE = 0,
77*0Sstevel@tonic-gate 	UFSDLO_COMMIT,
78*0Sstevel@tonic-gate 	UFSDLO_GET,
79*0Sstevel@tonic-gate 	UFSDLO_PUT,
80*0Sstevel@tonic-gate 	UFSDLO_RESET
81*0Sstevel@tonic-gate };
82*0Sstevel@tonic-gate 
83*0Sstevel@tonic-gate enum ufsd_fsck_state_t {
84*0Sstevel@tonic-gate 	UFSDFS_NONE = 0,
85*0Sstevel@tonic-gate 	UFSDFS_DISPATCH,
86*0Sstevel@tonic-gate 	UFSDFS_ERREXIT,
87*0Sstevel@tonic-gate 	UFSDFS_SUCCESS
88*0Sstevel@tonic-gate };
89*0Sstevel@tonic-gate 
90*0Sstevel@tonic-gate const UFSD_VARMSGMAX		= 1024;
91*0Sstevel@tonic-gate const UFSD_SPAREMSGBYTES	= 4;
92*0Sstevel@tonic-gate struct ufsd_log_data_t {
93*0Sstevel@tonic-gate 	int		umld_eob;
94*0Sstevel@tonic-gate 	int		umld_seq;
95*0Sstevel@tonic-gate 	char		umld_buf<UFSD_VARMSGMAX>;
96*0Sstevel@tonic-gate 
97*0Sstevel@tonic-gate };
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate union ufsd_log_msg_t switch (ufsd_log_op_t um_lop) {
100*0Sstevel@tonic-gate case UFSDLO_COMMIT:
101*0Sstevel@tonic-gate 	void;
102*0Sstevel@tonic-gate case UFSDLO_GET:
103*0Sstevel@tonic-gate 	void;
104*0Sstevel@tonic-gate case UFSDLO_PUT:
105*0Sstevel@tonic-gate 	ufsd_log_data_t	um_logdata;
106*0Sstevel@tonic-gate case UFSDLO_RESET:
107*0Sstevel@tonic-gate 	void;
108*0Sstevel@tonic-gate default:
109*0Sstevel@tonic-gate 	void;
110*0Sstevel@tonic-gate };
111*0Sstevel@tonic-gate 
112*0Sstevel@tonic-gate union ufsd_msg_vardata_t switch (ufsd_event_t umv_ev) {
113*0Sstevel@tonic-gate case UFSDEV_NONE:
114*0Sstevel@tonic-gate 	void;
115*0Sstevel@tonic-gate case UFSDEV_REBOOT:
116*0Sstevel@tonic-gate 	ufsd_boot_type_t	umv_b;
117*0Sstevel@tonic-gate case UFSDEV_FSCK:
118*0Sstevel@tonic-gate 	ufsd_fsck_state_t	umv_fs;
119*0Sstevel@tonic-gate case UFSDEV_LOG_OP:
120*0Sstevel@tonic-gate 	ufsd_log_msg_t		umv_lm;
121*0Sstevel@tonic-gate default:
122*0Sstevel@tonic-gate 	void;
123*0Sstevel@tonic-gate };
124*0Sstevel@tonic-gate 
125*0Sstevel@tonic-gate struct ufsd_msg_t {
126*0Sstevel@tonic-gate 	time_t			um_time;
127*0Sstevel@tonic-gate 	unsigned int		um_from;
128*0Sstevel@tonic-gate 	char			um_spare<UFSD_SPAREMSGBYTES>;
129*0Sstevel@tonic-gate 	ufsd_msg_vardata_t	um_var;
130*0Sstevel@tonic-gate };
131*0Sstevel@tonic-gate 
132*0Sstevel@tonic-gate %#define	UFSD_SERVNAME	"ufsd"
133*0Sstevel@tonic-gate %#define	xdr_dev_t	xdr_u_int
134*0Sstevel@tonic-gate %#define	xdr_time_t	xdr_int
135*0Sstevel@tonic-gate 
136*0Sstevel@tonic-gate %/*
137*0Sstevel@tonic-gate % * Set UFSD_THISVERS to the newest version of the protocol
138*0Sstevel@tonic-gate % * This allows the preprocessor to force an error if the
139*0Sstevel@tonic-gate % * protocol changes, since the kernel xdr routines may need to be
140*0Sstevel@tonic-gate % * recoded.  Note that we can't explicitly set the version to a
141*0Sstevel@tonic-gate % * symbol as rpcgen will then create erroneous routine names.
142*0Sstevel@tonic-gate % */
143*0Sstevel@tonic-gate %#define	UFSD_V1			1
144*0Sstevel@tonic-gate %#define	UFSD_ORIGVERS		UFSD_V1
145*0Sstevel@tonic-gate %#define	UFSD_THISVERS		1
146*0Sstevel@tonic-gate 
147*0Sstevel@tonic-gate program UFSD_PROG {
148*0Sstevel@tonic-gate 	version UFSD_VERS {
149*0Sstevel@tonic-gate 		ufsdrc_t UFSD_NULL(void)				= 0;
150*0Sstevel@tonic-gate 		ufsdrc_t UFSD_REPAIRFS(ufsd_repairfs_args_t)		= 1;
151*0Sstevel@tonic-gate 		ufsdrc_t UFSD_REPAIRFSLIST(ufsd_repairfs_list_t)	= 2;
152*0Sstevel@tonic-gate 		ufsdrc_t UFSD_SEND(ufsd_msg_t)				= 3;
153*0Sstevel@tonic-gate 		ufsdrc_t UFSD_RECV(ufsd_msg_t)				= 4;
154*0Sstevel@tonic-gate 		ufsdrc_t UFSD_EXIT(void)				= 5;
155*0Sstevel@tonic-gate 	} = 1;
156*0Sstevel@tonic-gate } = 100233;
157