FreeBSD/sys/kern/vfs_mount.c
/*
 * Add an argument which is a userland string.
 */
Add an argument which is a userland string.
Add an argument which is a userland string .
struct mntarg *
mount_argsu(struct mntarg *ma, const char *name, const void *val, int len)
{
	struct mntaarg *maa;
	char *tbuf;
	if (val == NULL)
		return (ma);
	if (ma == NULL) {
		ma = malloc(sizeof *ma, M_MOUNT, M_WAITOK | M_ZERO);
		SLIST_INIT(&ma->list);
	}
	if (ma->error)
		return (ma);
	maa = malloc(sizeof *maa + len, M_MOUNT, M_WAITOK | M_ZERO);
	SLIST_INSERT_HEAD(&ma->list, maa, next);
	tbuf = (void *)(maa + 1);
	ma->error = copyinstr(val, tbuf, len, NULL);
	return (mount_arg(ma, name, tbuf, -1));
}
struct mntarg * mount_argsu ( struct mntarg * ma , const char * name , const void * val , int len ) { struct mntaarg * maa ; char * tbuf ; if ( val == NULL ) return ( ma ) ; if ( ma == NULL ) { ma = malloc ( sizeof * ma , M_MOUNT , M_WAITOK | M_ZERO ) ; SLIST_INIT ( & ma -> list ) ; } if ( ma -> error ) return ( ma ) ; maa = malloc ( sizeof * maa + len , M_MOUNT , M_WAITOK | M_ZERO ) ; SLIST_INSERT_HEAD ( & ma -> list , maa , next ) ; tbuf = ( void * ) ( maa + 1 ) ; ma -> error = copyinstr ( val , tbuf , len , NULL ) ; return ( mount_arg ( ma , name , tbuf , -1 ) ) ; }
Add an argument which is a userland string.
Add an argument which is a userland string .