MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mount_arg

Function mount_arg

freebsd/kern/vfs_mount.c:2383–2407  ·  view source on GitHub ↗

* Plain argument. * * If length is -1, treat value as a C string. */

Source from the content-addressed store, hash-verified

2381 * If length is -1, treat value as a C string.
2382 */
2383struct mntarg *
2384mount_arg(struct mntarg *ma, const char *name, const void *val, int len)
2385{
2386
2387 if (ma == NULL) {
2388 ma = malloc(sizeof *ma, M_MOUNT, M_WAITOK | M_ZERO);
2389 SLIST_INIT(&ma->list);
2390 }
2391 if (ma->error)
2392 return (ma);
2393
2394 ma->v = realloc(ma->v, sizeof *ma->v * (ma->len + 2),
2395 M_MOUNT, M_WAITOK);
2396 ma->v[ma->len].iov_base = (void *)(uintptr_t)name;
2397 ma->v[ma->len].iov_len = strlen(name) + 1;
2398 ma->len++;
2399
2400 ma->v[ma->len].iov_base = (void *)(uintptr_t)val;
2401 if (len < 0)
2402 ma->v[ma->len].iov_len = strlen(val) + 1;
2403 else
2404 ma->v[ma->len].iov_len = len;
2405 ma->len++;
2406 return (ma);
2407}
2408
2409/*
2410 * Free a mntarg structure

Callers 5

parse_mountFunction · 0.85
parse_mountroot_optionsFunction · 0.85
mount_argbFunction · 0.85
mount_argsuFunction · 0.85
kernel_vmountFunction · 0.85

Calls 2

mallocFunction · 0.85
reallocFunction · 0.70

Tested by

no test coverage detected