Question

  675  * Check the validity of an ACL for a file.
  676  */
  677 int
  678 ufs_aclcheck(ap)
  679         struct vop_aclcheck_args /* {
  680                 struct vnode *vp;
  681                 acl_type_t type;
  682                 struct acl *aclp;
  683                 struct ucred *cred;
  684                 struct thread *td;
  685         } */ *ap;
  686 {
  687 
  688         if ((ap->a_vp->v_mount->mnt_flag & (MNT_ACLS | MNT_NFS4ACLS)) == 0)
  689                 return (EOPNOTSUPP);
  690 
  691         if (ap->a_type == ACL_TYPE_NFS4)
  692                 return (ufs_aclcheck_nfs4(ap));
  693 
  694         return (ufs_aclcheck_posix1e(ap));
  695 }
  696 
  697 #endif /* !UFS_ACL */

This code comes from Freebsd UFS source. This function looks strange. After function name, there is a struct being defined. What's the deal? thanks

Was it helpful?

Solution

This is an old style of writing C functions where you could define a function like:

void foo(a)  /* Function and its arguments */
   int a; /* Define the type of the arguments */
{
  // Function body
}

What you have in your function, after removing the comments:

int ufs_aclcheck(ap)
    struct vop_aclcheck_args * ap;
{
   // Function body
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top