xref: /openbsd/sys/isofs/cd9660/cd9660_extern.h (revision 7196c146)
1*7196c146Ssemarie /*	$OpenBSD: cd9660_extern.h,v 1.16 2023/07/17 09:41:20 semarie Exp $	*/
2c2afd936Sniklas /*	$NetBSD: cd9660_extern.h,v 1.1 1997/01/24 00:24:53 cgd Exp $	*/
3c2afd936Sniklas 
4c2afd936Sniklas /*-
5c2afd936Sniklas  * Copyright (c) 1994
6c2afd936Sniklas  *	The Regents of the University of California.  All rights reserved.
7c2afd936Sniklas  *
8c2afd936Sniklas  * This code is derived from software contributed to Berkeley
9c2afd936Sniklas  * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
10c2afd936Sniklas  * Support code is derived from software contributed to Berkeley
11c2afd936Sniklas  * by Atsushi Murai (amurai@spec.co.jp).
12c2afd936Sniklas  *
13c2afd936Sniklas  * Redistribution and use in source and binary forms, with or without
14c2afd936Sniklas  * modification, are permitted provided that the following conditions
15c2afd936Sniklas  * are met:
16c2afd936Sniklas  * 1. Redistributions of source code must retain the above copyright
17c2afd936Sniklas  *    notice, this list of conditions and the following disclaimer.
18c2afd936Sniklas  * 2. Redistributions in binary form must reproduce the above copyright
19c2afd936Sniklas  *    notice, this list of conditions and the following disclaimer in the
20c2afd936Sniklas  *    documentation and/or other materials provided with the distribution.
2129295d1cSmillert  * 3. Neither the name of the University nor the names of its contributors
22c2afd936Sniklas  *    may be used to endorse or promote products derived from this software
23c2afd936Sniklas  *    without specific prior written permission.
24c2afd936Sniklas  *
25c2afd936Sniklas  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26c2afd936Sniklas  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27c2afd936Sniklas  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28c2afd936Sniklas  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29c2afd936Sniklas  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30c2afd936Sniklas  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31c2afd936Sniklas  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32c2afd936Sniklas  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33c2afd936Sniklas  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34c2afd936Sniklas  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35c2afd936Sniklas  * SUCH DAMAGE.
36c2afd936Sniklas  *
37c2afd936Sniklas  *	@(#)iso.h	8.4 (Berkeley) 12/5/94
38c2afd936Sniklas  */
39c2afd936Sniklas 
40c2afd936Sniklas /*
41c2afd936Sniklas  * Definitions used in the kernel for cd9660 file system support.
42c2afd936Sniklas  */
43c2afd936Sniklas 
44c2afd936Sniklas /* CD-ROM Format type */
45c2afd936Sniklas enum ISO_FTYPE  { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP, ISO_FTYPE_ECMA };
46c2afd936Sniklas 
47c2afd936Sniklas #ifndef	ISOFSMNT_ROOT
48c2afd936Sniklas #define	ISOFSMNT_ROOT	0
49c2afd936Sniklas #endif
50c2afd936Sniklas 
51c2afd936Sniklas struct iso_mnt {
52c2afd936Sniklas 	int im_flags;
53c2afd936Sniklas 
54c2afd936Sniklas 	struct mount *im_mountp;
55c2afd936Sniklas 	dev_t im_dev;
56c2afd936Sniklas 	struct vnode *im_devvp;
57c2afd936Sniklas 
58c2afd936Sniklas 	int logical_block_size;
59c2afd936Sniklas 	int im_bshift;
60c2afd936Sniklas 	int im_bmask;
61c2afd936Sniklas 
62c2afd936Sniklas 	int volume_space_size;
63c2afd936Sniklas 	struct netexport im_export;
64c2afd936Sniklas 
65c2afd936Sniklas 	char root[ISODCL (157, 190)];
66c2afd936Sniklas 	int root_extent;
67c2afd936Sniklas 	int root_size;
68c2afd936Sniklas 	enum ISO_FTYPE  iso_ftype;
69c2afd936Sniklas 
70c2afd936Sniklas 	int rr_skip;
71c2afd936Sniklas 	int rr_skip0;
7249f343b7Sd 
7349f343b7Sd 	int joliet_level;
74c2afd936Sniklas };
75c2afd936Sniklas 
76c2afd936Sniklas #define VFSTOISOFS(mp)	((struct iso_mnt *)((mp)->mnt_data))
77c2afd936Sniklas 
78c2afd936Sniklas #define blkoff(imp, loc)	((loc) & (imp)->im_bmask)
79c2afd936Sniklas #define lblktosize(imp, blk)	((blk) << (imp)->im_bshift)
80c2afd936Sniklas #define lblkno(imp, loc)	((loc) >> (imp)->im_bshift)
81c2afd936Sniklas #define blksize(imp, ip, lbn)	((imp)->logical_block_size)
82c2afd936Sniklas 
83c4071fd1Smillert int cd9660_mount(struct mount *, const char *, void *,
84c4071fd1Smillert                       struct nameidata *, struct proc *);
85c4071fd1Smillert int cd9660_start(struct mount *, int, struct proc *);
86c4071fd1Smillert int cd9660_unmount(struct mount *, int, struct proc *);
87c4071fd1Smillert int cd9660_root(struct mount *, struct vnode **);
88c4071fd1Smillert int cd9660_quotactl(struct mount *, int, uid_t, caddr_t, struct proc *);
89c4071fd1Smillert int cd9660_statfs(struct mount *, struct statfs *, struct proc *);
90976e9839Sderaadt int cd9660_sync(struct mount *, int, int, struct ucred *, struct proc *);
91c4071fd1Smillert int cd9660_vget(struct mount *, ino_t, struct vnode **);
92c4071fd1Smillert int cd9660_fhtovp(struct mount *, struct fid *, struct vnode **);
93c4071fd1Smillert int cd9660_vptofh(struct vnode *, struct fid *);
94c4071fd1Smillert int cd9660_init(struct vfsconf *);
95c4071fd1Smillert int cd9660_check_export(struct mount *, struct mbuf *, int *,
96c4071fd1Smillert                              struct ucred **);
97c2afd936Sniklas 
98c4071fd1Smillert int cd9660_mountroot(void);
99c2afd936Sniklas 
1002d6b9e38Sclaudio extern const struct vops	cd9660_vops;
1012d6b9e38Sclaudio extern const struct vops	cd9660_specvops;
102c2afd936Sniklas #ifdef FIFO
1032d6b9e38Sclaudio extern const struct vops	cd9660_fifovops;
104c2afd936Sniklas #endif
105c2afd936Sniklas 
106c4071fd1Smillert int	isochar(const u_char *, const u_char *, int, u_char *);
107c4071fd1Smillert int	isofncmp(const u_char *, int, const u_char *, int, int);
108c4071fd1Smillert void	isofntrans(u_char *, int, u_char *, u_short *, int, int, int);
1090cad8b22Sguenther cdino_t	isodirino(struct iso_directory_record *, struct iso_mnt *);
110