xref: /illumos-gate/usr/src/head/rpcsvc/ufs_prot.x (revision 012e6ce759c490003aed29439cc47d3d73a99ad3)
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 by Sun Microsystems, Inc.
24  *	  All Rights Reserved
25  */
26 
27 %#include <sys/fs/ufs_fs.h>
28 %#include <sys/types.h>
29 %#include <sys/errno.h>
30 
31 enum ufsdrc_t {
32 	UFSDRC_OK	= 0,
33 	UFSDRC_NOENT	= ENOENT,	/* can't find fsck */
34 	UFSDRC_PERM	= EPERM,	/* no permissions */
35 	UFSDRC_INVAL	= EINVAL,	/* poorly formed args */
36 	UFSDRC_NOEXEC	= ENOEXEC,	/* can't exec fsck */
37 	UFSDRC_NODEV	= ENODEV,	/* invalid file system id */
38 	UFSDRC_NXIO	= ENXIO,	/* bad special device */
39 	UFSDRC_BUSY	= EBUSY,	/* another fsck in progress */
40 	UFSDRC_OPNOTSUP	= EOPNOTSUPP,	/* daemons mode makes this unfeasible */
41 	UFSDRC_EXECERR	= 254,		/* fsck/child ran but had an error */
42 	UFSDRC_ERR	= 255		/* generic error */
43 };
44 
45 struct fs_identity_t {
46 	dev_t		fs_dev;
47 	string		fs_name<MAXMNTLEN>;
48 };
49 
50 struct ufsd_repairfs_args_t {
51 	fs_identity_t	ua_fsid;
52 	unsigned int	ua_attempts;
53 };
54 
55 struct ufsd_repairfs_list_t {
56 	int			 ual_listlen;
57 	ufsd_repairfs_args_t	*ual_list;
58 };
59 
60 enum ufsd_event_t {
61 	UFSDEV_NONE = 0,
62 	UFSDEV_REBOOT,
63 	UFSDEV_FSCK,
64 	UFSDEV_LOG_OP
65 };
66 
67 enum ufsd_boot_type_t {
68 	UFSDB_NONE = 0,
69 	UFSDB_CLEAN,
70 	UFSDB_POSTPANIC
71 };
72 
73 enum ufsd_log_op_t {
74 	UFSDLO_NONE = 0,
75 	UFSDLO_COMMIT,
76 	UFSDLO_GET,
77 	UFSDLO_PUT,
78 	UFSDLO_RESET
79 };
80 
81 enum ufsd_fsck_state_t {
82 	UFSDFS_NONE = 0,
83 	UFSDFS_DISPATCH,
84 	UFSDFS_ERREXIT,
85 	UFSDFS_SUCCESS
86 };
87 
88 const UFSD_VARMSGMAX		= 1024;
89 const UFSD_SPAREMSGBYTES	= 4;
90 struct ufsd_log_data_t {
91 	int		umld_eob;
92 	int		umld_seq;
93 	char		umld_buf<UFSD_VARMSGMAX>;
94 
95 };
96 
97 union ufsd_log_msg_t switch (ufsd_log_op_t um_lop) {
98 case UFSDLO_COMMIT:
99 	void;
100 case UFSDLO_GET:
101 	void;
102 case UFSDLO_PUT:
103 	ufsd_log_data_t	um_logdata;
104 case UFSDLO_RESET:
105 	void;
106 default:
107 	void;
108 };
109 
110 union ufsd_msg_vardata_t switch (ufsd_event_t umv_ev) {
111 case UFSDEV_NONE:
112 	void;
113 case UFSDEV_REBOOT:
114 	ufsd_boot_type_t	umv_b;
115 case UFSDEV_FSCK:
116 	ufsd_fsck_state_t	umv_fs;
117 case UFSDEV_LOG_OP:
118 	ufsd_log_msg_t		umv_lm;
119 default:
120 	void;
121 };
122 
123 struct ufsd_msg_t {
124 	time_t			um_time;
125 	unsigned int		um_from;
126 	char			um_spare<UFSD_SPAREMSGBYTES>;
127 	ufsd_msg_vardata_t	um_var;
128 };
129 
130 %#define	UFSD_SERVNAME	"ufsd"
131 %#define	xdr_dev_t	xdr_u_int
132 %#define	xdr_time_t	xdr_int
133 
134 %/*
135 % * Set UFSD_THISVERS to the newest version of the protocol
136 % * This allows the preprocessor to force an error if the
137 % * protocol changes, since the kernel xdr routines may need to be
138 % * recoded.  Note that we can't explicitly set the version to a
139 % * symbol as rpcgen will then create erroneous routine names.
140 % */
141 %#define	UFSD_V1			1
142 %#define	UFSD_ORIGVERS		UFSD_V1
143 %#define	UFSD_THISVERS		1
144 
145 program UFSD_PROG {
146 	version UFSD_VERS {
147 		ufsdrc_t UFSD_NULL(void)				= 0;
148 		ufsdrc_t UFSD_REPAIRFS(ufsd_repairfs_args_t)		= 1;
149 		ufsdrc_t UFSD_REPAIRFSLIST(ufsd_repairfs_list_t)	= 2;
150 		ufsdrc_t UFSD_SEND(ufsd_msg_t)				= 3;
151 		ufsdrc_t UFSD_RECV(ufsd_msg_t)				= 4;
152 		ufsdrc_t UFSD_EXIT(void)				= 5;
153 	} = 1;
154 } = 100233;
155