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 2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #include <sys/systm.h> 28 #include <sys/vnode.h> 29 #include <sys/uio.h> 30 #include <sys/errno.h> 31 #include <sys/fs/ufs_inode.h> 32 33 #include <sys/fs/ufs_filio.h> 34 #include <sys/fs/ufs_log.h> 35 #include <sys/sunddi.h> 36 #include <sys/file.h> 37 38 /* ARGSUSED */ 39 int 40 ufs_fiologenable(vnode_t *vp, fiolog_t *ufl, cred_t *cr, int flags) 41 { 42 int error = 0; 43 fiolog_t fl; 44 45 /* 46 * Enable logging 47 */ 48 if (ddi_copyin(ufl, &fl, sizeof (fl), flags)) 49 return (EFAULT); 50 error = lufs_enable(vp, &fl, cr); 51 if (ddi_copyout(&fl, ufl, sizeof (*ufl), flags)) 52 return (EFAULT); 53 54 return (error); 55 } 56 57 /* ARGSUSED */ 58 int 59 ufs_fiologdisable(vnode_t *vp, fiolog_t *ufl, cred_t *cr, int flags) 60 { 61 int error = 0; 62 struct fiolog fl; 63 64 /* 65 * Disable logging 66 */ 67 if (ddi_copyin(ufl, &fl, sizeof (fl), flags)) 68 return (EFAULT); 69 error = lufs_disable(vp, &fl); 70 if (ddi_copyout(&fl, ufl, sizeof (*ufl), flags)) 71 return (EFAULT); 72 73 return (error); 74 } 75 76 /* 77 * ufs_fioislog 78 * Return true if log is present and active; otherwise false 79 */ 80 /* ARGSUSED */ 81 int 82 ufs_fioislog(vnode_t *vp, uint32_t *islog, cred_t *cr, int flags) 83 { 84 ufsvfs_t *ufsvfsp = VTOI(vp)->i_ufsvfs; 85 int active; 86 87 active = (ufsvfsp && ufsvfsp->vfs_log); 88 if (flags & FKIOCTL) 89 *islog = active; 90 else if (suword32(islog, active)) 91 return (EFAULT); 92 return (0); 93 } 94