xref: /openbsd/usr.sbin/amd/amd/efs_ops.c (revision 6fff3178)
1 /*
2  * Copyright (c) 1989 Jan-Simon Pendry
3  * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
4  * Copyright (c) 1989, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Jan-Simon Pendry at Imperial College, London.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *	from: @(#)efs_ops.c	8.1 (Berkeley) 6/6/93
35  *	$Id: efs_ops.c,v 1.4 2014/10/26 02:43:50 guenther Exp $
36  */
37 
38 #include "am.h"
39 
40 #ifdef HAS_EFS
41 
42 /*
43  * Error file system.
44  * This is used as a last resort catchall if
45  * nothing else worked.  EFS just returns lots
46  * of error codes, except for unmount which
47  * always works of course.
48  */
49 
50 /*
51  * EFS file system always matches
52  */
53 static char *
efs_match(am_opts * fo)54 efs_match(am_opts *fo)
55 {
56 	return strdup("(error-hook)");
57 }
58 
59 static int
efs_fmount(mntfs * mf)60 efs_fmount(mntfs *mf)
61 {
62 	return ENOENT;
63 }
64 
65 static int
efs_fumount(mntfs * mf)66 efs_fumount(mntfs *mf)
67 {
68 	/*
69 	 * Always succeed
70 	 */
71 
72 	return 0;
73 }
74 
75 /*
76  * EFS interface to RPC lookup() routine.
77  * Should never get here in the automounter.
78  * If we do then just give an error.
79  */
80 am_node *
efs_lookuppn(am_node * mp,char * fname,int * error_return,int op)81 efs_lookuppn(am_node *mp, char *fname, int *error_return, int op)
82 {
83 	*error_return = ESTALE;
84 	return 0;
85 }
86 
87 /*
88  * EFS interface to RPC readdir() routine.
89  * Should never get here in the automounter.
90  * If we do then just give an error.
91  */
92 int
efs_readdir(am_node * mp,nfscookie cookie,dirlist * dp,entry * ep,int count)93 efs_readdir(am_node *mp, nfscookie cookie, dirlist *dp, entry *ep,
94     int count)
95 {
96 	return ESTALE;
97 }
98 
99 /*
100  * Ops structure
101  */
102 am_ops efs_ops = {
103 	"error",
104 	efs_match,
105 	0, /* efs_init */
106 	auto_fmount,
107 	efs_fmount,
108 	auto_fumount,
109 	efs_fumount,
110 	efs_lookuppn,
111 	efs_readdir,
112 	0, /* efs_readlink */
113 	0, /* efs_mounted */
114 	0, /* efs_umounted */
115 	find_afs_srvr,
116 	FS_DISCARD
117 };
118 
119 #endif /* HAS_EFS */
120