138494Sobrien/* 2174294Sobrien * Copyright (c) 1997-2006 Erez Zadok 338494Sobrien * Copyright (c) 1989 Jan-Simon Pendry 438494Sobrien * Copyright (c) 1989 Imperial College of Science, Technology & Medicine 538494Sobrien * Copyright (c) 1989 The Regents of the University of California. 638494Sobrien * All rights reserved. 738494Sobrien * 838494Sobrien * This code is derived from software contributed to Berkeley by 938494Sobrien * Jan-Simon Pendry at Imperial College, London. 1038494Sobrien * 1138494Sobrien * Redistribution and use in source and binary forms, with or without 1238494Sobrien * modification, are permitted provided that the following conditions 1338494Sobrien * are met: 1438494Sobrien * 1. Redistributions of source code must retain the above copyright 1538494Sobrien * notice, this list of conditions and the following disclaimer. 1638494Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1738494Sobrien * notice, this list of conditions and the following disclaimer in the 1838494Sobrien * documentation and/or other materials provided with the distribution. 1938494Sobrien * 3. All advertising materials mentioning features or use of this software 2042629Sobrien * must display the following acknowledgment: 2138494Sobrien * This product includes software developed by the University of 2238494Sobrien * California, Berkeley and its contributors. 2338494Sobrien * 4. Neither the name of the University nor the names of its contributors 2438494Sobrien * may be used to endorse or promote products derived from this software 2538494Sobrien * without specific prior written permission. 2638494Sobrien * 2738494Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2838494Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2938494Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 3038494Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 3138494Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3238494Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3338494Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3438494Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3538494Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3638494Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3738494Sobrien * SUCH DAMAGE. 3838494Sobrien * 3938494Sobrien * 40174294Sobrien * File: am-utils/amd/amfs_error.c 4138494Sobrien * 4238494Sobrien */ 4338494Sobrien 4438494Sobrien/* 4538494Sobrien * Error file system. 4638494Sobrien * This is used as a last resort catchall if 4738494Sobrien * nothing else worked. EFS just returns lots 4838494Sobrien * of error codes, except for unmount which 4938494Sobrien * always works of course. 5038494Sobrien */ 5138494Sobrien 5238494Sobrien#ifdef HAVE_CONFIG_H 5338494Sobrien# include <config.h> 5438494Sobrien#endif /* HAVE_CONFIG_H */ 5538494Sobrien#include <am_defs.h> 5638494Sobrien#include <amd.h> 5738494Sobrien 5882794Sobrienstatic char *amfs_error_match(am_opts *fo); 59174294Sobrienstatic int amfs_error_mount(am_node *am, mntfs *mf); 60174294Sobrienstatic int amfs_error_umount(am_node *am, mntfs *mf); 6138494Sobrien 6238494Sobrien 6338494Sobrien/* 6438494Sobrien * Ops structure 6538494Sobrien */ 6638494Sobrienam_ops amfs_error_ops = 6738494Sobrien{ 6838494Sobrien "error", 6938494Sobrien amfs_error_match, 7038494Sobrien 0, /* amfs_error_init */ 71174294Sobrien amfs_error_mount, 72174294Sobrien amfs_error_umount, 73174294Sobrien amfs_error_lookup_child, 74174294Sobrien amfs_error_mount_child, 7538494Sobrien amfs_error_readdir, 7638494Sobrien 0, /* amfs_error_readlink */ 7738494Sobrien 0, /* amfs_error_mounted */ 78174294Sobrien 0, /* amfs_error_umounted */ 79174294Sobrien amfs_generic_find_srvr, 80174294Sobrien 0, /* amfs_error_get_wchan */ 81174294Sobrien FS_DISCARD, /* nfs_fs_flags */ 82174294Sobrien#ifdef HAVE_FS_AUTOFS 83174294Sobrien AUTOFS_ERROR_FS_FLAGS, 84174294Sobrien#endif /* HAVE_FS_AUTOFS */ 8538494Sobrien}; 8638494Sobrien 8738494Sobrien 8838494Sobrien 8938494Sobrien/* 9038494Sobrien * EFS file system always matches 9138494Sobrien */ 9238494Sobrienstatic char * 9338494Sobrienamfs_error_match(am_opts *fo) 9438494Sobrien{ 9538494Sobrien return strdup("(error-hook)"); 9638494Sobrien} 9738494Sobrien 9838494Sobrien 9938494Sobrienstatic int 100174294Sobrienamfs_error_mount(am_node *am, mntfs *mf) 10138494Sobrien{ 10238494Sobrien return ENOENT; 10338494Sobrien} 10438494Sobrien 10538494Sobrien 10638494Sobrienstatic int 107174294Sobrienamfs_error_umount(am_node *am, mntfs *mf) 10838494Sobrien{ 10938494Sobrien /* 11038494Sobrien * Always succeed 11138494Sobrien */ 11238494Sobrien return 0; 11338494Sobrien} 11438494Sobrien 11538494Sobrien 11638494Sobrien/* 11738494Sobrien * EFS interface to RPC lookup() routine. 11838494Sobrien * Should never get here in the automounter. 11938494Sobrien * If we do then just give an error. 12038494Sobrien */ 12138494Sobrienam_node * 122174294Sobrienamfs_error_lookup_child(am_node *mp, char *fname, int *error_return, int op) 12338494Sobrien{ 12438494Sobrien *error_return = ESTALE; 12538494Sobrien return 0; 12638494Sobrien} 12738494Sobrien 12838494Sobrien 12938494Sobrien/* 130174294Sobrien * EFS interface to RPC lookup() routine. 13138494Sobrien * Should never get here in the automounter. 13238494Sobrien * If we do then just give an error. 13338494Sobrien */ 134174294Sobrienam_node * 135174294Sobrienamfs_error_mount_child(am_node *ap, int *error_return) 13638494Sobrien{ 137174294Sobrien *error_return = ESTALE; 138174294Sobrien return 0; 13938494Sobrien} 14038494Sobrien 14138494Sobrien 14238494Sobrien/* 143174294Sobrien * EFS interface to RPC readdir() routine. 144174294Sobrien * Should never get here in the automounter. 145174294Sobrien * If we do then just give an error. 14638494Sobrien */ 147174294Sobrienint 148174294Sobrienamfs_error_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count) 14938494Sobrien{ 150174294Sobrien return ESTALE; 15138494Sobrien} 152