diff options
author | Miles Bader <miles@gnu.org> | 1997-02-06 08:37:17 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1997-02-06 08:37:17 +0000 |
commit | 93b7de6961af6e68560537542ee3877d14caca27 (patch) | |
tree | c5bc3c2ad53821b908e0425a70f949840a9749b1 /libdiskfs | |
parent | 3cabd08fb1de1600354091b5a195557bef548217 (diff) |
(diskfs_S_dir_reparent):
Implement.
Diffstat (limited to 'libdiskfs')
-rw-r--r-- | libdiskfs/dir-reparent.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/libdiskfs/dir-reparent.c b/libdiskfs/dir-reparent.c index dfe15cfc..7efeece5 100644 --- a/libdiskfs/dir-reparent.c +++ b/libdiskfs/dir-reparent.c @@ -25,5 +25,30 @@ error_t diskfs_S_dir_reparent (struct protid *cred, mach_port_t parent, mach_port_t *new_dir, mach_msg_type_name_t *new_dir_type) { - return EOPNOTSUPP; + error_t err; + struct node *node; + struct protid *new_cred; + + if (! cred) + return EOPNOTSUPP; + + node = cred->po->np; + if (! S_ISDIR (node->dn_stat.st_mode)) + return ENOTDIR; + + mutex_lock (&node->lock); + + err = diskfs_create_protid (diskfs_make_peropen (node, cred->po->openstat, + parent, 0), + cred->user, &new_cred); + if (! err) + { + *new_dir = ports_get_right (new_cred); + *new_dir_type = MACH_MSG_TYPE_MAKE_SEND; + ports_port_deref (new_cred); + } + + mutex_unlock (&node->lock); + + return err; } |