Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 May 2012 12:39:02 +1000 (EST)
From:      Peter Jeremy <peter@rulingia.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   docs/167832: [patch] swapon(2) (and elsewhere) refer to non-existent block devices
Message-ID:  <201205130239.q4D2d2W0077886@server.rulingia.com>
Resent-Message-ID: <201205130240.q4D2e4mD092176@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         167832
>Category:       docs
>Synopsis:       [patch] swapon(2) (and elsewhere) refer to non-existent block devices
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 13 02:40:04 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Peter Jeremy
>Release:        FreeBSD 8.2-STABLE amd64
>Organization:
n/a
>Environment:
System: FreeBSD server.rulingia.com 8.2-STABLE FreeBSD 8.2-STABLE #15: Thu Feb 2 11:02:29 EST 2012 root@server.vk2pj.dyndns.org:/var/obj/usr/src/sys/server amd64

Same issues still exist in head.

>Description:
	swapon(2) states "The swapon() system call makes the block device
	special available to the system" but block devices haven't existed
	in FreeBSD for something like a decade.  There's a similar error
	in the description of the ENOTBLK error.

	Looking further, I've found lots of similar references to block
	devices.

>How-To-Repeat:
	man 2 swapon intro mount
>Fix:

	In all 3 man pages, what is actually wanted is a disk device -
	either real or virtual via md(4).  The following patches use
	"disk" in place of "block" for all relevant non-contrib
	references.  Note that I am unclear of the correct fix to:
	tools/debugscripts/gdbinit.kernel
	share/man/man4/xen.4
	share/man/man4/virtio_blk.4
	share/man/man9/vnode.9

Index: sys/sys/errno.h
===================================================================
--- sys/sys/errno.h	(revision 235336)
+++ sys/sys/errno.h	(working copy)
@@ -62,7 +62,7 @@
 #define	EACCES		13		/* Permission denied */
 #define	EFAULT		14		/* Bad address */
 #ifndef _POSIX_SOURCE
-#define	ENOTBLK		15		/* Block device required */
+#define	ENOTBLK		15		/* Disk device required */
 #endif
 #define	EBUSY		16		/* Device busy */
 #define	EEXIST		17		/* File exists */
Index: sys/security/audit/audit_bsm_errno.c
===================================================================
--- sys/security/audit/audit_bsm_errno.c	(revision 235336)
+++ sys/security/audit/audit_bsm_errno.c	(working copy)
@@ -97,7 +97,7 @@
 	{ BSM_ERRNO_ENOMEM, ENOMEM, ES("Cannot allocate memory") },
 	{ BSM_ERRNO_EACCES, EACCES, ES("Permission denied") },
 	{ BSM_ERRNO_EFAULT, EFAULT, ES("Bad address") },
-	{ BSM_ERRNO_ENOTBLK, ENOTBLK, ES("Block device required") },
+	{ BSM_ERRNO_ENOTBLK, ENOTBLK, ES("Disk device required") },
 	{ BSM_ERRNO_EBUSY, EBUSY, ES("Device busy") },
 	{ BSM_ERRNO_EEXIST, EEXIST, ES("File exists") },
 	{ BSM_ERRNO_EXDEV, EXDEV, ES("Cross-device link") },
Index: lib/libgeom/geom_util.c
===================================================================
--- lib/libgeom/geom_util.c	(revision 235336)
+++ lib/libgeom/geom_util.c	(working copy)
@@ -45,7 +45,7 @@
 static char	*g_device_path_open(const char *, int *, int);
 
 /*
- * Open the given provider and at least check if this is a block device.
+ * Open the given provider and at least check if this is a disk device.
  */
 int
 g_open(const char *name, int dowrite)
