+ BlueSkyInode *dir = lookup_fh(&argp->where.dir);
+ if (dir == NULL) {
+ result.status = NFS3ERR_STALE;
+ result.diropres3_u.resfail = wcc;
+ return &result;
+ }
+
+ encode_pre_wcc(&wcc, dir);
+ if (dir->type != BLUESKY_DIRECTORY) {
+ result.status = NFS3ERR_NOTDIR;
+ result.diropres3_u.resfail = wcc;
+ return &result;
+ }
+
+ if (!validate_filename(argp->where.name)
+ || strcmp(argp->where.name, ".") == 0
+ || strcmp(argp->where.name, "..") == 0)
+ {
+ result.status = NFS3ERR_EXIST;
+ result.diropres3_u.resfail = wcc;
+ return &result;
+ }
+
+ BlueSkyInode *file;
+ file = bluesky_new_inode(bluesky_fs_alloc_inode(fs), fs, BLUESKY_SYMLINK);
+ file->nlink = 1;
+ file->mode = 0755;
+ int64_t time = bluesky_get_current_time();
+ file->mtime = time;
+ file->ctime = time;
+ file->atime = time;
+ file->ntime = time;
+ file->symlink_contents = g_strdup(argp->symlink.symlink_data);
+ bluesky_insert_inode(fs, file);
+ bluesky_directory_insert(dir, argp->where.name, file->inum);
+
+ dir->mtime = dir->ctime = bluesky_get_current_time();
+ dir->change_count++;
+
+ wcc.after.present = TRUE;
+ encode_fattr3(&wcc.after.post_op_attr_u.attributes, dir);
+ result.diropres3_u.resok.obj_attributes.present = TRUE;
+ encode_fattr3(&result.diropres3_u.resok.obj_attributes.post_op_attr_u.attributes, file);
+ result.diropres3_u.resok.dir_wcc = wcc;
+
+ static uint64_t fh_bytes;
+ fh_bytes = GUINT64_TO_BE(file->inum);
+ result.diropres3_u.resok.obj.present = TRUE;
+ result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_len = 8;
+ result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_val = (char *)&fh_bytes;