Page MenuHomeFreeBSD

D61883.1795451309.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D61883.1795451309.diff

diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -132,6 +132,8 @@
void *dos, *win, *local;
int error, v;
+ KASSERT(pmp != NULL, ("update_mp: missing mnt_data"));
+
if (!vfs_getopt(mp->mnt_optnew, "kiconv", NULL, NULL)) {
if (msdosfs_iconv != NULL) {
error = vfs_getopt(mp->mnt_optnew,
@@ -418,9 +420,9 @@
* entry that starts with 0x00).
*/
static int
-rootdir_free(struct msdosfsmount* pmp)
+rootdir_free(struct msdosfsmount* pmp, int *ffreep)
{
- struct buf *bp;
+ struct buf *bp = NULL;
struct direntry *dep;
u_long readsize;
int dirclu;
@@ -428,6 +430,7 @@
int dirmax;
int dirleft;
int ffree;
+ int error;
dirclu = pmp->pm_rootdirblk;
@@ -457,12 +460,14 @@
printf("rootdir_free: dirclu=%d dirleft=%d readsize=%lu\n",
dirclu, dirleft, readsize);
#endif
- if (bread(pmp->pm_devvp, dirclu, readsize, NOCRED, &bp) != 0) {
- printf("rootdir_free: read error\n");
+ error = bread(pmp->pm_devvp, dirclu, readsize, NOCRED, &bp);
+ if (error != 0) {
+ printf("rootdir_free: read error %d\n", error);
if (bp != NULL)
brelse(bp);
- return (-1);
+ return (error);
}
+
dirmax = readsize / sizeof(struct direntry);
for (diridx = 0; diridx < dirmax && dirleft > 0;
diridx++, dirleft--) {
@@ -496,7 +501,9 @@
bp = NULL;
dirclu += readsize / DEV_BSIZE;
}
- return (ffree);
+
+ *ffreep = ffree;
+ return (0);
}
static int
@@ -834,6 +841,14 @@
/*
* Finish up.
*/
+ if (FAT32(pmp)) {
+ pmp->pm_rootdirfree = 0;
+ } else {
+ error = rootdir_free(pmp, &pmp->pm_rootdirfree);
+ if (error != 0)
+ goto error_exit;
+ }
+
if (ronly)
pmp->pm_flags |= MSDOSFSMNT_RONLY;
else {
@@ -842,14 +857,6 @@
pmp->pm_fmod = 1;
}
- if (FAT32(pmp)) {
- pmp->pm_rootdirfree = 0;
- } else {
- pmp->pm_rootdirfree = rootdir_free(pmp);
- if (pmp->pm_rootdirfree < 0)
- goto error_exit;
- }
-
mp->mnt_data = pmp;
mp->mnt_stat.f_fsid.val[0] = dev2udev(dev);
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 23, 4:28 PM (14 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41911524
Default Alt Text
D61883.1795451309.diff (2 KB)

Event Timeline