Index: lib/libufs/block.c
===================================================================
--- lib/libufs/block.c	(revision 235336)
+++ lib/libufs/block.c	(working copy)
@@ -71,15 +71,15 @@
 	}
 	cnt = pread(disk->d_fd, p2, size, (off_t)(blockno * disk->d_bsize));
 	if (cnt == -1) {
-		ERROR(disk, "read error from block device");
+		ERROR(disk, "read error from disk device");
 		goto fail;
 	}
 	if (cnt == 0) {
-		ERROR(disk, "end of file from block device");
+		ERROR(disk, "end of file from disk device");
 		goto fail;
 	}
 	if ((size_t)cnt != size) {
-		ERROR(disk, "short read or read error from block device");
+		ERROR(disk, "short read or read error from disk device");
 		goto fail;
 	}
 	if (p2 != data) {
@@ -128,11 +128,11 @@
 	if (p2 != NULL)
 		free(p2);
 	if (cnt == -1) {
-		ERROR(disk, "write error to block device");
+		ERROR(disk, "write error to disk device");
 		return (-1);
 	}
 	if ((size_t)cnt != size) {
-		ERROR(disk, "short write to block device");
+		ERROR(disk, "short write to disk device");
 		return (-1);
 	}
 
Index: lib/libc/sys/mount.2
===================================================================
--- lib/libc/sys/mount.2	(revision 235336)
+++ lib/libc/sys/mount.2	(working copy)
@@ -279,7 +279,7 @@
 The
 .Fa fspec
 argument
-is not a block device.
+is not a disk device.
 .It Bq Er ENXIO
 The major device number of
 .Fa fspec
Index: lib/libc/sys/swapon.2
===================================================================
--- lib/libc/sys/swapon.2	(revision 235336)
+++ lib/libc/sys/swapon.2	(working copy)
@@ -46,7 +46,7 @@
 The
 .Fn swapon
 system call
-makes the block device
+makes the disk device
 .Fa special
 available to the system for
 allocation for paging and swapping.
@@ -106,7 +106,7 @@
 The
 .Fa special
 argument
-is not a block device.
+is not a disk device.
 .It Bq Er EBUSY
 The device specified by
 .Fa special
Index: lib/libc/sys/intro.2
===================================================================
--- lib/libc/sys/intro.2	(revision 235336)
+++ lib/libc/sys/intro.2	(working copy)
@@ -156,8 +156,12 @@
 .It Er 14 EFAULT Em "Bad address" .
 The system detected an invalid address in attempting to
 use an argument of a call.
-.It Er 15 ENOTBLK Em "Block device required" .
-A block device operation was attempted on a non-block device or file.
+.It Er 15 ENOTBLK Em "Disk device required" .
+A disk device operation was attempted on a non-disk device or file.
+Disk devices include both physical disks and virtual disks created
+using the
+.Xr md 4
+device.
 .It Er 16 EBUSY Em "Device busy" .
 An attempt to use a system resource which was in use at the time
 in a manner which would have conflicted with the request.
Index: lib/libc/gen/errlst.c
===================================================================
--- lib/libc/gen/errlst.c	(revision 235336)
+++ lib/libc/gen/errlst.c	(working copy)
@@ -51,7 +51,7 @@
 	"Cannot allocate memory",		/* 12 - ENOMEM */
 	"Permission denied",			/* 13 - EACCES */
 	"Bad address",				/* 14 - EFAULT */
-	"Block device required",		/* 15 - ENOTBLK */
+	"Disk device required",			/* 15 - ENOTBLK */
 	"Device busy",				/* 16 - EBUSY */
 	"File exists",				/* 17 - EEXIST */
 	"Cross-device link",			/* 18 - EXDEV */
Index: lib/libc/nls/C.msg
===================================================================
--- lib/libc/nls/C.msg	(revision 235336)
+++ lib/libc/nls/C.msg	(working copy)
@@ -34,7 +34,7 @@
 $ EFAULT
 14 Bad address
 $ ENOTBLK
-15 Block device required
+15 Disk device required
 $ EBUSY
 16 Device busy
 $ EEXIST
Index: share/examples/mdoc/example.9
===================================================================
--- share/examples/mdoc/example.9	(revision 235336)
+++ share/examples/mdoc/example.9	(working copy)
@@ -146,7 +146,7 @@
 .It Bq Er EFAULT
 Bad address.
 .It Bq Er ENOTBLK
-Block device required.
+Disk device required.
 .It Bq Er EBUSY
 Device busy.
 .It Bq Er EEXIST
Index: share/examples/mdoc/example.3
===================================================================
--- share/examples/mdoc/example.3	(revision 235336)
+++ share/examples/mdoc/example.3	(working copy)
@@ -133,7 +133,7 @@
 .It Bq Er EFAULT
 Bad address.
 .It Bq Er ENOTBLK
-Block device required.
+Disk device required.
 .It Bq Er EBUSY
 Device busy.
 .It Bq Er EEXIST
Index: share/man/man4/mmcsd.4
===================================================================
--- share/man/man4/mmcsd.4	(revision 235336)
+++ share/man/man4/mmcsd.4	(working copy)
@@ -35,7 +35,7 @@
 .Sh DESCRIPTION
 The
 .Nm
-driver implements direct access block device for MMC and SD memory cards.
+driver implements direct access disk device for MMC and SD memory cards.
 .Sh SEE ALSO
 .Xr mmc 4 ,
 .Xr at91_mci 4 ,
Index: share/man/man4/arcmsr.4
===================================================================
--- share/man/man4/arcmsr.4	(revision 235336)
+++ share/man/man4/arcmsr.4	(working copy)
@@ -137,7 +137,7 @@
 .Sh FILES
 .Bl -tag -width ".Pa /dev/arcmsr?" -compact
 .It Pa /dev/da?
-Array block device
+Array disk device
 .It Pa /dev/arcmsr?
 Management interface
 .El
Index: sys/security/audit/audit_bsm_errno.c
===================================================================
--- sys/security/audit/audit_bsm_errno.c	(revision 235336)
+++ sys/security/audit/audit_bsm_errno.c	(working copy)
@@ -97,7 +97,7 @@
 	{ BSM_ERRNO_ENOMEM, ENOMEM, ES("Cannot allocate memory") },
 	{ BSM_ERRNO_EACCES, EACCES, ES("Permission denied") },
 	{ BSM_ERRNO_EFAULT, EFAULT, ES("Bad address") },
-	{ BSM_ERRNO_ENOTBLK, ENOTBLK, ES("Block device required") },
+	{ BSM_ERRNO_ENOTBLK, ENOTBLK, ES("Disk device required") },
 	{ BSM_ERRNO_EBUSY, EBUSY, ES("Device busy") },
 	{ BSM_ERRNO_EEXIST, EEXIST, ES("File exists") },
 	{ BSM_ERRNO_EXDEV, EXDEV, ES("Cross-device link") },
Index: sys/xen/interface/io/blkif.h
===================================================================
--- sys/xen/interface/io/blkif.h	(revision 235336)
+++ sys/xen/interface/io/blkif.h	(working copy)
@@ -178,7 +178,7 @@
  *      Default Value:  0
  *      Notes:          4, 5
  *
- *      The offset, in bytes from the beginning of the virtual block device,
+ *      The offset, in bytes from the beginning of the virtual disk device,
  *      to the first, addressable, discard extent on the underlying device.
  *
  * discard-granularity
Index: sys/ufs/ufs/ufsmount.h
===================================================================
--- sys/ufs/ufs/ufsmount.h	(revision 235336)
+++ sys/ufs/ufs/ufsmount.h	(working copy)
@@ -69,7 +69,7 @@
 	struct	cdev *um_dev;			/* device mounted */
 	struct	g_consumer *um_cp;
 	struct	bufobj *um_bo;			/* Buffer cache object */
-	struct	vnode *um_devvp;		/* block device mounted vnode */
+	struct	vnode *um_devvp;		/* disk device mounted vnode */
 	u_long	um_fstype;			/* type of filesystem */
 	struct	fs *um_fs;			/* pointer to superblock */
 	struct	ufs_extattr_per_mount um_extattr;	/* extended attrs */
Index: sys/ufs/ffs/ffs_vnops.c
===================================================================
--- sys/ufs/ffs/ffs_vnops.c	(revision 235336)
+++ sys/ufs/ffs/ffs_vnops.c	(working copy)
@@ -308,7 +308,7 @@
 	/* Drain IO to see if we're done. */
 	bufobj_wwait(bo, 0, 0);
 	/*
-	 * Block devices associated with filesystems may have new I/O
+	 * Disk devices associated with filesystems may have new I/O
 	 * requests posted for them even if the vnode is locked, so no
 	 * amount of trying will get them clean.  We make several passes
 	 * as a best effort.
Index: sys/ufs/ffs/ffs_softdep.c
===================================================================
--- sys/ufs/ffs/ffs_softdep.c	(revision 235336)
+++ sys/ufs/ffs/ffs_softdep.c	(working copy)
@@ -1821,7 +1821,7 @@
 	struct ufsmount *ump;
 
 	/*
-	 * Alternately flush the block device associated with the mount
+	 * Alternately flush the disk device associated with the mount
 	 * point and process any dependencies that the flushing
 	 * creates. We continue until no more worklist dependencies
 	 * are found.
@@ -11848,7 +11848,7 @@
 }
 
 /*
- * Flush all the dirty bitmaps associated with the block device
+ * Flush all the dirty bitmaps associated with the disk device
  * before flushing the rest of the dirty blocks so as to reduce
  * the number of dependencies that will have to be rolled back.
  *
Index: sys/fs/ext2fs/ext2_mount.h
===================================================================
--- sys/fs/ext2fs/ext2_mount.h	(revision 235336)
+++ sys/fs/ext2fs/ext2_mount.h	(working copy)
@@ -45,7 +45,7 @@
 struct ext2mount {
 	struct	mount *um_mountp;		/* filesystem vfs structure */
 	struct	cdev *um_dev;			/* device mounted */
-	struct	vnode *um_devvp;		/* block device mounted vnode */
+	struct	vnode *um_devvp;		/* disk device mounted vnode */
 
 	struct	m_ext2fs *um_e2fs;		/* EXT2FS */
 #define em_e2fsb um_e2fs->e2fs
Index: sys/fs/ntfs/ntfs_vfsops.c
===================================================================
--- sys/fs/ntfs/ntfs_vfsops.c	(revision 235336)
+++ sys/fs/ntfs/ntfs_vfsops.c	(working copy)
@@ -183,7 +183,7 @@
 
 	/*
 	 * Not an update, or updating the name: look up the name
-	 * and verify that it refers to a sensible block device.
+	 * and verify that it refers to a sensible disk device.
 	 */
 	NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, from, td);
 	err = namei(&ndp);
