Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_firmware.c
Show First 20 Lines • Show All 296 Lines • ▼ Show 20 Lines | try_binary_file(const char *imagename, uint32_t flags) | ||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, fn); | NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, fn); | ||||
oflags = FREAD; | oflags = FREAD; | ||||
error = vn_open(&nd, &oflags, 0, NULL); | error = vn_open(&nd, &oflags, 0, NULL); | ||||
if (error) | if (error) | ||||
goto err; | goto err; | ||||
NDFREE_PNBUF(&nd); | NDFREE_PNBUF(&nd); | ||||
if (nd.ni_vp->v_type != VREG) | if (nd.ni_vp->v_type != VREG) | ||||
goto err2; | goto err2; | ||||
error = VOP_GETATTR(nd.ni_vp, &vattr, cred); | error = VOP_GETATTR(nd.ni_vp, 0, &vattr, cred); | ||||
if (error) | if (error) | ||||
goto err2; | goto err2; | ||||
/* | /* | ||||
* Limit this to something sane, 8MB by default. | * Limit this to something sane, 8MB by default. | ||||
*/ | */ | ||||
if (vattr.va_size > firmware_max_size) { | if (vattr.va_size > firmware_max_size) { | ||||
printf("Firmware %s is too big: %lld bytes, %ld bytes max.\n", | printf("Firmware %s is too big: %lld bytes, %ld bytes max.\n", | ||||
▲ Show 20 Lines • Show All 346 Lines • Show Last 20 Lines |