Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_register.c

    r1b20da0 ra35b458  
    7171{
    7272        int i;
    73        
     73
    7474        /*
    7575         * Check if the name is non-empty and is composed solely of ASCII
     
    8080                return false;
    8181        }
    82        
     82
    8383        for (i = 1; i < FS_NAME_MAXLEN; i++) {
    8484                if (!(islower(info->name[i]) || isdigit(info->name[i])) &&
     
    9393                }
    9494        }
    95        
     95
    9696        /*
    9797         * This check is not redundant. It ensures that the name is
     
    102102                return false;
    103103        }
    104        
     104
    105105        return true;
    106106}
     
    116116        dprintf("Processing VFS_REGISTER request received from %zx.\n",
    117117            request->in_phone_hash);
    118        
     118
    119119        vfs_info_t *vfs_info;
    120120        errno_t rc = async_data_write_accept((void **) &vfs_info, false,
    121121            sizeof(vfs_info_t), sizeof(vfs_info_t), 0, NULL);
    122        
     122
    123123        if (rc != EOK) {
    124124                dprintf("Failed to deliver the VFS info into our AS, rc=%d.\n",
     
    127127                return;
    128128        }
    129        
     129
    130130        /*
    131131         * Allocate and initialize a buffer for the fs_info structure.
     
    137137                return;
    138138        }
    139        
     139
    140140        link_initialize(&fs_info->fs_link);
    141141        fs_info->vfs_info = *vfs_info;
    142142        free(vfs_info);
    143        
     143
    144144        dprintf("VFS info delivered.\n");
    145        
     145
    146146        if (!vfs_info_sane(&fs_info->vfs_info)) {
    147147                free(fs_info);
     
    149149                return;
    150150        }
    151        
     151
    152152        fibril_mutex_lock(&fs_list_lock);
    153        
     153
    154154        /*
    155155         * Check for duplicit registrations.
     
    166166                return;
    167167        }
    168        
     168
    169169        /*
    170170         * Add fs_info to the list of registered FS's.
     
    172172        dprintf("Inserting FS into the list of registered file systems.\n");
    173173        list_append(&fs_info->fs_link, &fs_list);
    174        
     174
    175175        /*
    176176         * Now we want the client to send us the IPC_M_CONNECT_TO_ME call so
     
    187187                return;
    188188        }
    189        
     189
    190190        dprintf("Callback connection to FS created.\n");
    191        
     191
    192192        /*
    193193         * The client will want us to send him the address space area with PLB.
    194194         */
    195        
     195
    196196        size_t size;
    197197        ipc_callid_t callid;
     
    206206                return;
    207207        }
    208        
     208
    209209        /*
    210210         * We can only send the client address space area PLB_SIZE bytes long.
     
    220220                return;
    221221        }
    222        
     222
    223223        /*
    224224         * Commit to read-only sharing the PLB with the client.
     
    226226        (void) async_share_in_finalize(callid, plb,
    227227            AS_AREA_READ | AS_AREA_CACHEABLE);
    228        
     228
    229229        dprintf("Sharing PLB.\n");
    230        
     230
    231231        /*
    232232         * That was it. The FS has been registered.
     
    236236        fs_info->fs_handle = (fs_handle_t) atomic_postinc(&fs_handle_next);
    237237        async_answer_1(rid, EOK, (sysarg_t) fs_info->fs_handle);
    238        
     238
    239239        fibril_condvar_broadcast(&fs_list_cv);
    240240        fibril_mutex_unlock(&fs_list_lock);
    241        
     241
    242242        dprintf("\"%.*s\" filesystem successfully registered, handle=%d.\n",
    243243            FS_NAME_MAXLEN, fs_info->vfs_info.name, fs_info->fs_handle);
     
    260260         */
    261261        fibril_mutex_lock(&fs_list_lock);
    262        
     262
    263263        list_foreach(fs_list, fs_link, fs_info_t, fs) {
    264264                if (fs->fs_handle == handle) {
    265265                        fibril_mutex_unlock(&fs_list_lock);
    266                        
     266
    267267                        assert(fs->sess);
    268268                        async_exch_t *exch = async_exchange_begin(fs->sess);
    269                        
     269
    270270                        assert(exch);
    271271                        return exch;
    272272                }
    273273        }
    274        
     274
    275275        fibril_mutex_unlock(&fs_list_lock);
    276        
     276
    277277        return NULL;
    278278}
     
    300300{
    301301        int handle = 0;
    302        
     302
    303303        if (lock)
    304304                fibril_mutex_lock(&fs_list_lock);
    305        
     305
    306306        list_foreach(fs_list, fs_link, fs_info_t, fs) {
    307307                if (str_cmp(fs->vfs_info.name, name) == 0 &&
     
    311311                }
    312312        }
    313        
     313
    314314        if (lock)
    315315                fibril_mutex_unlock(&fs_list_lock);
    316        
     316
    317317        return handle;
    318318}
     
    328328{
    329329        vfs_info_t *info = NULL;
    330        
     330
    331331        fibril_mutex_lock(&fs_list_lock);
    332332        list_foreach(fs_list, fs_link, fs_info_t, fs) {
     
    337337        }
    338338        fibril_mutex_unlock(&fs_list_lock);
    339        
     339
    340340        return info;
    341341}
     
    355355
    356356        fibril_mutex_lock(&fs_list_lock);
    357        
     357
    358358        size = 0;
    359359        count = 0;
     
    362362                count++;
    363363        }
    364        
     364
    365365        if (size == 0)
    366366                size = 1;
    367        
     367
    368368        fstypes->buf = calloc(1, size);
    369369        if (fstypes->buf == NULL) {
     
    371371                return ENOMEM;
    372372        }
    373        
     373
    374374        fstypes->fstypes = calloc(sizeof(char *), count);
    375375        if (fstypes->fstypes == NULL) {
     
    379379                return ENOMEM;
    380380        }
    381        
     381
    382382        fstypes->size = size;
    383        
     383
    384384        size = 0; count = 0;
    385385        list_foreach(fs_list, fs_link, fs_info_t, fs) {
Note: See TracChangeset for help on using the changeset viewer.