Changeset ca127f37 in mainline
- Timestamp:
- 2024-09-07T18:33:36Z (6 months ago)
- Branches:
- master
- Children:
- de4f165
- Parents:
- e90019d
- Location:
- uspace
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sysinst/sysinst.c
re90019d rca127f37 279 279 } 280 280 281 rv = asprintf(&path, "%s%s", rdpath, "/cfg/ volsrv.sif");281 rv = asprintf(&path, "%s%s", rdpath, "/cfg/initvol.sif"); 282 282 if (rv < 0) { 283 283 rc = ENOMEM; -
uspace/srv/volsrv/part.c
re90019d rca127f37 52 52 #include "types/part.h" 53 53 #include "volume.h" 54 #include "volsrv.h" 54 55 55 56 static errno_t vol_part_add_locked(vol_parts_t *, service_id_t); … … 403 404 part->cur_mp_auto = mp_auto; 404 405 406 if (str_cmp(mp, "/w") == 0) { 407 log_msg(LOG_DEFAULT, LVL_NOTE, "Mounted system volume - " 408 "loading additional configuration."); 409 rc = vol_volumes_merge_to(part->parts->volumes, 410 vol_cfg_file); 411 if (rc != EOK) { 412 log_msg(LOG_DEFAULT, LVL_ERROR, "Error loading " 413 "additional configuration."); 414 return rc; 415 } 416 } 417 405 418 return rc; 406 419 } -
uspace/srv/volsrv/volsrv.c
re90019d rca127f37 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 53 53 #define NAME "volsrv" 54 54 55 const char *vol_cfg_file = "/cfg/volsrv.sif"; 55 const char *vol_icfg_file = "/cfg/initvol.sif"; 56 const char *vol_cfg_file = "/w/cfg/volsrv.sif"; 56 57 57 58 static void vol_client_conn(ipc_call_t *, void *); … … 66 67 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_init()"); 67 68 68 rc = vol_volumes_create(vol_ cfg_file, &volumes);69 rc = vol_volumes_create(vol_icfg_file, &volumes); 69 70 if (rc != EOK) 70 71 goto error; -
uspace/srv/volsrv/volume.c
re90019d rca127f37 185 185 free(volumes); 186 186 187 return rc; 188 } 189 190 /** Merge list of volumes into new file. 191 * 192 * @param volumes List of volumes 193 * @param cfg_path Path to file containing configuration repository in SIF 194 * @return EOK on success, ENOMEM if out of memory 195 */ 196 errno_t vol_volumes_merge_to(vol_volumes_t *volumes, const char *cfg_path) 197 { 198 sif_doc_t *doc = NULL; 199 sif_node_t *node; 200 const char *ntype; 201 char *dcfg_path; 202 errno_t rc; 203 204 dcfg_path = str_dup(cfg_path); 205 if (dcfg_path == NULL) { 206 rc = ENOMEM; 207 goto error; 208 } 209 210 free(volumes->cfg_path); 211 volumes->cfg_path = dcfg_path; 212 213 /* Try opening existing repository */ 214 rc = sif_load(cfg_path, &doc); 215 if (rc != EOK) { 216 /* Failed to open existing, create new repository */ 217 rc = vol_volumes_sync(volumes); 218 if (rc != EOK) 219 goto error; 220 } else { 221 /* 222 * Loaded existing configuration. Find 'volumes' node, should 223 * be the first child of the root node. 224 */ 225 node = sif_node_first_child(sif_get_root(doc)); 226 227 /* Verify it's the correct node type */ 228 ntype = sif_node_get_type(node); 229 if (str_cmp(ntype, "volumes") != 0) { 230 rc = EIO; 231 goto error; 232 } 233 234 rc = vol_volumes_load(node, volumes); 235 if (rc != EOK) 236 goto error; 237 238 sif_delete(doc); 239 } 240 241 return EOK; 242 error: 243 if (doc != NULL) 244 (void) sif_delete(doc); 187 245 return rc; 188 246 } -
uspace/srv/volsrv/volume.h
re90019d rca127f37 42 42 43 43 extern errno_t vol_volumes_create(const char *, vol_volumes_t **); 44 extern errno_t vol_volumes_merge_to(vol_volumes_t *, const char *); 44 45 extern errno_t vol_volumes_sync(vol_volumes_t *); 45 46 extern void vol_volumes_destroy(vol_volumes_t *);
Note:
See TracChangeset
for help on using the changeset viewer.