xref: /minix3/sys/lib/libsa/nullfs.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: nullfs.c,v 1.12 2014/03/20 03:13:18 christos Exp $	*/
258a2b000SEvgeniy Ivanov 
358a2b000SEvgeniy Ivanov /*-
458a2b000SEvgeniy Ivanov  * Copyright (c) 1993
558a2b000SEvgeniy Ivanov  *	The Regents of the University of California.  All rights reserved.
658a2b000SEvgeniy Ivanov  *
758a2b000SEvgeniy Ivanov  * This code is derived from software contributed to Berkeley by
858a2b000SEvgeniy Ivanov  * The Mach Operating System project at Carnegie-Mellon University.
958a2b000SEvgeniy Ivanov  *
1058a2b000SEvgeniy Ivanov  * Redistribution and use in source and binary forms, with or without
1158a2b000SEvgeniy Ivanov  * modification, are permitted provided that the following conditions
1258a2b000SEvgeniy Ivanov  * are met:
1358a2b000SEvgeniy Ivanov  * 1. Redistributions of source code must retain the above copyright
1458a2b000SEvgeniy Ivanov  *    notice, this list of conditions and the following disclaimer.
1558a2b000SEvgeniy Ivanov  * 2. Redistributions in binary form must reproduce the above copyright
1658a2b000SEvgeniy Ivanov  *    notice, this list of conditions and the following disclaimer in the
1758a2b000SEvgeniy Ivanov  *    documentation and/or other materials provided with the distribution.
1858a2b000SEvgeniy Ivanov  * 3. Neither the name of the University nor the names of its contributors
1958a2b000SEvgeniy Ivanov  *    may be used to endorse or promote products derived from this software
2058a2b000SEvgeniy Ivanov  *    without specific prior written permission.
2158a2b000SEvgeniy Ivanov  *
2258a2b000SEvgeniy Ivanov  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2358a2b000SEvgeniy Ivanov  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2458a2b000SEvgeniy Ivanov  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2558a2b000SEvgeniy Ivanov  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2658a2b000SEvgeniy Ivanov  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2758a2b000SEvgeniy Ivanov  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2858a2b000SEvgeniy Ivanov  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2958a2b000SEvgeniy Ivanov  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3058a2b000SEvgeniy Ivanov  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3158a2b000SEvgeniy Ivanov  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3258a2b000SEvgeniy Ivanov  * SUCH DAMAGE.
3358a2b000SEvgeniy Ivanov  *
3458a2b000SEvgeniy Ivanov  *	@(#)open.c	8.1 (Berkeley) 6/11/93
3558a2b000SEvgeniy Ivanov  *
3658a2b000SEvgeniy Ivanov  *
3758a2b000SEvgeniy Ivanov  * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
3858a2b000SEvgeniy Ivanov  * All Rights Reserved.
3958a2b000SEvgeniy Ivanov  *
4058a2b000SEvgeniy Ivanov  * Author: Alessandro Forin
4158a2b000SEvgeniy Ivanov  *
4258a2b000SEvgeniy Ivanov  * Permission to use, copy, modify and distribute this software and its
4358a2b000SEvgeniy Ivanov  * documentation is hereby granted, provided that both the copyright
4458a2b000SEvgeniy Ivanov  * notice and this permission notice appear in all copies of the
4558a2b000SEvgeniy Ivanov  * software, derivative works or modified versions, and any portions
4658a2b000SEvgeniy Ivanov  * thereof, and that both notices appear in supporting documentation.
4758a2b000SEvgeniy Ivanov  *
4858a2b000SEvgeniy Ivanov  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
4958a2b000SEvgeniy Ivanov  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
5058a2b000SEvgeniy Ivanov  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
5158a2b000SEvgeniy Ivanov  *
5258a2b000SEvgeniy Ivanov  * Carnegie Mellon requests users of this software to return to
5358a2b000SEvgeniy Ivanov  *
5458a2b000SEvgeniy Ivanov  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
5558a2b000SEvgeniy Ivanov  *  School of Computer Science
5658a2b000SEvgeniy Ivanov  *  Carnegie Mellon University
5758a2b000SEvgeniy Ivanov  *  Pittsburgh PA 15213-3890
5858a2b000SEvgeniy Ivanov  *
5958a2b000SEvgeniy Ivanov  * any improvements or extensions that they make and grant Carnegie the
6058a2b000SEvgeniy Ivanov  * rights to redistribute these changes.
6158a2b000SEvgeniy Ivanov  */
6258a2b000SEvgeniy Ivanov 
6358a2b000SEvgeniy Ivanov #include "stand.h"
6458a2b000SEvgeniy Ivanov 
6558a2b000SEvgeniy Ivanov /*
6658a2b000SEvgeniy Ivanov  * Null filesystem
6758a2b000SEvgeniy Ivanov  */
6858a2b000SEvgeniy Ivanov 
6958a2b000SEvgeniy Ivanov __compactcall int
null_open(const char * path,struct open_file * f)7058a2b000SEvgeniy Ivanov null_open(const char *path, struct open_file *f)
7158a2b000SEvgeniy Ivanov {
7258a2b000SEvgeniy Ivanov 
7358a2b000SEvgeniy Ivanov 	return EIO;
7458a2b000SEvgeniy Ivanov }
7558a2b000SEvgeniy Ivanov 
7658a2b000SEvgeniy Ivanov #ifndef LIBSA_NO_FS_CLOSE
7758a2b000SEvgeniy Ivanov __compactcall int
null_close(struct open_file * f)7858a2b000SEvgeniy Ivanov null_close(struct open_file *f)
7958a2b000SEvgeniy Ivanov {
8058a2b000SEvgeniy Ivanov 
8158a2b000SEvgeniy Ivanov 	return 0;
8258a2b000SEvgeniy Ivanov }
8358a2b000SEvgeniy Ivanov #endif
8458a2b000SEvgeniy Ivanov 
8558a2b000SEvgeniy Ivanov __compactcall int
null_read(struct open_file * f,void * buf,size_t size,size_t * resid)8658a2b000SEvgeniy Ivanov null_read(struct open_file *f, void *buf, size_t size, size_t *resid)
8758a2b000SEvgeniy Ivanov {
8858a2b000SEvgeniy Ivanov 
8958a2b000SEvgeniy Ivanov 	return EIO;
9058a2b000SEvgeniy Ivanov }
9158a2b000SEvgeniy Ivanov 
9258a2b000SEvgeniy Ivanov #ifndef LIBSA_NO_FS_WRITE
9358a2b000SEvgeniy Ivanov __compactcall int
null_write(struct open_file * f,void * buf,size_t size,size_t * resid)9458a2b000SEvgeniy Ivanov null_write(struct open_file *f, void *buf, size_t size, size_t *resid)
9558a2b000SEvgeniy Ivanov {
9658a2b000SEvgeniy Ivanov 
9758a2b000SEvgeniy Ivanov 	return EIO;
9858a2b000SEvgeniy Ivanov }
9958a2b000SEvgeniy Ivanov #endif
10058a2b000SEvgeniy Ivanov 
10158a2b000SEvgeniy Ivanov #ifndef LIBSA_NO_FS_SEEK
10258a2b000SEvgeniy Ivanov __compactcall off_t
null_seek(struct open_file * f,off_t offset,int where)10358a2b000SEvgeniy Ivanov null_seek(struct open_file *f, off_t offset, int where)
10458a2b000SEvgeniy Ivanov {
10558a2b000SEvgeniy Ivanov 
10658a2b000SEvgeniy Ivanov 	return (off_t)-1;
10758a2b000SEvgeniy Ivanov }
10858a2b000SEvgeniy Ivanov #endif
10958a2b000SEvgeniy Ivanov 
11058a2b000SEvgeniy Ivanov __compactcall int
null_stat(struct open_file * f,struct stat * sb)11158a2b000SEvgeniy Ivanov null_stat(struct open_file *f, struct stat *sb)
11258a2b000SEvgeniy Ivanov {
11358a2b000SEvgeniy Ivanov 
11458a2b000SEvgeniy Ivanov 	return EIO;
11558a2b000SEvgeniy Ivanov }
11658a2b000SEvgeniy Ivanov 
11758a2b000SEvgeniy Ivanov #if defined(LIBSA_ENABLE_LS_OP)
118*0a6a1f1dSLionel Sambuc #include "ls.h"
11958a2b000SEvgeniy Ivanov __compactcall void
null_ls(struct open_file * f,const char * pattern)120*0a6a1f1dSLionel Sambuc null_ls(struct open_file *f, const char *pattern)
12158a2b000SEvgeniy Ivanov {
122*0a6a1f1dSLionel Sambuc 	lsunsup("nullfs");
12358a2b000SEvgeniy Ivanov }
12458a2b000SEvgeniy Ivanov #endif
125