Changeset d3b2ffa in mainline for uspace/srv/volsrv/volsrv.c


Ignore:
Timestamp:
2018-06-29T15:40:10Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5e904dd
Parents:
1e472ee (diff), 1a9174e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge volume management improvements (still WIP).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/volsrv/volsrv.c

    r1e472ee rd3b2ffa  
    144144        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_info_srv(%zu)",
    145145            sid);
    146         rc = vol_part_find_by_id(sid, &part);
     146        rc = vol_part_find_by_id_ref(sid, &part);
    147147        if (rc != EOK) {
    148148                async_answer_0(icall_handle, ENOENT);
     
    153153        if (rc != EOK) {
    154154                async_answer_0(icall_handle, EIO);
    155                 return;
     155                goto error;
    156156        }
    157157
     
    161161                async_answer_0(chandle, EREFUSED);
    162162                async_answer_0(icall_handle, EREFUSED);
    163                 return;
     163                goto error;
    164164        }
    165165
     
    167167                async_answer_0(chandle, EINVAL);
    168168                async_answer_0(icall_handle, EINVAL);
    169                 return;
     169                goto error;
    170170        }
    171171
     
    175175                async_answer_0(chandle, rc);
    176176                async_answer_0(icall_handle, rc);
    177                 return;
    178         }
    179 
    180         async_answer_0(icall_handle, EOK);
     177                goto error;
     178        }
     179
     180        async_answer_0(icall_handle, EOK);
     181error:
     182        vol_part_del_ref(part);
     183}
     184
     185static void vol_part_eject_srv(cap_call_handle_t icall_handle, ipc_call_t *icall)
     186{
     187        service_id_t sid;
     188        vol_part_t *part;
     189        errno_t rc;
     190
     191        sid = IPC_GET_ARG1(*icall);
     192        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_eject_srv(%zu)", sid);
     193
     194        rc = vol_part_find_by_id_ref(sid, &part);
     195        if (rc != EOK) {
     196                async_answer_0(icall_handle, ENOENT);
     197                goto error;
     198        }
     199
     200        rc = vol_part_eject_part(part);
     201        if (rc != EOK) {
     202                async_answer_0(icall_handle, EIO);
     203                goto error;
     204        }
     205
     206        async_answer_0(icall_handle, EOK);
     207error:
     208        vol_part_del_ref(part);
    181209}
    182210
     
    190218        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_empty_srv(%zu)", sid);
    191219
    192         rc = vol_part_find_by_id(sid, &part);
     220        rc = vol_part_find_by_id_ref(sid, &part);
    193221        if (rc != EOK) {
    194222                async_answer_0(icall_handle, ENOENT);
     
    199227        if (rc != EOK) {
    200228                async_answer_0(icall_handle, EIO);
    201                 return;
    202         }
    203 
    204         async_answer_0(icall_handle, EOK);
     229                goto error;
     230        }
     231
     232        async_answer_0(icall_handle, EOK);
     233error:
     234        vol_part_del_ref(part);
    205235}
    206236
     
    251281        errno_t rc;
    252282
     283        log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_mkfs_srv()");
     284
    253285        sid = IPC_GET_ARG1(*icall);
    254286        fstype = IPC_GET_ARG2(*icall);
     
    261293        }
    262294
    263         printf("vol_part_mkfs_srv: label=%p\n", label);
    264         if (label != NULL)
    265                 printf("vol_part_mkfs_srv: label='%s'\n", label);
    266 
    267         rc = vol_part_find_by_id(sid, &part);
     295        if (label != NULL) {
     296                log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_mkfs_srv: label='%s'",
     297                    label);
     298        }
     299
     300        rc = vol_part_find_by_id_ref(sid, &part);
    268301        if (rc != EOK) {
    269302                free(label);
     
    276309                free(label);
    277310                async_answer_0(icall_handle, rc);
     311                vol_part_del_ref(part);
    278312                return;
    279313        }
     
    311345                        vol_part_info_srv(chandle, &call);
    312346                        break;
     347                case VOL_PART_EJECT:
     348                        vol_part_eject_srv(chandle, &call);
     349                        break;
    313350                case VOL_PART_EMPTY:
    314351                        vol_part_empty_srv(chandle, &call);
Note: See TracChangeset for help on using the changeset viewer.