bool_t xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead) { mntfs *mf; u_int len = 0; /* * Compute length of list */ for (mf = AM_LAST(mntfs, qhead); mf != HEAD(mntfs, qhead); mf = PREV(mntfs, mf)) { if (!(mf->mf_fsflags & FS_AMQINFO)) continue; len++; } xdr_u_int(xdrs, &len); /* * Send individual data items */ for (mf = AM_LAST(mntfs, qhead); mf != HEAD(mntfs, qhead); mf = PREV(mntfs, mf)) { int up; if (!(mf->mf_fsflags & FS_AMQINFO)) continue; if (!xdr_amq_string(xdrs, &mf->mf_ops->fs_type)) { return (FALSE); } if (!xdr_amq_string(xdrs, &mf->mf_mount)) { return (FALSE); } if (!xdr_amq_string(xdrs, &mf->mf_info)) { return (FALSE); } if (!xdr_amq_string(xdrs, &mf->mf_server->fs_host)) { return (FALSE); } if (!xdr_int(xdrs, &mf->mf_error)) { return (FALSE); } if (!xdr_int(xdrs, &mf->mf_refc)) { return (FALSE); } if (FSRV_ERROR(mf->mf_server) || FSRV_ISDOWN(mf->mf_server)) up = 0; else if (FSRV_ISUP(mf->mf_server)) up = 1; else up = -1; if (!xdr_int(xdrs, &up)) { return (FALSE); } } return (TRUE); }
/* * Automount interface to RPC lookup routine * Find the corresponding entry and return * the file handle for it. */ am_node * amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op) { am_node *new_mp; am_loc **al_array; dlog("in amfs_generic_lookup_child"); *error_return = 0; new_mp = amfs_lookup_node(mp, fname, error_return); /* return if we got an error */ if (!new_mp || *error_return > 0) return new_mp; /* also return if it's already mounted and known to be up */ if (*error_return == 0 && FSRV_ISUP(new_mp->am_al->al_mnt->mf_server)) return new_mp; switch (op) { case VLOOK_DELETE: /* * If doing a delete then don't create again! */ ereturn(ENOENT); case VLOOK_LOOKUP: return new_mp; } al_array = amfs_lookup_loc(new_mp, error_return); if (!al_array) { new_mp->am_error = new_mp->am_al->al_mnt->mf_error = *error_return; free_map(new_mp); return NULL; } /* store the array inside the am_node */ new_mp->am_alarray = al_array; /* * Note: while it might seem like a good idea to prioritize * the list of mntfs's we got here, it probably isn't. * It would ignore the ordering of entries specified by the user, * which is counterintuitive and confusing. */ return new_mp; }
/* * Automount interface to RPC lookup routine * Find the corresponding entry and return * the file handle for it. */ am_node * amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op) { am_node *new_mp; mntfs **mf_array; int mp_error; dlog("in amfs_generic_lookup_child"); *error_return = 0; new_mp = amfs_lookup_node(mp, fname, error_return); /* return if we got an error */ if (!new_mp || *error_return > 0) return new_mp; /* also return if it's already mounted and known to be up */ if (*error_return == 0 && FSRV_ISUP(new_mp->am_mnt->mf_server)) return new_mp; switch (op) { case VLOOK_DELETE: /* * If doing a delete then don't create again! */ ereturn(ENOENT); case VLOOK_LOOKUP: return new_mp; } /* save error_return */ mp_error = *error_return; mf_array = amfs_lookup_mntfs(new_mp, error_return); if (!mf_array) { new_mp->am_error = new_mp->am_mnt->mf_error = *error_return; free_map(new_mp); return NULL; } /* * Already mounted but known to be down: * check if we have any alternatives to mount */ if (mp_error == 0) { mntfs **mfp; for (mfp = mf_array; *mfp; mfp++) if (*mfp != new_mp->am_mnt) break; if (*mfp != NULL) { /* * we found an alternative, so try mounting again. */ *error_return = -1; } else { for (mfp = mf_array; *mfp; mfp++) free_mntfs(*mfp); XFREE(mf_array); if (new_mp->am_flags & AMF_SOFTLOOKUP) { ereturn(EIO); } else { *error_return = 0; return new_mp; } } } /* store the array inside the am_node */ new_mp->am_mfarray = mf_array; /* * Note: while it might seem like a good idea to prioritize * the list of mntfs's we got here, it probably isn't. * It would ignore the ordering of entries specified by the user, * which is counterintuitive and confusing. */ return new_mp; }