* Get a mount option by its name. * * Return 0 if the option was found, ENOENT otherwise. * If len is non-NULL it will be filled with the length * of the option. If buf is non-NULL, it will be filled * with the address of the option. */
| 2009 | * with the address of the option. |
| 2010 | */ |
| 2011 | int |
| 2012 | vfs_getopt(struct vfsoptlist *opts, const char *name, void **buf, int *len) |
| 2013 | { |
| 2014 | struct vfsopt *opt; |
| 2015 | |
| 2016 | KASSERT(opts != NULL, ("vfs_getopt: caller passed 'opts' as NULL")); |
| 2017 | |
| 2018 | TAILQ_FOREACH(opt, opts, link) { |
| 2019 | if (strcmp(name, opt->name) == 0) { |
| 2020 | opt->seen = 1; |
| 2021 | if (len != NULL) |
| 2022 | *len = opt->len; |
| 2023 | if (buf != NULL) |
| 2024 | *buf = opt->value; |
| 2025 | return (0); |
| 2026 | } |
| 2027 | } |
| 2028 | return (ENOENT); |
| 2029 | } |
| 2030 | |
| 2031 | int |
| 2032 | vfs_getopt_pos(struct vfsoptlist *opts, const char *name) |
no test coverage detected