diff options
author | Miles Bader <miles@gnu.org> | 1997-02-06 07:43:55 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1997-02-06 07:43:55 +0000 |
commit | 9bf0d068271bbf92b3dbf464fc225c3ab2c780e7 (patch) | |
tree | 48f0fc2765468971499be2cccb607926a60d3094 /libdiskfs | |
parent | d7ef8c8783570c330752c128f8962cca17459e1c (diff) |
(diskfs_S_file_getfh):
Implement (code from ufs).
Diffstat (limited to 'libdiskfs')
-rw-r--r-- | libdiskfs/file-getfh.c | 68 |
1 files changed, 50 insertions, 18 deletions
diff --git a/libdiskfs/file-getfh.c b/libdiskfs/file-getfh.c index bc788a20..1b23b80c 100644 --- a/libdiskfs/file-getfh.c +++ b/libdiskfs/file-getfh.c @@ -1,28 +1,60 @@ -/* libdiskfs implementation of fs.defs: file_getfh - Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation +/* Return a file handle (for nfs server support) - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. + Copyright (C) 1997 Free Software Foundation - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + The GNU Hurd is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + along with the GNU Hurd; see the file COPYING. If not, write to + the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include <string.h> #include "priv.h" #include "fs_S.h" +#include "fhandle.h" -/* Implement file_getfh as described in <hurd/fs.defs>. */ -kern_return_t -diskfs_S_file_getfh (struct protid *cred __attribute__ ((unused)), - char **data __attribute__ ((unused)), - u_int *datalen __attribute__ ((unused))) +/* Return an NFS file handle for CRED in FH & FN_LEN. */ +error_t +diskfs_S_file_getfh (struct protid *cred, char **fh, unsigned *fh_len) { - return EOPNOTSUPP; + struct node *node; + struct diskfs_fhandle *f; + + if (! cred) + return EOPNOTSUPP; + + if (! idvec_contains (cred->user->uids, 0)) + return EPERM; + + node = cred->po->np; + + mutex_lock (&node->lock); + + if (*fh_len < sizeof (struct diskfs_fhandle)) + vm_allocate (mach_task_self (), (vm_address_t *) fh, + sizeof (struct diskfs_fhandle), 1); + *fh_len = sizeof (struct diskfs_fhandle); + + f = (struct diskfs_fhandle *)*fh; + + f->cache_id = node->cache_id; + f->gen = node->dn_stat.st_gen; + + f->filler1 = 0; + bzero (f->filler2, sizeof f->filler2); + + mutex_unlock (&node->lock); + + return 0; } |