Changeset 594303b in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c


Ignore:
Timestamp:
2009-04-18T15:32:56Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8d049ee0
Parents:
6b6e423a
Message:

Support mount options.
Let tmpfs decide whether to start empty or restored a TMPFS dump based on the mount option.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    r6b6e423a r594303b  
    400400        dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
    401401
     402        /* accept the mount options */
     403        ipc_callid_t callid;
     404        size_t size;
     405        if (!ipc_data_write_receive(&callid, &size)) {
     406                ipc_answer_0(callid, EINVAL);
     407                ipc_answer_0(rid, EINVAL);
     408                return;
     409        }
     410        char *opts = malloc(size + 1);
     411        if (!opts) {
     412                ipc_answer_0(callid, ENOMEM);
     413                ipc_answer_0(rid, ENOMEM);
     414                return;
     415        }
     416        ipcarg_t retval = ipc_data_write_finalize(callid, opts, size);
     417        if (retval != EOK) {
     418                ipc_answer_0(rid, retval);
     419                free(opts);
     420                return;
     421        }
     422        opts[size] = '\0';
     423
    402424        /* Initialize TMPFS. */
    403425        if (!root && !tmpfs_init()) {
     
    406428        }
    407429
    408         if (dev_handle >= 0) {
     430        if (str_cmp(opts, "restore") == 0) {
    409431                if (tmpfs_restore(dev_handle))
    410432                        ipc_answer_3(rid, EOK, root->index, root->size,
Note: See TracChangeset for help on using the changeset viewer.