Page MenuHomeFreeBSD

D11197.id29676.diff
No OneTemporary

D11197.id29676.diff

Index: sys/fs/msdosfs/denode.h
===================================================================
--- sys/fs/msdosfs/denode.h
+++ sys/fs/msdosfs/denode.h
@@ -214,6 +214,8 @@
#define VTODE(vp) ((struct denode *)(vp)->v_data)
#define DETOV(de) ((de)->de_vnode)
+#ifdef _KERNEL
+
#define DETIMES(dep, acc, mod, cre) do { \
if ((dep)->de_flag & DE_UPDATE) { \
(dep)->de_flag |= DE_MODIFIED; \
@@ -262,9 +264,17 @@
int msdosfs_inactive(struct vop_inactive_args *);
int msdosfs_reclaim(struct vop_reclaim_args *);
+#endif /* _KERNEL */
+
/*
* Internal service routine prototypes.
*/
+
+struct componentname;
+struct direntry;
+struct buf;
+struct ucred;
+
int deget(struct msdosfsmount *, u_long, u_long, struct denode **);
int uniqdosname(struct denode *, struct componentname *, u_char *);
Index: sys/fs/msdosfs/direntry.h
===================================================================
--- sys/fs/msdosfs/direntry.h
+++ sys/fs/msdosfs/direntry.h
@@ -133,7 +133,7 @@
#define DD_YEAR_MASK 0xFE00 /* year - 1980 */
#define DD_YEAR_SHIFT 9
-#if defined(_KERNEL) || defined(MAKEFS)
+#ifdef _KERNEL
struct mbnambuf {
size_t nb_len;
int nb_last_id;
@@ -159,5 +159,5 @@
uint8_t winChksum(uint8_t *name);
int winSlotCnt(const u_char *un, size_t unlen, struct msdosfsmount *pmp);
size_t winLenFixup(const u_char *un, size_t unlen);
-#endif /* _KERNEL || MAKEFS */
+#endif /* _KERNEL */
#endif /* !_FS_MSDOSFS_DIRENTRY_H_ */
Index: sys/fs/msdosfs/fat.h
===================================================================
--- sys/fs/msdosfs/fat.h
+++ sys/fs/msdosfs/fat.h
@@ -94,6 +94,7 @@
*/
#define DE_CLEAR 1 /* Zero out the blocks allocated */
+struct buf;
int pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp, u_long *cnp, int* sp);
int clusterfree(struct msdosfsmount *pmp, u_long cn, u_long *oldcnp);
int clusteralloc(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith, u_long *retcluster, u_long *got);
Index: sys/fs/msdosfs/msdosfs_fat.c
===================================================================
--- sys/fs/msdosfs/msdosfs_fat.c
+++ sys/fs/msdosfs/msdosfs_fat.c
@@ -49,10 +49,20 @@
*/
#include <sys/param.h>
+#include <sys/errno.h>
+#ifndef MAKEFS
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/mount.h>
#include <sys/vnode.h>
+#else
+#include <stdio.h>
+#include <strings.h>
+#include <string.h>
+
+#include "ffs/buf.h"
+#include "msdos/msdosfs_extern.h"
+#endif
#include <fs/msdosfs/bpb.h>
#include <fs/msdosfs/direntry.h>
@@ -60,7 +70,12 @@
#include <fs/msdosfs/fat.h>
#include <fs/msdosfs/msdosfsmount.h>
-#define FULL_RUN ((u_int)0xffffffff)
+#define FULL_RUN ((u_int)0xffffffff)
+#ifndef MAKEFS
+#define SYNCHRONOUS_WRITES(pmp) (pmp->pm_mountp->mnt_flag & MNT_SYNCHRONOUS)
+#else
+#define SYNCHRONOUS_WRITES(pmp) 1
+#endif
static int chainalloc(struct msdosfsmount *pmp, u_long start,
u_long count, u_long fillwith, u_long *retcluster,
@@ -341,7 +356,7 @@
((uint8_t *)bpn->b_data)[3] |= 0x80;
else if (cleanfat == 32)
((uint8_t *)bpn->b_data)[7] |= 0x08;
- if (pmp->pm_mountp->mnt_flag & MNT_SYNCHRONOUS)
+ if (SYNCHRONOUS_WRITES(pmp))
bwrite(bpn);
else
bdwrite(bpn);
@@ -351,7 +366,7 @@
/*
* Write out the first (or current) FAT last.
*/
- if (pmp->pm_mountp->mnt_flag & MNT_SYNCHRONOUS)
+ if (SYNCHRONOUS_WRITES(pmp))
bwrite(bp);
else
bdwrite(bp);
@@ -967,7 +982,6 @@
u_long cn, got;
struct msdosfsmount *pmp = dep->de_pmp;
struct buf *bp;
- daddr_t blkno;
/*
* Don't try to extend the root directory
@@ -1047,6 +1061,8 @@
*/
fc_setcache(dep, FC_LASTFC, frcn + got - 1, cn + got - 1);
+#ifndef MAKEFS
+ daddr_t blkno;
if (flags & DE_CLEAR) {
while (got-- > 0) {
/*
@@ -1080,6 +1096,23 @@
bdwrite(bp);
}
}
+#else
+ if ((flags & DE_CLEAR) &&
+ (dep->de_Attributes & ATTR_DIRECTORY)) {
+ while (got-- > 0) {
+ bp = getblk(pmp->pm_devvp,
+ cntobn(pmp, cn++),
+ pmp->pm_bpcluster, 0, 0, 0);
+ clrbuf(bp);
+ if (bpp) {
+ *bpp = bp;
+ bpp = NULL;
+ } else {
+ bdwrite(bp);
+ }
+ }
+ }
+#endif
}
return (0);
Index: sys/fs/msdosfs/msdosfs_lookup.c
===================================================================
--- sys/fs/msdosfs/msdosfs_lookup.c
+++ sys/fs/msdosfs/msdosfs_lookup.c
@@ -49,11 +49,18 @@
*/
#include <sys/param.h>
+#include <sys/errno.h>
+#ifndef MAKEFS
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/mount.h>
#include <sys/namei.h>
#include <sys/vnode.h>
+#else
+#include <string.h>
+#include "ffs/buf.h"
+#include "msdos/msdosfs_extern.h"
+#endif
#include <fs/msdosfs/bpb.h>
#include <fs/msdosfs/direntry.h>
@@ -61,6 +68,7 @@
#include <fs/msdosfs/fat.h>
#include <fs/msdosfs/msdosfsmount.h>
+#ifndef MAKEFS
static int msdosfs_lookup_(struct vnode *vdp, struct vnode **vpp,
struct componentname *cnp, uint64_t *inum);
@@ -584,6 +592,8 @@
return (0);
}
+#endif /* !MAKEFS */
+
/*
* dep - directory entry to copy into the directory
* ddep - directory to add to
@@ -749,7 +759,7 @@
return (0);
}
for (dentp = (struct direntry *)bp->b_data;
- (char *)dentp < bp->b_data + blsize;
+ (char *)dentp < (char *)bp->b_data + blsize;
dentp++) {
if (dentp->deName[0] != SLOT_DELETED &&
(dentp->deAttributes & ATTR_VOLUME) == 0) {
@@ -1039,7 +1049,7 @@
return error;
}
for (dentp = (struct direntry *)bp->b_data;
- (char *)dentp < bp->b_data + blsize;
+ (char *)dentp < (char *)bp->b_data + blsize;
dentp++) {
if (dentp->deName[0] == SLOT_EMPTY) {
/*
Index: sys/fs/msdosfs/msdosfsmount.h
===================================================================
--- sys/fs/msdosfs/msdosfsmount.h
+++ sys/fs/msdosfs/msdosfsmount.h
@@ -51,7 +51,7 @@
#ifndef _MSDOSFS_MSDOSFSMOUNT_H_
#define _MSDOSFS_MSDOSFSMOUNT_H_
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(MAKEFS)
#include <sys/types.h>
#include <sys/lock.h>
@@ -220,8 +220,9 @@
#define MSDOSFS_ASSERT_MP_LOCKED(pmp) \
lockmgr_assert(&(pmp)->pm_fatlock, KA_XLOCKED)
-#endif /* _KERNEL */
+#endif /* _KERNEL || MAKEFS */
+#ifndef MAKEFS
/*
* Arguments to mount MSDOS filesystems.
*/
@@ -239,6 +240,7 @@
char *cs_local; /* Local Charset */
mode_t dirmask; /* dir mask to be applied for msdosfs perms */
};
+#endif /* !MAKEFS */
/*
* Msdosfs mount options:

File Metadata

Mime Type
text/plain
Expires
Tue, Jan 21, 7:15 AM (19 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16003192
Default Alt Text
D11197.id29676.diff (6 KB)

Event Timeline