-static
-int mti_set_sec_opts(struct mgs_target_info *mti, struct lustre_mount_data *lmd)
-{
- char *s1, *s2;
-
- if (lmd->lmd_sec_mdt == NULL && lmd->lmd_sec_cli == NULL) {
- /* just let on-disk params do its work. but we have an
- * assumption that any changes of on-disk data by tune2fs
- * should lead to server rewrite log.
- */
- return 0;
- }
-
- /* filter out existing sec options */
- s1 = mti->mti_params;
- while (*s1) {
- int clear;
-
- while (*s1 == ' ')
- s1++;
-
- if (strncmp(s1, PARAM_SEC_RPC_MDT,
- sizeof(PARAM_SEC_RPC_MDT) - 1) == 0 ||
- strncmp(s1, PARAM_SEC_RPC_CLI,
- sizeof(PARAM_SEC_RPC_CLI) - 1) == 0)
- clear = 1;
- else
- clear = 0;
-
- s2 = strchr(s1, ' ');
- if (s2 == NULL) {
- if (clear)
- *s1 = '\0';
- break;
- }
- s2++;
- if (clear)
- memmove(s1, s2, strlen(s2) + 1);
- else
- s1 = s2;
- }
-
- /* append sec options from lmd */
- /* FIXME add flag LDD_F_UPDATE after mountconf start supporting
- * log updating.
- */
- if (lmd->lmd_sec_mdt) {
- if (strlen(mti->mti_params) + strlen(lmd->lmd_sec_mdt) +
- sizeof(PARAM_SEC_RPC_MDT) + 1 >= sizeof(mti->mti_params)) {
- CERROR("security params too big for mti\n");
- return -ENOMEM;
- }
- strcat(mti->mti_params, " "PARAM_SEC_RPC_MDT);
- strcat(mti->mti_params, lmd->lmd_sec_mdt);
- //mti->mti_flags |= LDD_F_UPDATE;
- }
- if (lmd->lmd_sec_cli) {
- if (strlen(mti->mti_params) + strlen(lmd->lmd_sec_cli) +
- sizeof(PARAM_SEC_RPC_CLI) + 2 > sizeof(mti->mti_params)) {
- CERROR("security params too big for mti\n");
- return -ENOMEM;
- }
- strcat(mti->mti_params, " "PARAM_SEC_RPC_CLI);
- strcat(mti->mti_params, lmd->lmd_sec_cli);
- //mti->mti_flags |= LDD_F_UPDATE;
- }
-
- return 0;
-}
-