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