Subject: Re: VPS mailing list, BSD interest?
To: Kevin P. Neal <kpneal@pobox.com>
From: Terry Lambert <terry@lambert.org>
List: tech-kern
Date: 10/02/1996 14:40:43
[ ... soft geometry control metadata ... ]

> How about storing the data in a private section of the disk, and being able
> to export the data into a flat file, human readable? Then also being
> able to parse the output file and restore it onto the disk?
> 
> I mean, the mount command on some (all?) systems can generate an fstab.
> Why not the virtual disk device?

Actually, you want each device to be able to do several things:

1)	Ennumerate partitioning allowed on this logical or physical
	device
2)	Determine partitioning currently present on this device
3)	Manipulate partitioning currently present on this device
4)	Export additional device based on active partitioning


Thus:

	struct pt_enum		pterec;		/* partition entry records*/
	struct pt_contrl	ptectrl;	/* partition entry control*/
	struct pt_data		ptdata;		/* partition table entry*/
	int			fd;
	int			cnt = 0

	fd = open( devname, O_RDWR);

	/* get available partitioning*/
	pterec.index = 0;
	while( ioctl( fd, PTIO_ENUMALL, &pterec)) {
		/* get list of allowable partitioning schemas*/.
		strcpy( list[ cnt], pterec.name);
		cnt++;
	}

	/* list/select paritioning*/
	if( ioctl( fd, PTIO_GETACT, &ptectrl) == 0) {
		printf( "Current partitioning is %s\n", list[ ptectrl.type]);
		...
	} else {
		int	i;
		printf( "Not partitioned.  Available partitioning:\n");
		for( i = 0; i < cnt; i++) {
			printf( "   %2d. %s\n", i, list[ i]);
		}
		...
	}

	/* display partitions present on device*/
	ptdata.index = 0;
	while( ioctl( fd, PTIO_ENUMACT, &ptdata) {
		printf( "partition %i (in blocks):\n", ptdata.index - 1);
		printf( "   relative start: %d\n", ptdata.pd_rstart);
		printf( "   relative end  : %d\n", ptdata.pd_rend);
		printf( "   total length  : %d\n", ptdata.pd_length);
		printf( "   physical start: %d\n", ptdata.pd_start);
		printf( "   physical end  : %d\n", ptdata.pd_end);
		printf( "   device name   : %s/%s\n", devname, ptdata.pd_dnam);
		printf( "\n");
	}



One tool handles all partitioning tasks... for all partitioning schemas.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.