Changeset 44fe800 in mainline


Ignore:
Timestamp:
2015-10-17T21:50:38Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
68b5dd11
Parents:
ea0ff6b
Message:

Create file system when creating partition.

Location:
uspace
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/vol.c

    rea0ff6b r44fe800  
    250250}
    251251
     252/** Create file system. */
     253int vol_part_mkfs(vol_t *vol, service_id_t sid, vol_fstype_t fstype)
     254{
     255        async_exch_t *exch;
     256        int retval;
     257
     258        exch = async_exchange_begin(vol->sess);
     259        retval = async_req_2_0(exch, VOL_PART_MKFS, sid, fstype);
     260        async_exchange_end(exch);
     261
     262        if (retval != EOK)
     263                return retval;
     264
     265        return EOK;
     266}
     267
    252268/** @}
    253269 */
  • uspace/lib/c/include/ipc/vol.h

    rea0ff6b r44fe800  
    4040        VOL_PART_ADD,
    4141        VOL_PART_INFO,
    42         VOL_PART_EMPTY
     42        VOL_PART_EMPTY,
     43        VOL_PART_MKFS
    4344} vol_request_t;
    4445
  • uspace/lib/c/include/types/vol.h

    rea0ff6b r44fe800  
    3535#ifndef LIBC_TYPES_VOL_H_
    3636#define LIBC_TYPES_VOL_H_
     37
     38#include <async.h>
    3739
    3840typedef enum {
  • uspace/lib/c/include/vol.h

    rea0ff6b r44fe800  
    4848extern int vol_part_info(vol_t *, service_id_t, vol_part_info_t *);
    4949extern int vol_part_empty(vol_t *, service_id_t);
     50extern int vol_part_mkfs(vol_t *, service_id_t, vol_fstype_t);
    5051
    5152#endif
  • uspace/lib/fdisk/src/fdisk.c

    rea0ff6b r44fe800  
    767767        }
    768768
     769        rc = vol_part_mkfs(dev->fdisk->vol, part->svc_id, pspec->fstype);
     770        if (rc != EOK && rc != ENOTSUP) {
     771                printf("mkfs failed\n");
     772                fdisk_part_remove(part);
     773                (void) vbd_part_delete(dev->fdisk->vbd, partid);
     774                return EIO;
     775        }
     776
    769777        printf("fdisk_part_create() - done\n");
    770778        part->pcnt = vpc_fs;
  • uspace/srv/bd/vbd/disk.c

    rea0ff6b r44fe800  
    660660        int rc;
    661661
     662        log_msg(LOG_DEFAULT, LVL_NOTE, "vbds_part_create(%zu)", sid);
     663
    662664        rc = vbds_disk_by_svcid(sid, &disk);
    663665        if (rc != EOK) {
  • uspace/srv/volsrv/Makefile

    rea0ff6b r44fe800  
    3636SOURCES = \
    3737        empty.c \
     38        mkfs.c \
    3839        part.c \
    3940        volsrv.c
  • uspace/srv/volsrv/empty.c

    rea0ff6b r44fe800  
    8585}
    8686
    87 int vol_part_is_empty(service_id_t sid, bool *rempty)
     87int volsrv_part_is_empty(service_id_t sid, bool *rempty)
    8888{
    8989        int rc;
     
    176176}
    177177
    178 int vol_part_empty(service_id_t sid)
     178int volsrv_part_empty(service_id_t sid)
    179179{
    180180        int rc;
  • uspace/srv/volsrv/empty.h

    rea0ff6b r44fe800  
    4040#include <loc.h>
    4141
    42 extern int vol_part_is_empty(service_id_t, bool *);
    43 extern int vol_part_empty(service_id_t);
     42extern int volsrv_part_is_empty(service_id_t, bool *);
     43extern int volsrv_part_empty(service_id_t);
    4444
    4545#endif
  • uspace/srv/volsrv/part.c

    rea0ff6b r44fe800  
    4444
    4545#include "empty.h"
     46#include "mkfs.h"
    4647#include "part.h"
    4748#include "types/part.h"
     
    154155
    155156        log_msg(LOG_DEFAULT, LVL_NOTE, "Probe partition %s", part->svc_name);
    156         rc = vol_part_is_empty(sid, &empty);
     157        rc = volsrv_part_is_empty(sid, &empty);
    157158        if (rc != EOK) {
    158159                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed determining if "
     
    256257        log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_empty_part()");
    257258
    258         rc = vol_part_empty(part->svc_id);
     259        rc = volsrv_part_empty(part->svc_id);
    259260        if (rc != EOK) {
    260261                log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_empty_part() - failed %d",
     
    268269}
    269270
     271int vol_part_mkfs_part(vol_part_t *part, vol_fstype_t fstype)
     272{
     273        int rc;
     274
     275        log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_mkfs_part()");
     276
     277        rc = volsrv_part_mkfs(part->svc_id, fstype);
     278        if (rc != EOK) {
     279                log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_mkfs_part() - failed %d",
     280                    rc);
     281                return rc;
     282        }
     283
     284        log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_mkfs_part() - success");
     285        part->pcnt = vpc_fs;
     286        part->fstype = fstype;
     287        return EOK;
     288}
     289
    270290int vol_part_get_info(vol_part_t *part, vol_part_info_t *pinfo)
    271291{
  • uspace/srv/volsrv/part.h

    rea0ff6b r44fe800  
    4949extern int vol_part_find_by_id(service_id_t, vol_part_t **);
    5050extern int vol_part_empty_part(vol_part_t *);
     51extern int vol_part_mkfs_part(vol_part_t *, vol_fstype_t);
    5152extern int vol_part_get_info(vol_part_t *, vol_part_info_t *);
    5253
  • uspace/srv/volsrv/volsrv.c

    rea0ff6b r44fe800  
    220220}
    221221
     222static void vol_part_mkfs_srv(ipc_callid_t iid, ipc_call_t *icall)
     223{
     224        service_id_t sid;
     225        vol_part_t *part;
     226        vol_fstype_t fstype;
     227        int rc;
     228
     229        sid = IPC_GET_ARG1(*icall);
     230        fstype = IPC_GET_ARG2(*icall);
     231
     232        log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_mkfs_srv(%zu, %d)", sid,
     233            fstype);
     234
     235        rc = vol_part_find_by_id(sid, &part);
     236        if (rc != EOK) {
     237                log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_mkfs_srv(%zu) - "
     238                    "partition not found", sid);
     239                async_answer_0(iid, ENOENT);
     240                return;
     241        }
     242
     243        log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_mkfs_srv(%zu) - "
     244            "call vol_part_mkfs_part()", sid);
     245        rc = vol_part_mkfs_part(part, fstype);
     246        if (rc != EOK) {
     247                async_answer_0(iid, rc);
     248                return;
     249        }
     250
     251        async_answer_0(iid, EOK);
     252}
     253
    222254static void vol_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    223255{
     
    251283                        vol_part_empty_srv(callid, &call);
    252284                        break;
     285                case VOL_PART_MKFS:
     286                        vol_part_mkfs_srv(callid, &call);
     287                        break;
    253288                default:
    254289                        async_answer_0(callid, EINVAL);
Note: See TracChangeset for help on using the changeset viewer.