Lines Matching refs:mf

64 dup_mntfs(mntfs *mf)  in dup_mntfs()  argument
66 if (mf->mf_refc == 0) { in dup_mntfs()
67 if (mf->mf_cid) in dup_mntfs()
68 untimeout(mf->mf_cid); in dup_mntfs()
69 mf->mf_cid = 0; in dup_mntfs()
71 mf->mf_refc++; in dup_mntfs()
73 return mf; in dup_mntfs()
78 init_mntfs(mntfs *mf, am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, char *mopts,… in init_mntfs() argument
80 mf->mf_ops = ops; in init_mntfs()
81 mf->mf_fsflags = ops->nfs_fs_flags; in init_mntfs()
82 mf->mf_fo = 0; in init_mntfs()
84 mf->mf_fo = copy_opts(mo); in init_mntfs()
86 mf->mf_mount = xstrdup(mp); in init_mntfs()
87 mf->mf_info = xstrdup(info); in init_mntfs()
88 mf->mf_auto = xstrdup(auto_opts); in init_mntfs()
89 mf->mf_mopts = xstrdup(mopts); in init_mntfs()
90 mf->mf_remopts = xstrdup(remopts); in init_mntfs()
91 mf->mf_loopdev = NULL; in init_mntfs()
92 mf->mf_refc = 1; in init_mntfs()
93 mf->mf_flags = 0; in init_mntfs()
94 mf->mf_error = -1; in init_mntfs()
95 mf->mf_cid = 0; in init_mntfs()
96 mf->mf_private = NULL; in init_mntfs()
97 mf->mf_prfree = NULL; in init_mntfs()
100 mf->mf_server = (*ops->ffserver) (mf); in init_mntfs()
102 mf->mf_server = NULL; in init_mntfs()
109 mntfs *mf = ALLOC(struct mntfs); in alloc_mntfs() local
111 init_mntfs(mf, ops, mo, mp, info, auto_opts, mopts, remopts); in alloc_mntfs()
112 ins_que(&mf->mf_q, &mfhead); in alloc_mntfs()
115 return mf; in alloc_mntfs()
123 mntfs *mf; in locate_mntfs() local
127 ITER(mf, mntfs, &mfhead) { in locate_mntfs()
135 if (STREQ(mf->mf_mount, mp) && in locate_mntfs()
136 ((mf->mf_flags & MFF_MOUNTED && !(mf->mf_fsflags & FS_DIRECT)) in locate_mntfs()
137 || (STREQ(mf->mf_info, info) && mf->mf_ops == ops))) { in locate_mntfs()
146 if (mf->mf_ops != &amfs_error_ops) in locate_mntfs()
148 return dup_mntfs(mf); in locate_mntfs()
151 dlog("mf->mf_flags = %#x", mf->mf_flags); in locate_mntfs()
153 if ((mf->mf_flags & MFF_RESTART) && amd_state < Finishing) { in locate_mntfs()
157 dlog("Restarting filesystem %s", mf->mf_mount); in locate_mntfs()
165 if (mf->mf_ops == &amfs_toplvl_ops) { in locate_mntfs()
166 mf->mf_ops = ops; in locate_mntfs()
167 mf->mf_info = strealloc(mf->mf_info, info); in locate_mntfs()
168 ops->mounted(mf); /* XXX: not right, but will do for now */ in locate_mntfs()
171 return mf; in locate_mntfs()
174 if (!(mf->mf_flags & (MFF_MOUNTED | MFF_MOUNTING | MFF_UNMOUNTING))) { in locate_mntfs()
176 mf->mf_flags &= ~MFF_ERROR; in locate_mntfs()
177 mf->mf_error = -1; in locate_mntfs()
178 mf->mf_auto = strealloc(mf->mf_auto, auto_opts); in locate_mntfs()
179 mf->mf_mopts = strealloc(mf->mf_mopts, mopts); in locate_mntfs()
180 mf->mf_remopts = strealloc(mf->mf_remopts, remopts); in locate_mntfs()
181 mf->mf_info = strealloc(mf->mf_info, info); in locate_mntfs()
183 if (mf->mf_private && mf->mf_prfree) { in locate_mntfs()
184 mf->mf_prfree(mf->mf_private); in locate_mntfs()
185 mf->mf_private = NULL; in locate_mntfs()
188 fs = ops->ffserver ? (*ops->ffserver) (mf) : (fserver *) NULL; in locate_mntfs()
189 if (mf->mf_server) in locate_mntfs()
190 free_srvr(mf->mf_server); in locate_mntfs()
191 mf->mf_server = fs; in locate_mntfs()
193 return dup_mntfs(mf); in locate_mntfs()
205 mntfs *mf = locate_mntfs(ops, mo, mp, info, auto_opts, mopts, remopts); in find_mntfs() local
206 if (mf) in find_mntfs()
207 return mf; in find_mntfs()
231 uninit_mntfs(mntfs *mf) in uninit_mntfs() argument
233 if (mf->mf_fo) { in uninit_mntfs()
234 free_opts(mf->mf_fo); in uninit_mntfs()
235 XFREE(mf->mf_fo); in uninit_mntfs()
237 XFREE(mf->mf_auto); in uninit_mntfs()
238 XFREE(mf->mf_mopts); in uninit_mntfs()
239 XFREE(mf->mf_remopts); in uninit_mntfs()
240 XFREE(mf->mf_info); in uninit_mntfs()
241 if (mf->mf_private && mf->mf_prfree) in uninit_mntfs()
242 (*mf->mf_prfree) (mf->mf_private); in uninit_mntfs()
244 XFREE(mf->mf_mount); in uninit_mntfs()
249 if (mf->mf_server) in uninit_mntfs()
250 free_srvr(mf->mf_server); in uninit_mntfs()
255 if (mf->mf_cid) { in uninit_mntfs()
256 untimeout(mf->mf_cid); in uninit_mntfs()
257 mf->mf_cid = 0; in uninit_mntfs()
265 mntfs *mf = v; in discard_mntfs() local
267 rem_que(&mf->mf_q); in discard_mntfs()
272 uninit_mntfs(mf); in discard_mntfs()
273 XFREE(mf); in discard_mntfs()
292 mntfs *mf; in flush_mntfs() local
294 mf = AM_FIRST(mntfs, &mfhead); in flush_mntfs()
295 while (mf != HEAD(mntfs, &mfhead)) { in flush_mntfs()
296 mntfs *mf2 = mf; in flush_mntfs()
297 mf = NEXT(mntfs, mf); in flush_mntfs()
324 mntfs *mf = (mntfs *) arg; in free_mntfs() local
327 mf->mf_mount, mf->mf_ops->fs_type, mf->mf_refc, mf->mf_flags); in free_mntfs()
334 if (mf->mf_refc <= 0) { in free_mntfs()
336 mf->mf_mount, mf->mf_refc, mf->mf_flags); in free_mntfs()
341 if (mf->mf_refc == 1 && mf->mf_flags & MFF_RSTKEEP) { in free_mntfs()
343 mf->mf_mount, mf->mf_refc, mf->mf_flags); in free_mntfs()
347 if (--mf->mf_refc == 0) { in free_mntfs()
348 if (mf->mf_flags & MFF_MOUNTED) { in free_mntfs()
350 mf->mf_flags &= ~MFF_MOUNTED; in free_mntfs()
355 quoted = strchr(mf->mf_info, ' ') != 0; /* cheap */ in free_mntfs()
358 mf->mf_info, in free_mntfs()
360 mf->mf_error ? "discard" : "unmount", in free_mntfs()
361 mf->mf_ops->fs_type, mf->mf_mount); in free_mntfs()
364 if (mf->mf_fsflags & FS_DISCARD) { in free_mntfs()
365 dlog("Immediately discarding mntfs for %s", mf->mf_mount); in free_mntfs()
366 discard_mntfs(mf); in free_mntfs()
370 if (mf->mf_flags & MFF_RESTART) { in free_mntfs()
371 dlog("Discarding remount hook for %s", mf->mf_mount); in free_mntfs()
374 mf->mf_mount, mf->mf_ops->fs_type); in free_mntfs()
376 if (mf->mf_flags & (MFF_MOUNTED | MFF_MOUNTING | MFF_UNMOUNTING)) in free_mntfs()
377 dlog("mntfs reference for %s still active", mf->mf_mount); in free_mntfs()
378 mf->mf_cid = timeout(ALLOWED_MOUNT_TIME, discard_mntfs, (voidp) mf); in free_mntfs()
385 realloc_mntfs(mntfs *mf, am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, char *mop… in realloc_mntfs() argument
389 if (mf->mf_refc == 1 && in realloc_mntfs()
390 mf->mf_flags & MFF_RESTART && in realloc_mntfs()
391 STREQ(mf->mf_mount, mp)) { in realloc_mntfs()
396 return mf; in realloc_mntfs()
403 if (mf->mf_ops != &amfs_error_ops && in realloc_mntfs()
404 (mf->mf_flags & MFF_MOUNTED) && in realloc_mntfs()
405 !FSRV_ISDOWN(mf->mf_server)) { in realloc_mntfs()
406 return mf; in realloc_mntfs()
410 free_mntfs(mf); in realloc_mntfs()