Changeset 35b7d86e in mainline


Ignore:
Timestamp:
2017-03-13T20:33:06Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8ffedd8
Parents:
ea56098
Message:

Remove VFS_IN_MTAB_GET

The mountpoints in VFS don't know their path anymore and it does not
make much sense to maintain this global mount table when tasks can have
different roots.

Location:
uspace
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/mount/mount.c

    rea56098 r35b7d86e  
    3232#include <str_error.h>
    3333#include <vfs/vfs.h>
     34#include <vfs/vfs_mtab.h>
    3435#include <adt/list.h>
    3536#include <errno.h>
  • uspace/app/df/df.c

    rea56098 r35b7d86e  
    4444#include <adt/list.h>
    4545#include <vfs/vfs.h>
     46#include <vfs/vfs_mtab.h>
    4647
    4748#define NAME  "df"
  • uspace/lib/c/generic/vfs/vfs.c

    rea56098 r35b7d86e  
    11061106int vfs_get_mtab_list(list_t *mtab_list)
    11071107{
    1108         sysarg_t rc;
    1109         aid_t req;
    1110         size_t i;
    1111         sysarg_t num_mounted_fs;
    1112        
    1113         async_exch_t *exch = vfs_exchange_begin();
    1114 
    1115         req = async_send_0(exch, VFS_IN_MTAB_GET, NULL);
    1116 
    1117         /* Ask VFS how many filesystems are mounted */
    1118         rc = async_req_0_1(exch, VFS_IN_PING, &num_mounted_fs);
    1119         if (rc != EOK)
    1120                 goto exit;
    1121 
    1122         for (i = 0; i < num_mounted_fs; ++i) {
    1123                 mtab_ent_t *mtab_ent;
    1124 
    1125                 mtab_ent = malloc(sizeof(mtab_ent_t));
    1126                 if (mtab_ent == NULL) {
    1127                         rc = ENOMEM;
    1128                         goto exit;
    1129                 }
    1130 
    1131                 memset(mtab_ent, 0, sizeof(mtab_ent_t));
    1132 
    1133                 rc = async_data_read_start(exch, (void *) mtab_ent->mp,
    1134                     MAX_PATH_LEN);
    1135                 if (rc != EOK)
    1136                         goto exit;
    1137 
    1138                 rc = async_data_read_start(exch, (void *) mtab_ent->opts,
    1139                         MAX_MNTOPTS_LEN);
    1140                 if (rc != EOK)
    1141                         goto exit;
    1142 
    1143                 rc = async_data_read_start(exch, (void *) mtab_ent->fs_name,
    1144                         FS_NAME_MAXLEN);
    1145                 if (rc != EOK)
    1146                         goto exit;
    1147 
    1148                 sysarg_t p[2];
    1149 
    1150                 rc = async_req_0_2(exch, VFS_IN_PING, &p[0], &p[1]);
    1151                 if (rc != EOK)
    1152                         goto exit;
    1153 
    1154                 mtab_ent->instance = p[0];
    1155                 mtab_ent->service_id = p[1];
    1156 
    1157                 link_initialize(&mtab_ent->link);
    1158                 list_append(&mtab_ent->link, mtab_list);
    1159         }
    1160 
    1161 exit:
    1162         async_wait_for(req, &rc);
    1163         vfs_exchange_end(exch);
     1108        sysarg_t rc = ENOTSUP;
     1109       
    11641110        return rc;
    11651111}
  • uspace/lib/c/include/ipc/vfs.h

    rea56098 r35b7d86e  
    6969        VFS_IN_FSTAT,
    7070        VFS_IN_CLOSE,
    71         VFS_IN_PING,
    7271        VFS_IN_MOUNT,
    7372        VFS_IN_UNMOUNT,
     
    7877        VFS_IN_DUP,
    7978        VFS_IN_WAIT_HANDLE,
    80         VFS_IN_MTAB_GET,
    8179        VFS_IN_STATFS,
    8280        VFS_IN_WALK,
  • uspace/lib/c/include/vfs/vfs.h

    rea56098 r35b7d86e  
    4242#include <stdio.h>
    4343#include <async.h>
    44 #include "vfs_mtab.h"
    45 
    4644
    4745enum vfs_change_state_type {
    4846        VFS_PASS_HANDLE
    4947};
    50 
    5148
    5249extern char *vfs_absolutize(const char *, size_t *);
  • uspace/srv/vfs/vfs_ipc.c

    rea56098 r35b7d86e  
    110110}
    111111
    112 static void vfs_in_mtab_get(ipc_callid_t rid, ipc_call_t *request)
    113 {
    114         int rc = vfs_op_mtab_get();
    115         async_answer_0(rid, rc);
    116 }
    117 
    118112static void vfs_in_open2(ipc_callid_t rid, ipc_call_t *request)
    119113{
     
    306300                        vfs_in_mount(callid, &call);
    307301                        break;
    308                 case VFS_IN_MTAB_GET:
    309                         vfs_in_mtab_get(callid, &call);
    310                         break;
    311302                case VFS_IN_OPEN2:
    312303                        vfs_in_open2(callid, &call);
  • uspace/srv/vfs/vfs_ops.c

    rea56098 r35b7d86e  
    5252#include <assert.h>
    5353#include <vfs/canonify.h>
    54 #include <vfs/vfs_mtab.h>
    55 
    56 FIBRIL_MUTEX_INITIALIZE(mtab_list_lock);
    57 LIST_INITIALIZE(mtab_list);
    58 static size_t mtab_size = 0;
    5954
    6055/* Forward declarations of static functions. */
     
    243238        vfs_file_t *file = NULL;
    244239        int fd = -1;
    245         mtab_ent_t *mtab_ent = NULL;
    246240       
    247241        if (!(flags & VFS_MOUNT_CONNECT_ONLY)) {
     
    274268                        goto out;
    275269                }
    276         }
    277        
    278         /* Add the filesystem info to the list of mounted filesystems */
    279         mtab_ent = malloc(sizeof(mtab_ent_t));
    280         if (!mtab_ent) {
    281                 rc = ENOMEM;
    282                 goto out;
    283270        }
    284271       
     
    301288        }
    302289       
    303        
    304290        if (flags & VFS_MOUNT_NO_REF) {
    305291                vfs_node_delref(root);
     
    313299        }
    314300       
    315         /* Add the filesystem info to the list of mounted filesystems */
    316         str_cpy(mtab_ent->mp, MAX_PATH_LEN, "fixme");
    317         str_cpy(mtab_ent->fs_name, FS_NAME_MAXLEN, fs_name);
    318         str_cpy(mtab_ent->opts, MAX_MNTOPTS_LEN, opts);
    319         mtab_ent->instance = instance;
    320         mtab_ent->service_id = service_id;
    321 
    322         link_initialize(&mtab_ent->link);
    323 
    324         fibril_mutex_lock(&mtab_list_lock);
    325         list_append(&mtab_ent->link, &mtab_list);
    326         mtab_size++;
    327         fibril_mutex_unlock(&mtab_list_lock);   
    328 
    329301out:
    330302        if (mp) {
     
    340312       
    341313        *outfd = fd;
    342         return rc;
    343 }
    344 
    345 int vfs_op_mtab_get(void)
    346 {
    347         ipc_callid_t callid;
    348         ipc_call_t data;
    349         sysarg_t rc = EOK;
    350         size_t len;
    351 
    352         fibril_mutex_lock(&mtab_list_lock);
    353 
    354         /* Send to the caller the number of mounted filesystems */
    355         callid = async_get_call(&data);
    356         if (IPC_GET_IMETHOD(data) != VFS_IN_PING) {
    357                 rc = ENOTSUP;
    358                 async_answer_0(callid, rc);
    359                 goto exit;
    360         }
    361         async_answer_1(callid, EOK, mtab_size);
    362 
    363         list_foreach(mtab_list, link, mtab_ent_t, mtab_ent) {
    364                 rc = ENOTSUP;
    365 
    366                 if (!async_data_read_receive(&callid, &len)) {
    367                         async_answer_0(callid, rc);
    368                         goto exit;
    369                 }
    370 
    371                 (void) async_data_read_finalize(callid, mtab_ent->mp,
    372                     str_size(mtab_ent->mp));
    373 
    374                 if (!async_data_read_receive(&callid, &len)) {
    375                         async_answer_0(callid, rc);
    376                         goto exit;
    377                 }
    378 
    379                 (void) async_data_read_finalize(callid, mtab_ent->opts,
    380                     str_size(mtab_ent->opts));
    381 
    382                 if (!async_data_read_receive(&callid, &len)) {
    383                         async_answer_0(callid, rc);
    384                         goto exit;
    385                 }
    386 
    387                 (void) async_data_read_finalize(callid, mtab_ent->fs_name,
    388                     str_size(mtab_ent->fs_name));
    389 
    390                 callid = async_get_call(&data);
    391 
    392                 if (IPC_GET_IMETHOD(data) != VFS_IN_PING) {
    393                         async_answer_0(callid, rc);
    394                         goto exit;
    395                 }
    396 
    397                 rc = EOK;
    398                 async_answer_2(callid, rc, mtab_ent->instance,
    399                     mtab_ent->service_id);
    400         }
    401 
    402 exit:
    403         fibril_mutex_unlock(&mtab_list_lock);
    404314        return rc;
    405315}
     
    984894        fibril_rwlock_write_unlock(&namespace_rwlock);
    985895       
    986         fibril_mutex_lock(&mtab_list_lock);
    987         int found = 0;
    988 
    989         list_foreach(mtab_list, link, mtab_ent_t, mtab_ent) {
    990                 // FIXME: mp name
    991                 if (str_cmp(mtab_ent->mp, "fixme") == 0) {
    992                         list_remove(&mtab_ent->link);
    993                         mtab_size--;
    994                         free(mtab_ent);
    995                         found = 1;
    996                         break;
    997                 }
    998         }
    999         assert(found);
    1000         fibril_mutex_unlock(&mtab_list_lock);
    1001        
    1002896        vfs_file_put(mp);
    1003897        return EOK;
Note: See TracChangeset for help on using the changeset viewer.