SCCS-vsn: sys/ufs/ffs/ffs_alloc.c 7.15
SCCS-vsn: sys/ufs/lfs/lfs_alloc.c 7.15
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)ffs_alloc.c 7.14 (Berkeley) %G%
+ * @(#)ffs_alloc.c 7.15 (Berkeley) %G%
+/*
+ * Check that a specified block number is in range.
+ */
+badblock(fs, bn)
+ register struct fs *fs;
+ daddr_t bn;
+{
+
+ if ((unsigned)bn >= fs->fs_size) {
+ printf("bad block %d, ", bn);
+ fserr(fs, "bad block");
+ return (1);
+ }
+ return (0);
+}
+
/*
* Fserr prints the name of a file system with an error diagnostic.
*
/*
* Fserr prints the name of a file system with an error diagnostic.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)lfs_alloc.c 7.14 (Berkeley) %G%
+ * @(#)lfs_alloc.c 7.15 (Berkeley) %G%
+/*
+ * Check that a specified block number is in range.
+ */
+badblock(fs, bn)
+ register struct fs *fs;
+ daddr_t bn;
+{
+
+ if ((unsigned)bn >= fs->fs_size) {
+ printf("bad block %d, ", bn);
+ fserr(fs, "bad block");
+ return (1);
+ }
+ return (0);
+}
+
/*
* Fserr prints the name of a file system with an error diagnostic.
*
/*
* Fserr prints the name of a file system with an error diagnostic.
*