// TypeForDevice determines the usable FAT type based solely on
// size information about the block device.
433718
func TypeForDevice(device fs.BlockDevice) FATType {
	sizeInMB := device.Len() / (1024 * 1024)
	switch {
	case sizeInMB < 4:
		return FAT12
	case sizeInMB < 512:
		return FAT16
	default:
		return FAT32
	}
}
598578
func (m *MockLinkLayerDevice) Type() state.LinkLayerDeviceType {
	ret := m.ctrl.Call(m, "Type")
	ret0, _ := ret[0].(state.LinkLayerDeviceType)
	return ret0
}
267444
func (ckf *ComputedKeyFamily) UpdateDevices(tcl TypedChainLink) (err error) {

	var dobj *Device
	if dobj = tcl.GetDevice(); dobj == nil {
		ckf.G().VDL.Log(VLog1, "Short-circuit of UpdateDevices(); not a device link")
		return
	}

	defer ckf.G().Trace("UpdateDevice", func() error { return err })()

	did := dobj.ID
	kid := dobj.Kid

	ckf.G().Log.Debug("| Device ID=%s; KID=%s", did, kid.String())

	var prevKid keybase1.KID
	if existing, found := ckf.cki.Devices[did]; found {
		ckf.G().Log.Debug("| merge with existing")
		prevKid = existing.Kid
		existing.Merge(dobj)
		dobj = existing
	} else {
		ckf.G().Log.Debug("| New insert")
		ckf.cki.Devices[did] = dobj
	}

	// If a KID is specified, we should clear out any previous KID from the
	// KID->Device map. But if not, leave the map as it is. Later "device"
	// blobs in the sigchain aren't required to repeat the KID every time.
	if kid.IsValid() {
		if prevKid.IsValid() {
			ckf.G().Log.Debug("| Clear out old key")
			delete(ckf.cki.KIDToDeviceID, prevKid)
		}
		ckf.cki.KIDToDeviceID[kid] = did
	}

	return
}
317627
func TypeByFilename(fullFilename string) string {
	ext := filepath.Ext(fullFilename)
	return TypeByExtension(ext)
}
761228
func (r ChainedProviderRegistry) StorageProviderTypes() ([]ProviderType, error) {
	var result []ProviderType
	for _, r := range r {
		types, err := r.StorageProviderTypes()
		if err != nil {
			return nil, errors.Trace(err)
		}
		result = append(result, types...)
	}
	return result, nil
}
1186533
func SchemaForCtyContainerType(ty cty.Type) *configschema.NestedBlock {
	var nesting configschema.NestingMode
	switch {
	case ty.IsListType():
		nesting = configschema.NestingList
	case ty.IsSetType():
		nesting = configschema.NestingSet
	default:
		panic("unsuitable type")
	}
	nested := SchemaForCtyElementType(ty.ElementType())
	return &configschema.NestedBlock{
		Nesting: nesting,
		Block:   *nested,
	}
}
1372854
func (s *SegmentDemographics) SetDeviceType(v *SetDimension) *SegmentDemographics {
	s.DeviceType = v
	return s
}
434783
func (s *TermvectorsService) Type(typ string) *TermvectorsService {
	s.typ = typ
	return s
}
658565
func (c *Cursor) Type() string {
	if c == nil {
		return "Cursor"
	}

	c.mu.RLock()
	defer c.mu.RUnlock()

	return c.cursorType
}
50151
func (s *BulkService) Type(typ string) *BulkService {
	s.typ = typ
	return s
}
1149502
func (s *DeleteByQueryService) Type(typ ...string) *DeleteByQueryService {
	s.typ = append(s.typ, typ...)
	return s
}
763821
func (r StaticProviderRegistry) StorageProviderTypes() ([]ProviderType, error) {
	typeStrings := make([]string, 0, len(r.Providers))
	for t := range r.Providers {
		typeStrings = append(typeStrings, string(t))
	}
	sort.Strings(typeStrings)
	types := make([]ProviderType, len(typeStrings))
	for i, s := range typeStrings {
		types[i] = ProviderType(s)
	}
	return types, nil
}
735046
func (c *Context) DeviceType() string {
	userAgent := c.RequestHeader("User-Agent")
	deviceType := "web"

	if strings.Contains(userAgent, "Android") ||
		strings.Contains(userAgent, "webOS") ||
		strings.Contains(userAgent, "iPhone") ||
		strings.Contains(userAgent, "BlackBerry") ||
		strings.Contains(userAgent, "Windows Phone") {
		deviceType = "mobile"
	} else if strings.Contains(userAgent, "iPad") ||
		strings.Contains(userAgent, "iPod") ||
		(strings.Contains(userAgent, "tablet") ||
			strings.Contains(userAgent, "RX-34") ||
			strings.Contains(userAgent, "FOLIO")) ||
		(strings.Contains(userAgent, "Kindle") ||
			strings.Contains(userAgent, "Mac OS") &&
				strings.Contains(userAgent, "Silk")) ||
		(strings.Contains(userAgent, "AppleWebKit") &&
			strings.Contains(userAgent, "Silk")) {
		deviceType = "tab"
	} else if strings.Contains(userAgent, "TV") ||
		strings.Contains(userAgent, "NetCast") ||
		strings.Contains(userAgent, "boxee") ||
		strings.Contains(userAgent, "Kylo") ||
		strings.Contains(userAgent, "Roku") ||
		strings.Contains(userAgent, "DLNADOC") {
		deviceType = "tv"
	}
	return deviceType
}
960367
func (d Datastore) Type(ctx context.Context) (types.HostFileSystemVolumeFileSystemType, error) {
	var mds mo.Datastore

	if err := d.Properties(ctx, d.Reference(), []string{"summary.type"}, &mds); err != nil {
		return types.HostFileSystemVolumeFileSystemType(""), err
	}
	return types.HostFileSystemVolumeFileSystemType(mds.Summary.Type), nil
}
97816
func getEphemeralDevices(
	ctx types.Context) (deviceNames []string, err error) {

	buf, err := BlockDevices(ctx)
	if err != nil {
		return nil, err
	}

	// Filter list of all block devices for ephemeral devices
	scanner := bufio.NewScanner(bytes.NewReader(buf))
	scanner.Split(bufio.ScanWords)

	for scanner.Scan() {
		word := scanner.Bytes()
		if !ephemDevRX.Match(word) {
			continue
		}

		name, err := BlockDeviceName(ctx, string(word))
		if err != nil {
			return nil, goof.WithError(
				"ec2 block device mapping lookup failed", err)
		}

		// compensate for kernel volume mapping i.e. change "/dev/sda" to
		// "/dev/xvda"
		deviceNameStr := strings.Replace(
			string(name),
			"sd",
			NextDeviceInfo.Prefix, 1)

		deviceNames = append(deviceNames, deviceNameStr)
	}
	return deviceNames, nil
}
484992
func typeEqual(t1, t2 confType) bool {
	if t1 == nil || t2 == nil {
		return false
	}
	return t1.typeString() == t2.typeString()
}
1366257
func TypeFromFolderType(ft keybase1.FolderType) Type {
	switch ft {
	case keybase1.FolderType_PRIVATE:
		return Private
	case keybase1.FolderType_PUBLIC:
		return Public
	case keybase1.FolderType_TEAM:
		return SingleTeam
	default:
		return Unknown
	}
}