1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1989, 1991, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. Neither the name of the University nor the names of its contributors 16 * may be used to endorse or promote products derived from this software 17 * without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 #ifndef FAT_MOUNT_H 32 #define FAT_MOUNT_H 33 34 35 // Modified to support the Haiku FAT driver. 36 37 #include <sys/queue.h> 38 39 #ifdef FS_SHELL 40 #include "fssh_api_wrapper.h" 41 #else 42 #include <fs_interface.h> 43 #endif // !FS_SHELL 44 45 #include "sys/_mutex.h" 46 #include "sys/ucred.h" 47 48 49 /* 50 * filesystem statistics 51 */ 52 struct statfs { 53 uint64_t f_iosize; /* optimal transfer block size */ 54 char f_mntonname[B_PATH_NAME_LENGTH]; /* directory on which mounted */ 55 }; 56 57 struct mount { 58 int mnt_kern_flag; /* kernel only flags */ 59 uint64_t mnt_flag; /* flags shared with user */ 60 struct vfsconf* mnt_vfc; /* configuration info */ 61 struct mtx mnt_mtx; 62 struct statfs mnt_stat; /* cache of filesystem stats */ 63 // In the Haiku port, mnt_stat.f_mntonname is only initialized in the kernel addon 64 // (not in fat_shell or fat_userland) 65 void* mnt_data; /* private data */ 66 int mnt_iosize_max; /* max size for clusters, etc */ 67 68 // Members added for Haiku port 69 struct fs_volume* mnt_fsvolume; 70 void* mnt_cache; 71 // Haiku block cache 72 int32 mnt_volentry; 73 // index of volume label entry in root directory, or -1 if no such entry was found 74 struct { 75 rw_lock lock; 76 ino_t cur_vnid; 77 uint32 cache_size; 78 struct vcache_entry** by_vnid; 79 struct vcache_entry** by_loc; 80 } vcache; 81 // hash tables storing the default (location-based) and final inode numbers for each node 82 }; 83 84 /* 85 * User specifiable flags, stored in mnt_flag. 86 */ 87 #define MNT_RDONLY 0x0000000000000001ULL /* read only filesystem */ 88 #define MNT_SYNCHRONOUS 0x0000000000000002ULL /* fs written synchronously */ 89 #define MNT_ASYNC 0x0000000000000040ULL /* fs written asynchronously */ 90 #define MNT_NOCLUSTERW 0x0000000080000000ULL /* disable cluster write */ 91 92 /* 93 * Flags for various system call interfaces. 94 */ 95 #define MNT_WAIT 1 /* synchronously wait for I/O to complete */ 96 97 // For the Haiku port, vfc_typenum will be arbitrarily set to 1. 98 struct vfsconf { 99 int vfc_typenum; /* historic filesystem type number */ 100 }; 101 102 103 #endif // FAT_MOUNT_H 104