From owner-freebsd-bugs@FreeBSD.ORG Tue Nov 9 15:50:07 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 081871065674 for ; Tue, 9 Nov 2010 15:50:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B80F98FC1A for ; Tue, 9 Nov 2010 15:50:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id oA9Fo6kf007703 for ; Tue, 9 Nov 2010 15:50:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id oA9Fo6H2007702; Tue, 9 Nov 2010 15:50:06 GMT (envelope-from gnats) Resent-Date: Tue, 9 Nov 2010 15:50:06 GMT Resent-Message-Id: <201011091550.oA9Fo6H2007702@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Pedro Giffuni Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 399FF1065693 for ; Tue, 9 Nov 2010 15:42:48 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 0E5908FC1D for ; Tue, 9 Nov 2010 15:42:48 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id oA9FgleG055696 for ; Tue, 9 Nov 2010 15:42:47 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id oA9FglEh055695; Tue, 9 Nov 2010 15:42:47 GMT (envelope-from nobody) Message-Id: <201011091542.oA9FglEh055695@www.freebsd.org> Date: Tue, 9 Nov 2010 15:42:47 GMT From: Pedro Giffuni To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/152079: msdosfs: Small cleanups from the other NetBSD/OpenBSD X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2010 15:50:07 -0000 >Number: 152079 >Category: kern >Synopsis: msdosfs: Small cleanups from the other NetBSD/OpenBSD >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Nov 09 15:50:06 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Pedro Giffuni >Release: 8.1-RELEASE >Organization: >Environment: FreeBSD mogwai.giffuni.net 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 2010 root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: Here are some small cleanups to sync with the other BSDs. denode.h NetBSD: protect userland exported files against multiple inclusion. OpenBSD: Move some macros in to outside the #ifdef _KERNEL so that libkvm doesn't need to define that, thereby avoiding some warnings. msdosfs_lookup.c NetBSD: Return EINVAL for rename and delete operations to the root directory instead of the erroneous EROFS. >How-To-Repeat: >Fix: Patch follows. Patch attached with submission follows: --- msdosfs/denode.h.orig 2010-11-09 09:54:16.000000000 +0000 +++ msdosfs/denode.h 2010-11-09 10:11:06.000000000 +0000 @@ -47,6 +47,8 @@ * * October 1992 */ +#ifndef _FS_MSDOSFS_DENODE_H_ +#define _FS_MSDOSFS_DENODE_H_ /* * This is the pc filesystem specific portion of the vnode structure. @@ -207,8 +209,6 @@ ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), \ putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16)) -#ifdef _KERNEL - #define VTODE(vp) ((struct denode *)(vp)->v_data) #define DETOV(de) ((de)->de_vnode) @@ -254,6 +254,8 @@ #endif }; +#ifdef _KERNEL + extern struct vop_vector msdosfs_vnodeops; int msdosfs_lookup(struct vop_cachedlookup_args *); @@ -279,3 +281,4 @@ int detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred, struct thread *td); int doscheckpath( struct denode *source, struct denode *target); #endif /* _KERNEL */ +#endif /* !_FS_MSDOSFS_DENODE_H_ */ --- msdosfs/msdosfs_lookup.c.orig 2010-11-09 09:49:14.000000000 +0000 +++ msdosfs/msdosfs_lookup.c 2010-11-09 09:50:44.000000000 +0000 @@ -458,7 +458,7 @@ * Don't allow deleting the root. */ if (blkoff == MSDOSFSROOT_OFS) - return EROFS; /* really? XXX */ + return EINVAL; /* * Write access to directory required to delete files. @@ -491,7 +491,7 @@ */ if (nameiop == RENAME && (flags & ISLASTCN)) { if (blkoff == MSDOSFSROOT_OFS) - return EROFS; /* really? XXX */ + return EINVAL; error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_thread); if (error) >Release-Note: >Audit-Trail: >Unformatted: