NFS link operation.
[bluesky.git] / nfs3 / nfs3.c
1 /*
2  * This is sample code generated by rpcgen.
3  * These are only templates and you can use them
4  * as a guideline for developing your own functions.
5  */
6
7 #include "nfs3_prot.h"
8 #include "bluesky.h"
9
10 extern BlueSkyFS *fs;
11
12 static int null_int;
13 static void *null_result = (void *)&null_int;
14
15 /* Check that a string is a valid file name.  We require that it be valid
16  * UTF-8, that it not be empty, and that it not contain embedded forward
17  * slashes.  Also checks that the length of the string is not more than the
18  * maximum allowed length.  This function does allow the names "." and "..".
19  * Returns TRUE if the string is allowed as a filename. */
20 gboolean validate_filename(const char *filename)
21 {
22     if (filename == NULL || filename[0] == '\0')
23         return FALSE;
24     if (strlen(filename) > 255)
25         return FALSE;
26     if (!g_utf8_validate(filename, -1, NULL))
27         return FALSE;
28     if (strchr(filename, '/') != NULL)
29         return FALSE;
30     return TRUE;
31 }
32
33 /* Look up a BlueSkyInode given an NFS filehandle.  Returns NULL if the
34  * filehandle is invalid. */
35 BlueSkyInode *lookup_fh(nfs_fh3 *fh)
36 {
37     BlueSkyInode *inode = NULL;
38     if (fh->data.data_len == 8) {
39         uint64_t inum = GUINT64_FROM_BE(*(uint64_t *)(fh->data.data_val));
40         inode = bluesky_get_inode(fs, inum);
41     }
42     return inode;
43 }
44
45 int64_t decode_nfstime3(nfstime3 *time)
46 {
47     int64_t result = (int64_t)time->seconds * 1000000;
48     result += time->nseconds / 1000;
49     return result;
50 }
51
52 void set_attributes(BlueSkyInode *inode, sattr3 *attributes)
53 {
54     int64_t now = bluesky_get_current_time();
55
56     if (attributes->mode.set) {
57         inode->mode = attributes->mode.set_uint32_u.val;
58     }
59
60     if (attributes->uid.set) {
61         inode->uid = attributes->uid.set_uint32_u.val;
62     }
63
64     if (attributes->gid.set) {
65         inode->gid = attributes->gid.set_uint32_u.val;
66     }
67
68     if (attributes->size.set) {
69         if (inode->type == BLUESKY_REGULAR) {
70             bluesky_file_truncate(inode, attributes->size.set_uint64_u.val);
71             inode->mtime = now;
72         }
73     }
74
75     switch (attributes->atime.set) {
76     case DONT_CHANGE:
77         break;
78     case SET_TO_SERVER_TIME:
79         inode->atime = now;
80         break;
81     case SET_TO_CLIENT_TIME:
82         inode->atime = decode_nfstime3(&attributes->atime.set_time_u.time);
83         break;
84     }
85
86     switch (attributes->mtime.set) {
87     case DONT_CHANGE:
88         break;
89     case SET_TO_SERVER_TIME:
90         inode->mtime = now;
91         break;
92     case SET_TO_CLIENT_TIME:
93         inode->mtime = decode_nfstime3(&attributes->mtime.set_time_u.time);
94         break;
95     }
96
97     inode->ctime = now;
98     inode->change_count++;
99 }
100
101 /* Copy inode attributes into NFS response.  The BlueSkyInode should be locked
102  * by the caller. */
103 void encode_fattr3(struct fattr3 *result, BlueSkyInode *inode)
104 {
105     result->type = inode->type;
106     result->mode = inode->mode;
107     result->nlink = inode->nlink;
108     result->uid = inode->uid;
109     result->gid = inode->gid;
110     result->size = inode->size;
111     result->used = 0;
112     result->rdev.major = 0;
113     result->rdev.minor = 0;
114     result->fsid = 0;
115     result->fileid = inode->inum;
116     result->atime.seconds = inode->atime / 1000000;
117     result->atime.nseconds = (inode->atime % 1000000) * 1000;
118     result->mtime.seconds = inode->mtime / 1000000;
119     result->mtime.nseconds = (inode->mtime % 1000000) * 1000;
120     result->ctime.seconds = inode->ctime / 1000000;
121     result->ctime.nseconds = (inode->ctime % 1000000) * 1000;
122 }
123
124 void encode_pre_wcc(struct wcc_data *wcc, BlueSkyInode *inode)
125 {
126     wcc->before.present = TRUE;
127     wcc->before.pre_op_attr_u.attributes.size = inode->size;
128     wcc->before.pre_op_attr_u.attributes.mtime.seconds = inode->mtime / 1000000;
129     wcc->before.pre_op_attr_u.attributes.mtime.nseconds = (inode->mtime % 1000000) * 1000;
130     wcc->before.pre_op_attr_u.attributes.ctime.seconds = inode->ctime / 1000000;
131     wcc->before.pre_op_attr_u.attributes.ctime.nseconds = (inode->ctime % 1000000) * 1000;
132 }
133
134 void *
135 nfsproc3_null_3_svc(void *argp, struct svc_req *rqstp)
136 {
137     return null_result;
138 }
139
140 getattr3res *
141 nfsproc3_getattr_3_svc(nfs_fh3 *argp, struct svc_req *rqstp)
142 {
143     static getattr3res result;
144
145     BlueSkyInode *inode = lookup_fh(argp);
146     if (inode != NULL) {
147         result.status = NFS3_OK;
148         encode_fattr3(&result.getattr3res_u.attributes, inode);
149     } else {
150         result.status = NFS3ERR_STALE;
151     }
152
153     return &result;
154 }
155
156 wccstat3 *
157 nfsproc3_setattr_3_svc(setattr3args *argp, struct svc_req *rqstp)
158 {
159     static wccstat3 result;
160
161     result.wccstat3_u.wcc.before.present = FALSE;
162     result.wccstat3_u.wcc.after.present = FALSE;
163     BlueSkyInode *inode = lookup_fh(&argp->object);
164     if (inode == NULL) {
165         result.status = NFS3ERR_STALE;
166         return &result;
167     }
168
169     encode_pre_wcc(&result.wccstat3_u.wcc, inode);
170     if (argp->guard.check) {
171         if (inode->ctime != decode_nfstime3(&argp->guard.sattrguard3_u.ctime)) {
172             result.status = NFS3ERR_NOT_SYNC;
173             result.wccstat3_u.wcc.after.present = TRUE;
174             encode_fattr3(&result.wccstat3_u.wcc.after.post_op_attr_u.attributes, inode);
175             return &result;
176         }
177     }
178
179     set_attributes(inode, &argp->new_attributes);
180
181     result.wccstat3_u.wcc.after.present = TRUE;
182     encode_fattr3(&result.wccstat3_u.wcc.after.post_op_attr_u.attributes,
183                   inode);
184     result.status = NFS3_OK;
185
186     return &result;
187 }
188
189 lookup3res *
190 nfsproc3_lookup_3_svc(diropargs3 *argp, struct svc_req *rqstp)
191 {
192     static lookup3res result;
193
194     BlueSkyInode *dir = lookup_fh(&argp->dir);
195     if (dir == NULL) {
196         result.status = NFS3ERR_STALE;
197         result.lookup3res_u.resfail.present = FALSE;
198         return &result;
199     }
200
201     result.lookup3res_u.resfail.present = TRUE;
202     encode_fattr3(&result.lookup3res_u.resfail.post_op_attr_u.attributes, dir);
203     if (!validate_filename(argp->name)) {
204         if (strlen(argp->name) > 255)
205             result.status = NFS3ERR_NAMETOOLONG;
206         else
207             result.status = NFS3ERR_NOENT;
208         return &result;
209     }
210
211     /* TODO: Special-case "." and "..". */
212     uint64_t inum = bluesky_directory_lookup(dir, argp->name);
213     if (inum == 0) {
214         result.status = NFS3ERR_NOENT;
215         return &result;
216     }
217     BlueSkyInode *inode = bluesky_get_inode(fs, inum);
218     if (inode == NULL) {
219         result.status = NFS3ERR_NOENT;
220         return &result;
221     }
222
223     result.status = NFS3_OK;
224     result.lookup3res_u.resok.dir_attributes.present = TRUE;
225     encode_fattr3(&result.lookup3res_u.resok.dir_attributes.post_op_attr_u.attributes, dir);
226     result.lookup3res_u.resok.obj_attributes.present = TRUE;
227     encode_fattr3(&result.lookup3res_u.resok.obj_attributes.post_op_attr_u.attributes, inode);
228
229     static uint64_t fh_bytes;
230     fh_bytes = GUINT64_TO_BE(inum);
231     result.lookup3res_u.resok.object.data.data_len = 8;
232     result.lookup3res_u.resok.object.data.data_val = (char *)&fh_bytes;
233
234     return &result;
235 }
236
237 access3res *
238 nfsproc3_access_3_svc(access3args *argp, struct svc_req *rqstp)
239 {
240     static access3res result;
241
242     BlueSkyInode *inode = lookup_fh(&argp->object);
243     if (inode == NULL) {
244         result.status = NFS3ERR_STALE;
245         result.access3res_u.resfail.present = FALSE;
246         return &result;
247     }
248
249     result.status = NFS3_OK;
250     result.access3res_u.resok.obj_attributes.present = TRUE;
251     encode_fattr3(&result.access3res_u.resok.obj_attributes.post_op_attr_u.attributes, inode);
252     result.access3res_u.resok.access = argp->access;
253
254     return &result;
255 }
256
257 readlink3res *
258 nfsproc3_readlink_3_svc(nfs_fh3 *argp, struct svc_req *rqstp)
259 {
260     static readlink3res result;
261
262     result.status = NFS3ERR_NOTSUPP;
263
264     return &result;
265 }
266
267 read3res *
268 nfsproc3_read_3_svc(read3args *argp, struct svc_req *rqstp)
269 {
270     static read3res result;
271     static char buf[32768];
272
273     BlueSkyInode *inode = lookup_fh(&argp->file);
274     if (inode == NULL) {
275         result.status = NFS3ERR_STALE;
276         result.read3res_u.resfail.present = FALSE;
277         return &result;
278     }
279
280     int count = argp->count;
281     if (argp->offset >= inode->size) {
282         count = 0;
283         result.read3res_u.resok.eof = TRUE;
284     } else {
285         count = MIN(count, inode->size - argp->offset);
286         if (argp->offset + count == inode->size)
287             result.read3res_u.resok.eof = TRUE;
288         else
289             result.read3res_u.resok.eof = FALSE;
290
291         bluesky_file_read(inode, argp->offset, buf, count);
292     }
293
294     result.status = NFS3_OK;
295     result.read3res_u.resok.file_attributes.present = TRUE;
296     encode_fattr3(&result.read3res_u.resok.file_attributes.post_op_attr_u.attributes, inode);
297     result.read3res_u.resok.count = count;
298     result.read3res_u.resok.data.data_val = buf;
299     result.read3res_u.resok.data.data_len = count;
300
301     return &result;
302 }
303
304 write3res *
305 nfsproc3_write_3_svc(write3args *argp, struct svc_req *rqstp)
306 {
307     static write3res result;
308     struct wcc_data wcc;
309     memset(&wcc, 0, sizeof(wcc));
310
311     BlueSkyInode *inode = lookup_fh(&argp->file);
312     if (inode == NULL) {
313         result.status = NFS3ERR_STALE;
314         result.write3res_u.resfail = wcc;
315         return &result;
316     }
317
318     encode_pre_wcc(&wcc, inode);
319     if (inode->type != BLUESKY_REGULAR) {
320         result.status = NFS3ERR_INVAL;
321         result.write3res_u.resfail = wcc;
322         return &result;
323     }
324
325     uint64_t lastbyte = argp->offset + argp->count;
326     if (lastbyte > inode->size) {
327         bluesky_file_truncate(inode, lastbyte);
328     }
329
330     if (argp->data.data_len < argp->count) {
331         /* ??? */
332     } else {
333         bluesky_file_write(inode, argp->offset,
334                            argp->data.data_val, argp->count);
335     }
336
337     encode_fattr3(&wcc.after.post_op_attr_u.attributes, inode);
338     result.write3res_u.resok.file_wcc = wcc;
339     result.write3res_u.resok.count = argp->count;
340     result.write3res_u.resok.committed = FILE_SYNC;
341
342     return &result;
343 }
344
345 diropres3 *
346 nfsproc3_create_3_svc(create3args *argp, struct svc_req *rqstp)
347 {
348     static diropres3 result;
349     struct wcc_data wcc;
350     memset(&wcc, 0, sizeof(wcc));
351
352     BlueSkyInode *dir = lookup_fh(&argp->where.dir);
353     if (dir == NULL) {
354         result.status = NFS3ERR_STALE;
355         result.diropres3_u.resfail = wcc;
356         return &result;
357     }
358
359     encode_pre_wcc(&wcc, dir);
360     if (dir->type != BLUESKY_DIRECTORY) {
361         result.status = NFS3ERR_NOTDIR;
362         result.diropres3_u.resfail = wcc;
363         return &result;
364     }
365
366     if (!validate_filename(argp->where.name)
367         || strcmp(argp->where.name, ".") == 0
368         || strcmp(argp->where.name, "..") == 0)
369     {
370         result.status = NFS3ERR_EXIST;
371         result.diropres3_u.resfail = wcc;
372         return &result;
373     }
374
375     BlueSkyInode *file;
376     file = bluesky_new_inode(bluesky_fs_alloc_inode(fs), fs, BLUESKY_REGULAR);
377     file->nlink = 1;
378     file->mode = 0755;
379     int64_t time = bluesky_get_current_time();
380     printf("time: %"PRIi64"\n", time);
381     file->mtime = time;
382     file->ctime = time;
383     file->atime = time;
384     file->ntime = time;
385     bluesky_insert_inode(fs, file);
386     bluesky_directory_insert(dir, argp->where.name, file->inum);
387
388     dir->mtime = dir->ctime = bluesky_get_current_time();
389     dir->change_count++;
390
391     wcc.after.present = TRUE;
392     encode_fattr3(&wcc.after.post_op_attr_u.attributes, dir);
393     result.diropres3_u.resok.obj_attributes.present = TRUE;
394     encode_fattr3(&result.diropres3_u.resok.obj_attributes.post_op_attr_u.attributes, file);
395     result.diropres3_u.resok.dir_wcc = wcc;
396
397     static uint64_t fh_bytes;
398     fh_bytes = GUINT64_TO_BE(file->inum);
399     result.diropres3_u.resok.obj.present = TRUE;
400     result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_len = 8;
401     result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_val = (char *)&fh_bytes;
402
403     return &result;
404 }
405
406 diropres3 *
407 nfsproc3_mkdir_3_svc(mkdir3args *argp, struct svc_req *rqstp)
408 {
409     static diropres3 result;
410     struct wcc_data wcc;
411     memset(&wcc, 0, sizeof(wcc));
412
413     BlueSkyInode *dir = lookup_fh(&argp->where.dir);
414     if (dir == NULL) {
415         result.status = NFS3ERR_STALE;
416         result.diropres3_u.resfail = wcc;
417         return &result;
418     }
419
420     encode_pre_wcc(&wcc, dir);
421     if (dir->type != BLUESKY_DIRECTORY) {
422         result.status = NFS3ERR_NOTDIR;
423         result.diropres3_u.resfail = wcc;
424         return &result;
425     }
426
427     if (!validate_filename(argp->where.name)
428         || strcmp(argp->where.name, ".") == 0
429         || strcmp(argp->where.name, "..") == 0)
430     {
431         result.status = NFS3ERR_EXIST;
432         result.diropres3_u.resfail = wcc;
433         return &result;
434     }
435
436     BlueSkyInode *file;
437     file = bluesky_new_inode(bluesky_fs_alloc_inode(fs), fs, BLUESKY_DIRECTORY);
438     file->nlink = 1;
439     file->mode = 0755;
440     int64_t time = bluesky_get_current_time();
441     file->mtime = time;
442     file->ctime = time;
443     file->atime = time;
444     file->ntime = time;
445     bluesky_insert_inode(fs, file);
446     bluesky_directory_insert(dir, argp->where.name, file->inum);
447     set_attributes(file, &argp->attributes);
448
449     dir->mtime = dir->ctime = bluesky_get_current_time();
450     dir->change_count++;
451
452     wcc.after.present = TRUE;
453     encode_fattr3(&wcc.after.post_op_attr_u.attributes, dir);
454     result.diropres3_u.resok.obj_attributes.present = TRUE;
455     encode_fattr3(&result.diropres3_u.resok.obj_attributes.post_op_attr_u.attributes, file);
456     result.diropres3_u.resok.dir_wcc = wcc;
457
458     static uint64_t fh_bytes;
459     fh_bytes = GUINT64_TO_BE(file->inum);
460     result.diropres3_u.resok.obj.present = TRUE;
461     result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_len = 8;
462     result.diropres3_u.resok.obj.post_op_fh3_u.handle.data.data_val = (char *)&fh_bytes;
463
464     return &result;
465 }
466
467 diropres3 *
468 nfsproc3_symlink_3_svc(symlink3args *argp, struct svc_req *rqstp)
469 {
470     static diropres3 result;
471
472     result.status = NFS3ERR_NOTSUPP;
473
474     return &result;
475 }
476
477 diropres3 *
478 nfsproc3_mknod_3_svc(mknod3args *argp, struct svc_req *rqstp)
479 {
480     static diropres3 result;
481
482     result.status = NFS3ERR_NOTSUPP;
483
484     return &result;
485 }
486
487 wccstat3 *
488 nfsproc3_remove_3_svc(diropargs3 *argp, struct svc_req *rqstp)
489 {
490     static wccstat3 result;
491
492     result.wccstat3_u.wcc.before.present = FALSE;
493     result.wccstat3_u.wcc.after.present = FALSE;
494
495     BlueSkyInode *dir = lookup_fh(&argp->dir);
496     if (dir == NULL) {
497         result.status = NFS3ERR_STALE;
498         return &result;
499     }
500
501     encode_pre_wcc(&result.wccstat3_u.wcc, dir);
502
503     if (!validate_filename(argp->name)
504         || strcmp(argp->name, ".") == 0
505         || strcmp(argp->name, "..") == 0)
506     {
507         result.status = NFS3ERR_NOENT;
508         return &result;
509     }
510
511     bluesky_directory_remove(dir, argp->name);
512
513     result.status = NFS3_OK;
514     result.wccstat3_u.wcc.after.present = TRUE;
515     encode_fattr3(&result.wccstat3_u.wcc.after.post_op_attr_u.attributes,
516                   dir);
517
518     return &result;
519 }
520
521 wccstat3 *
522 nfsproc3_rmdir_3_svc(diropargs3 *argp, struct svc_req *rqstp)
523 {
524     static wccstat3 result;
525
526     result.status = NFS3ERR_NOTSUPP;
527
528     return &result;
529 }
530
531 rename3res *
532 nfsproc3_rename_3_svc(rename3args *argp, struct svc_req *rqstp)
533 {
534     static rename3res result;
535
536     result.status = NFS3ERR_NOTSUPP;
537
538     return &result;
539 }
540
541 link3res *
542 nfsproc3_link_3_svc(link3args *argp, struct svc_req *rqstp)
543 {
544     static link3res result;
545     struct wcc_data wcc;
546     memset(&wcc, 0, sizeof(wcc));
547
548     BlueSkyInode *inode = lookup_fh(&argp->file);
549     if (inode == NULL) {
550         result.status = NFS3ERR_STALE;
551         result.link3res_u.res.linkdir_wcc = wcc;
552         return &result;
553     }
554
555     BlueSkyInode *dir = lookup_fh(&argp->link.dir);
556     if (dir == NULL) {
557         result.status = NFS3ERR_STALE;
558         result.link3res_u.res.linkdir_wcc = wcc;
559         return &result;
560     }
561
562     encode_pre_wcc(&wcc, dir);
563     if (dir->type != BLUESKY_DIRECTORY) {
564         result.status = NFS3ERR_NOTDIR;
565         result.link3res_u.res.linkdir_wcc = wcc;
566         return &result;
567     }
568
569     if (!validate_filename(argp->link.name)
570         || strcmp(argp->link.name, ".") == 0
571         || strcmp(argp->link.name, "..") == 0
572         || bluesky_directory_lookup(dir, argp->link.name) != 0)
573     {
574         result.status = NFS3ERR_EXIST;
575         result.link3res_u.res.linkdir_wcc = wcc;
576         return &result;
577     }
578
579     if (!bluesky_directory_insert(dir, argp->link.name, inode->inum)) {
580         result.status = NFS3ERR_EXIST;
581         result.link3res_u.res.linkdir_wcc = wcc;
582         return &result;
583     }
584     inode->nlink++;
585     bluesky_inode_update_ctime(inode, 0);
586
587     result.status = NFS3_OK;
588     wcc.after.present = TRUE;
589     encode_fattr3(&wcc.after.post_op_attr_u.attributes, dir);
590     result.link3res_u.res.file_attributes.present = TRUE;
591     encode_fattr3(&result.link3res_u.res.file_attributes.post_op_attr_u.attributes, inode);
592     result.link3res_u.res.linkdir_wcc = wcc;
593
594     return &result;
595 }
596
597 gint bluesky_dirent_compare(gconstpointer a, gconstpointer b,
598                             gpointer unused);
599
600 readdir3res *
601 nfsproc3_readdir_3_svc(readdir3args *argp, struct svc_req *rqstp)
602 {
603     static readdir3res result;
604
605     BlueSkyInode *dir = lookup_fh(&argp->dir);
606     if (dir == NULL) {
607         result.status = NFS3ERR_STALE;
608         result.readdir3res_u.resfail.present = FALSE;
609         return &result;
610     }
611
612     result.status = NFS3_OK;
613     result.readdir3res_u.resok.dir_attributes.present = TRUE;
614     encode_fattr3(&result.readdir3res_u.resok.dir_attributes.post_op_attr_u.attributes, dir);
615     memset(result.readdir3res_u.resok.cookieverf, 0,
616            sizeof(result.readdir3res_u.resok.cookieverf));
617
618 #define MAX_READDIR_DIRENTS 4
619     static entry3 dirents[MAX_READDIR_DIRENTS];
620     int count = 0;
621
622     BlueSkyDirent start = {NULL, NULL, argp->cookie, 0};
623     GSequenceIter *i = g_sequence_search(dir->dirents, &start,
624                                          bluesky_dirent_compare, NULL);
625
626     while (count < MAX_READDIR_DIRENTS && !g_sequence_iter_is_end(i)) {
627         BlueSkyDirent *d = g_sequence_get(i);
628         dirents[count].fileid = d->inum;
629         dirents[count].name = d->name;
630         dirents[count].cookie = d->cookie;
631         dirents[count].nextentry = NULL;
632         if (count > 0)
633             dirents[count - 1].nextentry = &dirents[count];
634         i = g_sequence_iter_next(i);
635         count++;
636     }
637
638     if (count > 0)
639         result.readdir3res_u.resok.reply.entries = &dirents[0];
640     else
641         result.readdir3res_u.resok.reply.entries = NULL;
642     result.readdir3res_u.resok.reply.eof = g_sequence_iter_is_end(i);
643
644     return &result;
645 }
646
647 readdirplus3res *
648 nfsproc3_readdirplus_3_svc(readdirplus3args *argp, struct svc_req *rqstp)
649 {
650     static readdirplus3res result;
651
652     result.status = NFS3ERR_NOTSUPP;
653
654     return &result;
655 }
656
657 fsstat3res *
658 nfsproc3_fsstat_3_svc(nfs_fh3 *argp, struct svc_req *rqstp)
659 {
660     static fsstat3res result;
661
662     result.status = NFS3ERR_NOTSUPP;
663
664     return &result;
665 }
666
667 fsinfo3res *
668 nfsproc3_fsinfo_3_svc(nfs_fh3 *argp, struct svc_req *rqstp)
669 {
670     static fsinfo3res result;
671
672     BlueSkyInode *inode = bluesky_get_inode(fs, 1);
673     result.status = NFS3_OK;
674     result.fsinfo3res_u.resok.obj_attributes.present = TRUE;
675     encode_fattr3(&result.fsinfo3res_u.resok.obj_attributes.post_op_attr_u.attributes, inode);
676     result.fsinfo3res_u.resok.rtmax = 32768;
677     result.fsinfo3res_u.resok.rtpref = 32768;
678     result.fsinfo3res_u.resok.rtmult = 4096;
679     result.fsinfo3res_u.resok.wtmax = 32768;
680     result.fsinfo3res_u.resok.wtpref = 32768;
681     result.fsinfo3res_u.resok.wtmult = 4096;
682     result.fsinfo3res_u.resok.dtpref = 4096;
683     result.fsinfo3res_u.resok.maxfilesize = 0x7fffffffffffffffULL;
684     result.fsinfo3res_u.resok.time_delta.seconds = 0;
685     result.fsinfo3res_u.resok.time_delta.nseconds = 1000;
686     result.fsinfo3res_u.resok.properties
687         = FSF3_LINK | FSF3_SYMLINK | FSF3_HOMOGENEOUS | FSF3_CANSETTIME;
688
689     return &result;
690 }
691
692 pathconf3res *
693 nfsproc3_pathconf_3_svc(nfs_fh3 *argp, struct svc_req *rqstp)
694 {
695     static pathconf3res result;
696
697     BlueSkyInode *inode = bluesky_get_inode(fs, 1);
698     result.status = NFS3_OK;
699     result.pathconf3res_u.resok.obj_attributes.present = TRUE;
700     encode_fattr3(&result.pathconf3res_u.resok.obj_attributes.post_op_attr_u.attributes, inode);
701     result.pathconf3res_u.resok.linkmax = 0xffffffff;
702     result.pathconf3res_u.resok.name_max = 255;
703     result.pathconf3res_u.resok.no_trunc = TRUE;
704     result.pathconf3res_u.resok.chown_restricted = TRUE;
705     result.pathconf3res_u.resok.case_insensitive = FALSE;
706     result.pathconf3res_u.resok.case_preserving = TRUE;
707
708     return &result;
709 }
710
711 commit3res *
712 nfsproc3_commit_3_svc(commit3args *argp, struct svc_req *rqstp)
713 {
714     static commit3res result;
715
716     result.status = NFS3ERR_NOTSUPP;
717
718     return &result;
719 }