]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/vfs/vnode_if.sh
xnu-7195.50.7.100.1.tar.gz
[apple/xnu.git] / bsd / vfs / vnode_if.sh
old mode 100644 (file)
new mode 100755 (executable)
index 5a721a1..c88ebe1
@@ -1,9 +1,9 @@
 #!/bin/sh -
 copyright='
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2019 Apple Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
  * The contents of this file constitute Original Code as defined in and
  * are subject to the Apple Public Source License Version 1.1 (the
@@ -19,7 +19,7 @@ copyright='
  * License for the specific language governing rights and limitations
  * under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 /*
  * Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved
@@ -170,9 +170,13 @@ exec > $out_h
 echo "$copyright"
 echo "$warning"
 echo '
-#ifndef _VNODE_IF_H_
-#define _VNODE_IF_H_
+#ifndef _SYS_VNODE_IF_H_
+#define _SYS_VNODE_IF_H_
 
+#include <sys/appleapiopts.h>
+#include <sys/ubc.h>
+
+#ifdef __APPLE_API_UNSTABLE
 extern struct vnodeop_desc vop_default_desc;
 '
 
@@ -203,25 +207,23 @@ function doit() {
        printf("static __inline int _%s(", toupper(name));
        for (i=0; i<argc; i++) {
                # generate ANSI protoypes now, hurrah!
-               printf("%s %s", argtype[i], argname[i]);
+               printf("%s _%s", argtype[i], argname[i]);
                if (i < (argc-1)) printf(", ");
        }
        printf(")\n");
        printf("{\n\tstruct %s_args a;\n", name);
        printf("\ta.a_desc = VDESC(%s);\n", name);
        for (i=0; i<argc; i++) {
-               printf("\ta.a_%s = %s;\n", argname[i], argname[i]);
+               printf("\ta.a_%s = _%s;\n", argname[i], argname[i]);
        }
        if (toupper(ubc) == "UBC") {
-               printf("\t{\n\t\tint _err;\n\t\t"   \
-                       "extern int ubc_hold();\n\t\textern void ubc_rele();\n\t\t"     \
-                       "int _didhold = ubc_hold(%s);\n\t\t"  \
-                       "_err = VCALL(%s%s, VOFFSET(%s), &a);\n\t\t"    \
-                       "if (_didhold)\n\t\t\tubc_rele(%s);\n\t\t"      \
+               printf("\t{\n\t\t" \
+                       "int _err;\n\t\t"   \
+                       "_err = VCALL(_%s%s, VOFFSET(%s), &a);\n\t\t"    \
                        "return (_err);\n\t}\n}\n",
                        argname[0], argname[0], arg0special, name, argname[0]);
        } else {
-               printf("\treturn (VCALL(%s%s, VOFFSET(%s), &a));\n}\n",
+               printf("\treturn (VCALL(_%s%s, VOFFSET(%s), &a));\n}\n",
                        argname[0], arg0special, name);
        }
 }
@@ -236,7 +238,7 @@ END {
        arg0special="->b_vp";
        name="vop_strategy";
        doit();
-       name="vop_bwrite";
+       name="VNOP_BWRITE";
        doit();
 }
 '"$awk_parser" | sed -e "$space_elim"
@@ -245,7 +247,8 @@ END {
 echo '
 /* End of special cases. */
 
-#endif /* !_VNODE_IF_H_ */'
+#endif /* __APPLE_API_UNSTABLE */
+#endif /* !_SYS_VNODE_IF_H_ */'
 
 #
 # Redirect stdout to the C file.
@@ -263,15 +266,16 @@ echo '
 #include <sys/vnode.h>
 
 struct vnodeop_desc vop_default_desc = {
-       0,
-       "default",
-       0,
-       NULL,
-       VDESC_NO_OFFSET,
-       VDESC_NO_OFFSET,
-       VDESC_NO_OFFSET,
-       VDESC_NO_OFFSET,
-       NULL,
+       .vdesc_offset = 0,
+       .vdesc_name = "default",
+       .vdesc_flags = 0,
+       .vdesc_vp_offsets = NULL,
+       .vdesc_vpp_offset = VDESC_NO_OFFSET,
+       .vdesc_cred_offset = VDESC_NO_OFFSET,
+       .vdesc_proc_offset = VDESC_NO_OFFSET,
+       .vdesc_componentname_offset = VDESC_NO_OFFSET,
+       .vdesc_context_offset = VDESC_NO_OFFSET,
+       .vdesc_transports = NULL,
 };
 '
 
@@ -310,13 +314,15 @@ function doit() {
        printf("\t0");
        vpnum = 0;
        for (i=0; i<argc; i++) {
-               if (willrele[i]) {
-                       if (argdir[i] ~ /OUT/) {
-                               printf(" | VDESC_VPP_WILLRELE");
-                       } else {
-                               printf(" | VDESC_VP%s_WILLRELE", vpnum);
-                       };
-                       vpnum++;
+               if (match(argtype[i], "struct vnode *") == 1) {
+                       if (willrele[i]) {
+                               if (argdir[i] ~ /OUT/) {
+                                       printf(" | VDESC_VPP_WILLRELE");
+                               } else {
+                                       printf(" | VDESC_VP%s_WILLRELE", vpnum);
+                               };
+                       }
+               vpnum++;
                }
        }
        print ",";
@@ -325,7 +331,7 @@ function doit() {
        # vpp (if any)
        do_offset("struct vnode **");
        # cred (if any)
-       do_offset("struct ucred *");
+       do_offset("kauth_credential_t");
        # proc (if any)
        do_offset("struct proc *");
        # componentname
@@ -342,7 +348,7 @@ END {
        willrele[0]=0;
        name="vop_strategy";
        doit();
-       name="vop_bwrite";
+       name="VNOP_BWRITE";
        doit();
 }
 '"$awk_parser" | sed -e "$space_elim"
@@ -357,7 +363,7 @@ echo '
 struct vnodeop_desc *vfs_op_descs[] = {
        &vop_default_desc,      /* MUST BE FIRST */
        &vop_strategy_desc,     /* XXX: SPECIAL CASE */
-       &vop_bwrite_desc,       /* XXX: SPECIAL CASE */
+       &VNOP_BWRITE_desc,      /* XXX: SPECIAL CASE */
 '
 
 # Body stuff