* Add an argument which is a userland string. */
| 2355 | * Add an argument which is a userland string. |
| 2356 | */ |
| 2357 | struct mntarg * |
| 2358 | mount_argsu(struct mntarg *ma, const char *name, const void *val, int len) |
| 2359 | { |
| 2360 | struct mntaarg *maa; |
| 2361 | char *tbuf; |
| 2362 | |
| 2363 | if (val == NULL) |
| 2364 | return (ma); |
| 2365 | if (ma == NULL) { |
| 2366 | ma = malloc(sizeof *ma, M_MOUNT, M_WAITOK | M_ZERO); |
| 2367 | SLIST_INIT(&ma->list); |
| 2368 | } |
| 2369 | if (ma->error) |
| 2370 | return (ma); |
| 2371 | maa = malloc(sizeof *maa + len, M_MOUNT, M_WAITOK | M_ZERO); |
| 2372 | SLIST_INSERT_HEAD(&ma->list, maa, next); |
| 2373 | tbuf = (void *)(maa + 1); |
| 2374 | ma->error = copyinstr(val, tbuf, len, NULL); |
| 2375 | return (mount_arg(ma, name, tbuf, -1)); |
| 2376 | } |
| 2377 | |
| 2378 | /* |
| 2379 | * Plain argument. |