kern/152079: msdosfs: Small cleanups from the other NetBSD/OpenBSD
Pedro Giffuni
giffunip at tutopia.com
Tue Nov 9 15:50:07 UTC 2010
>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 at 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 <msdosfs/denode.h> 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:
More information about the freebsd-bugs
mailing list