working with pack labels
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Fri, 3 Apr 1987 06:49:42 +0000 (22:49 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Fri, 3 Apr 1987 06:49:42 +0000 (22:49 -0800)
SCCS-vsn: sys/kern/kern_exec.c 7.4
SCCS-vsn: sys/ufs/ffs/ffs_alloc.c 7.2
SCCS-vsn: sys/ufs/lfs/lfs_alloc.c 7.2
SCCS-vsn: sys/kern/vfs_bio.c 7.2
SCCS-vsn: sys/kern/vfs_cluster.c 7.2
SCCS-vsn: sys/ufs/ffs/ffs_balloc.c 7.2
SCCS-vsn: sys/ufs/lfs/lfs_balloc.c 7.2
SCCS-vsn: sys/ufs/ffs/ffs_inode.c 7.2
SCCS-vsn: sys/ufs/ffs/ufs_inode.c 7.2
SCCS-vsn: sys/ufs/lfs/lfs_inode.c 7.2
SCCS-vsn: sys/ufs/ufs/ufs_inode.c 7.2
SCCS-vsn: sys/ufs/ffs/ffs_vfsops.c 7.3
SCCS-vsn: sys/ufs/ffs/ufs_vfsops.c 7.3
SCCS-vsn: sys/ufs/lfs/lfs_vfsops.c 7.3
SCCS-vsn: sys/ufs/ufs/ufs_vfsops.c 7.3
SCCS-vsn: sys/kern/vfs_lookup.c 7.2
SCCS-vsn: sys/ufs/ffs/ufs_lookup.c 7.2
SCCS-vsn: sys/ufs/ufs/ufs_lookup.c 7.2
SCCS-vsn: sys/ufs/ffs/ffs_subr.c 7.4
SCCS-vsn: sys/vm/vm_swap.c 7.2
SCCS-vsn: sys/kern/kern_physio.c 7.3

21 files changed:
usr/src/sys/kern/kern_exec.c
usr/src/sys/kern/kern_physio.c
usr/src/sys/kern/vfs_bio.c
usr/src/sys/kern/vfs_cluster.c
usr/src/sys/kern/vfs_lookup.c
usr/src/sys/ufs/ffs/ffs_alloc.c
usr/src/sys/ufs/ffs/ffs_balloc.c
usr/src/sys/ufs/ffs/ffs_inode.c
usr/src/sys/ufs/ffs/ffs_subr.c
usr/src/sys/ufs/ffs/ffs_vfsops.c
usr/src/sys/ufs/ffs/ufs_inode.c
usr/src/sys/ufs/ffs/ufs_lookup.c
usr/src/sys/ufs/ffs/ufs_vfsops.c
usr/src/sys/ufs/lfs/lfs_alloc.c
usr/src/sys/ufs/lfs/lfs_balloc.c
usr/src/sys/ufs/lfs/lfs_inode.c
usr/src/sys/ufs/lfs/lfs_vfsops.c
usr/src/sys/ufs/ufs/ufs_inode.c
usr/src/sys/ufs/ufs/ufs_lookup.c
usr/src/sys/ufs/ufs/ufs_vfsops.c
usr/src/sys/vm/vm_swap.c

index 91e44a4..d83ba16 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)kern_exec.c 7.3.1.1 (Berkeley) %G%
+ *     @(#)kern_exec.c 7.4 (Berkeley) %G%
  */
 
 #include "../machine/reg.h"
  */
 
 #include "../machine/reg.h"
index 96d7120..eedca3a 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)kern_physio.c       7.2.1.1 (Berkeley) %G%
+ *     @(#)kern_physio.c       7.3 (Berkeley) %G%
  */
 
 #include "../machine/pte.h"
  */
 
 #include "../machine/pte.h"
index 29ec5df..6bd5bc8 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)vfs_bio.c   7.1.1.1 (Berkeley) %G%
+ *     @(#)vfs_bio.c   7.2 (Berkeley) %G%
  */
 
 #include "../machine/pte.h"
  */
 
 #include "../machine/pte.h"
@@ -561,6 +561,9 @@ biodone(bp)
 
 /*
  * Insure that no part of a specified block is in an incore buffer.
 
 /*
  * Insure that no part of a specified block is in an incore buffer.
+#ifdef SECSIZE
+ * "size" is given in device blocks (the units of b_blkno).
+#endif SECSIZE
 #ifdef SECSIZE
  * "size" is given in device blocks (the units of b_blkno).
 #endif SECSIZE
 #ifdef SECSIZE
  * "size" is given in device blocks (the units of b_blkno).
 #endif SECSIZE
index c711ed0..b3e79ad 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)vfs_cluster.c       7.1.1.1 (Berkeley) %G%
+ *     @(#)vfs_cluster.c       7.2 (Berkeley) %G%
  */
 
 #include "../machine/pte.h"
  */
 
 #include "../machine/pte.h"
@@ -561,6 +561,9 @@ biodone(bp)
 
 /*
  * Insure that no part of a specified block is in an incore buffer.
 
 /*
  * Insure that no part of a specified block is in an incore buffer.
+#ifdef SECSIZE
+ * "size" is given in device blocks (the units of b_blkno).
+#endif SECSIZE
 #ifdef SECSIZE
  * "size" is given in device blocks (the units of b_blkno).
 #endif SECSIZE
 #ifdef SECSIZE
  * "size" is given in device blocks (the units of b_blkno).
 #endif SECSIZE
index 64b9d8f..a606530 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)vfs_lookup.c        7.1.1.1 (Berkeley) %G%
+ *     @(#)vfs_lookup.c        7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
index 0dd37ef..cc78876 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ffs_alloc.c 7.1.1.1 (Berkeley) %G%
+ *     @(#)ffs_alloc.c 7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
index 3f115b4..b481675 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ffs_balloc.c        7.1.1.1 (Berkeley) %G%
+ *     @(#)ffs_balloc.c        7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
index 2320433..6f51d86 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ffs_inode.c 7.1.1.1 (Berkeley) %G%
+ *     @(#)ffs_inode.c 7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
index e2ed4f2..d5b4db9 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ffs_subr.c  7.3.1.1 (Berkeley) %G%
+ *     @(#)ffs_subr.c  7.4 (Berkeley) %G%
  */
 
 #ifdef KERNEL
  */
 
 #ifdef KERNEL
index 7942a36..e6f3cdf 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ffs_vfsops.c        7.2.1.1 (Berkeley) %G%
+ *     @(#)ffs_vfsops.c        7.3 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -20,6 +20,9 @@
 #include "ioctl.h"
 #include "disklabel.h"
 #include "stat.h"
 #include "ioctl.h"
 #include "disklabel.h"
 #include "stat.h"
+#include "ioctl.h"
+#include "disklabel.h"
+#include "stat.h"
 
 smount()
 {
 
 smount()
 {
@@ -84,6 +87,12 @@ mountfs(dev, ronly, ip)
        if (error)
                goto out;
        needclose = 1;
        if (error)
                goto out;
        needclose = 1;
+       if ((*bdevsw[major(dev)].d_ioctl)(dev, DIOCGPART,
+           (caddr_t)&dpart, FREAD) == 0) {
+               havepart = 1;
+               size = dpart.disklab->d_secsize;
+       } else
+               size = DEV_BSIZE;
 #ifdef SECSIZE
        /*
         * If possible, determine hardware sector size
 #ifdef SECSIZE
        /*
         * If possible, determine hardware sector size
@@ -140,6 +149,12 @@ found:
        fs->fs_ronly = (ronly != 0);
        if (ronly == 0)
                fs->fs_fmod = 1;
        fs->fs_ronly = (ronly != 0);
        if (ronly == 0)
                fs->fs_fmod = 1;
+       if (havepart) {
+               dpart.part->p_fstype = FS_BSDFFS;
+               dpart.part->p_fsize = fs->fs_fsize;
+               dpart.part->p_frag = fs->fs_frag;
+               fs->fs_dbsize = size;
+       }
 #ifdef SECSIZE
        /*
         * If we have a disk label, force per-partition
 #ifdef SECSIZE
        /*
         * If we have a disk label, force per-partition
@@ -202,6 +217,7 @@ found:
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
        fs->fs_interleave = MAX(fs->fs_interleave, 1);          /* XXX */
 
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
        fs->fs_interleave = MAX(fs->fs_interleave, 1);          /* XXX */
 
+
        return (fs);
 out:
        if (error == 0)
        return (fs);
 out:
        if (error == 0)
@@ -209,6 +225,9 @@ out:
        if (needclose)
                (void) closei((dev_t)ip->i_rdev, IFBLK,
                    ronly? FREAD : FREAD|FWRITE);
        if (needclose)
                (void) closei((dev_t)ip->i_rdev, IFBLK,
                    ronly? FREAD : FREAD|FWRITE);
+       if (needclose)
+               (void) closei((dev_t)ip->i_rdev, IFBLK,
+                   ronly? FREAD : FREAD|FWRITE);
        if (ip)
                iput(ip);
        if (mp)
        if (ip)
                iput(ip);
        if (mp)
@@ -240,6 +259,7 @@ unmount1(fname, forcibly)
        register struct inode *ip;
        register struct fs *fs;
 
        register struct inode *ip;
        register struct fs *fs;
 
+       forcibly = 0;                                   /* XXX */
        forcibly = 0;                                   /* XXX */
        error = getmdev(&dev, fname);
        if (error)
        forcibly = 0;                                   /* XXX */
        error = getmdev(&dev, fname);
        if (error)
index c72684c..e8de953 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ufs_inode.c 7.1.1.1 (Berkeley) %G%
+ *     @(#)ufs_inode.c 7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
index 9a2f656..83dc198 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ufs_lookup.c        7.1.1.1 (Berkeley) %G%
+ *     @(#)ufs_lookup.c        7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
index fc3de6d..745f9b9 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ufs_vfsops.c        7.2.1.1 (Berkeley) %G%
+ *     @(#)ufs_vfsops.c        7.3 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -20,6 +20,9 @@
 #include "ioctl.h"
 #include "disklabel.h"
 #include "stat.h"
 #include "ioctl.h"
 #include "disklabel.h"
 #include "stat.h"
+#include "ioctl.h"
+#include "disklabel.h"
+#include "stat.h"
 
 smount()
 {
 
 smount()
 {
@@ -84,6 +87,12 @@ mountfs(dev, ronly, ip)
        if (error)
                goto out;
        needclose = 1;
        if (error)
                goto out;
        needclose = 1;
+       if ((*bdevsw[major(dev)].d_ioctl)(dev, DIOCGPART,
+           (caddr_t)&dpart, FREAD) == 0) {
+               havepart = 1;
+               size = dpart.disklab->d_secsize;
+       } else
+               size = DEV_BSIZE;
 #ifdef SECSIZE
        /*
         * If possible, determine hardware sector size
 #ifdef SECSIZE
        /*
         * If possible, determine hardware sector size
@@ -140,6 +149,12 @@ found:
        fs->fs_ronly = (ronly != 0);
        if (ronly == 0)
                fs->fs_fmod = 1;
        fs->fs_ronly = (ronly != 0);
        if (ronly == 0)
                fs->fs_fmod = 1;
+       if (havepart) {
+               dpart.part->p_fstype = FS_BSDFFS;
+               dpart.part->p_fsize = fs->fs_fsize;
+               dpart.part->p_frag = fs->fs_frag;
+               fs->fs_dbsize = size;
+       }
 #ifdef SECSIZE
        /*
         * If we have a disk label, force per-partition
 #ifdef SECSIZE
        /*
         * If we have a disk label, force per-partition
@@ -202,6 +217,7 @@ found:
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
        fs->fs_interleave = MAX(fs->fs_interleave, 1);          /* XXX */
 
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
        fs->fs_interleave = MAX(fs->fs_interleave, 1);          /* XXX */
 
+
        return (fs);
 out:
        if (error == 0)
        return (fs);
 out:
        if (error == 0)
@@ -209,6 +225,9 @@ out:
        if (needclose)
                (void) closei((dev_t)ip->i_rdev, IFBLK,
                    ronly? FREAD : FREAD|FWRITE);
        if (needclose)
                (void) closei((dev_t)ip->i_rdev, IFBLK,
                    ronly? FREAD : FREAD|FWRITE);
+       if (needclose)
+               (void) closei((dev_t)ip->i_rdev, IFBLK,
+                   ronly? FREAD : FREAD|FWRITE);
        if (ip)
                iput(ip);
        if (mp)
        if (ip)
                iput(ip);
        if (mp)
@@ -240,6 +259,7 @@ unmount1(fname, forcibly)
        register struct inode *ip;
        register struct fs *fs;
 
        register struct inode *ip;
        register struct fs *fs;
 
+       forcibly = 0;                                   /* XXX */
        forcibly = 0;                                   /* XXX */
        error = getmdev(&dev, fname);
        if (error)
        forcibly = 0;                                   /* XXX */
        error = getmdev(&dev, fname);
        if (error)
index 98712a8..19db9e4 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)lfs_alloc.c 7.1.1.1 (Berkeley) %G%
+ *     @(#)lfs_alloc.c 7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
index 48870ad..a6bb42b 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)lfs_balloc.c        7.1.1.1 (Berkeley) %G%
+ *     @(#)lfs_balloc.c        7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
index 998c3a1..539e0c3 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)lfs_inode.c 7.1.1.1 (Berkeley) %G%
+ *     @(#)lfs_inode.c 7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
index 0628f9e..bbdd699 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)lfs_vfsops.c        7.2.1.1 (Berkeley) %G%
+ *     @(#)lfs_vfsops.c        7.3 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -20,6 +20,9 @@
 #include "ioctl.h"
 #include "disklabel.h"
 #include "stat.h"
 #include "ioctl.h"
 #include "disklabel.h"
 #include "stat.h"
+#include "ioctl.h"
+#include "disklabel.h"
+#include "stat.h"
 
 smount()
 {
 
 smount()
 {
@@ -84,6 +87,12 @@ mountfs(dev, ronly, ip)
        if (error)
                goto out;
        needclose = 1;
        if (error)
                goto out;
        needclose = 1;
+       if ((*bdevsw[major(dev)].d_ioctl)(dev, DIOCGPART,
+           (caddr_t)&dpart, FREAD) == 0) {
+               havepart = 1;
+               size = dpart.disklab->d_secsize;
+       } else
+               size = DEV_BSIZE;
 #ifdef SECSIZE
        /*
         * If possible, determine hardware sector size
 #ifdef SECSIZE
        /*
         * If possible, determine hardware sector size
@@ -140,6 +149,12 @@ found:
        fs->fs_ronly = (ronly != 0);
        if (ronly == 0)
                fs->fs_fmod = 1;
        fs->fs_ronly = (ronly != 0);
        if (ronly == 0)
                fs->fs_fmod = 1;
+       if (havepart) {
+               dpart.part->p_fstype = FS_BSDFFS;
+               dpart.part->p_fsize = fs->fs_fsize;
+               dpart.part->p_frag = fs->fs_frag;
+               fs->fs_dbsize = size;
+       }
 #ifdef SECSIZE
        /*
         * If we have a disk label, force per-partition
 #ifdef SECSIZE
        /*
         * If we have a disk label, force per-partition
@@ -202,6 +217,7 @@ found:
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
        fs->fs_interleave = MAX(fs->fs_interleave, 1);          /* XXX */
 
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
        fs->fs_interleave = MAX(fs->fs_interleave, 1);          /* XXX */
 
+
        return (fs);
 out:
        if (error == 0)
        return (fs);
 out:
        if (error == 0)
@@ -209,6 +225,9 @@ out:
        if (needclose)
                (void) closei((dev_t)ip->i_rdev, IFBLK,
                    ronly? FREAD : FREAD|FWRITE);
        if (needclose)
                (void) closei((dev_t)ip->i_rdev, IFBLK,
                    ronly? FREAD : FREAD|FWRITE);
+       if (needclose)
+               (void) closei((dev_t)ip->i_rdev, IFBLK,
+                   ronly? FREAD : FREAD|FWRITE);
        if (ip)
                iput(ip);
        if (mp)
        if (ip)
                iput(ip);
        if (mp)
@@ -240,6 +259,7 @@ unmount1(fname, forcibly)
        register struct inode *ip;
        register struct fs *fs;
 
        register struct inode *ip;
        register struct fs *fs;
 
+       forcibly = 0;                                   /* XXX */
        forcibly = 0;                                   /* XXX */
        error = getmdev(&dev, fname);
        if (error)
        forcibly = 0;                                   /* XXX */
        error = getmdev(&dev, fname);
        if (error)
index c72684c..e8de953 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ufs_inode.c 7.1.1.1 (Berkeley) %G%
+ *     @(#)ufs_inode.c 7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
index 9a2f656..83dc198 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ufs_lookup.c        7.1.1.1 (Berkeley) %G%
+ *     @(#)ufs_lookup.c        7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
index fc3de6d..745f9b9 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ufs_vfsops.c        7.2.1.1 (Berkeley) %G%
+ *     @(#)ufs_vfsops.c        7.3 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -20,6 +20,9 @@
 #include "ioctl.h"
 #include "disklabel.h"
 #include "stat.h"
 #include "ioctl.h"
 #include "disklabel.h"
 #include "stat.h"
+#include "ioctl.h"
+#include "disklabel.h"
+#include "stat.h"
 
 smount()
 {
 
 smount()
 {
@@ -84,6 +87,12 @@ mountfs(dev, ronly, ip)
        if (error)
                goto out;
        needclose = 1;
        if (error)
                goto out;
        needclose = 1;
+       if ((*bdevsw[major(dev)].d_ioctl)(dev, DIOCGPART,
+           (caddr_t)&dpart, FREAD) == 0) {
+               havepart = 1;
+               size = dpart.disklab->d_secsize;
+       } else
+               size = DEV_BSIZE;
 #ifdef SECSIZE
        /*
         * If possible, determine hardware sector size
 #ifdef SECSIZE
        /*
         * If possible, determine hardware sector size
@@ -140,6 +149,12 @@ found:
        fs->fs_ronly = (ronly != 0);
        if (ronly == 0)
                fs->fs_fmod = 1;
        fs->fs_ronly = (ronly != 0);
        if (ronly == 0)
                fs->fs_fmod = 1;
+       if (havepart) {
+               dpart.part->p_fstype = FS_BSDFFS;
+               dpart.part->p_fsize = fs->fs_fsize;
+               dpart.part->p_frag = fs->fs_frag;
+               fs->fs_dbsize = size;
+       }
 #ifdef SECSIZE
        /*
         * If we have a disk label, force per-partition
 #ifdef SECSIZE
        /*
         * If we have a disk label, force per-partition
@@ -202,6 +217,7 @@ found:
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
        fs->fs_interleave = MAX(fs->fs_interleave, 1);          /* XXX */
 
        fs->fs_npsect = MAX(fs->fs_npsect, fs->fs_nsect);       /* XXX */
        fs->fs_interleave = MAX(fs->fs_interleave, 1);          /* XXX */
 
+
        return (fs);
 out:
        if (error == 0)
        return (fs);
 out:
        if (error == 0)
@@ -209,6 +225,9 @@ out:
        if (needclose)
                (void) closei((dev_t)ip->i_rdev, IFBLK,
                    ronly? FREAD : FREAD|FWRITE);
        if (needclose)
                (void) closei((dev_t)ip->i_rdev, IFBLK,
                    ronly? FREAD : FREAD|FWRITE);
+       if (needclose)
+               (void) closei((dev_t)ip->i_rdev, IFBLK,
+                   ronly? FREAD : FREAD|FWRITE);
        if (ip)
                iput(ip);
        if (mp)
        if (ip)
                iput(ip);
        if (mp)
@@ -240,6 +259,7 @@ unmount1(fname, forcibly)
        register struct inode *ip;
        register struct fs *fs;
 
        register struct inode *ip;
        register struct fs *fs;
 
+       forcibly = 0;                                   /* XXX */
        forcibly = 0;                                   /* XXX */
        error = getmdev(&dev, fname);
        if (error)
        forcibly = 0;                                   /* XXX */
        error = getmdev(&dev, fname);
        if (error)
index 9f43187..1240635 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)vm_swap.c   7.1.1.1 (Berkeley) %G%
+ *     @(#)vm_swap.c   7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -17,6 +17,7 @@
 #include "uio.h"
 #include "file.h"
 #include "stat.h"
 #include "uio.h"
 #include "file.h"
 #include "stat.h"
+#include "stat.h"
 
 struct buf rswbuf;
 /*
 
 struct buf rswbuf;
 /*
@@ -144,6 +145,7 @@ long        argdbsize;              /* XXX */
 swfree(index)
        int index;
 {
 swfree(index)
        int index;
 {
+       register struct swdevt *sp;
        register struct swdevt *sp;
        register swblk_t vsbase;
        register long blk;
        register struct swdevt *sp;
        register swblk_t vsbase;
        register long blk;
@@ -151,6 +153,7 @@ swfree(index)
        register swblk_t dvbase;
        register int nblks;
        int error;
        register swblk_t dvbase;
        register int nblks;
        int error;
+       int error;
 
        sp = &swdevt[index];
        dev = sp->sw_dev;
 
        sp = &swdevt[index];
        dev = sp->sw_dev;
@@ -193,8 +196,16 @@ swfree(index)
                         */
                        rmfree(swapmap, blk - ctod(CLSIZE),
                            vsbase + ctod(CLSIZE));
                         */
                        rmfree(swapmap, blk - ctod(CLSIZE),
                            vsbase + ctod(CLSIZE));
+               } else if (dvbase == 0) {
+                       /*
+                        * Don't use the first cluster of the device
+                        * in case it starts with a label or boot block.
+                        */
+                       rmfree(swapmap, blk - ctod(CLSIZE),
+                           vsbase + ctod(CLSIZE));
                } else
                        rmfree(swapmap, blk, vsbase);
        }
        return (0);
                } else
                        rmfree(swapmap, blk, vsbase);
        }
        return (0);
+       return (0);
 }
 }