static void check_partition(unsigned int dev) { int minor, i; struct buffer_head *bh; struct partition *p; if (!(bh = bread(dev,0))) { printk("Unable to read partition table of device %04x\n",dev); return; } minor = current_minor; if (*(unsigned short *) (bh->b_data+510) == 0xAA55) { p = 0x1BE + (void *)bh->b_data; for (i=0 ; i<4 ; i++,p++) { hd[i+minor].start_sect = p->start_sect; hd[i+minor].nr_sects = p->nr_sects; } if (p->nr_sects && p->sys_ind == EXTENDED_PARTITION) { current_minor += 4; check_partition(i+minor); } } else printk("Bad partition table on dev %04x\n",dev); brelse(bh); }
/* insert _tail data into history table */ apr_status_t gpdb_check_partitions(mmon_options_t *opt) { // health is not a full table and needs to be added to the list apr_status_t r1, r2, r3, r4; // open a connection PGconn* conn = NULL; conn = PQconnectdb(GPDB_CONNECTION_STRING); if (PQstatus(conn) != CONNECTION_OK) { gpmon_warning( FLINE, "error creating GPDB client connection to dynamically " "check/create gpperfmon partitions: %s", PQerrorMessage(conn)); return APR_EINVAL; } r1 = check_partition("health", NULL, conn, opt); r2 = check_partition("emcconnect", NULL, conn, opt); r3 = call_for_each_table_with_opt(check_partition, NULL, conn, opt); r4 = check_partition("log_alert", NULL, conn, opt); // close connection PQfinish(conn); if (r1 != APR_SUCCESS) { return r1; } else if (r2 != APR_SUCCESS) { return r2; } else if (r3 != APR_SUCCESS) { return r3; } return r4; }
/* * Get partitioning information */ static struct partsfs_state *get_partitions_info(struct super_block *sb, int silent) { struct parsed_partitions *partitions; struct gendisk *disk; struct partsfs_state *state; int partno; int p; disk = get_gendisk(sb->s_bdev->bd_dev, &partno); if (!disk) { if (!silent) printk(KERN_WARNING "PARTSFS: Error getting partition information (get_gendisk failed)\n"); return NULL; } state = kzalloc(sizeof(struct partsfs_state), GFP_KERNEL); partitions = check_partition(disk, sb->s_bdev); if (IS_ERR(partitions) || partitions == NULL) { if (!silent) printk(KERN_WARNING "PARTSFS: Error getting partition information (check_partition failed)\n"); return NULL; } state->sector_size = bdev_logical_block_size(sb->s_bdev); state->capacity = get_capacity(disk); sb_set_blocksize(sb, state->sector_size); put_disk(disk); /* Count the partitions */ state->number_of_partitions = 0; state->last_partition = 0; for (p = 1; p < partitions->limit; p++) { if (partitions->parts[p].size != 0) { if (!silent) printk(KERN_WARNING "PARTSFS: Partition %d start: %llu size: %llu\n", p, (unsigned long long)partitions->parts[p].from, (unsigned long long)partitions->parts[p].size * state->sector_size); state->parts[p].from = partitions->parts[p].from; state->parts[p].size = partitions->parts[p].size; state->number_of_partitions++; state->last_partition = p; } } kfree(partitions); return state; }
void resetup_one_dev(struct gendisk *dev, int drive) { int i; int first_minor = drive << dev->minor_shift; int end_minor = first_minor + dev->max_p; blk_size[dev->major] = NULL; current_minor = 1 + first_minor; check_partition(dev, MKDEV(dev->major, first_minor)); /* * We need to set the sizes array before we will be able to access * any of the partitions on this device. */ if (dev->sizes != NULL) { /* optional safeguard in ll_rw_blk.c */ for (i = first_minor; i < end_minor; i++) dev->sizes[i] = dev->part[i].nr_sects >> (BLOCK_SIZE_BITS - 9); blk_size[dev->major] = dev->sizes; } }
static void setup_dev(struct gendisk *dev) { int i, drive; int end_minor = dev->max_nr * dev->max_p; blk_size[dev->major] = NULL; for (i = 0 ; i < end_minor; i++) { dev->part[i].start_sect = 0; dev->part[i].nr_sects = 0; } dev->init(dev); for (drive = 0 ; drive < dev->nr_real ; drive++) { int first_minor = drive << dev->minor_shift; current_minor = 1 + first_minor; check_partition(dev, MKDEV(dev->major, first_minor)); } if (dev->sizes != NULL) { /* optional safeguard in ll_rw_blk.c */ for (i = 0; i < end_minor; i++) dev->sizes[i] = dev->part[i].nr_sects >> (BLOCK_SIZE_BITS - 9); blk_size[dev->major] = dev->sizes; } }
void ParallelMesher::setup_this() { // make partitioned and send and receive model entity sets for (MEntSelection::iterator mit = mentSelection.begin(); mit != mentSelection.end(); mit++) { ModelEnt *me_vol = (*mit).first; if (me_vol->dimension() != 3) throw Error(MK_BAD_INPUT, "Parallel mesher assigned to an entity with dimension != 3."); RefEntity* vol = reinterpret_cast<RefEntity*> (me_vol->geom_handle()); TDParallel *td_par_vol = (TDParallel *) vol->get_TD(&TDParallel::is_parallel); if (td_par_vol == NULL) ECERRCHK(MK_FAILURE, "Volume should have partitioned information."); unsigned int charge_proc = td_par_vol->get_charge_proc(); MEntVector children; // partititoned vols if (m_rank == charge_proc) { m_sEntity[MESH_VOLUME].insert(me_vol); // volume if (debug_parallelmesher) print_geom_info(me_vol, 3, true); // get non-interface surfaces children.clear(); me_vol->get_adjacencies(2, children); for (MEntVector::iterator cit = children.begin(); cit != children.end(); cit++) { RefEntity* child = reinterpret_cast< RefEntity* > ((*cit)->geom_handle()); TDParallel *td_par_child = (TDParallel *) child->get_TD(&TDParallel::is_parallel); if (td_par_child == NULL) { m_sEntity[MESH_NINTER_SURF].insert(*cit); } } } // get child interface entities for (int i = 2; i > -1; i--) { children.clear(); me_vol->get_adjacencies(i, children); for (MEntVector::iterator cit = children.begin(); cit != children.end(); cit++) { RefEntity* child = reinterpret_cast< RefEntity* > ((*cit)->geom_handle()); TDParallel *td_par_child = (TDParallel *) child->get_TD(&TDParallel::is_parallel); if (td_par_child != NULL) { check_partition(td_par_child, *cit, i); if (debug_parallelmesher) print_geom_info(*cit, i, m_rank == td_par_child->get_charge_proc()); } } } } add_parallel_mesh_op(MESH_VERTEX); add_parallel_mesh_op(EXCHANGE_VERTEX); add_parallel_mesh_op(MESH_EDGE); add_parallel_mesh_op(EXCHANGE_EDGE); add_parallel_mesh_op(MESH_INTER_SURF); add_parallel_mesh_op(SEND_POST_SURF_MESH); add_parallel_mesh_op(MESH_NINTER_SURF); add_parallel_mesh_op(RECV_SURF_MESH); add_parallel_mesh_op(MESH_VOLUME); if (debug_parallelmesher) { for (PARALLEL_OP_TYPE type = MESH_VERTEX; type <= MESH_VOLUME;) { std::cout << "# of parallel mesh type " << type << "=" << m_sEntity[type].size() << std::endl; type = static_cast<PARALLEL_OP_TYPE> (type + 1); } } }
/* This may be used only once, enforced by 'static int callable' */ int sys_setup(void * BIOS) { static int callable = 1; int i,drive; unsigned char cmos_disks; if (!callable) return -1; callable = 0; #ifndef HD_TYPE for (drive=0 ; drive<2 ; drive++) { hd_info[drive].cyl = *(unsigned short *) BIOS; hd_info[drive].head = *(unsigned char *) (2+BIOS); hd_info[drive].wpcom = *(unsigned short *) (5+BIOS); hd_info[drive].ctl = *(unsigned char *) (8+BIOS); hd_info[drive].lzone = *(unsigned short *) (12+BIOS); hd_info[drive].sect = *(unsigned char *) (14+BIOS); BIOS += 16; } if (hd_info[1].cyl) NR_HD=2; else NR_HD=1; #endif for (i=0 ; i<NR_HD ; i++) { hd[i<<6].start_sect = 0; hd[i<<6].nr_sects = hd_info[i].head* hd_info[i].sect*hd_info[i].cyl; } /* We querry CMOS about hard disks : it could be that we have a SCSI/ESDI/etc controller that is BIOS compatable with ST-506, and thus showing up in our BIOS table, but not register compatable, and therefore not present in CMOS. Furthurmore, we will assume that our ST-506 drives <if any> are the primary drives in the system, and the ones reflected as drive 1 or 2. The first drive is stored in the high nibble of CMOS byte 0x12, the second in the low nibble. This will be either a 4 bit drive type or 0xf indicating use byte 0x19 for an 8 bit type, drive 1, 0x1a for drive 2 in CMOS. Needless to say, a non-zero value means we have an AT controller hard disk for that drive. */ if ((cmos_disks = CMOS_READ(0x12)) & 0xf0) if (cmos_disks & 0x0f) NR_HD = 2; else NR_HD = 1; else NR_HD = 0; for (i = NR_HD ; i < 2 ; i++) { hd[i<<6].start_sect = 0; hd[i<<6].nr_sects = 0; } for (drive=0 ; drive<NR_HD ; drive++) { current_minor = 1+(drive<<6); check_partition(0x0300+(drive<<6)); } for (i=0 ; i<(MAX_HD<<6) ; i++) hd_sizes[i] = hd[i].nr_sects>>1 ; blk_size[MAJOR_NR] = hd_sizes; if (NR_HD) printk("Partition table%s ok.\n\r",(NR_HD>1)?"s":""); rd_load(); mount_root(); return (0); }