Add new errno ``ENOATTR''.

This commit is contained in:
Brian Feldman 2002-03-07 15:13:44 +00:00
parent 1acac5eba8
commit 9d9737ecb2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91814
5 changed files with 24 additions and 30 deletions

View file

@ -29,6 +29,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@ -143,6 +145,7 @@ const char *const sys_errlist[] = {
"Value too large to be stored in data type", /* 84 - EOVERFLOW */
"Operation canceled", /* 85 - ECANCELED */
"Illegal byte sequence", /* 86 - EILSEQ */
"Attribute not found", /* 87 - ENOATTR */
};
int errno;
const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]);

View file

@ -451,6 +451,8 @@ The scheduled operation was canceled.
While decoding a multibyte character the function came along an
invalid or an incomplete sequence of bytes or the given wide
character is invalid.
.It Er 87 ENOATTR Em "Attribute not found"
The specified extended attribute does not exist.
.El
.Sh DEFINITIONS
.Bl -tag -width Ds

View file

@ -167,7 +167,8 @@ __END_DECLS
#define EOVERFLOW 84 /* Value too large to be stored in data type */
#define ECANCELED 85 /* Operation canceled */
#define EILSEQ 86 /* Illegal byte sequence */
#define ELAST 86 /* Must be equal largest errno */
#define ENOATTR 87 /* Attribute not found */
#define ELAST 87 /* Must be equal largest errno */
#endif /* _POSIX_SOURCE */

View file

@ -242,10 +242,9 @@ ufs_getacl(ap)
POSIX1E_ACL_ACCESS_EXTATTR_NAME, &len, (char *) ap->a_aclp,
ap->a_td);
switch (error) {
/* XXX: Will be ENOATTR. */
/* XXX: If ufs_getacl() should work on file systems without
* the EA configured, add case EOPNOTSUPP here. */
case ENOENT:
case ENOATTR:
/*
* Legitimately no ACL set on object, purely
* emulate it through the inode. These fields will
@ -302,10 +301,9 @@ ufs_getacl(ap)
* and an empty ACL, as required by POSIX.1e.
*/
switch (error) {
/* XXX: Will be ENOATTR. */
/* XXX: If ufs_getacl() should work on file systems without
* the EA configured, add case EOPNOTSUPP here. */
case ENOENT:
case ENOATTR:
bzero(ap->a_aclp, sizeof(*ap->a_aclp));
ap->a_aclp->acl_cnt = 0;
error = 0;
@ -420,10 +418,9 @@ ufs_setacl(ap)
* XXX: Note that since we can't distinguish
* "that EA is not supported" from "that EA is not
* defined", the success case here overlaps the
* the ENOENT->EOPNOTSUPP case below.
* the ENOATTR->EOPNOTSUPP case below.
*/
/* XXX: the ENOENT here will eventually be ENOATTR. */
if (error == ENOENT)
if (error == ENOATTR)
error = 0;
} else
error = vn_extattr_set(ap->a_vp, IO_NODELOCKED,
@ -439,8 +436,7 @@ ufs_setacl(ap)
* Map lack of attribute definition in UFS_EXTATTR into lack of
* support for ACLs on the file system.
*/
/* XXX: ENOENT here will eventually be ENOATTR. */
if (error == ENOENT)
if (error == ENOATTR)
return (EOPNOTSUPP);
if (error != 0)
return (error);

View file

@ -685,8 +685,7 @@ ufs_extattr_disable(struct ufsmount *ump, int attrnamespace,
uele = ufs_extattr_find_attr(ump, attrnamespace, attrname);
if (!uele)
/* XXX: ENOENT here will eventually be ENOATTR. */
return (ENOENT);
return (ENOATTR);
LIST_REMOVE(uele, uele_entries);
@ -881,8 +880,7 @@ ufs_extattr_get(struct vnode *vp, int attrnamespace, const char *name,
attribute = ufs_extattr_find_attr(ump, attrnamespace, name);
if (!attribute)
/* XXX: ENOENT here will eventually be ENOATTR. */
return (ENOENT);
return (ENOATTR);
if ((error = ufs_extattr_credcheck(vp, attribute, cred, td, IREAD)))
return (error);
@ -937,8 +935,7 @@ ufs_extattr_get(struct vnode *vp, int attrnamespace, const char *name,
/* Defined? */
if ((ueh.ueh_flags & UFS_EXTATTR_ATTR_FLAG_INUSE) == 0) {
/* XXX: ENOENT here will eventually be ENOATTR. */
error = ENOENT;
error = ENOATTR;
goto vopunlock_exit;
}
@ -950,10 +947,9 @@ ufs_extattr_get(struct vnode *vp, int attrnamespace, const char *name,
* is to coerce this to undefined, and let it get cleaned
* up by the next write or extattrctl clean.
*/
printf("ufs_extattr_get: inode number inconsistency (%d, %d)\n",
ueh.ueh_i_gen, ip->i_gen);
/* XXX: ENOENT here will eventually be ENOATTR. */
error = ENOENT;
printf("ufs_extattr_get (%s): inode number inconsistency (%d, %d)\n",
mp->mnt_stat.f_mntonname, ueh.ueh_i_gen, ip->i_gen);
error = ENOATTR;
goto vopunlock_exit;
}
@ -1062,8 +1058,7 @@ ufs_extattr_set(struct vnode *vp, int attrnamespace, const char *name,
attribute = ufs_extattr_find_attr(ump, attrnamespace, name);
if (!attribute)
/* XXX: ENOENT here will eventually be ENOATTR. */
return (ENOENT);
return (ENOATTR);
if ((error = ufs_extattr_credcheck(vp, attribute, cred, td, IWRITE)))
return (error);
@ -1174,8 +1169,7 @@ ufs_extattr_rm(struct vnode *vp, int attrnamespace, const char *name,
attribute = ufs_extattr_find_attr(ump, attrnamespace, name);
if (!attribute)
/* XXX: ENOENT here will eventually be ENOATTR. */
return (ENOENT);
return (ENOATTR);
if ((error = ufs_extattr_credcheck(vp, attribute, cred, td, IWRITE)))
return (error);
@ -1220,8 +1214,7 @@ ufs_extattr_rm(struct vnode *vp, int attrnamespace, const char *name,
/* Defined? */
if ((ueh.ueh_flags & UFS_EXTATTR_ATTR_FLAG_INUSE) == 0) {
/* XXX: ENOENT here will eventually be ENOATTR. */
error = ENOENT;
error = ENOATTR;
goto vopunlock_exit;
}
@ -1233,10 +1226,9 @@ ufs_extattr_rm(struct vnode *vp, int attrnamespace, const char *name,
* coerce this to undefined, and let it get cleaned up by
* the next write or extattrctl clean.
*/
printf("ufs_extattr_rm: inode number inconsistency (%d, %d)\n",
ueh.ueh_i_gen, ip->i_gen);
/* XXX: ENOENT here will eventually be ENOATTR. */
error = ENOENT;
printf("ufs_extattr_rm (%s): inode number inconsistency (%d, %d)\n",
mp->mnt_stat.f_mntonname, ueh.ueh_i_gen, ip->i_gen);
error = ENOATTR;
goto vopunlock_exit;
}