Index: sys/fs/ntfs/ntfs.h
===================================================================
--- sys/fs/ntfs/ntfs.h	(revision 235336)
+++ sys/fs/ntfs/ntfs.h	(working copy)
@@ -244,7 +244,7 @@
 	struct bootfile ntm_bootfile;
 	struct g_consumer *ntm_cp;
 	struct bufobj  *ntm_bo;
-	struct vnode   *ntm_devvp;	/* block device mounted vnode */
+	struct vnode   *ntm_devvp;	/* disk device mounted vnode */
 	struct vnode   *ntm_sysvn[NTFS_SYSNODESNUM];
 	u_int32_t       ntm_bpmftrec;
 	uid_t           ntm_uid;
Index: sys/fs/cd9660/cd9660_vfsops.c
===================================================================
--- sys/fs/cd9660/cd9660_vfsops.c	(revision 235336)
+++ sys/fs/cd9660/cd9660_vfsops.c	(working copy)
@@ -156,7 +156,7 @@
 	}
 	/*
 	 * Not an update, or updating the name: look up the name
-	 * and verify that it refers to a sensible block device.
+	 * and verify that it refers to a sensible disk device.
 	 */
 	NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td);
 	if ((error = namei(&ndp)))
Index: sys/fs/hpfs/hpfs_vfsops.c
===================================================================
--- sys/fs/hpfs/hpfs_vfsops.c	(revision 235336)
+++ sys/fs/hpfs/hpfs_vfsops.c	(working copy)
@@ -156,7 +156,7 @@
 
 	/*
 	 * Not an update, or updating the name: look up the name
-	 * and verify that it refers to a sensible block device.
+	 * and verify that it refers to a sensible disk device.
 	 */
 	NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, from, td);
 	err = namei(&ndp);
