src/sys/kern/vfs_mount.c
/*
 * Check if options are equal (with or without the "no" prefix).
 */
Check if options are equal (with or without the "no" prefix).
Check if options are equal ( with or without the " no " prefix ) .
static int
vfs_equalopts(const char *opt1, const char *opt2)
{
	char *p;
	if (strcmp(opt1, opt2) == 0)
		return (1);
	if (strncmp(opt1, "no", 2) == 0 && strcmp(opt1 + 2, opt2) == 0)
		return (1);
	if (strncmp(opt2, "no", 2) == 0 && strcmp(opt1, opt2 + 2) == 0)
		return (1);
	while ((p = strchr(opt1, '.')) != NULL &&
	    !strncmp(opt1, opt2, ++p - opt1)) {
		opt2 += p - opt1;
		opt1 = p;
		if (strncmp(opt1, "no", 2) == 0 && strcmp(opt1 + 2, opt2) == 0)
			return (1);
		if (strncmp(opt2, "no", 2) == 0 && strcmp(opt1, opt2 + 2) == 0)
			return (1);
	}
	if ((vfs_isopt_ro(opt1) || vfs_isopt_rw(opt1)) &&
	    (vfs_isopt_ro(opt2) || vfs_isopt_rw(opt2)))
		return (1);
	return (0);
}
static int vfs_equalopts ( const char * opt1 , const char * opt2 ) { char * p ; if ( strcmp ( opt1 , opt2 ) == 0 ) return ( 1 ) ; if ( strncmp ( opt1 , " " , 2 ) == 0 && strcmp ( opt1 + 2 , opt2 ) == 0 ) return ( 1 ) ; if ( strncmp ( opt2 , " " , 2 ) == 0 && strcmp ( opt1 , opt2 + 2 ) == 0 ) return ( 1 ) ; while ( ( p = strchr ( opt1 , ' ' ) ) != NULL && ! strncmp ( opt1 , opt2 , ++ p - opt1 ) ) { opt2 += p - opt1 ; opt1 = p ; if ( strncmp ( opt1 , " " , 2 ) == 0 && strcmp ( opt1 + 2 , opt2 ) == 0 ) return ( 1 ) ; if ( strncmp ( opt2 , " " , 2 ) == 0 && strcmp ( opt1 , opt2 + 2 ) == 0 ) return ( 1 ) ; } if ( ( vfs_isopt_ro ( opt1 ) || vfs_isopt_rw ( opt1 ) ) && ( vfs_isopt_ro ( opt2 ) || vfs_isopt_rw ( opt2 ) ) ) return ( 1 ) ; return ( 0 ) ; }
Check if options are equal (with or without the "no" prefix).
Check if options are equal ( with or without the " no " prefix ) .
/* "opt" vs. "opt" or "noopt" vs. "noopt" */ /* "noopt" vs. "opt" */ /* "opt" vs. "noopt" */ /* "foo.noopt" vs. "foo.opt" */ /* "foo.opt" vs. "foo.noopt" */ /* "ro" / "rdonly" / "norw" / "rw" / "noro" */