static int zfsctl_snapshot_zname(struct inode *ip, const char *name, int len, char *zname) { objset_t *os = ITOZSB(ip)->z_os; if (snapshot_namecheck(name, NULL, NULL) != 0) return (EILSEQ); dmu_objset_name(os, zname); if ((strlen(zname) + 1 + strlen(name)) >= len) return (ENAMETOOLONG); (void) strcat(zname, "@"); (void) strcat(zname, name); return (0); }
/* * Permissions set name must start with the letter '@' followed by the * same character restrictions as snapshot names, except that the name * cannot exceed 64 characters. */ int permset_namecheck(const char *path, namecheck_err_t *why, char *what) { if (strlen(path) >= ZFS_PERMSET_MAXLEN) { if (why) *why = NAME_ERR_TOOLONG; return (-1); } if (path[0] != '@') { if (why) { *why = NAME_ERR_NO_AT; *what = path[0]; } return (-1); } return (snapshot_namecheck(&path[1], why, what)); }