Changes in / [7964475:b5ec347] in mainline


Ignore:
Files:
4 added
25 deleted
49 edited

Legend:

Unmodified
Added
Removed
  • .bzrignore

    r7964475 rb5ec347  
    6262./uspace/app/trace/trace
    6363./uspace/app/usb/usb
    64 ./uspace/app/usbinfo/usbinfo
    6564./uspace/app/virtusbkbd/vuk
    66 ./uspace/dist/app/*
     65./uspace/dist/app/bdsh
     66./uspace/dist/app/edit
     67./uspace/dist/app/getterm
     68./uspace/dist/app/klog
     69./uspace/dist/app/mkfat
     70./uspace/dist/app/netecho
     71./uspace/dist/app/netstart
     72./uspace/dist/app/nettest1
     73./uspace/dist/app/nettest2
     74./uspace/dist/app/ping
     75./uspace/dist/app/redir
     76./uspace/dist/app/sbi
     77./uspace/dist/app/stats
     78./uspace/dist/app/taskdump
     79./uspace/dist/app/tasks
     80./uspace/dist/app/tester
     81./uspace/dist/app/test_serial
     82./uspace/dist/app/tetris
     83./uspace/dist/app/top
     84./uspace/dist/app/trace
     85./uspace/dist/app/usb
     86./uspace/dist/app/vuk
    6787./uspace/dist/cfg/net/general
    6888./uspace/dist/cfg/net/lo
    6989./uspace/dist/cfg/net/ne2k
    70 ./uspace/dist/drv/*
    71 ./uspace/dist/srv/*
     90./uspace/dist/drv/isa/
     91./uspace/dist/drv/ns8250/
     92./uspace/dist/drv/pciintel/
     93./uspace/dist/drv/root/
     94./uspace/dist/drv/rootia32/
     95./uspace/dist/drv/uhci/
     96./uspace/dist/drv/usbhub/
     97./uspace/dist/drv/usbkbd/
     98./uspace/dist/drv/vhc/
     99./uspace/dist/srv/arp
     100./uspace/dist/srv/ata_bd
     101./uspace/dist/srv/char_ms
     102./uspace/dist/srv/clip
     103./uspace/dist/srv/console
     104./uspace/dist/srv/devfs
     105./uspace/dist/srv/devman
     106./uspace/dist/srv/dp8390
     107./uspace/dist/srv/eth
     108./uspace/dist/srv/fat
     109./uspace/dist/srv/fb
     110./uspace/dist/srv/file_bd
     111./uspace/dist/srv/g_part
     112./uspace/dist/srv/i8042
     113./uspace/dist/srv/icmp
     114./uspace/dist/srv/ip
     115./uspace/dist/srv/kbd
     116./uspace/dist/srv/lo
     117./uspace/dist/srv/mbr_part
     118./uspace/dist/srv/net
     119./uspace/dist/srv/netstart
     120./uspace/dist/srv/nildummy
     121./uspace/dist/srv/pci
     122./uspace/dist/srv/taskmon
     123./uspace/dist/srv/tcp
     124./uspace/dist/srv/tmpfs
     125./uspace/dist/srv/udp
     126./uspace/dist/srv/vhcd
    72127./uspace/drv/root/root
    73128./uspace/drv/isa/isa
    74129./uspace/drv/ns8250/ns8250
    75130./uspace/drv/pciintel/pciintel
    76 ./uspace/drv/rootpc/rootpc
    77 ./uspace/drv/rootvirt/rootvirt
    78 ./uspace/drv/test1/test1
    79 ./uspace/drv/test2/test2
     131./uspace/drv/rootia32/rootia32
    80132./uspace/drv/uhci/uhci
    81133./uspace/drv/usbhub/usbhub
  • HelenOS.config

    r7964475 rb5ec347  
    545545% Line debugging information
    546546! [CONFIG_STRIP_BINARIES!=y] CONFIG_LINE_DEBUG (n/y)
    547 
    548 % Launch (devman) test drivers
    549 ! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (y/n)
    550 
  • Makefile

    r7964475 rb5ec347  
    4141CONFIG_HEADER = config.h
    4242
    43 .PHONY: all precheck cscope autotool config_auto config_default config distclean clean
     43.PHONY: all precheck cscope autotool config_default config distclean clean
    4444
    4545all: $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER)
     
    6666
    6767config_default: $(CONFIG_RULES)
    68 ifeq ($(HANDS_OFF),y)
    69         $(CONFIG) $< hands-off $(PROFILE)
    70 else
    71         $(CONFIG) $< default $(PROFILE)
    72 endif
     68        $(CONFIG) $< default
    7369
    7470config: $(CONFIG_RULES)
  • boot/Makefile.common

    r7964475 rb5ec347  
    111111RD_DRVS = \
    112112        root \
    113         rootvirt \
    114         test1 \
    115         test2 \
    116113        vhc
    117114
     
    145142        $(USPACE_PATH)/app/ping/ping \
    146143        $(USPACE_PATH)/app/stats/stats \
     144        $(USPACE_PATH)/app/virtusbkbd/vuk \
    147145        $(USPACE_PATH)/app/tasks/tasks \
    148         $(USPACE_PATH)/app/top/top \
    149         $(USPACE_PATH)/app/usbinfo/usbinfo \
    150         $(USPACE_PATH)/app/virtusbkbd/vuk
     146        $(USPACE_PATH)/app/top/top
    151147
    152148ifneq ($(CONFIG_BAREBONE),y)
  • boot/arch/amd64/Makefile.inc

    r7964475 rb5ec347  
    3737
    3838RD_DRVS += \
    39         rootpc \
     39        rootia32 \
    4040        pciintel \
    4141        isa \
  • tools/config.py

    r7964475 rb5ec347  
    4747
    4848def read_config(fname, config):
    49         "Read saved values from last configuration run or a preset file"
     49        "Read saved values from last configuration run"
    5050       
    5151        inf = open(fname, 'r')
     
    218218# and verify that all variables have a value (previously specified or inferred).
    219219#
    220 # @param config Configuration to work on
    221 # @param rules  Rules
    222 #
    223 # @return True if configuration is complete and valid, False
    224 #         otherwise.
     220# @param config Configuration to work on
     221# @param rules  Rules
     222#
     223# @return       True if configuration is complete and valid, False
     224#               otherwise.
    225225#
    226226def infer_verify_choices(config, rules):
     
    229229        for rule in rules:
    230230                varname, vartype, name, choices, cond = rule
    231                
     231
    232232                if cond and (not check_condition(cond, config, rules)):
    233233                        continue
     
    237237                else:
    238238                        value = config[varname]
    239                
    240                 if not validate_rule_value(rule, value):
     239
     240                if not rule_value_is_valid(rule, value):
    241241                        value = None
    242                
    243                 default = get_default_rule(rule)
    244 
    245                 #
    246                 # If we don't have a value but we do have
    247                 # a default, use it.
    248                 #
    249                 if value == None and default != None:
    250                         value = default
     242
     243                default = rule_get_default(rule)
     244                if default != None:
    251245                        config[varname] = default
    252                
     246
    253247                if not varname in config:
    254248                        return False
     
    257251
    258252## Get default value from a rule.
    259 def get_default_rule(rule):
     253def rule_get_default(rule):
    260254        varname, vartype, name, choices, cond = rule
    261        
     255
    262256        default = None
    263        
     257
    264258        if vartype == 'choice':
    265259                # If there is just one option, use it
     
    276270        else:
    277271                raise RuntimeError("Unknown variable type: %s" % vartype)
    278        
     272
    279273        return default
    280274
    281275## Get option from a rule.
    282276#
    283 # @param rule  Rule for a variable
    284 # @param value Current value of the variable
     277# @param rule   Rule for a variable
     278# @param value  Current value of the variable
    285279#
    286280# @return Option (string) to ask or None which means not to ask.
    287281#
    288 def get_rule_option(rule, value):
     282def rule_get_option(rule, value):
    289283        varname, vartype, name, choices, cond = rule
    290        
     284
    291285        option = None
    292        
     286
    293287        if vartype == 'choice':
    294288                # If there is just one option, don't ask
     
    308302        else:
    309303                raise RuntimeError("Unknown variable type: %s" % vartype)
    310        
     304
    311305        return option
    312306
    313307## Check if variable value is valid.
    314308#
    315 # @param rule  Rule for the variable
    316 # @param value Value of the variable
    317 #
    318 # @return True if valid, False if not valid.
    319 #
    320 def validate_rule_value(rule, value):
     309# @param rule   Rule for the variable
     310# @param value  Value of the variable
     311#
     312# @return       True if valid, False if not valid.
     313#
     314def rule_value_is_valid(rule, value):
    321315        varname, vartype, name, choices, cond = rule
    322316       
    323317        if value == None:
    324318                return True
    325        
     319
    326320        if vartype == 'choice':
    327321                if not value in [choice[0] for choice in choices]:
     
    341335        else:
    342336                raise RuntimeError("Unknown variable type: %s" % vartype)
    343        
     337
    344338        return True
    345339
     
    419413        return list
    420414
    421 ## Ask user to choose a configuration profile.
    422 #
    423 def choose_profile(root, fname, screen, config):
     415## Choose a profile and load configuration presets.
     416#
     417def load_presets(root, fname, screen, config):
    424418        options = []
    425419        opt2path = {}
     
    442436                                        subprofile = True
    443437                                        options.append("%s (%s)" % (name, subname))
    444                                         opt2path[cnt] = [name, subname]
     438                                        opt2path[cnt] = (canon, subcanon)
    445439                                        cnt += 1
    446440                       
    447441                        if not subprofile:
    448442                                options.append(name)
    449                                 opt2path[cnt] = [name]
     443                                opt2path[cnt] = (canon, None)
    450444                                cnt += 1
    451445       
     
    455449                return None
    456450       
    457         return opt2path[value]
    458 
    459 ## Read presets from a configuration profile.
    460 #
    461 # @param profile Profile to load from (a list of string components)
    462 # @param config  Output configuration
    463 #
    464 def read_presets(profile, config):
    465         path = os.path.join(PRESETS_DIR, profile[0], MAKEFILE)
    466         read_config(path, config)
    467        
    468         if len(profile) > 1:
    469                 path = os.path.join(PRESETS_DIR, profile[0], profile[1], MAKEFILE)
    470                 read_config(path, config)
    471 
    472 ## Parse profile name (relative OS path) into a list of components.
    473 #
    474 # @param profile_name Relative path (using OS separator)
    475 # @return             List of components
    476 #
    477 def parse_profile_name(profile_name):
    478         profile = []
    479        
    480         head, tail = os.path.split(profile_name)
    481         if head != '':
    482                 profile.append(head)
    483        
    484         profile.append(tail)
    485         return profile
     451        read_config(opt2path[value][0], config)
     452        if opt2path[value][1] != None:
     453                read_config(opt2path[value][1], config)
    486454
    487455def main():
    488         profile = None
    489456        config = {}
    490457        rules = []
     
    493460        parse_rules(RULES_FILE, rules)
    494461       
    495         # Input configuration file can be specified on command line
    496         # otherwise configuration from previous run is used.
    497         if len(sys.argv) >= 4:
    498                 profile = parse_profile_name(sys.argv[3])
    499                 read_presets(profile, config)
    500         elif os.path.exists(MAKEFILE):
     462        # Read configuration from previous run
     463        if os.path.exists(MAKEFILE):
    501464                read_config(MAKEFILE, config)
    502465       
    503         # Default mode: check values and regenerate configuration files
     466        # Default mode: only check values and regenerate configuration files
    504467        if (len(sys.argv) >= 3) and (sys.argv[2] == 'default'):
    505468                if (infer_verify_choices(config, rules)):
    506469                        create_output(MAKEFILE, MACROS, config, rules)
    507470                        return 0
    508        
    509         # Hands-off mode: check values and regenerate configuration files,
    510         # but no interactive fallback
    511         if (len(sys.argv) >= 3) and (sys.argv[2] == 'hands-off'):
    512                 # We deliberately test sys.argv >= 4 because we do not want
    513                 # to read implicitly any possible previous run configuration
    514                 if len(sys.argv) < 4:
    515                         sys.stderr.write("Configuration error: No presets specified\n")
    516                         return 2
    517                
    518                 if (infer_verify_choices(config, rules)):
    519                         create_output(MAKEFILE, MACROS, config, rules)
    520                         return 0
    521                
    522                 sys.stderr.write("Configuration error: The presets are ambiguous\n")
    523                 return 1
    524471       
    525472        # Check mode: only check configuration
     
    560507                                        value = config[varname]
    561508                               
    562                                 if not validate_rule_value(rule, value):
     509                                if not rule_value_is_valid(rule, value):
    563510                                        value = None
    564                                
    565                                 default = get_default_rule(rule)
    566 
    567                                 #
    568                                 # If we don't have a value but we do have
    569                                 # a default, use it.
    570                                 #
    571                                 if value == None and default != None:
     511
     512                                default = rule_get_default(rule)
     513                                if default != None:
    572514                                        value = default
    573515                                        config[varname] = default
    574                                
    575                                 option = get_rule_option(rule, value)
     516
     517                                option = rule_get_option(rule, value)
    576518                                if option != None:
    577519                                        options.append(option)
    578                                 else:
    579                                         continue
    580520                               
    581521                                opt2row[cnt] = (varname, vartype, name, choices)
     
    599539                       
    600540                        if value == 0:
    601                                 profile = choose_profile(PRESETS_DIR, MAKEFILE, screen, config)
    602                                 if profile != None:
    603                                         read_presets(profile, config)
     541                                load_presets(PRESETS_DIR, MAKEFILE, screen, config)
    604542                                position = 1
    605543                                continue
  • uspace/Makefile

    r7964475 rb5ec347  
    4949        app/trace \
    5050        app/top \
    51         app/usbinfo \
    5251        app/virtusbkbd \
    5352        app/netecho \
     
    8887        srv/net/net \
    8988        drv/root \
    90         drv/rootvirt \
    91         drv/test1 \
    92         drv/test2 \
    9389        drv/vhc
    9490
     
    114110
    115111ifeq ($(UARCH),amd64)
    116         DIRS += drv/rootpc
    117         DIRS += drv/pciintel
    118         DIRS += drv/isa
    119         DIRS += drv/ns8250
    120112endif
    121113
    122114ifeq ($(UARCH),ia32)
    123         DIRS += drv/rootpc
     115        DIRS += drv/rootia32
    124116        DIRS += drv/pciintel
    125117        DIRS += drv/isa
  • uspace/app/netecho/print_error.c

    r7964475 rb5ec347  
    164164        case EDESTADDRREQ:
    165165                fprintf(output, "Destination address required (%d) error", error_code);
    166         case EAGAIN:
     166        case TRY_AGAIN:
    167167                fprintf(output, "Try again (%d) error", error_code);
    168168        default:
  • uspace/app/tester/Makefile

    r7964475 rb5ec347  
    3131BINARY = tester
    3232
    33 LIBS += $(LIBUSB_PREFIX)/libusb.a
    34 EXTRA_CFLAGS += -I$(LIBUSB_PREFIX)/include
    35 
    3633SOURCES = \
    3734        tester.c \
    38         adt/usbaddrkeep.c \
    3935        thread/thread1.c \
    4036        print/print1.c \
  • uspace/app/tester/tester.c

    r7964475 rb5ec347  
    6565#include "mm/malloc1.def"
    6666#include "hw/serial/serial1.def"
    67 #include "adt/usbaddrkeep.def"
    6867        {NULL, NULL, NULL, false}
    6968};
  • uspace/app/tester/tester.h

    r7964475 rb5ec347  
    8282extern const char *test_malloc1(void);
    8383extern const char *test_serial1(void);
    84 extern const char *test_usbaddrkeep(void);
    8584
    8685extern test_t tests[];
  • uspace/drv/isa/isa.c

    r7964475 rb5ec347  
    282282
    283283                printf(NAME ": added io range (addr=0x%x, size=0x%x) to "
    284                     "device %s\n", (unsigned int) addr, (unsigned int) len,
    285                     dev->name);
     284                    "device %s\n", addr, len, dev->name);
    286285        }
    287286}
     
    490489static int isa_add_device(device_t *dev)
    491490{
    492         printf(NAME ": isa_add_device, device handle = %d\n",
    493             (int) dev->handle);
     491        printf(NAME ": isa_add_device, device handle = %d\n", dev->handle);
    494492
    495493        /* Add child devices. */
  • uspace/drv/ns8250/ns8250.c

    r7964475 rb5ec347  
    274274       
    275275        /* Gain control over port's registers. */
    276         if (pio_enable((void *)(uintptr_t) data->io_addr, REG_COUNT,
     276        if (pio_enable((void *) data->io_addr, REG_COUNT,
    277277            (void **) &data->port)) {
    278278                printf(NAME ": error - cannot gain the port %#" PRIx32 " for device "
     
    727727{
    728728        printf(NAME ": ns8250_add_device %s (handle = %d)\n",
    729             dev->name, (int) dev->handle);
     729            dev->name, dev->handle);
    730730       
    731731        int res = ns8250_dev_initialize(dev);
  • uspace/drv/pciintel/pci.c

    r7964475 rb5ec347  
    324324                printf(NAME ": device %s : ", dev->name);
    325325                printf("address = %" PRIx64, range_addr);
    326                 printf(", size = %x\n", (unsigned int) range_size);
     326                printf(", size = %x\n", range_size);
    327327        }
    328328       
     
    489489            (uint32_t) hw_resources.resources[0].res.io_range.address;
    490490       
    491         if (pio_enable((void *)(uintptr_t)bus_data->conf_io_addr, 8,
     491        if (pio_enable((void *)bus_data->conf_io_addr, 8,
    492492            &bus_data->conf_addr_port)) {
    493493                printf(NAME ": failed to enable configuration ports.\n");
  • uspace/drv/root/root.c

    r7964475 rb5ec347  
    11/*
    22 * Copyright (c) 2010 Lenka Trochtova
    3  * Copyright (c) 2010 Vojtech Horky
    43 * All rights reserved.
    54 *
     
    5453#define NAME "root"
    5554
    56 #define PLATFORM_DEVICE_NAME "hw"
    57 #define PLATFORM_DEVICE_MATCH_ID STRING(UARCH)
    58 #define PLATFORM_DEVICE_MATCH_SCORE 100
    59 
    60 #define VIRTUAL_DEVICE_NAME "virt"
    61 #define VIRTUAL_DEVICE_MATCH_ID "rootvirt"
    62 #define VIRTUAL_DEVICE_MATCH_SCORE 100
    63 
    6455static int root_add_device(device_t *dev);
    6556
     
    7566};
    7667
    77 /** Create the device which represents the root of virtual device tree.
    78  *
    79  * @param parent Parent of the newly created device.
    80  * @return Error code.
    81  */
    82 static int add_virtual_root_child(device_t *parent)
    83 {
    84         printf(NAME ": adding new child for virtual devices.\n");
    85         printf(NAME ":   device node is `%s' (%d %s)\n", VIRTUAL_DEVICE_NAME,
    86             VIRTUAL_DEVICE_MATCH_SCORE, VIRTUAL_DEVICE_MATCH_ID);
    87 
    88         int res = child_device_register_wrapper(parent, VIRTUAL_DEVICE_NAME,
    89             VIRTUAL_DEVICE_MATCH_ID, VIRTUAL_DEVICE_MATCH_SCORE);
    90 
    91         return res;
    92 }
    93 
    9468/** Create the device which represents the root of HW device tree.
    9569 *
     
    10074{
    10175        printf(NAME ": adding new child for platform device.\n");
    102         printf(NAME ":   device node is `%s' (%d %s)\n", PLATFORM_DEVICE_NAME,
    103             PLATFORM_DEVICE_MATCH_SCORE, PLATFORM_DEVICE_MATCH_ID);
    104        
    105         int res = child_device_register_wrapper(parent, PLATFORM_DEVICE_NAME,
    106             PLATFORM_DEVICE_MATCH_ID, PLATFORM_DEVICE_MATCH_SCORE);
    107 
     76       
     77        int res = EOK;
     78        device_t *platform = NULL;
     79        match_id_t *match_id = NULL;
     80       
     81        /* Create new device. */
     82        platform = create_device();
     83        if (NULL == platform) {
     84                res = ENOMEM;
     85                goto failure;
     86        }       
     87       
     88        platform->name = "hw";
     89        printf(NAME ": the new device's name is %s.\n", platform->name);
     90       
     91        /* Initialize match id list. */
     92        match_id = create_match_id();
     93        if (NULL == match_id) {
     94                res = ENOMEM;
     95                goto failure;
     96        }
     97       
     98        /* TODO - replace this with some better solution (sysinfo ?) */
     99        match_id->id = STRING(UARCH);
     100        match_id->score = 100;
     101        add_match_id(&platform->match_ids, match_id);
     102       
     103        /* Register child device. */
     104        res = child_device_register(platform, parent);
     105        if (EOK != res)
     106                goto failure;
     107       
    108108        return res;
     109       
     110failure:
     111        if (NULL != match_id)
     112                match_id->id = NULL;
     113       
     114        if (NULL != platform) {
     115                platform->name = NULL;
     116                delete_device(platform);
     117        }
     118       
     119        return res;
     120}
     121
     122/** Create virtual USB host controller device.
     123 * Note that the virtual HC is actually device and driver in one
     124 * task.
     125 *
     126 * @param parent Parent device.
     127 * @return Error code.
     128 */
     129static int add_virtual_usb_host_controller(device_t *parent)
     130{
     131        printf(NAME ": adding virtual host contoller.\n");
     132
     133        int rc;
     134        device_t *vhc = NULL;
     135        match_id_t *match_id = NULL;
     136
     137        vhc = create_device();
     138        if (vhc == NULL) {
     139                rc = ENOMEM;
     140                goto failure;
     141        }
     142
     143        vhc->name = "vhc";
     144        printf(NAME ": the new device's name is %s.\n", vhc->name);
     145
     146        /* Initialize match id list. */
     147        match_id = create_match_id();
     148        if (match_id == NULL) {
     149                rc = ENOMEM;
     150                goto failure;
     151        }
     152
     153        match_id->id = "usb&hc=vhc";
     154        match_id->score = 100;
     155        add_match_id(&vhc->match_ids, match_id);
     156
     157        /* Register child device. */
     158        rc = child_device_register(vhc, parent);
     159        if (rc != EOK)
     160                goto failure;
     161
     162        return EOK;
     163
     164failure:
     165        if (match_id != NULL)
     166                match_id->id = NULL;
     167
     168        if (vhc != NULL) {
     169                vhc->name = NULL;
     170                delete_device(vhc);
     171        }
     172
     173        return rc;
    109174}
    110175
     
    119184            dev->handle);
    120185       
    121         /*
    122          * Register virtual devices root.
    123          * We ignore error occurrence because virtual devices shall not be
    124          * vital for the system.
    125          */
    126         add_virtual_root_child(dev);
    127 
    128186        /* Register root device's children. */
    129187        int res = add_platform_child(dev);
     
    131189                printf(NAME ": failed to add child device for platform.\n");
    132190       
     191        /* Register virtual USB host controller. */
     192        int rc = add_virtual_usb_host_controller(dev);
     193        if (EOK != rc) {
     194                printf(NAME ": failed to add child device - virtual USB HC.\n");
     195        }
     196
    133197        return res;
    134198}
  • uspace/drv/uhci/main.c

    r7964475 rb5ec347  
    2727 */
    2828#include <usb/hcdhubd.h>
    29 #include <usb/debug.h>
    3029#include <errno.h>
    3130#include "uhci.h"
     
    3736static int uhci_add_device(device_t *device)
    3837{
    39         usb_dprintf(NAME, 1, "uhci_add_device() called\n");
    4038        device->ops = &uhci_ops;
    4139
     
    4341         * We need to announce the presence of our root hub.
    4442         */
    45         usb_dprintf(NAME, 2, "adding root hub\n");
    4643        usb_hcd_add_root_hub(device);
    4744
     
    6461         */
    6562        sleep(5);
    66         usb_dprintf_enable(NAME, 5);
    6763
    6864        return driver_main(&uhci_driver);
  • uspace/drv/vhc/Makefile

    r7964475 rb5ec347  
    3939
    4040SOURCES = \
     41        addrmgm.c \
    4142        conndev.c \
    4243        connhost.c \
  • uspace/drv/vhc/conn.h

    r7964475 rb5ec347  
    4848
    4949void address_init(void);
     50int reserve_default_address(device_t *);
     51int release_default_address(device_t *);
     52int request_address(device_t *, usb_address_t *);
     53int release_address(device_t *, usb_address_t);
     54int bind_address(device_t *, usb_address_t, devman_handle_t);
    5055
     56int tell_address(device_t *, devman_handle_t, usb_address_t *);
    5157
    5258void default_connection_handler(device_t *, ipc_callid_t, ipc_call_t *);
  • uspace/drv/vhc/connhost.c

    r7964475 rb5ec347  
    3636#include <errno.h>
    3737#include <usb/usb.h>
    38 #include <usb/hcd.h>
    3938
    4039#include "vhcd.h"
     
    5857                case USB_DIRECTION_IN:
    5958                        transfer->in_callback(transfer->dev,
    60                             outcome, size,
     59                            size, outcome,
    6160                            transfer->arg);
    6261                        break;
     
    219218}
    220219
    221 static usb_address_keeping_t addresses;
    222 
    223 
    224 static int reserve_default_address(device_t *dev)
    225 {
    226         usb_address_keeping_reserve_default(&addresses);
    227         return EOK;
    228 }
    229 
    230 static int release_default_address(device_t *dev)
    231 {
    232         usb_address_keeping_release_default(&addresses);
    233         return EOK;
    234 }
    235 
    236 static int request_address(device_t *dev, usb_address_t *address)
    237 {
    238         usb_address_t addr = usb_address_keeping_request(&addresses);
    239         if (addr < 0) {
    240                 return (int)addr;
    241         }
    242 
    243         *address = addr;
    244         return EOK;
    245 }
    246 
    247 static int release_address(device_t *dev, usb_address_t address)
    248 {
    249         return usb_address_keeping_release(&addresses, address);
    250 }
    251 
    252 static int bind_address(device_t *dev, usb_address_t address,
    253     devman_handle_t handle)
    254 {
    255         usb_address_keeping_devman_bind(&addresses, address, handle);
    256         return EOK;
    257 }
    258 
    259 static int tell_address(device_t *dev, devman_handle_t handle,
    260     usb_address_t *address)
    261 {
    262         usb_address_t addr = usb_address_keeping_find(&addresses, handle);
    263         if (addr < 0) {
    264                 return addr;
    265         }
    266 
    267         *address = addr;
    268         return EOK;
    269 }
    270 
    271 void address_init(void)
    272 {
    273         usb_address_keeping_init(&addresses, 50);
    274 }
    275220
    276221usbhc_iface_t vhc_iface = {
  • uspace/drv/vhc/debug.c

    r7964475 rb5ec347  
    3535#include <stdio.h>
    3636#include <ipc/ipc.h>
    37 #include <usb/debug.h>
    3837
    3938#include "vhcd.h"
    4039
     40/** Current debug level. */
     41int debug_level = 0;
     42
     43/** Debugging printf.
     44 * This function is intended for single-line messages as it
     45 * automatically prints debugging prefix at the beginning of the
     46 * line.
     47 *
     48 * @see printf
     49 * @param level Debugging level.
     50 */
     51void dprintf(int level, const char *format, ...)
     52{
     53        if (level > debug_level) {
     54                return;
     55        }
     56       
     57        printf("%s(%d): ", NAME, level);
     58        va_list args;
     59        va_start(args, format);
     60        vprintf(format, args);
     61        va_end(args);
     62        printf("\n");
     63}
    4164
    4265/** Debug print informing of invalid call.
  • uspace/drv/vhc/hcd.c

    r7964475 rb5ec347  
    111111        printf("%s: virtual USB host controller driver.\n", NAME);
    112112
    113         usb_dprintf_enable(NAME, 10);
     113        debug_level = 10;
    114114
    115115        fid_t fid = fibril_create(hc_manager_fibril, NULL);
  • uspace/drv/vhc/vhcd.h

    r7964475 rb5ec347  
    3636#define VHCD_VHCD_H_
    3737
    38 #include <usb/debug.h>
    39 
    4038#define NAME "vhc"
    4139#define NAME_DEV "hcd-virt-dev"
     
    4543#define DEVMAP_PATH_DEV NAMESPACE "/" NAME_DEV
    4644
    47 #define dprintf(level, format, ...) \
    48         usb_dprintf(NAME, (level), format "\n", ##__VA_ARGS__)
     45extern int debug_level;
     46void dprintf(int, const char *, ...);
    4947void dprintf_inval_call(int, ipc_call_t, ipcarg_t);
    5048
  • uspace/lib/c/generic/adt/char_map.c

    r7964475 rb5ec347  
    9090        }
    9191
    92         map->items[map->next]->c = *identifier;
    93         identifier++;
    94         map->next++;
    95         if ((length > 1) || ((length == 0) && *identifier)) {
     92        map->items[map->next]->c = * identifier;
     93        ++ identifier;
     94        ++ map->next;
     95        if ((length > 1) || ((length == 0) && (*identifier))) {
    9696                map->items[map->next - 1]->value = CHAR_MAP_NULL;
    9797                return char_map_add_item(map->items[map->next - 1], identifier,
     
    142142    const int value)
    143143{
    144         if (char_map_is_valid(map) && identifier && (length || *identifier)) {
     144        if (char_map_is_valid(map) && (identifier) &&
     145            ((length) || (*identifier))) {
    145146                int index;
    146147
    147                 for (index = 0; index < map->next; index++) {
     148                for (index = 0; index < map->next; ++ index) {
    148149                        if (map->items[index]->c != *identifier)
    149150                                continue;
    150151                               
    151                         identifier++;
    152                         if((length > 1) || ((length == 0) && *identifier)) {
     152                        ++ identifier;
     153                        if((length > 1) || ((length == 0) && (*identifier))) {
    153154                                return char_map_add(map->items[index],
    154155                                    identifier, length ? length - 1 : 0, value);
     
    177178
    178179                map->magic = 0;
    179                 for (index = 0; index < map->next; index++)
     180                for (index = 0; index < map->next; ++index)
    180181                        char_map_destroy(map->items[index]);
    181182
     
    206207                return NULL;
    207208
    208         if (length || *identifier) {
     209        if (length || (*identifier)) {
    209210                int index;
    210211
    211                 for (index = 0; index < map->next; index++) {
     212                for (index = 0; index < map->next; ++index) {
    212213                        if (map->items[index]->c == *identifier) {
    213                                 identifier++;
     214                                ++identifier;
    214215                                if (length == 1)
    215216                                        return map->items[index];
  • uspace/lib/c/generic/devman.c

    r7964475 rb5ec347  
    116116{
    117117        ipc_call_t answer;
    118         aid_t req = async_send_1(phone, DEVMAN_ADD_MATCH_ID, match_id->score, &answer);
     118        async_send_1(phone, DEVMAN_ADD_MATCH_ID, match_id->score, &answer);
    119119        int retval = async_data_write_start(phone, match_id->id, str_size(match_id->id));
    120         async_wait_for(req, NULL);
    121         return retval;
     120        return retval; 
    122121}
    123122
  • uspace/lib/c/include/adt/generic_field.h

    r7964475 rb5ec347  
    9191                        } \
    9292                        field->items[field->next] = value; \
    93                         field->next++; \
     93                        ++field->next; \
    9494                        field->items[field->next] = NULL; \
    9595                        return field->next - 1; \
     
    108108                        int index; \
    109109                        field->magic = 0; \
    110                         for (index = 0; index < field->next; index++) { \
     110                        for (index = 0; index < field->next; ++ index) { \
    111111                                if (field->items[index]) \
    112112                                        free(field->items[index]); \
  • uspace/lib/c/include/errno.h

    r7964475 rb5ec347  
    8383#define ENOTCONN        (-10057)
    8484
    85 /** The requested operation was not performed. Try again later. */
    86 #define EAGAIN          (-11002)
     85/** The requested operation was not performed.
     86 *  Try again later.
     87 */
     88#define TRY_AGAIN       (-11002)
    8789
    8890/** No data.
  • uspace/lib/c/include/ipc/dev_iface.h

    r7964475 rb5ec347  
    5454        DEV_IFACE_ID(DEV_FIRST_CUSTOM_METHOD_IDX)
    5555
    56 /*
    57  * The first argument is actually method (as the "real" method is used
    58  * for indexing into interfaces.
    59  */
    60 
    61 #define DEV_IPC_GET_ARG1(call) IPC_GET_ARG2((call))
    62 #define DEV_IPC_GET_ARG2(call) IPC_GET_ARG3((call))
    63 #define DEV_IPC_GET_ARG3(call) IPC_GET_ARG4((call))
    64 #define DEV_IPC_GET_ARG4(call) IPC_GET_ARG5((call))
    65 
    6656
    6757#endif
  • uspace/lib/c/include/ipc/vfs.h

    r7964475 rb5ec347  
    3636#define LIBC_IPC_VFS_H_
    3737
     38#include <sys/types.h>
    3839#include <ipc/ipc.h>
    39 #include <sys/types.h>
    40 #include <bool.h>
    4140
    4241#define FS_NAME_MAXLEN  20
     
    5655        /** Unique identifier of the fs. */
    5756        char name[FS_NAME_MAXLEN + 1];
    58         bool concurrent_read_write;
    59         bool write_retains_size;
    6057} vfs_info_t;
    6158
  • uspace/lib/drv/generic/driver.c

    r7964475 rb5ec347  
    381381}
    382382
    383 /** Wrapper for child_device_register for devices with single match id.
    384  *
    385  * @param parent Parent device.
    386  * @param child_name Child device name.
    387  * @param child_match_id Child device match id.
    388  * @param child_match_score Child device match score.
    389  * @return Error code.
    390  */
    391 int child_device_register_wrapper(device_t *parent, const char *child_name,
    392     const char *child_match_id, int child_match_score)
    393 {
    394         device_t *child = NULL;
    395         match_id_t *match_id = NULL;
    396         int rc;
    397 
    398         child = create_device();
    399         if (child == NULL) {
    400                 rc = ENOMEM;
    401                 goto failure;
    402         }
    403 
    404         child->name = child_name;
    405 
    406         match_id = create_match_id();
    407         if (match_id == NULL) {
    408                 rc = ENOMEM;
    409                 goto failure;
    410         }
    411 
    412         match_id->id = child_match_id;
    413         match_id->score = child_match_score;
    414         add_match_id(&child->match_ids, match_id);
    415 
    416         rc = child_device_register(child, parent);
    417         if (EOK != rc)
    418                 goto failure;
    419 
    420         return EOK;
    421 
    422 failure:
    423         if (match_id != NULL) {
    424                 match_id->id = NULL;
    425                 delete_match_id(match_id);
    426         }
    427 
    428         if (child != NULL) {
    429                 child->name = NULL;
    430                 delete_device(child);
    431         }
    432 
    433         return rc;
    434 }
    435 
    436383int driver_main(driver_t *drv)
    437384{
  • uspace/lib/drv/generic/remote_usbhc.c

    r7964475 rb5ec347  
    108108        }
    109109
    110         devman_handle_t handle = DEV_IPC_GET_ARG1(*call);
     110        devman_handle_t handle = IPC_GET_ARG1(*call);
    111111
    112112        usb_address_t address;
     
    122122    ipc_callid_t callid, ipc_call_t *call)
    123123{
    124         ipcarg_t buffer_hash = DEV_IPC_GET_ARG1(*call);
     124        ipcarg_t buffer_hash = IPC_GET_ARG1(*call);
    125125        async_transaction_t * trans = (async_transaction_t *)buffer_hash;
    126126        if (trans == NULL) {
     
    144144                accepted_size = trans->size;
    145145        }
    146         async_data_read_finalize(cid, trans->buffer, accepted_size);
     146        async_data_read_finalize(callid, trans->buffer, accepted_size);
    147147
    148148        ipc_answer_1(callid, EOK, accepted_size);
     
    211211        }
    212212
    213         usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
    214         devman_handle_t handle = (devman_handle_t) DEV_IPC_GET_ARG2(*call);
     213        usb_address_t address = (usb_address_t) IPC_GET_ARG1(*call);
     214        devman_handle_t handle = (devman_handle_t) IPC_GET_ARG2(*call);
    215215
    216216        int rc = usb_iface->bind_address(device, address, handle);
     
    229229        }
    230230
    231         usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
     231        usb_address_t address = (usb_address_t) IPC_GET_ARG1(*call);
    232232
    233233        int rc = usb_iface->release_address(device, address);
     
    275275        }
    276276
    277         size_t expected_len = DEV_IPC_GET_ARG3(*call);
     277        size_t expected_len = IPC_GET_ARG3(*call);
    278278        usb_target_t target = {
    279                 .address = DEV_IPC_GET_ARG1(*call),
    280                 .endpoint = DEV_IPC_GET_ARG2(*call)
     279                .address = IPC_GET_ARG1(*call),
     280                .endpoint = IPC_GET_ARG2(*call)
    281281        };
    282282
     
    327327        }
    328328
    329         size_t len = DEV_IPC_GET_ARG3(*call);
     329        size_t len = IPC_GET_ARG3(*call);
    330330        usb_target_t target = {
    331                 .address = DEV_IPC_GET_ARG1(*call),
    332                 .endpoint = DEV_IPC_GET_ARG2(*call)
     331                .address = IPC_GET_ARG1(*call),
     332                .endpoint = IPC_GET_ARG2(*call)
    333333        };
    334334
     
    384384
    385385        usb_target_t target = {
    386                 .address = DEV_IPC_GET_ARG1(*call),
    387                 .endpoint = DEV_IPC_GET_ARG2(*call)
     386                .address = IPC_GET_ARG1(*call),
     387                .endpoint = IPC_GET_ARG2(*call)
    388388        };
    389389
  • uspace/lib/drv/include/driver.h

    r7964475 rb5ec347  
    199199
    200200int child_device_register(device_t *, device_t *);
    201 int child_device_register_wrapper(device_t *, const char *, const char *, int);
    202201
    203202
  • uspace/lib/usb/Makefile

    r7964475 rb5ec347  
    3333
    3434SOURCES = \
    35         src/addrkeep.c \
    36         src/debug.c \
    37         src/drvpsync.c \
    3835        src/hcdhubd.c \
    3936        src/hcdrv.c \
     
    4138        src/remotedrv.c \
    4239        src/usb.c \
    43         src/usbdrvreq.c \
    4440        src/usbdrv.c
    4541
  • uspace/lib/usb/include/usb/devreq.h

    r7964475 rb5ec347  
    3838#include <ipc/ipc.h>
    3939#include <async.h>
    40 #include <usb/usb.h>
    41 #include <usb/descriptor.h>
    4240
    4341/** Standard device request. */
     
    8583} __attribute__ ((packed)) usb_device_request_setup_packet_t;
    8684
    87 int usb_drv_req_set_address(int, usb_address_t, usb_address_t);
    88 int usb_drv_req_get_device_descriptor(int, usb_address_t,
    89     usb_standard_device_descriptor_t *);
    90 int usb_drv_req_get_bare_configuration_descriptor(int, usb_address_t, int,
    91     usb_standard_configuration_descriptor_t *);
    92 int usb_drv_req_get_full_configuration_descriptor(int, usb_address_t, int,
    93     void *, size_t, size_t *);
    94 
    95 
    9685#endif
    9786/**
  • uspace/lib/usb/include/usb/usb.h

    r7964475 rb5ec347  
    6969typedef int usb_address_t;
    7070
    71 /** Default USB address. */
    72 #define USB_ADDRESS_DEFAULT 0
    73 /** Maximum address number in USB 1.1. */
    74 #define USB11_ADDRESS_MAX 128
    75 
    7671/** USB endpoint number type.
    7772 * Negative values could be used to indicate error.
  • uspace/lib/usb/include/usb/usbdrv.h

    r7964475 rb5ec347  
    3636#define LIBUSB_USBDRV_H_
    3737
    38 #include <usb/usb.h>
     38#include "usb.h"
    3939#include <driver.h>
    40 #include <usb/devreq.h>
    41 #include <usb/descriptor.h>
    4240
    4341int usb_drv_hc_connect(device_t *, unsigned int);
     
    5654    void *, size_t, size_t *, usb_handle_t *);
    5755
    58 int usb_drv_psync_interrupt_out(int, usb_target_t, void *, size_t);
    59 int usb_drv_psync_interrupt_in(int, usb_target_t, void *, size_t, size_t *);
    60 
    61 
    62 
    6356int usb_drv_async_control_write_setup(int, usb_target_t,
    6457    void *, size_t, usb_handle_t *);
     
    6760int usb_drv_async_control_write_status(int, usb_target_t,
    6861    usb_handle_t *);
    69 
    70 int usb_drv_psync_control_write_setup(int, usb_target_t, void *, size_t);
    71 int usb_drv_psync_control_write_data(int, usb_target_t, void *, size_t);
    72 int usb_drv_psync_control_write_status(int, usb_target_t);
    73 
    74 int usb_drv_psync_control_write(int, usb_target_t,
    75     void *, size_t, void *, size_t);
    76 
    7762
    7863int usb_drv_async_control_read_setup(int, usb_target_t,
     
    8368    usb_handle_t *);
    8469
    85 int usb_drv_psync_control_read_setup(int, usb_target_t, void *, size_t);
    86 int usb_drv_psync_control_read_data(int, usb_target_t, void *, size_t, size_t *);
    87 int usb_drv_psync_control_read_status(int, usb_target_t);
    88 
    89 int usb_drv_psync_control_read(int, usb_target_t,
    90     void *, size_t, void *, size_t, size_t *);
    91 
    92 
    93 
    9470int usb_drv_async_wait_for(usb_handle_t);
    95 
    9671
    9772#endif
  • uspace/lib/usb/src/usbdrv.c

    r7964475 rb5ec347  
    7171        devman_handle_t handle;
    7272
    73         rc = devman_device_get_handle("/virt/usbhc", &handle, 0);
     73        rc = devman_device_get_handle("/vhc", &handle, 0);
    7474        if (rc != EOK) {
    7575                return rc;
  • uspace/lib/usbvirt/main.c

    r7964475 rb5ec347  
    183183}
    184184
    185 /** Create necessary phones for communication with virtual HCD.
     185/** Create necessary phones for comunication with virtual HCD.
    186186 * This function wraps following calls:
    187  * -# open <code>/dev/devices/\\virt\\usbhc for reading
     187 * -# open <code>/dev/devices/\\vhc for reading
    188188 * -# access phone of file opened in previous step
    189189 * -# create callback through just opened phone
     
    193193 * @warning This function is wrapper for several actions and therefore
    194194 * it is not possible - in case of error - to determine at which point
    195  * error occurred.
    196  *
     195 * error occured.
     196 *
     197 * @param hcd_path HCD identification under devfs
     198 *     (without <code>/dev/usb/</code>).
    197199 * @param dev Device to connect.
    198200 * @return EOK on success or error code from errno.h.
     
    205207        }
    206208       
    207         const char *vhc_path = "/virt/usbhc";
     209        const char *vhc_path = "/vhc";
    208210        int rc;
    209211        devman_handle_t handle;
  • uspace/srv/devman/devman.c

    r7964475 rb5ec347  
    516516/** Notify driver about the devices to which it was assigned.
    517517 *
     518 * The driver's mutex must be locked.
     519 *
    518520 * @param driver        The driver to which the devices are passed.
    519521 */
     
    524526        int phone;
    525527
    526         printf(NAME ": pass_devices_to_driver(`%s')\n", driver->name);
    527 
    528         fibril_mutex_lock(&driver->driver_mutex);
    529 
    530         phone = async_connect_me_to(driver->phone, DRIVER_DEVMAN, 0, 0);
    531 
    532         if (phone < 0) {
    533                 fibril_mutex_unlock(&driver->driver_mutex);
    534                 return;
    535         }
    536 
    537         /*
    538          * Go through devices list as long as there is some device
    539          * that has not been passed to the driver.
    540          */
    541         link = driver->devices.next;
    542         while (link != &driver->devices) {
    543                 dev = list_get_instance(link, node_t, driver_devices);
    544                 if (dev->passed_to_driver) {
     528        printf(NAME ": pass_devices_to_driver\n");
     529
     530        phone = ipc_connect_me_to(driver->phone, DRIVER_DEVMAN, 0, 0);
     531        if (phone > 0) {
     532               
     533                link = driver->devices.next;
     534                while (link != &driver->devices) {
     535                        dev = list_get_instance(link, node_t, driver_devices);
     536                        add_device(phone, driver, dev, tree);
    545537                        link = link->next;
    546                         continue;
    547538                }
    548 
    549                 /*
    550                  * We remove the device from the list to allow safe adding
    551                  * of new devices (no one will touch our item this way).
    552                  */
    553                 list_remove(link);
    554 
    555                 /*
    556                  * Unlock to avoid deadlock when adding device
    557                  * handled by itself.
    558                  */
    559                 fibril_mutex_unlock(&driver->driver_mutex);
    560 
    561                 add_device(phone, driver, dev, tree);
    562 
    563                 /*
    564                  * Lock again as we will work with driver's
    565                  * structure.
    566                  */
    567                 fibril_mutex_lock(&driver->driver_mutex);
    568 
    569                 /*
    570                  * Insert the device back.
    571                  * The order is not relevant here so no harm is done
    572                  * (actually, the order would be preserved in most cases).
    573                  */
    574                 list_append(link, &driver->devices);
    575 
    576                 /*
    577                  * Restart the cycle to go through all devices again.
    578                  */
    579                 link = driver->devices.next;
    580         }
    581 
    582         ipc_hangup(phone);
    583 
    584         /*
    585          * Once we passed all devices to the driver, we need to mark the
    586          * driver as running.
    587          * It is vital to do it here and inside critical section.
    588          *
    589          * If we would change the state earlier, other devices added to
    590          * the driver would be added to the device list and started
    591          * immediately and possibly started here as well.
    592          */
    593         printf(NAME ": driver %s goes into running state.\n", driver->name);
    594         driver->state = DRIVER_RUNNING;
    595 
    596         fibril_mutex_unlock(&driver->driver_mutex);
     539               
     540                ipc_hangup(phone);
     541        }
    597542}
    598543
     
    608553void initialize_running_driver(driver_t *driver, dev_tree_t *tree)
    609554{
    610         printf(NAME ": initialize_running_driver (`%s')\n", driver->name);
     555        printf(NAME ": initialize_running_driver\n");
     556        fibril_mutex_lock(&driver->driver_mutex);
    611557       
    612558        /*
     
    615561         */
    616562        pass_devices_to_driver(driver, tree);
     563       
     564        /* Change driver's state to running. */
     565        driver->state = DRIVER_RUNNING;
     566       
     567        fibril_mutex_unlock(&driver->driver_mutex);
    617568}
    618569
     
    686637}
    687638
    688 static FIBRIL_MUTEX_INITIALIZE(add_device_guard);
    689639
    690640/** Pass a device to running driver.
     
    695645void add_device(int phone, driver_t *drv, node_t *node, dev_tree_t *tree)
    696646{
    697         fibril_mutex_lock(&add_device_guard);
    698 
    699         /*
    700          * We do not expect to have driver's mutex locked as we do not
    701          * access any structures that would affect driver_t.
    702          */
    703         printf(NAME ": add_device (driver `%s', device `%s')\n", drv->name,
    704             node->name);
     647        printf(NAME ": add_device\n");
    705648       
    706649        ipcarg_t rc;
     
    714657                parent_handle = 0;
    715658        }
    716 
    717659        aid_t req = async_send_2(phone, DRIVER_ADD_DEVICE, node->handle,
    718660            parent_handle, &answer);
     
    724666                /* TODO handle error */
    725667        }
    726 
     668       
    727669        /* Wait for answer from the driver. */
    728670        async_wait_for(req, &rc);
    729 
    730         fibril_mutex_unlock(&add_device_guard);
    731 
    732671        switch(rc) {
    733672        case EOK:
     
    742681        }
    743682       
    744         node->passed_to_driver = true;
    745 
    746683        return;
    747684}
     
    769706        attach_driver(node, drv);
    770707       
    771         fibril_mutex_lock(&drv->driver_mutex);
    772708        if (drv->state == DRIVER_NOT_STARTED) {
    773709                /* Start the driver. */
    774710                start_driver(drv);
    775711        }
    776         bool is_running = drv->state == DRIVER_RUNNING;
    777         fibril_mutex_unlock(&drv->driver_mutex);
    778 
    779         if (is_running) {
     712       
     713        if (drv->state == DRIVER_RUNNING) {
    780714                /* Notify the driver about the new device. */
    781                 int phone = async_connect_me_to(drv->phone, DRIVER_DEVMAN, 0, 0);
     715                int phone = ipc_connect_me_to(drv->phone, DRIVER_DEVMAN, 0, 0);
    782716                if (phone > 0) {
    783717                        add_device(phone, drv, node, tree);
     
    941875        node->name = dev_name;
    942876        if (!set_dev_path(node, parent)) {
     877                fibril_rwlock_write_unlock(&tree->rwlock);
    943878                return false;
    944879        }
     
    11621097        while (link != &class_list->classes) {
    11631098                cl = list_get_instance(link, dev_class_t, link);
    1164                 if (str_cmp(cl->name, class_name) == 0) {
     1099                if (str_cmp(cl->name, class_name) == 0)
    11651100                        return cl;
    1166                 }
    1167                 link = link->next;
    11681101        }
    11691102       
  • uspace/srv/devman/devman.h

    r7964475 rb5ec347  
    168168         */
    169169        link_t devmap_link;
    170 
    171         /**
    172          * Whether this device was already passed to the driver.
    173          */
    174         bool passed_to_driver;
    175170};
    176171
  • uspace/srv/devman/main.c

    r7964475 rb5ec347  
    197197}
    198198
    199 static int assign_driver_fibril(void *arg)
    200 {
    201         node_t *node = (node_t *) arg;
    202         assign_driver(node, &drivers_list, &device_tree);
    203         return EOK;
    204 }
    205 
    206199/** Handle child device registration.
    207200 *
     
    244237       
    245238        devman_receive_match_ids(match_count, &node->match_ids);
    246 
    247         /*
    248          * Try to find a suitable driver and assign it to the device.  We do
    249          * not want to block the current fibril that is used for processing
    250          * incoming calls: we will launch a separate fibril to handle the
    251          * driver assigning. That is because assign_driver can actually include
    252          * task spawning which could take some time.
    253          */
    254         fid_t assign_fibril = fibril_create(assign_driver_fibril, node);
    255         if (assign_fibril == 0) {
    256                 /*
    257                  * Fallback in case we are out of memory.
    258                  * Probably not needed as we will die soon anyway ;-).
    259                  */
    260                 (void) assign_driver_fibril(node);
    261         } else {
    262                 fibril_add_ready(assign_fibril);
    263         }
    264 
     239       
    265240        /* Return device handle to parent's driver. */
    266241        ipc_answer_1(callid, EOK, node->handle);
     242       
     243        /* Try to find suitable driver and assign it to the device. */
     244        assign_driver(node, &drivers_list, &device_tree);
    267245}
    268246
     
    319297        printf(NAME ": device '%s' added to class '%s', class name '%s' was "
    320298            "asigned to it\n", dev->pathname, class_name, class_info->dev_name);
    321 
     299       
    322300        ipc_answer_0(callid, EOK);
    323301}
  • uspace/srv/devman/match.c

    r7964475 rb5ec347  
    4646        if (str_cmp(driver->id, device->id) == 0) {
    4747                /*
    48                  * The strings match, return the product of their scores.
     48                 * The strings matches, return their score multiplied.
    4949                 */
    5050                return driver->score * device->score;
     
    6666       
    6767        /*
    68          * Go through all pairs, return the highest score obtained.
     68         * Go through all pairs, return the highest score obtainetd.
    6969         */
    7070        int highest_score = 0;
  • uspace/srv/fs/devfs/devfs.c

    r7964475 rb5ec347  
    5353static vfs_info_t devfs_vfs_info = {
    5454        .name = NAME,
    55         .concurrent_read_write = false,
    56         .write_retains_size = false,
    5755};
    5856
  • uspace/srv/fs/fat/fat.c

    r7964475 rb5ec347  
    5252vfs_info_t fat_vfs_info = {
    5353        .name = NAME,
    54         .concurrent_read_write = false,
    55         .write_retains_size = false,   
    5654};
    5755
  • uspace/srv/fs/tmpfs/tmpfs.c

    r7964475 rb5ec347  
    5757vfs_info_t tmpfs_vfs_info = {
    5858        .name = NAME,
    59         .concurrent_read_write = false,
    60         .write_retains_size = false,
    6159};
    6260
  • uspace/srv/net/il/arp/arp.c

    r7964475 rb5ec347  
    7272#define NAME  "arp"
    7373
    74 /** Number of microseconds to wait for an ARP reply. */
    75 #define ARP_TRANS_WAIT  1000000
    76 
    7774/** ARP global data. */
    7875arp_globals_t arp_globals;
     
    8077DEVICE_MAP_IMPLEMENT(arp_cache, arp_device_t);
    8178INT_MAP_IMPLEMENT(arp_protos, arp_proto_t);
    82 GENERIC_CHAR_MAP_IMPLEMENT(arp_addr, arp_trans_t);
    83 
    84 static void arp_clear_trans(arp_trans_t *trans)
    85 {
    86         if (trans->hw_addr) {
    87                 free(trans->hw_addr);
    88                 trans->hw_addr = NULL;
    89         }
    90         fibril_condvar_broadcast(&trans->cv);
    91 }
    92 
    93 static void arp_clear_addr(arp_addr_t *addresses)
    94 {
    95         int count;
    96         arp_trans_t *trans;
    97 
    98         for (count = arp_addr_count(addresses) - 1; count >= 0; count--) {
    99                 trans = arp_addr_items_get_index(&addresses->values, count);
    100                 if (trans)
    101                         arp_clear_trans(trans);
    102         }
    103 }
    104 
     79GENERIC_CHAR_MAP_IMPLEMENT(arp_addr, measured_string_t);
    10580
    10681/** Clears the device specific data.
     
    12196                        if (proto->addr_data)
    12297                                free(proto->addr_data);
    123                         arp_clear_addr(&proto->addresses);
    12498                        arp_addr_destroy(&proto->addresses);
    12599                }
     
    133107        arp_device_t *device;
    134108
    135         fibril_mutex_lock(&arp_globals.lock);
     109        fibril_rwlock_write_lock(&arp_globals.lock);
    136110        for (count = arp_cache_count(&arp_globals.cache) - 1; count >= 0;
    137111            count--) {
     
    146120        }
    147121        arp_cache_clear(&arp_globals.cache);
    148         fibril_mutex_unlock(&arp_globals.lock);
     122        fibril_rwlock_write_unlock(&arp_globals.lock);
    149123        printf("Cache cleaned\n");
    150124        return EOK;
     
    156130        arp_device_t *device;
    157131        arp_proto_t *proto;
    158         arp_trans_t *trans;
    159 
    160         fibril_mutex_lock(&arp_globals.lock);
     132
     133        fibril_rwlock_write_lock(&arp_globals.lock);
    161134        device = arp_cache_find(&arp_globals.cache, device_id);
    162135        if (!device) {
    163                 fibril_mutex_unlock(&arp_globals.lock);
     136                fibril_rwlock_write_unlock(&arp_globals.lock);
    164137                return ENOENT;
    165138        }
    166139        proto = arp_protos_find(&device->protos, protocol);
    167140        if (!proto) {
    168                 fibril_mutex_unlock(&arp_globals.lock);
     141                fibril_rwlock_write_unlock(&arp_globals.lock);
    169142                return ENOENT;
    170143        }
    171         trans = arp_addr_find(&proto->addresses, address->value, address->length);
    172         if (trans)
    173                 arp_clear_trans(trans);
    174144        arp_addr_exclude(&proto->addresses, address->value, address->length);
    175         fibril_mutex_unlock(&arp_globals.lock);
     145        fibril_rwlock_write_unlock(&arp_globals.lock);
    176146        return EOK;
    177147}
     
    182152        arp_device_t *device;
    183153
    184         fibril_mutex_lock(&arp_globals.lock);
     154        fibril_rwlock_write_lock(&arp_globals.lock);
    185155        device = arp_cache_find(&arp_globals.cache, device_id);
    186156        if (!device) {
    187                 fibril_mutex_unlock(&arp_globals.lock);
     157                fibril_rwlock_write_unlock(&arp_globals.lock);
    188158                return ENOENT;
    189159        }
    190160        arp_clear_device(device);
    191161        printf("Device %d cleared\n", device_id);
    192         fibril_mutex_unlock(&arp_globals.lock);
     162        fibril_rwlock_write_unlock(&arp_globals.lock);
    193163        return EOK;
    194164}
     
    251221        int rc;
    252222
    253         fibril_mutex_lock(&arp_globals.lock);
     223        fibril_rwlock_write_lock(&arp_globals.lock);
    254224
    255225        /* An existing device? */
     
    259229                if (device->service != service) {
    260230                        printf("Device %d already exists\n", device->device_id);
    261                         fibril_mutex_unlock(&arp_globals.lock);
     231                        fibril_rwlock_write_unlock(&arp_globals.lock);
    262232                        return EEXIST;
    263233                }
     
    271241                        rc = arp_proto_create(&proto, protocol, address);
    272242                        if (rc != EOK) {
    273                                 fibril_mutex_unlock(&arp_globals.lock);
     243                                fibril_rwlock_write_unlock(&arp_globals.lock);
    274244                                return rc;
    275245                        }
     
    277247                            proto);
    278248                        if (index < 0) {
    279                                 fibril_mutex_unlock(&arp_globals.lock);
     249                                fibril_rwlock_write_unlock(&arp_globals.lock);
    280250                                free(proto);
    281251                                return index;
     
    292262                device = (arp_device_t *) malloc(sizeof(arp_device_t));
    293263                if (!device) {
    294                         fibril_mutex_unlock(&arp_globals.lock);
     264                        fibril_rwlock_write_unlock(&arp_globals.lock);
    295265                        return ENOMEM;
    296266                }
     
    299269                rc = arp_protos_initialize(&device->protos);
    300270                if (rc != EOK) {
    301                         fibril_mutex_unlock(&arp_globals.lock);
     271                        fibril_rwlock_write_unlock(&arp_globals.lock);
    302272                        free(device);
    303273                        return rc;
     
    305275                rc = arp_proto_create(&proto, protocol, address);
    306276                if (rc != EOK) {
    307                         fibril_mutex_unlock(&arp_globals.lock);
     277                        fibril_rwlock_write_unlock(&arp_globals.lock);
    308278                        free(device);
    309279                        return rc;
     
    311281                index = arp_protos_add(&device->protos, proto->service, proto);
    312282                if (index < 0) {
    313                         fibril_mutex_unlock(&arp_globals.lock);
     283                        fibril_rwlock_write_unlock(&arp_globals.lock);
    314284                        arp_protos_destroy(&device->protos);
    315285                        free(device);
     
    323293                    arp_globals.client_connection);
    324294                if (device->phone < 0) {
    325                         fibril_mutex_unlock(&arp_globals.lock);
     295                        fibril_rwlock_write_unlock(&arp_globals.lock);
    326296                        arp_protos_destroy(&device->protos);
    327297                        free(device);
     
    333303                    &device->packet_dimension);
    334304                if (rc != EOK) {
    335                         fibril_mutex_unlock(&arp_globals.lock);
     305                        fibril_rwlock_write_unlock(&arp_globals.lock);
    336306                        arp_protos_destroy(&device->protos);
    337307                        free(device);
     
    343313                    &device->addr_data);
    344314                if (rc != EOK) {
    345                         fibril_mutex_unlock(&arp_globals.lock);
     315                        fibril_rwlock_write_unlock(&arp_globals.lock);
    346316                        arp_protos_destroy(&device->protos);
    347317                        free(device);
     
    353323                    &device->broadcast_addr, &device->broadcast_data);
    354324                if (rc != EOK) {
    355                         fibril_mutex_unlock(&arp_globals.lock);
     325                        fibril_rwlock_write_unlock(&arp_globals.lock);
    356326                        free(device->addr);
    357327                        free(device->addr_data);
     
    364334                    device);
    365335                if (rc != EOK) {
    366                         fibril_mutex_unlock(&arp_globals.lock);
     336                        fibril_rwlock_write_unlock(&arp_globals.lock);
    367337                        free(device->addr);
    368338                        free(device->addr_data);
     
    377347                    device->service, protocol);
    378348        }
    379         fibril_mutex_unlock(&arp_globals.lock);
     349        fibril_rwlock_write_unlock(&arp_globals.lock);
    380350       
    381351        return EOK;
     
    393363        int rc;
    394364
    395         fibril_mutex_initialize(&arp_globals.lock);
    396         fibril_mutex_lock(&arp_globals.lock);
     365        fibril_rwlock_initialize(&arp_globals.lock);
     366        fibril_rwlock_write_lock(&arp_globals.lock);
    397367        arp_globals.client_connection = client_connection;
    398368        rc = arp_cache_initialize(&arp_globals.cache);
    399         fibril_mutex_unlock(&arp_globals.lock);
     369        fibril_rwlock_write_unlock(&arp_globals.lock);
    400370       
    401371        return rc;
     
    413383        arp_device_t *device;
    414384
    415         fibril_mutex_lock(&arp_globals.lock);
     385        fibril_rwlock_write_lock(&arp_globals.lock);
    416386        device = arp_cache_find(&arp_globals.cache, device_id);
    417387        if (!device) {
    418                 fibril_mutex_unlock(&arp_globals.lock);
     388                fibril_rwlock_write_unlock(&arp_globals.lock);
    419389                return ENOENT;
    420390        }
    421391        device->packet_dimension.content = mtu;
    422         fibril_mutex_unlock(&arp_globals.lock);
     392        fibril_rwlock_write_unlock(&arp_globals.lock);
    423393        printf("arp - device %d changed mtu to %zu\n\n", device_id, mtu);
    424394        return EOK;
     
    451421        arp_device_t *device;
    452422        arp_proto_t *proto;
    453         arp_trans_t *trans;
     423        measured_string_t *hw_source;
    454424        uint8_t *src_hw;
    455425        uint8_t *src_proto;
     
    482452        des_hw = src_proto + header->protocol_length;
    483453        des_proto = des_hw + header->hardware_length;
    484         trans = arp_addr_find(&proto->addresses, (char *) src_proto,
     454        hw_source = arp_addr_find(&proto->addresses, (char *) src_proto,
    485455            CONVERT_SIZE(uint8_t, char, header->protocol_length));
    486456        /* Exists? */
    487         if (trans && trans->hw_addr) {
    488                 if (trans->hw_addr->length != CONVERT_SIZE(uint8_t, char,
     457        if (hw_source) {
     458                if (hw_source->length != CONVERT_SIZE(uint8_t, char,
    489459                    header->hardware_length)) {
    490460                        return EINVAL;
    491461                }
    492                 memcpy(trans->hw_addr->value, src_hw, trans->hw_addr->length);
     462                memcpy(hw_source->value, src_hw, hw_source->length);
    493463        }
    494464        /* Is my protocol address? */
     
    500470            proto->addr->length)) {
    501471                /* Not already updated? */
    502                 if (!trans) {
    503                         trans = (arp_trans_t *) malloc(sizeof(arp_trans_t));
    504                         if (!trans)
     472                if (!hw_source) {
     473                        hw_source = measured_string_create_bulk((char *) src_hw,
     474                            CONVERT_SIZE(uint8_t, char,
     475                            header->hardware_length));
     476                        if (!hw_source)
    505477                                return ENOMEM;
    506                         trans->hw_addr = NULL;
    507                         fibril_condvar_initialize(&trans->cv);
     478
    508479                        rc = arp_addr_add(&proto->addresses, (char *) src_proto,
    509                             CONVERT_SIZE(uint8_t, char, header->protocol_length),
    510                             trans);
    511                         if (rc != EOK) {
    512                                 /* The generic char map has already freed trans! */
     480                            CONVERT_SIZE(uint8_t, char,
     481                            header->protocol_length), hw_source);
     482                        if (rc != EOK)
    513483                                return rc;
    514                         }
    515                 }
    516                 if (!trans->hw_addr) {
    517                         trans->hw_addr = measured_string_create_bulk(
    518                             (char *) src_hw, CONVERT_SIZE(uint8_t, char,
    519                             header->hardware_length));
    520                         if (!trans->hw_addr)
    521                                 return ENOMEM;
    522 
    523                         /* Notify the fibrils that wait for the translation. */
    524                         fibril_condvar_broadcast(&trans->cv);
    525484                }
    526485                if (ntohs(header->operation) == ARPOP_REQUEST) {
     
    531490                        memcpy(src_hw, device->addr->value,
    532491                            device->packet_dimension.addr_len);
    533                         memcpy(des_hw, trans->hw_addr->value,
     492                        memcpy(des_hw, hw_source->value,
    534493                            header->hardware_length);
    535494                       
     
    557516 * @param[in] protocol  The protocol service.
    558517 * @param[in] target    The target protocol address.
    559  * @param[out] translation Where the hardware address of the target is stored.
    560  * @return              EOK on success.
    561  * @return              EAGAIN if the caller should try again.
    562  * @return              Other error codes in case of error.
    563  */
    564 static int
     518 * @return              The hardware address of the target.
     519 * @return              NULL if the target parameter is NULL.
     520 * @return              NULL if the device is not found.
     521 * @return              NULL if the device packet is too small to send a
     522 *                      request.
     523 * @return              NULL if the hardware address is not found in the cache.
     524 */
     525static measured_string_t *
    565526arp_translate_message(device_id_t device_id, services_t protocol,
    566     measured_string_t *target, measured_string_t **translation)
     527    measured_string_t *target)
    567528{
    568529        arp_device_t *device;
    569530        arp_proto_t *proto;
    570         arp_trans_t *trans;
     531        measured_string_t *addr;
    571532        size_t length;
    572533        packet_t *packet;
    573534        arp_header_t *header;
    574         bool retry = false;
    575         int rc;
    576 
    577 restart:
    578         if (!target || !translation)
    579                 return EBADMEM;
     535
     536        if (!target)
     537                return NULL;
    580538
    581539        device = arp_cache_find(&arp_globals.cache, device_id);
    582540        if (!device)
    583                 return ENOENT;
     541                return NULL;
    584542
    585543        proto = arp_protos_find(&device->protos, protocol);
    586544        if (!proto || (proto->addr->length != target->length))
    587                 return ENOENT;
    588 
    589         trans = arp_addr_find(&proto->addresses, target->value, target->length);
    590         if (trans) {
    591                 if (trans->hw_addr) {
    592                         *translation = trans->hw_addr;
    593                         return EOK;
    594                 }
    595                 if (retry)
    596                         return EAGAIN;
    597                 rc = fibril_condvar_wait_timeout(&trans->cv, &arp_globals.lock,
    598                     ARP_TRANS_WAIT);
    599                 if (rc == ETIMEOUT)
    600                         return ENOENT;
    601                 retry = true;
    602                 goto restart;
    603         }
    604         if (retry)
    605                 return EAGAIN;
     545                return NULL;
     546
     547        addr = arp_addr_find(&proto->addresses, target->value, target->length);
     548        if (addr)
     549                return addr;
    606550
    607551        /* ARP packet content size = header + (address + translation) * 2 */
     
    609553            CONVERT_SIZE(char, uint8_t, device->addr->length));
    610554        if (length > device->packet_dimension.content)
    611                 return ELIMIT;
     555                return NULL;
    612556
    613557        packet = packet_get_4_remote(arp_globals.net_phone,
     
    615559            length, device->packet_dimension.suffix);
    616560        if (!packet)
    617                 return ENOMEM;
     561                return NULL;
    618562
    619563        header = (arp_header_t *) packet_suffix(packet, length);
    620564        if (!header) {
    621565                pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
    622                 return ENOMEM;
     566                return NULL;
    623567        }
    624568
     
    639583        memcpy(((uint8_t *) header) + length, target->value, target->length);
    640584
    641         rc = packet_set_addr(packet, (uint8_t *) device->addr->value,
     585        if (packet_set_addr(packet, (uint8_t *) device->addr->value,
    642586            (uint8_t *) device->broadcast_addr->value,
    643             CONVERT_SIZE(char, uint8_t, device->addr->length));
    644         if (rc != EOK) {
     587            CONVERT_SIZE(char, uint8_t, device->addr->length)) != EOK) {
    645588                pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
    646                 return rc;
     589                return NULL;
    647590        }
    648591
    649592        nil_send_msg(device->phone, device_id, packet, SERVICE_ARP);
    650 
    651         trans = (arp_trans_t *) malloc(sizeof(arp_trans_t));
    652         if (!trans)
    653                 return ENOMEM;
    654         trans->hw_addr = NULL;
    655         fibril_condvar_initialize(&trans->cv);
    656         rc = arp_addr_add(&proto->addresses, target->value, target->length,
    657             trans);
    658         if (rc != EOK) {
    659                 /* The generic char map has already freed trans! */
    660                 return rc;
    661         }
    662        
    663         rc = fibril_condvar_wait_timeout(&trans->cv, &arp_globals.lock,
    664             ARP_TRANS_WAIT);
    665         if (rc == ETIMEOUT)
    666                 return ENOENT;
    667         retry = true;
    668         goto restart;
     593        return NULL;
    669594}
    670595
     
    717642                        return rc;
    718643               
    719                 fibril_mutex_lock(&arp_globals.lock);
    720                 rc = arp_translate_message(IPC_GET_DEVICE(call),
    721                     IPC_GET_SERVICE(call), address, &translation);
     644                fibril_rwlock_read_lock(&arp_globals.lock);
     645                translation = arp_translate_message(IPC_GET_DEVICE(call),
     646                    IPC_GET_SERVICE(call), address);
    722647                free(address);
    723648                free(data);
    724                 if (rc != EOK) {
    725                         fibril_mutex_unlock(&arp_globals.lock);
    726                         return rc;
    727                 }
    728649                if (!translation) {
    729                         fibril_mutex_unlock(&arp_globals.lock);
     650                        fibril_rwlock_read_unlock(&arp_globals.lock);
    730651                        return ENOENT;
    731652                }
    732653                rc = measured_strings_reply(translation, 1);
    733                 fibril_mutex_unlock(&arp_globals.lock);
     654                fibril_rwlock_read_unlock(&arp_globals.lock);
    734655                return rc;
    735656
     
    761682                        return rc;
    762683               
    763                 fibril_mutex_lock(&arp_globals.lock);
     684                fibril_rwlock_read_lock(&arp_globals.lock);
    764685                do {
    765686                        next = pq_detach(packet);
     
    771692                        packet = next;
    772693                } while (packet);
    773                 fibril_mutex_unlock(&arp_globals.lock);
     694                fibril_rwlock_read_unlock(&arp_globals.lock);
    774695               
    775696                return EOK;
  • uspace/srv/net/il/arp/arp.h

    r7964475 rb5ec347  
    6565typedef struct arp_proto arp_proto_t;
    6666
    67 /** Type definition of the ARP address translation record.
    68  * @see arp_trans
    69  */
    70 typedef struct arp_trans arp_trans_t;
    71 
    7267/** ARP address map.
    7368 *
     
    7570 * @see generic_char_map.h
    7671 */
    77 GENERIC_CHAR_MAP_DECLARE(arp_addr, arp_trans_t);
     72GENERIC_CHAR_MAP_DECLARE(arp_addr, measured_string_t);
    7873
    7974/** ARP address cache.
     
    9489struct arp_device {
    9590        /** Actual device hardware address. */
    96         measured_string_t *addr;
     91        measured_string_t * addr;
    9792        /** Actual device hardware address data. */
    9893        char *addr_data;
    9994        /** Broadcast device hardware address. */
    100         measured_string_t *broadcast_addr;
     95        measured_string_t * broadcast_addr;
    10196        /** Broadcast device hardware address data. */
    10297        char *broadcast_data;
     
    134129        int net_phone;
    135130        /** Safety lock. */
    136         fibril_mutex_t lock;
     131        fibril_rwlock_t lock;
    137132};
    138133
     
    149144};
    150145
    151 /** ARP address translation record. */
    152 struct arp_trans {
    153         /**
    154          * Hardware address for the translation. NULL denotes an incomplete
    155          * record with possible waiters.
    156          */
    157         measured_string_t *hw_addr;
    158         /** Condition variable used for waiting for completion of the record. */
    159         fibril_condvar_t cv;
    160 };
    161 
    162146#endif
    163147
    164148/** @}
    165149 */
    166 
  • uspace/srv/vfs/vfs.h

    r7964475 rb5ec347  
    172172
    173173extern fs_handle_t fs_name_to_handle(char *, bool);
    174 extern vfs_info_t *fs_handle_to_info(fs_handle_t);
    175174
    176175extern int vfs_lookup_internal(char *, int, vfs_lookup_res_t *,
  • uspace/srv/vfs/vfs_ops.c

    r7964475 rb5ec347  
    781781static void vfs_rdwr(ipc_callid_t rid, ipc_call_t *request, bool read)
    782782{
    783         vfs_info_t *vi;
    784783
    785784        /*
     
    808807        fibril_mutex_lock(&file->lock);
    809808
    810         vi = fs_handle_to_info(file->node->fs_handle);
    811         assert(vi);
    812 
    813809        /*
    814810         * Lock the file's node so that no other client can read/write to it at
    815          * the same time unless the FS supports concurrent reads/writes and its
    816          * write implementation does not modify the file size.
    817          */
    818         if (read || (vi->concurrent_read_write && vi->write_retains_size))
     811         * the same time.
     812         */
     813        if (read)
    819814                fibril_rwlock_read_lock(&file->node->contents_rwlock);
    820815        else
     
    862857       
    863858        /* Unlock the VFS node. */
    864         if (read || (vi->concurrent_read_write && vi->write_retains_size))
     859        if (read)
    865860                fibril_rwlock_read_unlock(&file->node->contents_rwlock);
    866861        else {
  • uspace/srv/vfs/vfs_register.c

    r7964475 rb5ec347  
    333333}
    334334
    335 /** Find the VFS info structure.
    336  *
    337  * @param handle        FS handle for which the VFS info structure is sought.
    338  * @return              VFS info structure on success or NULL otherwise.
    339  */
    340 vfs_info_t *fs_handle_to_info(fs_handle_t handle)
    341 {
    342         vfs_info_t *info = NULL;
    343         link_t *cur;
    344 
    345         fibril_mutex_lock(&fs_head_lock);
    346         for (cur = fs_head.next; cur != &fs_head; cur = cur->next) {
    347                 fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link);
    348                 if (fs->fs_handle == handle) {
    349                         info = &fs->vfs_info;
    350                         break;
    351                 }
    352         }
    353         fibril_mutex_unlock(&fs_head_lock);
    354 
    355         return info;
    356 }
    357 
    358335/**
    359336 * @}
Note: See TracChangeset for help on using the changeset viewer.