kernels/linux-2.4.0/drivers/block/xd.c
/* xd_reread_partitions: rereads the partition table from a drive */
rereads the partition table from a drive
rereads the partition table from a drive
static int xd_reread_partitions(kdev_t dev)
{
	int target;
	int start;
	int partition;
	target = DEVICE_NR(dev);
 	start = target << xd_gendisk.minor_shift;
	cli();
	xd_valid[target] = (xd_access[target] != 1);
        sti();
	if (xd_valid[target])
		return -EBUSY;
	for (partition = xd_gendisk.max_p - 1; partition >= 0; partition--) {
		int minor = (start | partition);
		kdev_t devp = MKDEV(MAJOR_NR, minor);
		struct super_block * sb = get_super(devp);
		sync_dev(devp);
		if (sb)
			invalidate_inodes(sb);
		invalidate_buffers(devp);
		xd_gendisk.part[minor].start_sect = 0;
		xd_gendisk.part[minor].nr_sects = 0;
	};
	grok_partitions(&xd_gendisk, target, 1<<6,
			xd_info[target].heads * xd_info[target].cylinders * xd_info[target].sectors);
	xd_valid[target] = 1;
	wake_up(&xd_wait_open);
	return 0;
}
static int xd_reread_partitions ( kdev_t dev ) { int target ; int start ; int partition ; target = DEVICE_NR ( dev ) ; start = target << xd_gendisk . minor_shift ; cli ( ) ; xd_valid [ target ] = ( xd_access [ target ] != 1 ) ; sti ( ) ; if ( xd_valid [ target ] ) return - EBUSY ; for ( partition = xd_gendisk . max_p - 1 ; partition >= 0 ; partition -- ) { int minor = ( start | partition ) ; kdev_t devp = MKDEV ( MAJOR_NR , minor ) ; struct super_block * sb = get_super ( devp ) ; sync_dev ( devp ) ; if ( sb ) invalidate_inodes ( sb ) ; invalidate_buffers ( devp ) ; xd_gendisk . part [ minor ] . start_sect = 0 ; xd_gendisk . part [ minor ] . nr_sects = 0 ; } ; grok_partitions ( & xd_gendisk , target , 1 << 6 , xd_info [ target ] . heads * xd_info [ target ] . cylinders * xd_info [ target ] . sectors ) ; xd_valid [ target ] = 1 ; wake_up ( & xd_wait_open ) ; return 0 ; }
xd_reread_partitions: rereads the partition table from a drive
xd_reread_partitions : rereads the partition table from a drive