dkio.4

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 4 代码 · 共 128 行

4
128
字号
.\" SCCSID: @(#)dkio.4	2.1	3/10/87.TH dkio 4 RISC.SH Namedkio \- disk interface.SH Syntax\fB#include <sys/fs.h>\fR.br\fB#include <sys/ioctl.h>\fR.SH Description.NXS "disk interface" "dkio file".NXR "dkio file" "ioctl codes"This section describes the ioctl (input/output controller) codes for alldisk drivers..NXR "disk interface" "ioctl codes"The basic ioctl (input/output controller) format is:.sp.br\fB#include <sys/fs.h>\fR.br\fB#include <sys/ioctl.h>\fR.br\fBioctl\fR(\fIfildes, code, arg)\fR.br\fBstruct pt\fR *\fR\fIarg\fR;.sp The applicable \fIcodes\fR are:.IP DIOCGETPT 16Indicates to the driver to storethe information in the current partition table inthe address pointed to by \fIarg\fR.The file descriptor must be opened on the rawpartitions, \fIa\fR or \fIc\fR..IPDIOCGETPT does not change the partition table,but it does provide access to the partition table information..IP DIOCSETPTIndicates to the driver to modifythe current partition table with the informationpointed to by \fIarg\fR..IPThe file descriptor must be opened on the rawpartitions, \fIa\fR or \fIc\fR..IPIf the \fIa\fR or \fIc\fR partition is not mounted,only the partition table in the driver is modified.This temporarily modifies the partition table of the disk.The modifications are overwritten with the default tablewhen the disk is turned off and on..IPIf the \fIa\fR or \fIc\fR partition is mounted,both the partition table in the driver and the partition table inthe primary superblock are modified.This permanently modifies the partition table of the disk.This is not recommended.To change a partition table permanently,use the .MS chpt 8command..IP DIOCDGTPTIndicates to the driver to storethe \fIdefault\fR information of the current partition table inthe address pointed to by \fIarg\fR.The file descriptor must be opened on the rawpartitions \fIa\fR or \fIc\fR..IPDIOCGETPT does not change the partition table,but it does provide access to the partition table information..IP DKIOCGETAllows the user to receive generic disk information as defined in.PN <sys/devio.h> .IR struct devget ..IP DKIOCACCThis code is defined in .PN <sys/bbr.h>.It is currently unused..RE.SH Restrictions.NXR "disk interface" "restricted"These restrictions apply when using the DIOCSETPT ioctl code:.IP \(bu 4You must have superuser privileges..IP \(buYou cannot shrink or change the offset of a partitionwith a file system mounted on itor with an open file descriptor on the entire partition..IP \(buYou cannot change the offset of the \fIa\fR partition..SH ExamplesThis example shows how to use the DIOGETPT ioctl code toprint the length and offset of the \fIa\fR partition of an RZ23 disk:.NXR(e) "disk interface" "DIOGETPT and".EX 0#include <sys/types.h>#include <sys/param.h>#include <sys/fs.h>#include <sys/ioctl.h> main(){	struct pt arg;	int fd, i; 	/* Open the "a" partition of the disk you want to see */ 	if ( (fd = open("/dev/rz0a",0)) < 0 ) {		printf("Unable to open device\\n");		exit(2);	} 	/* Get the partition information */ 	if ( ioctl(fd,DIOCGETPT,&arg) < 0 )		printf("Error in ioctl\\n"); 	printf("Length\\t\\tOffset\\n");  	for ( i = 0; i <= 7; i++ ) {		printf("%d\\t\\t%d\\n",arg.pt_part[i].pi_nblocks,				  arg.pt_part[i].pi_blkoff );	}}.SH Files.PN /dev/{r}rz???.SH See Alsorz(4), disktab(5), fstab(5), chpt(8), diskpart(8), fsck(8), MAKEDEV(8), mkfs(8), tunefs(8)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?