1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 1998 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_LOCKFS_H 28 #define _SYS_LOCKFS_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #ifdef _SYSCALL32 35 /* 36 * ILP32 version of lockfs, used in ufs_ioctl() to support 32-bit app in 37 * LP64 kernel 38 */ 39 struct lockfs32 { 40 uint32_t lf_lock; /* desired lock */ 41 uint32_t lf_flags; /* misc flags */ 42 uint32_t lf_key; /* lock key */ 43 uint32_t lf_comlen; /* length of comment */ 44 uint32_t lf_comment; /* address of comment */ 45 }; 46 #endif /* _SYSCALL32 */ 47 48 struct lockfs { 49 ulong_t lf_lock; /* desired lock */ 50 ulong_t lf_flags; /* misc flags */ 51 ulong_t lf_key; /* lock key */ 52 ulong_t lf_comlen; /* length of comment */ 53 caddr_t lf_comment; /* address of comment */ 54 }; 55 56 /* 57 * lf_lock and lf_locking 58 */ 59 #define LOCKFS_ULOCK 0 /* unlock */ 60 #define LOCKFS_WLOCK 1 /* write lock */ 61 #define LOCKFS_NLOCK 2 /* name lock */ 62 #define LOCKFS_DLOCK 3 /* delete lock */ 63 #define LOCKFS_HLOCK 4 /* hard lock */ 64 #define LOCKFS_ELOCK 5 /* error lock */ 65 #define LOCKFS_ROELOCK 6 /* error lock (read-only) - unimplemented */ 66 #define LOCKFS_MAXLOCK 6 /* maximum lock number */ 67 68 /* 69 * lf_flags 70 */ 71 #define LOCKFS_BUSY 0x00000001 /* lock is being set */ 72 #define LOCKFS_MOD 0x00000002 /* file system modified */ 73 74 #define LOCKFS_MAXCOMMENTLEN 1024 /* maximum comment length */ 75 76 /* 77 * some nice checking macros 78 */ 79 80 #define LOCKFS_IS_BUSY(LF) ((LF)->lf_flags & LOCKFS_BUSY) 81 #define LOCKFS_IS_MOD(LF) ((LF)->lf_flags & LOCKFS_MOD) 82 83 #define LOCKFS_CLR_BUSY(LF) ((LF)->lf_flags &= ~LOCKFS_BUSY) 84 #define LOCKFS_CLR_MOD(LF) ((LF)->lf_flags &= ~LOCKFS_MOD) 85 86 #define LOCKFS_SET_MOD(LF) ((LF)->lf_flags |= LOCKFS_MOD) 87 #define LOCKFS_SET_BUSY(LF) ((LF)->lf_flags |= LOCKFS_BUSY) 88 89 #define LOCKFS_IS_WLOCK(LF) ((LF)->lf_lock == LOCKFS_WLOCK) 90 #define LOCKFS_IS_HLOCK(LF) ((LF)->lf_lock == LOCKFS_HLOCK) 91 #define LOCKFS_IS_ROELOCK(LF) ((LF)->lf_lock == LOCKFS_ROELOCK) 92 #define LOCKFS_IS_ELOCK(LF) ((LF)->lf_lock == LOCKFS_ELOCK) 93 #define LOCKFS_IS_ULOCK(LF) ((LF)->lf_lock == LOCKFS_ULOCK) 94 #define LOCKFS_IS_NLOCK(LF) ((LF)->lf_lock == LOCKFS_NLOCK) 95 #define LOCKFS_IS_DLOCK(LF) ((LF)->lf_lock == LOCKFS_DLOCK) 96 97 #ifdef __cplusplus 98 } 99 #endif 100 101 #endif /* _SYS_LOCKFS_H */ 102