Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/cache/g_cache.c
Show First 20 Lines • Show All 488 Lines • ▼ Show 20 Lines | g_cache_create(struct g_class *mp, struct g_provider *pp, | ||||
/* Cache size is minimum 100. */ | /* Cache size is minimum 100. */ | ||||
if (md->md_size < 100) { | if (md->md_size < 100) { | ||||
G_CACHE_DEBUG(0, "Invalid size for device %s.", md->md_name); | G_CACHE_DEBUG(0, "Invalid size for device %s.", md->md_name); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
/* Block size restrictions. */ | /* Block size restrictions. */ | ||||
bshift = ffs(md->md_bsize) - 1; | bshift = ffs(md->md_bsize) - 1; | ||||
if (md->md_bsize == 0 || md->md_bsize > MAXPHYS || | if (md->md_bsize == 0 || md->md_bsize > maxphys || | ||||
md->md_bsize != 1 << bshift || | md->md_bsize != 1 << bshift || | ||||
(md->md_bsize % pp->sectorsize) != 0) { | (md->md_bsize % pp->sectorsize) != 0) { | ||||
G_CACHE_DEBUG(0, "Invalid blocksize for provider %s.", pp->name); | G_CACHE_DEBUG(0, "Invalid blocksize for provider %s.", pp->name); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
/* Check for duplicate unit. */ | /* Check for duplicate unit. */ | ||||
if (g_cache_find_device(mp, (const char *)&md->md_name) != NULL) { | if (g_cache_find_device(mp, (const char *)&md->md_name) != NULL) { | ||||
▲ Show 20 Lines • Show All 509 Lines • Show Last 20 Lines |