zfs_namecheck.c (185029) | zfs_namecheck.c (209962) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* |
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. | 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
23 * Use is subject to license terms. 24 */ 25 | 23 * Use is subject to license terms. 24 */ 25 |
26#pragma ident "%Z%%M% %I% %E% SMI" 27 | |
28/* 29 * Common name validation routines for ZFS. These routines are shared by the 30 * userland code as well as the ioctl() layer to ensure that we don't 31 * inadvertently expose a hole through direct ioctl()s that never gets tested. 32 * In userland, however, we want significantly more information about _why_ the 33 * name is invalid. In the kernel, we only care whether it's valid or not. 34 * Each routine therefore takes a 'namecheck_err_t' which describes exactly why 35 * the name failed to validate. --- 304 unchanged lines hidden (view full) --- 340 if (pool[0] == 'c' && (pool[1] >= '0' && pool[1] <= '9')) { 341 if (why) 342 *why = NAME_ERR_DISKLIKE; 343 return (-1); 344 } 345 346 return (0); 347} | 26/* 27 * Common name validation routines for ZFS. These routines are shared by the 28 * userland code as well as the ioctl() layer to ensure that we don't 29 * inadvertently expose a hole through direct ioctl()s that never gets tested. 30 * In userland, however, we want significantly more information about _why_ the 31 * name is invalid. In the kernel, we only care whether it's valid or not. 32 * Each routine therefore takes a 'namecheck_err_t' which describes exactly why 33 * the name failed to validate. --- 304 unchanged lines hidden (view full) --- 338 if (pool[0] == 'c' && (pool[1] >= '0' && pool[1] <= '9')) { 339 if (why) 340 *why = NAME_ERR_DISKLIKE; 341 return (-1); 342 } 343 344 return (0); 345} |
348 349/* 350 * Check if the dataset name is private for internal usage. 351 * '$' is reserved for internal dataset names. e.g. "$MOS" 352 * 353 * Return 1 if the given name is used internally. 354 * Return 0 if it is not. 355 */ 356int 357dataset_name_hidden(const char *name) 358{ 359 if (strchr(name, '$') != NULL) 360 return (1); 361 362 return (0); 363} | |