150 |
retry_type *do_retry, char *retry_name, |
retry_type *do_retry, char *retry_name, |
151 |
mach_port_t *node, mach_msg_type_name_t *node_type) |
mach_port_t *node, mach_msg_type_name_t *node_type) |
152 |
{ |
{ |
153 |
|
error_t err; |
154 |
struct magic *const m = cntl->hook; |
struct magic *const m = cntl->hook; |
155 |
|
|
156 |
if (m->directory) |
if (m->directory) |
160 |
*do_retry = FS_RETRY_MAGICAL; |
*do_retry = FS_RETRY_MAGICAL; |
161 |
*node = MACH_PORT_NULL; |
*node = MACH_PORT_NULL; |
162 |
*node_type = MACH_MSG_TYPE_COPY_SEND; |
*node_type = MACH_MSG_TYPE_COPY_SEND; |
163 |
|
|
164 |
|
err = mach_port_deallocate (mach_task_self (), dotdot); |
165 |
|
assert_perror (err); |
166 |
|
|
167 |
return 0; |
return 0; |
168 |
} |
} |
169 |
|
|
183 |
error_t err = trivfs_open (cntl, user, flags, realnode, cred); |
error_t err = trivfs_open (cntl, user, flags, realnode, cred); |
184 |
if (!err) |
if (!err) |
185 |
{ |
{ |
186 |
|
/* We consume the reference for DOTDOT. */ |
187 |
(*cred)->po->hook = (void *) dotdot; |
(*cred)->po->hook = (void *) dotdot; |
|
err = mach_port_mod_refs (mach_task_self (), dotdot, |
|
|
MACH_PORT_RIGHT_SEND, +1); |
|
|
assert_perror (err); |
|
|
err = mach_port_deallocate (mach_task_self (), dotdot); |
|
|
assert_perror (err); |
|
188 |
struct magic *const m = cntl->hook; |
struct magic *const m = cntl->hook; |
189 |
m->nusers++; |
m->nusers++; |
190 |
} |
} |
191 |
return err; |
return err; |
192 |
} |
} |
193 |
|
|
194 |
|
static void |
195 |
|
magic_peropen_destroy (struct trivfs_peropen *po) |
196 |
|
{ |
197 |
|
mach_port_deallocate (mach_task_self (), (mach_port_t) po->hook); |
198 |
|
} |
199 |
|
|
200 |
|
|
201 |
/* We have this hook only for simple tracking of the live user ports. */ |
/* We have this hook only for simple tracking of the live user ports. */ |
202 |
static void |
static void |
203 |
magic_protid_destroy (struct trivfs_protid *cred) |
magic_protid_destroy (struct trivfs_protid *cred) |
475 |
trivfs_getroot_hook = &magic_getroot; |
trivfs_getroot_hook = &magic_getroot; |
476 |
trivfs_open_hook = &magic_open; |
trivfs_open_hook = &magic_open; |
477 |
trivfs_protid_destroy_hook = &magic_protid_destroy; |
trivfs_protid_destroy_hook = &magic_protid_destroy; |
478 |
|
if (m->directory) |
479 |
|
trivfs_peropen_destroy_hook = &magic_peropen_destroy; |
480 |
|
|
481 |
/* Reply to our parent */ |
/* Reply to our parent */ |
482 |
err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &fsys); |
err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &fsys); |