+ cname.cn_nameiop = CREATE;
+ cname.cn_flags = ISLASTCN;
+ cname.cn_context = ctx;
+ cname.cn_pnbuf = filename;
+ cname.cn_pnlen = sizeof(filename);
+ cname.cn_nameptr = filename;
+ cname.cn_namelen = strlen(filename);
+ cname.cn_hash = 0;
+ cname.cn_consume = 0;
+
+ VATTR_INIT(&va);
+ VATTR_SET(&va, va_type, VREG);
+ VATTR_SET(&va, va_mode, S_IFREG | S_IRUSR | S_IWUSR);
+ VATTR_SET(&va, va_uid, 0);
+ VATTR_SET(&va, va_gid, 0);
+
+ if (hfs_start_transaction(hfsmp) != 0) {
+ error = EINVAL;
+ goto out;
+ }
+
+ /* call ourselves directly, ignore the higher-level VFS file creation code */
+ error = VNOP_CREATE(dvp, &vp, &cname, &va, ctx);
+ if (error) {
+ printf("hfs: error %d creating HFBT on %s\n", error, HFSTOVCB(hfsmp)->vcbVN);
+ goto out;
+ }
+ if (dvp) {
+ vnode_put(dvp);
+ dvp = NULL;
+ }
+ if ((error = hfs_lock(VTOC(vp), HFS_EXCLUSIVE_LOCK, HFS_LOCK_DEFAULT))) {
+ goto out;
+ }
+ cp = VTOC(vp);
+