diff options
author | Michael I. Bushnell <mib@gnu.org> | 1995-06-20 15:52:20 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1995-06-20 15:52:20 +0000 |
commit | 50d2a0d2a9130d627794fc8ef31ac97fccc94afa (patch) | |
tree | c66d8de4e65133692d7e5ad072cb6a7c625d1ce0 /libdiskfs | |
parent | bea527e8a44111b401db9504293724076a90277b (diff) |
(diskfs_S_file_set_translator): Remove assignment from if test.
Diffstat (limited to 'libdiskfs')
-rw-r--r-- | libdiskfs/file-set-trans.c | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/libdiskfs/file-set-trans.c b/libdiskfs/file-set-trans.c index 43665dcc..10bb8899 100644 --- a/libdiskfs/file-set-trans.c +++ b/libdiskfs/file-set-trans.c @@ -32,6 +32,7 @@ diskfs_S_file_set_translator (struct protid *cred, { struct node *np; error_t error; + mach_port_t control = MACH_PORT_NULL; if (!cred) return EOPNOTSUPP; @@ -46,24 +47,36 @@ diskfs_S_file_set_translator (struct protid *cred, mutex_lock (&np->lock); - if (error = diskfs_isowner (np, cred)) + error = diskfs_isowner (np, cred); + if (error) { mutex_unlock (&np->lock); return error; } - /* Handle exclusive bits */ - if ((passive_flags & FS_TRANS_SET) - && (passive_flags & FS_TRANS_EXCL) - && np->istranslated) + if (active_flags & FS_TRANS_SET) { - mutex_unlock (&np->lock); - return EBUSY; + error = fshelp_fetch_control (&np->transbox, &control); + if (error) + { + mutex_unlock (&np->lock); + return error; + } + + if (control != MACH_PORT_NULL && (active_flags & FS_TRANS_EXCL == 0)) + { + mutex_unlock (&np->lock); + error = fsys_goaway (control, killtrans_flags); + if (error) + return error; + mutex_lock (&np->lock); + } } - if ((active_flags & FS_TRANS_SET) - && (active_flags & FS_TRANS_EXCL) - && np->transbox.active != MACH_PORT_NULL) + /* Handle exclusive passive bit *first*. */ + if ((passive_flags & FS_TRANS_SET) + && (passive_flags & FS_TRANS_EXCL) + && np->istranslated) { mutex_unlock (&np->lock); return EBUSY; @@ -71,22 +84,15 @@ diskfs_S_file_set_translator (struct protid *cred, if (active_flags & FS_TRANS_SET) { - if (active != np->transbox.active - && np->transbox.active != MACH_PORT_NULL) + error = fshelp_set_active (&np->transbox, active, + active_flags & FS_TRANS_EXCL); + if (error) { - mach_port_t control; - - error = fshelp_fetch_control (&np->transbox, &control); mutex_unlock (&np->lock); - if (!error) - error = fsys_goaway (control, killtrans_flags); - if (error) - return error; - mutex_lock (&np->lock); + return error; } - fshelp_set_active (&np->transbox, active); } - + /* Set passive translator */ if (passive_flags & FS_TRANS_SET) { |