// Create primary table for resized disk
// size - in sectors
513518
func (this Table) CreateTableForNewDiskSize(size uint64) (res Table) {
	res = this.copy()

	// Always create primary table
	res.Header.HeaderStartLBA = 1
	res.Header.PartitionsTableStartLBA = 2
	res.Header.HeaderCopyStartLBA = size - 1 // Last sector

	partitionsTableSize := uint64(res.Header.PartitionEntrySize) * uint64(res.Header.PartitionsArrLen)
	partitionSizeInSector := partitionsTableSize / uint64(res.SectorSize)
	if partitionsTableSize%uint64(res.SectorSize) != 0 {
		partitionSizeInSector++
	}
	res.Header.LastUsableLBA = size - 1 - partitionSizeInSector - 1 // header in last sector and partitions table

	res.Header.CRC = res.Header.calcCRC()
	return res
}
1323399
func (m *DbMap) CreateTablesIfNotExists() error {
	_, err := m.createTables(true, true)
	return err
}
438345
func (fsc *FSCache) DiskUsage(ctx context.Context) (int64, error) {
	return fsc.store.DiskUsage(ctx)
}
1005599
func (dfs *DistributedFilesystem) Create(tenantID string) error {
	glog.V(1).Infof("Creating volume for %s", tenantID)
	vol, err := dfs.disk.Create(tenantID)
	if err != nil {
		glog.Errorf("Could not create volume for tenant %s: %s", tenantID, err)
		return err
	}
	glog.V(1).Infof("Volume created for %s at %s", tenantID, vol.Path())
	if err := dfs.export(vol.Path()); err != nil {
		glog.Errorf("Could not export volume at %s: %s", vol.Path(), err)
		return err
	}
	return nil
}
1341312
func (cb *ColumnBuilder) VarChar(size int64) *CreateTableBuilder {
	return cb.tableBuilder.appendColumn(&tableColumn{
		name:    cb.name,
		sqlType: fmt.Sprintf("VARCHAR(%v)", size),
	})
}
653323
func (f *FAT) ResizeChain(start uint32, length int) ([]uint32, error) {
	chain := f.Chain(start)
	if len(chain) == length {
		return chain, nil
	}

	change := int(math.Abs(float64(length - len(chain))))
	if length > len(chain) {
		var lastCluster uint32

		lastCluster = chain[0]
		for i := 1; i < len(chain); i++ {
			if f.isEofCluster(f.entries[lastCluster]) {
				break
			}

			lastCluster = chain[i]
		}

		for i := 0; i < change; i++ {
			newCluster, err := f.allocNew()
			if err != nil {
				return nil, err
			}

			f.entries[lastCluster] = newCluster
			lastCluster = newCluster
		}
	} else {
		panic("making chains smaller not implemented yet")
	}

	return f.Chain(start), nil
}
31653
func (s *oracleVolumeSource) CreateVolumes(ctx context.ProviderCallContext, params []storage.VolumeParams) ([]storage.CreateVolumesResult, error) {
	if params == nil {
		return []storage.CreateVolumesResult{}, nil
	}
	results := make([]storage.CreateVolumesResult, len(params))
	for i, volume := range params {
		vol, err := s.createVolume(volume)
		if err != nil {
			results[i].Error = errors.Trace(err)
			continue
		}
		results[i].Volume = vol
	}
	return results, nil
}
1359038
func (ds *DiskSpec) SizeGB() uint64 {
	size := ds.SizeHintGB
	if ds.TooSmall() {
		size = MinDiskSizeGB(ds.Series)
	}
	return size
}
987336
func PartitionSize(n int64) DasetsetHint {
	return func(d *Dataset) {
		d.Meta.TotalSize = n * int64(len(d.GetShards()))
	}
}
1362639
func main() {
	Tables := []interface{}{
		&promotion.Discount{},
		&promotion.Rule{},
		&promotion.Benefit{},
		&promotion.Coupon{},
		&promotion.BenefitRecord{},
		&enterprise.QorMicroSite{},
	}

	TruncateTables(Tables...)
	createPromotion()
	createMicroSite()
}
806969
func (d *Driver) Create(id string, parent string, ml string, storageOpts map[string]string) error {
	if parent != "" {
		logrus.Infof("Creating layer %s with parent %s", id, parent)
	} else {
		logrus.Infof("Creating parent layer %s", id)
	}

	cID := C.CString(id)
	cParent := C.CString(parent)

	ret, err := C.create_layer(cID, cParent)
	if int(ret) != 0 {
		logrus.Warnf("Error while creating layer %s", id)
		return err
	}

	return nil
}
472879
func (m *MonitorValues) FlattenUsedDisk1SizeValue() ([]FlatMonitorValue, error) {
	return m.flattenValue(func(v *MonitorValue) *float64 { return v.UsedDisk1Size })
}
1147645
func (c *Client) DBSize() (int, error) {
	v, err := c.execOnFirst(false, "DBSIZE")
	if err != nil {
		return 0, err
	}
	return iface2int(v)
}
982495
func New(size int) *Table {
	conf := make([]CellConf, size)
	dflt := CellConf{Left, []byte{' '}, []byte{}}
	for i := 0; i < size; i++ {
		conf[i] = dflt
	}
	conf[size-1].PadRight = []byte{}
	return NewWithConf(conf)
}
829493
func (d *Datastore) DiskUsage() (uint64, error) {
	var size uint64
	err := d.runOp(func() error {
		var err error
		size, err = ds.DiskUsage(d.Batching)
		return err
	})
	return size, err
}
507363
func (dd *dictDecoder) HistSize() int {
	if dd.full {
		return dd.size
	}
	return dd.wrPos
}
241564
func (si *SegmentCommitInfo) SizeInBytes() (sum int64, err error) {
	if si.sizeInBytes == -1 {
		sum = 0
		for _, fileName := range si.Files() {
			d, err := si.Info.Dir.FileLength(fileName)
			if err != nil {
				return 0, err
			}
			sum += d
		}
		si.sizeInBytes = sum
	}
	return si.sizeInBytes, nil
}