Index: sys/kern/vfs_subr.c
===================================================================
--- sys/kern/vfs_subr.c	(revision 235336)
+++ sys/kern/vfs_subr.c	(working copy)
@@ -198,7 +198,7 @@
  * not waste disk bandwidth being created and removed. To realize this,
  * we append vnodes to a "workitem" queue. When running with a soft
  * updates implementation, most pending metadata dependencies should
- * not wait for more than a few seconds. Thus, mounted on block devices
+ * not wait for more than a few seconds. Thus, mounted on disk devices
  * are delayed only about a half the time that file data is delayed.
  * Similarly, directory updates are more critical, so are only delayed
  * about a third the time that file data is delayed. Thus, there are
Index: sys/powerpc/powerpc/dump_machdep.c
===================================================================
--- sys/powerpc/powerpc/dump_machdep.c	(revision 235336)
+++ sys/powerpc/powerpc/dump_machdep.c	(working copy)
@@ -241,7 +241,7 @@
 	dumpsize += fileofs;
 	hdrgap = fileofs - DEV_ALIGN(hdrsz);
 
-	/* For block devices, determine the dump offset on the device. */
+	/* For disk devices, determine the dump offset on the device. */
 	if (di->mediasize > 0) {
 		if (di->mediasize <
 		    SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2) {
Index: sys/mips/include/param.h
===================================================================
--- sys/mips/include/param.h	(revision 235336)
+++ sys/mips/include/param.h	(working copy)
@@ -170,7 +170,7 @@
 #define	dtoc(x)			((x) >> (PAGE_SHIFT - DEV_BSHIFT))
 
 /*
- * Map a ``block device block'' to a file system block.
+ * Map a ``disk device block'' to a file system block.
  * This should be device dependent, and should use the bsize
  * field from the disk label.
  * For now though just use DEV_BSIZE.
Index: sys/conf/NOTES
===================================================================
--- sys/conf/NOTES	(revision 235336)
+++ sys/conf/NOTES	(working copy)
@@ -112,9 +112,9 @@
 options 	DFLDSIZ=(1024UL*1024*1024)
 
 #
-# BLKDEV_IOSIZE sets the default block size used in user block
+# BLKDEV_IOSIZE sets the default block size used in user disk
 # device I/O.  Note that this value will be overridden by the label
-# when specifying a block device from a label with a non-0
+# when specifying a disk device from a label with a non-0
 # partition blocksize.  The default is PAGE_SIZE.
 #
 options 	BLKDEV_IOSIZE=8192
@@ -122,7 +122,7 @@
 #
 # MAXPHYS and DFLTPHYS
 #
-# These are the maximal and safe 'raw' I/O block device access sizes.
+# These are the maximal and safe 'raw' I/O disk device access sizes.
 # Reads and writes will be split into MAXPHYS chunks for known good
 # devices and DFLTPHYS for the rest. Some applications have better
 # performance with larger raw I/O access sizes. Note that certain VM
Index: sys/pc98/cbus/fdc.c
===================================================================
--- sys/pc98/cbus/fdc.c	(revision 235336)
+++ sys/pc98/cbus/fdc.c	(working copy)
@@ -1291,7 +1291,7 @@
 }
 
 /*
- * Block device driver interface functions (interspersed with even more
+ * Disk device driver interface functions (interspersed with even more
  * auxiliary functions).
  */
 static int
Index: sys/sys/param.h
===================================================================
--- sys/sys/param.h	(revision 235336)
+++ sys/sys/param.h	(working copy)
@@ -139,7 +139,7 @@
 #define	DEV_BSIZE	(1<<DEV_BSHIFT)
 
 #ifndef BLKDEV_IOSIZE
-#define BLKDEV_IOSIZE  PAGE_SIZE	/* default block device I/O size */
+#define BLKDEV_IOSIZE  PAGE_SIZE	/* default disk device I/O size */
 #endif
 #ifndef DFLTPHYS
 #define DFLTPHYS	(64 * 1024)	/* default max raw I/O transfer size */
Index: sys/sys/errno.h
===================================================================
--- sys/sys/errno.h	(revision 235336)
+++ sys/sys/errno.h	(working copy)
@@ -62,7 +62,7 @@
 #define	EACCES		13		/* Permission denied */
 #define	EFAULT		14		/* Bad address */
 #ifndef _POSIX_SOURCE
-#define	ENOTBLK		15		/* Block device required */
+#define	ENOTBLK		15		/* Disk device required */
 #endif
 #define	EBUSY		16		/* Device busy */
 #define	EEXIST		17		/* File exists */
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205130239.q4D2d2W0077886>