Changes in / [14f8fd4:43cd499] in mainline


Ignore:
Files:
12 added
19 deleted
62 edited

Legend:

Unmodified
Added
Removed
  • abi/include/syscall.h

    r14f8fd4 r43cd499  
    9292        SYS_IRQ_UNREGISTER,
    9393       
    94         SYS_SYSINFO_GET_KEYS_SIZE,
    95         SYS_SYSINFO_GET_KEYS,
    9694        SYS_SYSINFO_GET_VAL_TYPE,
    9795        SYS_SYSINFO_GET_VALUE,
  • boot/Makefile.common

    r14f8fd4 r43cd499  
    165165        $(USPACE_PATH)/app/locinfo/locinfo \
    166166        $(USPACE_PATH)/app/mkfat/mkfat \
    167         $(USPACE_PATH)/app/mkexfat/mkexfat \
    168167        $(USPACE_PATH)/app/mkmfs/mkmfs \
    169168        $(USPACE_PATH)/app/lsusb/lsusb \
  • kernel/arch/amd64/include/context.h

    r14f8fd4 r43cd499  
    3838#include <typedefs.h>
    3939
    40 /*
    41  * According to ABI the stack MUST be aligned on
     40/* According to ABI the stack MUST be aligned on
    4241 * 16-byte boundary. If it is not, the va_arg calling will
    4342 * panic sooner or later
  • kernel/arch/arm32/include/context.h

    r14f8fd4 r43cd499  
    2727 */
    2828
    29 /** @addtogroup arm32
     29/** @addtogroup arm32   
    3030 * @{
    3131 */
  • kernel/arch/ia64/include/context.h

    r14f8fd4 r43cd499  
    2727 */
    2828
    29 /** @addtogroup ia64
     29/** @addtogroup ia64   
    3030 * @{
    3131 */
     
    4747 * One item is put onto the stack to support get_stack_base().
    4848 */
    49 #define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
     49#define SP_DELTA        (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    5050
    5151/* RSE stack starts at the bottom of memory stack, hence the division by 2. */
    52 #define context_set(c, _pc, stack, size) \
    53         do { \
    54                 (c)->pc = (uintptr_t) _pc; \
    55                 (c)->bsp = ((uintptr_t) stack) + ALIGN_UP((size / 2), REGISTER_STACK_ALIGNMENT); \
    56                 (c)->ar_pfs &= PFM_MASK; \
    57                 (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size / 2), STACK_ALIGNMENT) - SP_DELTA; \
    58         } while (0)
     52#define context_set(c, _pc, stack, size)                                                                \
     53        do {                                                                                            \
     54                (c)->pc = (uintptr_t) _pc;                                                              \
     55                (c)->bsp = ((uintptr_t) stack) + ALIGN_UP((size / 2), REGISTER_STACK_ALIGNMENT);        \
     56                (c)->ar_pfs &= PFM_MASK;                                                                \
     57                (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size / 2), STACK_ALIGNMENT) - SP_DELTA;       \
     58        } while (0);
    5959
    6060/*
  • kernel/arch/mips32/include/context.h

    r14f8fd4 r43cd499  
    4242 * Put one item onto the stack to support get_stack_base() and align it up.
    4343 */
    44 #define SP_DELTA  (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
     44#define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    4545
    4646#ifndef __ASM__
  • kernel/arch/mips32/include/stack.h

    r14f8fd4 r43cd499  
    2727 */
    2828
    29 /** @addtogroup mips32
     29/** @addtogroup mips32 
    3030 * @{
    3131 */
     
    3636#define KERN_mips32_STACK_H_
    3737
    38 #define STACK_ITEM_SIZE  4
    39 #define STACK_ALIGNMENT  8
    40 #define ABI_STACK_FRAME  32
     38#define STACK_ITEM_SIZE         4
     39#define STACK_ALIGNMENT         8
    4140
    4241#endif
  • kernel/arch/mips32/src/start.S

    r14f8fd4 r43cd499  
    241241        /* $a1 contains physical address of bootinfo_t */
    242242        jal arch_pre_main
    243         addiu $sp, -ABI_STACK_FRAME
     243        nop
    244244       
    245245        j main_bsp
     
    281281       
    282282        move $a1, $sp
     283        jal exc_dispatch     /* exc_dispatch(excno, register_space) */
    283284        move $a0, $k0
    284         jal exc_dispatch     /* exc_dispatch(excno, register_space) */
    285         addiu $sp, -ABI_STACK_FRAME
    286         addiu $sp, ABI_STACK_FRAME
    287285       
    288286        REGISTERS_LOAD $sp
     
    325323        sw $t0, ISTATE_OFFSET_T0($sp)  /* save the 5th argument on the stack */
    326324        sw $t1, ISTATE_OFFSET_T1($sp)  /* save the 6th argument on the stack */
    327        
    328325        jal syscall_handler
    329326        sw $v0, ISTATE_OFFSET_V0($sp)  /* save the syscall number on the stack */
     
    360357        move $sp, $k0
    361358       
    362         move $a0, $sp
    363359        jal tlb_refill
    364         addiu $sp, -ABI_STACK_FRAME
    365         addiu $sp, ABI_STACK_FRAME
     360        move $a0, $sp
    366361       
    367362        REGISTERS_LOAD $sp
     
    371366cache_error_handler:
    372367        KERNEL_STACK_TO_K0
    373         sub $k0, ISTATE_SOFT_SIZE
     368        sub $k0, ISTATE_SOFT_SIZE 
    374369        REGISTERS_STORE_AND_EXC_RESET $k0
    375370        sw $sp, ISTATE_OFFSET_SP($k0)
    376371        move $sp, $k0
    377372       
     373        jal cache_error
    378374        move $a0, $sp
    379         jal cache_error
    380         addiu $sp, -ABI_STACK_FRAME
    381         addiu $sp, ABI_STACK_FRAME
    382375       
    383376        REGISTERS_LOAD $sp
  • kernel/arch/mips64/include/context.h

    r14f8fd4 r43cd499  
    4242 * Put one item onto the stack to support get_stack_base() and align it up.
    4343 */
    44 #define SP_DELTA  (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
     44#define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    4545
    4646#ifndef __ASM__
  • kernel/arch/mips64/include/stack.h

    r14f8fd4 r43cd499  
    3838#define STACK_ITEM_SIZE  8
    3939#define STACK_ALIGNMENT  8
    40 #define ABI_STACK_FRAME  64
    4140
    4241#endif
  • kernel/arch/mips64/src/start.S

    r14f8fd4 r43cd499  
    241241        /* $a1 contains physical address of bootinfo_t */
    242242        jal arch_pre_main
    243         addiu $sp, -ABI_STACK_FRAME
     243        nop
    244244       
    245245        j main_bsp
     
    281281       
    282282        move $a1, $sp
     283        jal exc_dispatch     /* exc_dispatch(excno, register_space) */
    283284        move $a0, $k0
    284         jal exc_dispatch     /* exc_dispatch(excno, register_space) */
    285         addiu $sp, -ABI_STACK_FRAME
    286         addiu $sp, ABI_STACK_FRAME
    287285       
    288286        REGISTERS_LOAD $sp
     
    325323        sw $t0, ISTATE_OFFSET_T0($sp)  /* save the 5th argument on the stack */
    326324        sw $t1, ISTATE_OFFSET_T1($sp)  /* save the 6th argument on the stack */
    327        
    328325        jal syscall_handler
    329326        sw $v0, ISTATE_OFFSET_V0($sp)  /* save the syscall number on the stack */
     
    360357        move $sp, $k0
    361358       
    362         move $a0, $sp
    363359        jal tlb_refill
    364         addiu $sp, -ABI_STACK_FRAME
    365         addiu $sp, ABI_STACK_FRAME
     360        move $a0, $sp
    366361       
    367362        REGISTERS_LOAD $sp
     
    371366cache_error_handler:
    372367        KERNEL_STACK_TO_K0
    373         sub $k0, ISTATE_SOFT_SIZE
     368        sub $k0, ISTATE_SOFT_SIZE 
    374369        REGISTERS_STORE_AND_EXC_RESET $k0
    375370        sw $sp, ISTATE_OFFSET_SP($k0)
    376371        move $sp, $k0
    377372       
     373        jal cache_error
    378374        move $a0, $sp
    379         jal cache_error
    380         addiu $sp, -ABI_STACK_FRAME
    381         addiu $sp, ABI_STACK_FRAME
    382375       
    383376        REGISTERS_LOAD $sp
  • kernel/arch/ppc32/src/ppc32.c

    r14f8fd4 r43cd499  
    173173                ofw_tree_walk_by_device_type("display", display_register, NULL);
    174174#endif
    175                 /* Map OFW information into sysinfo */
    176                 ofw_sysinfo_map();
    177175               
    178176                /* Initialize IRQ routing */
  • kernel/arch/sparc64/include/context.h

    r14f8fd4 r43cd499  
    2727 */
    2828
    29 /** @addtogroup sparc64
     29/** @addtogroup sparc64 
    3030 * @{
    3131 */
     
    4040#include <align.h>
    4141
    42 #define SP_DELTA  (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE)
     42#define SP_DELTA        (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE)
    4343
    44 #define context_set(c, _pc, stack, size) \
    45         do { \
    46                 (c)->pc = ((uintptr_t) _pc) - 8; \
    47                 (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size), \
    48                     STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \
    49                 (c)->fp = -STACK_BIAS; \
    50         } while (0)
     44#define context_set(c, _pc, stack, size)                        \
     45        (c)->pc = ((uintptr_t) _pc) - 8;                        \
     46        (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size),        \
     47                STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA);     \
     48        (c)->fp = -STACK_BIAS
     49       
    5150
    5251/*
  • kernel/arch/sparc64/src/sun4u/sparc64.c

    r14f8fd4 r43cd499  
    9494{
    9595        if (config.cpu_active == 1) {
    96                 /* Map OFW information into sysinfo */
    97                 ofw_sysinfo_map();
    98                
    9996                /*
    10097                 * We have 2^11 different interrupt vectors.
  • kernel/arch/sparc64/src/sun4v/sparc64.c

    r14f8fd4 r43cd499  
    9292{
    9393        if (config.cpu_active == 1) {
    94                 /* Map OFW information into sysinfo */
    95                 ofw_sysinfo_map();
    96                
    9794                /*
    9895                 * We have 2^11 different interrupt vectors.
  • kernel/genarch/include/ofw/ofw_tree.h

    r14f8fd4 r43cd499  
    6767
    6868extern void ofw_tree_init(ofw_tree_node_t *);
    69 extern void ofw_sysinfo_map(void);
     69extern void ofw_tree_print(void);
    7070
    7171extern const char *ofw_tree_node_name(const ofw_tree_node_t *);
  • kernel/genarch/src/ofw/ofw_tree.c

    r14f8fd4 r43cd499  
    3838#include <genarch/ofw/ofw_tree.h>
    3939#include <mm/slab.h>
    40 #include <sysinfo/sysinfo.h>
    4140#include <memstr.h>
    4241#include <str.h>
     
    6665    const char *name)
    6766{
    68         for (size_t i = 0; i < node->properties; i++) {
     67        size_t i;
     68       
     69        for (i = 0; i < node->properties; i++) {
    6970                if (str_cmp(node->property[i].name, name) == 0)
    7071                        return &node->property[i];
     
    103104    const char *name)
    104105{
     106        ofw_tree_node_t *cur;
     107       
    105108        /*
    106109         * Try to find the disambigued name.
    107110         */
    108         for (ofw_tree_node_t *cur = node->child; cur; cur = cur->peer) {
     111        for (cur = node->child; cur; cur = cur->peer) {
    109112                if (str_cmp(cur->da_name, name) == 0)
    110113                        return cur;
     
    118121         * are not always fully-qualified.
    119122         */
    120         for (ofw_tree_node_t *cur = node->child; cur; cur = cur->peer) {
     123        for (cur = node->child; cur; cur = cur->peer) {
    121124                if (str_cmp(ofw_tree_node_name(cur), name) == 0)
    122125                        return cur;
     
    138141    const char *dtype)
    139142{
    140         for (ofw_tree_node_t *cur = node->child; cur; cur = cur->peer) {
     143        ofw_tree_node_t *cur;
     144       
     145        for (cur = node->child; cur; cur = cur->peer) {
    141146                ofw_tree_property_t *prop =
    142147                    ofw_tree_getprop(cur, "device_type");
     
    167172    phandle handle)
    168173{
    169         for (ofw_tree_node_t *cur = root; cur; cur = cur->peer) {
     174        ofw_tree_node_t *cur;
     175       
     176        for (cur = root; cur; cur = cur->peer) {
    170177                if (cur->node_handle == handle)
    171178                        return cur;
    172179               
    173180                if (cur->child) {
    174                         ofw_tree_node_t *node =
    175                             ofw_tree_find_node_by_handle(cur->child, handle);
     181                        ofw_tree_node_t *node
     182                            = ofw_tree_find_node_by_handle(cur->child, handle);
    176183                        if (node)
    177184                                return node;
     
    194201    const char *dtype)
    195202{
    196         for (ofw_tree_node_t *cur = node->peer; cur; cur = cur->peer) {
     203        ofw_tree_node_t *cur;
     204       
     205        for (cur = node->peer; cur; cur = cur->peer) {
    197206                ofw_tree_property_t *prop =
    198207                    ofw_tree_getprop(cur, "device_type");
     
    220229    const char *name)
    221230{
    222         for (ofw_tree_node_t *cur = node->peer; cur; cur = cur->peer) {
    223                 ofw_tree_property_t *prop =
    224                     ofw_tree_getprop(cur, "name");
     231        ofw_tree_node_t *cur;
     232       
     233        for (cur = node->peer; cur; cur = cur->peer) {
     234                ofw_tree_property_t *prop
     235                    = ofw_tree_getprop(cur, "name");
    225236               
    226237                if ((!prop) || (!prop->value))
     
    248259       
    249260        ofw_tree_node_t *node = ofw_root;
     261        size_t i;
    250262        size_t j;
    251263       
    252         for (size_t i = 1; (i < str_size(path)) && (node); i = j + 1) {
     264        for (i = 1; (i < str_size(path)) && (node); i = j + 1) {
    253265                for (j = i; (j < str_size(path)) && (path[j] != '/'); j++);
    254266               
     
    282294    const char *dtype, ofw_tree_walker_t walker, void *arg)
    283295{
    284         for (ofw_tree_node_t *cur = node; cur; cur = cur->peer) {
     296        ofw_tree_node_t *cur;
     297       
     298        for (cur = node; cur; cur = cur->peer) {
    285299                ofw_tree_property_t *prop =
    286300                    ofw_tree_getprop(cur, "device_type");
     
    320334}
    321335
    322 /** Get OpenFirmware node properties.
    323  *
    324  * @param item    Sysinfo item (unused).
    325  * @param size    Size of the returned data.
    326  * @param dry_run Do not get the data, just calculate the size.
    327  * @param data    OpenFirmware node.
    328  *
    329  * @return Data containing a serialized dump of all node
    330  *         properties. If the return value is not NULL, it
    331  *         should be freed in the context of the sysinfo request.
    332  *
    333  */
    334 static void *ofw_sysinfo_properties(struct sysinfo_item *item, size_t *size,
    335     bool dry_run, void *data)
    336 {
    337         ofw_tree_node_t *node = (ofw_tree_node_t *) data;
    338        
    339         /* Compute serialized data size */
    340         *size = 0;
    341         for (size_t i = 0; i < node->properties; i++)
    342                 *size += str_size(node->property[i].name) + 1 +
    343                     sizeof(node->property[i].size) + node->property[i].size;
    344        
    345         if (dry_run)
    346                 return NULL;
    347        
    348         void *dump = malloc(*size, FRAME_ATOMIC);
    349         if (dump == NULL) {
    350                 *size = 0;
    351                 return NULL;
    352         }
    353        
    354         /* Serialize the data */
    355         size_t pos = 0;
    356         for (size_t i = 0; i < node->properties; i++) {
    357                 /* Property name */
    358                 str_cpy(dump + pos, *size - pos, node->property[i].name);
    359                 pos += str_size(node->property[i].name) + 1;
    360                
    361                 /* Value size */
    362                 memcpy(dump + pos, &node->property[i].size,
    363                     sizeof(node->property[i].size));
    364                 pos += sizeof(node->property[i].size);
    365                
    366                 /* Value */
    367                 memcpy(dump + pos, node->property[i].value,
    368                     node->property[i].size);
    369                 pos += node->property[i].size;
    370         }
    371        
    372         return ((void *) dump);
    373 }
    374 
    375 /** Map OpenFirmware device subtree rooted in a node into sysinfo.
     336/** Print OpenFirmware device subtree rooted in a node.
    376337 *
    377338 * Child nodes are processed recursively and peer nodes are processed
     
    382343 *
    383344 */
    384 static void ofw_tree_node_sysinfo(ofw_tree_node_t *node, const char *path)
     345static void ofw_tree_node_print(ofw_tree_node_t *node, const char *path)
    385346{
    386347        char *cur_path = (char *) malloc(PATH_MAX_LEN, 0);
    387        
    388         for (ofw_tree_node_t *cur = node; cur; cur = cur->peer) {
    389                 if ((cur->parent) && (path))
    390                         snprintf(cur_path, PATH_MAX_LEN, "%s.%s", path, cur->da_name);
    391                 else
    392                         snprintf(cur_path, PATH_MAX_LEN, "firmware.%s", cur->da_name);
    393                
    394                 sysinfo_set_item_gen_data(cur_path, NULL, ofw_sysinfo_properties,
    395                     (void *) cur);
     348        ofw_tree_node_t *cur;
     349       
     350        for (cur = node; cur; cur = cur->peer) {
     351                if ((cur->parent) && (path)) {
     352                        snprintf(cur_path, PATH_MAX_LEN, "%s/%s", path, cur->da_name);
     353                        printf("%s\n", cur_path);
     354                } else {
     355                        snprintf(cur_path, PATH_MAX_LEN, "%s", cur->da_name);
     356                        printf("/\n");
     357                }
    396358               
    397359                if (cur->child)
    398                         ofw_tree_node_sysinfo(cur->child, cur_path);
     360                        ofw_tree_node_print(cur->child, cur_path);
    399361        }
    400362       
     
    402364}
    403365
    404 /** Map the OpenFirmware device tree into sysinfo. */
    405 void ofw_sysinfo_map(void)
    406 {
    407         ofw_tree_node_sysinfo(ofw_root, NULL);
     366/** Print the structure of the OpenFirmware device tree. */
     367void ofw_tree_print(void)
     368{
     369        ofw_tree_node_print(ofw_root, NULL);
    408370}
    409371
  • kernel/generic/include/context.h

    r14f8fd4 r43cd499  
    4141
    4242#define context_set_generic(ctx, _pc, stack, size) \
    43         do { \
    44                 (ctx)->pc = (uintptr_t) (_pc); \
    45                 (ctx)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \
    46         } while (0)
     43        (ctx)->pc = (uintptr_t) (_pc); \
     44        (ctx)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA;
    4745
    4846extern int context_save_arch(context_t *ctx) __attribute__((returns_twice));
  • kernel/generic/include/sysinfo/sysinfo.h

    r14f8fd4 r43cd499  
    11/*
    22 * Copyright (c) 2006 Jakub Vana
    3  * Copyright (c) 2012 Martin Decky
    43 * All rights reserved.
    54 *
     
    5554struct sysinfo_item;
    5655
    57 /** Generated numeric value function */
    58 typedef sysarg_t (*sysinfo_fn_val_t)(struct sysinfo_item *, void *);
    59 
    60 /** Sysinfo generated numberic value data
    61  *
    62  */
    63 typedef struct {
    64         sysinfo_fn_val_t fn;  /**< Generated value function */
    65         void *data;           /**< Private data */
    66 } sysinfo_gen_val_data_t;
     56/** Gerated numeric value function */
     57typedef sysarg_t (*sysinfo_fn_val_t)(struct sysinfo_item *);
    6758
    6859/** Generated binary data function */
    69 typedef void *(*sysinfo_fn_data_t)(struct sysinfo_item *, size_t *, bool,
    70     void *);
    71 
    72 /** Sysinfo generated binary data data
    73  *
    74  */
    75 typedef struct {
    76         sysinfo_fn_data_t fn;  /**< Generated binary data function */
    77         void *data;            /**< Private data */
    78 } sysinfo_gen_data_data_t;
     60typedef void *(*sysinfo_fn_data_t)(struct sysinfo_item *, size_t *, bool);
    7961
    8062/** Sysinfo item binary data
     
    9072 */
    9173typedef union {
    92         sysarg_t val;                      /**< Constant numberic value */
    93         sysinfo_data_t data;               /**< Constant binary data */
    94         sysinfo_gen_val_data_t gen_val;    /**< Generated numeric value function */
    95         sysinfo_gen_data_data_t gen_data;  /**< Generated binary data function */
     74        sysarg_t val;               /**< Constant numberic value */
     75        sysinfo_fn_val_t fn_val;    /**< Generated numeric value function */
     76        sysinfo_fn_data_t fn_data;  /**< Generated binary data function */
     77        sysinfo_data_t data;        /**< Constant binary data */
    9678} sysinfo_item_val_t;
    9779
     
    11395
    11496/** Generated subtree function */
    115 typedef sysinfo_return_t (*sysinfo_fn_subtree_t)(const char *, bool, void *);
    116 
    117 /** Sysinfo generated subtree data
    118  *
    119  */
    120 typedef struct {
    121         sysinfo_fn_subtree_t fn;  /**< Generated subtree function */
    122         void *data;               /**< Private data */
    123 } sysinfo_gen_subtree_data_t;
     97typedef sysinfo_return_t (*sysinfo_fn_subtree_t)(const char *, bool);
    12498
    12599/** Sysinfo subtree (union)
     
    127101 */
    128102typedef union {
    129         struct sysinfo_item *table;            /**< Fixed subtree (list of subitems) */
    130         sysinfo_gen_subtree_data_t generator;  /**< Generated subtree */
     103        struct sysinfo_item *table;     /**< Fixed subtree (list of subitems) */
     104        sysinfo_fn_subtree_t get_data;  /**< Generated subtree function */
    131105} sysinfo_subtree_t;
    132106
     
    149123extern void sysinfo_set_item_data(const char *, sysinfo_item_t **, void *,
    150124    size_t);
    151 extern void sysinfo_set_item_gen_val(const char *, sysinfo_item_t **,
    152     sysinfo_fn_val_t, void *);
    153 extern void sysinfo_set_item_gen_data(const char *, sysinfo_item_t **,
    154     sysinfo_fn_data_t, void *);
     125extern void sysinfo_set_item_fn_val(const char *, sysinfo_item_t **,
     126    sysinfo_fn_val_t);
     127extern void sysinfo_set_item_fn_data(const char *, sysinfo_item_t **,
     128    sysinfo_fn_data_t);
    155129extern void sysinfo_set_item_undefined(const char *, sysinfo_item_t **);
    156130
    157131extern void sysinfo_set_subtree_fn(const char *, sysinfo_item_t **,
    158     sysinfo_fn_subtree_t, void *);
     132    sysinfo_fn_subtree_t);
    159133
    160134extern void sysinfo_init(void);
    161135extern void sysinfo_dump(sysinfo_item_t *);
    162136
    163 extern sysarg_t sys_sysinfo_get_keys_size(void *, size_t, void *);
    164 extern sysarg_t sys_sysinfo_get_keys(void *, size_t, void *, size_t, size_t *);
    165137extern sysarg_t sys_sysinfo_get_val_type(void *, size_t);
    166138extern sysarg_t sys_sysinfo_get_value(void *, size_t, void *);
  • kernel/generic/src/main/main.c

    r14f8fd4 r43cd499  
    221221        frame_init();
    222222        slab_cache_init();
    223         ra_init();
     223        ra_init();     
    224224        sysinfo_init();
    225225        btree_init();
  • kernel/generic/src/mm/frame.c

    r14f8fd4 r43cd499  
    12701270/** Adjust bounds of physical memory region according to low/high memory split.
    12711271 *
    1272  * @param low[in]       If true, the adjustment is performed to make the region
     1272 * @param low[in]       If true, the adujstment is performed to make the region
    12731273 *                      fit in the low memory. Otherwise the adjustment is
    12741274 *                      performed to make the region fit in the high memory.
     
    12821282bool frame_adjust_zone_bounds(bool low, uintptr_t *basep, size_t *sizep)
    12831283{
    1284         uintptr_t limit = KA2PA(config.identity_base) + config.identity_size;
     1284        // FIXME: This might lead to overflow if the identity_size is too big
     1285        // but it is necessary if the PA identity_base > identity_size
     1286        const uintptr_t limit =
     1287            KA2PA(config.identity_base) + config.identity_size;
    12851288
    12861289        if (low) {
  • kernel/generic/src/syscall/syscall.c

    r14f8fd4 r43cd499  
    184184       
    185185        /* Sysinfo syscalls. */
    186         (syshandler_t) sys_sysinfo_get_keys_size,
    187         (syshandler_t) sys_sysinfo_get_keys,
    188186        (syshandler_t) sys_sysinfo_get_val_type,
    189187        (syshandler_t) sys_sysinfo_get_value,
  • kernel/generic/src/sysinfo/stats.c

    r14f8fd4 r43cd499  
    8383 *
    8484 * @param item Sysinfo item (unused).
    85  * @param data Unused.
    8685 *
    8786 * @return System uptime (in secords).
    8887 *
    8988 */
    90 static sysarg_t get_stats_uptime(struct sysinfo_item *item, void *data)
     89static sysarg_t get_stats_uptime(struct sysinfo_item *item)
    9190{
    9291        /* This doesn't have to be very accurate */
     
    9998 * @param size    Size of the returned data.
    10099 * @param dry_run Do not get the data, just calculate the size.
    101  * @param data    Unused.
    102100 *
    103101 * @return Data containing several stats_cpu_t structures.
     
    106104 */
    107105static void *get_stats_cpus(struct sysinfo_item *item, size_t *size,
    108     bool dry_run, void *data)
     106    bool dry_run)
    109107{
    110108        *size = sizeof(stats_cpu_t) * config.cpu_count;
     
    251249        ASSERT(interrupts_disabled());
    252250        ASSERT(irq_spinlock_locked(&task->lock));
    253        
     251
    254252        stats_task->task_id = task->taskid;
    255253        str_cpy(stats_task->name, TASK_NAME_BUFLEN, task->name);
     
    295293 * @param size    Size of the returned data.
    296294 * @param dry_run Do not get the data, just calculate the size.
    297  * @param data    Unused.
    298295 *
    299296 * @return Data containing several stats_task_t structures.
     
    302299 */
    303300static void *get_stats_tasks(struct sysinfo_item *item, size_t *size,
    304     bool dry_run, void *data)
     301    bool dry_run)
    305302{
    306303        /* Messing with task structures, avoid deadlock */
     
    353350        ASSERT(interrupts_disabled());
    354351        ASSERT(irq_spinlock_locked(&thread->lock));
    355        
     352
    356353        stats_thread->thread_id = thread->tid;
    357354        stats_thread->task_id = thread->task->taskid;
     
    401398 * @param size    Size of the returned data.
    402399 * @param dry_run Do not get the data, just calculate the size.
    403  * @param data    Unused.
    404400 *
    405401 * @return Data containing several stats_task_t structures.
     
    408404 */
    409405static void *get_stats_threads(struct sysinfo_item *item, size_t *size,
    410     bool dry_run, void *data)
     406    bool dry_run)
    411407{
    412408        /* Messing with threads structures, avoid deadlock */
     
    455451 * @param name    Task ID (string-encoded number).
    456452 * @param dry_run Do not get the data, just calculate the size.
    457  * @param data    Unused.
    458453 *
    459454 * @return Sysinfo return holder. The type of the returned
     
    465460 *
    466461 */
    467 static sysinfo_return_t get_stats_task(const char *name, bool dry_run,
    468     void *data)
     462static sysinfo_return_t get_stats_task(const char *name, bool dry_run)
    469463{
    470464        /* Initially no return value */
     
    526520 * @param name    Thread ID (string-encoded number).
    527521 * @param dry_run Do not get the data, just calculate the size.
    528  * @param data    Unused.
    529522 *
    530523 * @return Sysinfo return holder. The type of the returned
     
    536529 *
    537530 */
    538 static sysinfo_return_t get_stats_thread(const char *name, bool dry_run,
    539     void *data)
     531static sysinfo_return_t get_stats_thread(const char *name, bool dry_run)
    540532{
    541533        /* Initially no return value */
     
    594586 * @param size    Size of the returned data.
    595587 * @param dry_run Do not get the data, just calculate the size.
    596  * @param data    Unused.
    597588 *
    598589 * @return Data containing several stats_exc_t structures.
     
    601592 */
    602593static void *get_stats_exceptions(struct sysinfo_item *item, size_t *size,
    603     bool dry_run, void *data)
     594    bool dry_run)
    604595{
    605596        *size = sizeof(stats_exc_t) * IVT_ITEMS;
     
    643634 * @param name    Exception number (string-encoded number).
    644635 * @param dry_run Do not get the data, just calculate the size.
    645  * @param data    Unused.
    646636 *
    647637 * @return Sysinfo return holder. The type of the returned
     
    653643 *
    654644 */
    655 static sysinfo_return_t get_stats_exception(const char *name, bool dry_run,
    656     void *data)
     645static sysinfo_return_t get_stats_exception(const char *name, bool dry_run)
    657646{
    658647        /* Initially no return value */
     
    716705 * @param size    Size of the returned data.
    717706 * @param dry_run Do not get the data, just calculate the size.
    718  * @param data    Unused.
    719707 *
    720708 * @return Data containing stats_physmem_t.
     
    723711 */
    724712static void *get_stats_physmem(struct sysinfo_item *item, size_t *size,
    725     bool dry_run, void *data)
     713    bool dry_run)
    726714{
    727715        *size = sizeof(stats_physmem_t);
     
    747735 * @param size    Size of the returned data.
    748736 * @param dry_run Do not get the data, just calculate the size.
    749  * @param data    Unused.
    750737 *
    751738 * @return Data several load_t values.
     
    754741 */
    755742static void *get_stats_load(struct sysinfo_item *item, size_t *size,
    756     bool dry_run, void *data)
     743    bool dry_run)
    757744{
    758745        *size = sizeof(load_t) * LOAD_STEPS;
     
    823810        mutex_initialize(&load_lock, MUTEX_PASSIVE);
    824811       
    825         sysinfo_set_item_gen_val("system.uptime", NULL, get_stats_uptime, NULL);
    826         sysinfo_set_item_gen_data("system.cpus", NULL, get_stats_cpus, NULL);
    827         sysinfo_set_item_gen_data("system.physmem", NULL, get_stats_physmem, NULL);
    828         sysinfo_set_item_gen_data("system.load", NULL, get_stats_load, NULL);
    829         sysinfo_set_item_gen_data("system.tasks", NULL, get_stats_tasks, NULL);
    830         sysinfo_set_item_gen_data("system.threads", NULL, get_stats_threads, NULL);
    831         sysinfo_set_item_gen_data("system.exceptions", NULL, get_stats_exceptions, NULL);
    832         sysinfo_set_subtree_fn("system.tasks", NULL, get_stats_task, NULL);
    833         sysinfo_set_subtree_fn("system.threads", NULL, get_stats_thread, NULL);
    834         sysinfo_set_subtree_fn("system.exceptions", NULL, get_stats_exception, NULL);
     812        sysinfo_set_item_fn_val("system.uptime", NULL, get_stats_uptime);
     813        sysinfo_set_item_fn_data("system.cpus", NULL, get_stats_cpus);
     814        sysinfo_set_item_fn_data("system.physmem", NULL, get_stats_physmem);
     815        sysinfo_set_item_fn_data("system.load", NULL, get_stats_load);
     816        sysinfo_set_item_fn_data("system.tasks", NULL, get_stats_tasks);
     817        sysinfo_set_item_fn_data("system.threads", NULL, get_stats_threads);
     818        sysinfo_set_item_fn_data("system.exceptions", NULL, get_stats_exceptions);
     819        sysinfo_set_subtree_fn("system.tasks", NULL, get_stats_task);
     820        sysinfo_set_subtree_fn("system.threads", NULL, get_stats_thread);
     821        sysinfo_set_subtree_fn("system.exceptions", NULL, get_stats_exception);
    835822}
    836823
  • kernel/generic/src/sysinfo/sysinfo.c

    r14f8fd4 r43cd499  
    11/*
    22 * Copyright (c) 2006 Jakub Vana
    3  * Copyright (c) 2012 Martin Decky
    43 * All rights reserved.
    54 *
     
    10099            sizeof(sysinfo_item_t), 0, sysinfo_item_constructor,
    101100            sysinfo_item_destructor, SLAB_CACHE_MAGDEFERRED);
    102        
     101
    103102        mutex_initialize(&sysinfo_lock, MUTEX_ACTIVE);
    104103}
     
    111110 * @param subtree Current sysinfo (sub)tree root item.
    112111 * @param ret     If the return value is NULL, this argument
    113  *                can be set either to NULL (i.e. no item was
     112 *                can be either also NULL (i.e. no item was
    114113 *                found and no data was generated) or the
    115114 *                original pointer is used to store the value
     
    126125{
    127126        ASSERT(subtree != NULL);
     127        ASSERT(ret != NULL);
    128128       
    129129        sysinfo_item_t *cur = subtree;
     
    151151                        case SYSINFO_SUBTREE_FUNCTION:
    152152                                /* Get generated data */
    153                                 if (ret != NULL)
    154                                         **ret = cur->subtree.generator.fn(name + i + 1,
    155                                             dry_run, cur->subtree.generator.data);
    156                                
     153                                **ret = cur->subtree.get_data(name + i + 1, dry_run);
    157154                                return NULL;
    158155                        default:
    159156                                /* Not found, no data generated */
    160                                 if (ret != NULL)
    161                                         *ret = NULL;
    162                                
     157                                *ret = NULL;
    163158                                return NULL;
    164159                        }
     
    169164       
    170165        /* Not found, no data generated */
    171         if (ret != NULL)
    172                 *ret = NULL;
    173        
     166        *ret = NULL;
    174167        return NULL;
    175168}
     
    359352 *             a new root item (NULL for global sysinfo root).
    360353 * @param fn   Numeric value generator function.
    361  * @param data Private data.
    362  *
    363  */
    364 void sysinfo_set_item_gen_val(const char *name, sysinfo_item_t **root,
    365     sysinfo_fn_val_t fn, void *data)
     354 *
     355 */
     356void sysinfo_set_item_fn_val(const char *name, sysinfo_item_t **root,
     357    sysinfo_fn_val_t fn)
    366358{
    367359        /* Protect sysinfo tree consistency */
     
    374366        if (item != NULL) {
    375367                item->val_type = SYSINFO_VAL_FUNCTION_VAL;
    376                 item->val.gen_val.fn = fn;
    377                 item->val.gen_val.data = data;
     368                item->val.fn_val = fn;
    378369        }
    379370       
     
    392383 *             a new root item (NULL for global sysinfo root).
    393384 * @param fn   Binary data generator function.
    394  * @param data Private data.
    395  *
    396  */
    397 void sysinfo_set_item_gen_data(const char *name, sysinfo_item_t **root,
    398     sysinfo_fn_data_t fn, void *data)
     385 *
     386 */
     387void sysinfo_set_item_fn_data(const char *name, sysinfo_item_t **root,
     388    sysinfo_fn_data_t fn)
    399389{
    400390        /* Protect sysinfo tree consistency */
     
    407397        if (item != NULL) {
    408398                item->val_type = SYSINFO_VAL_FUNCTION_DATA;
    409                 item->val.gen_data.fn = fn;
    410                 item->val.gen_data.data = data;
     399                item->val.fn_data = fn;
    411400        }
    412401       
     
    442431 *             a new root item (NULL for global sysinfo root).
    443432 * @param fn   Subtree generator function.
    444  * @param data Private data to be passed to the generator.
    445433 *
    446434 */
    447435void sysinfo_set_subtree_fn(const char *name, sysinfo_item_t **root,
    448     sysinfo_fn_subtree_t fn, void *data)
     436    sysinfo_fn_subtree_t fn)
    449437{
    450438        /* Protect sysinfo tree consistency */
     
    460448        if ((item != NULL) && (item->subtree_type != SYSINFO_SUBTREE_TABLE)) {
    461449                item->subtree_type = SYSINFO_SUBTREE_FUNCTION;
    462                 item->subtree.generator.fn = fn;
    463                 item->subtree.generator.data = data;
     450                item->subtree.get_data = fn;
    464451        }
    465452       
     
    469456/** Sysinfo dump indentation helper routine
    470457 *
    471  * @param depth Number of spaces to print.
    472  *
    473  */
    474 NO_TRACE static void sysinfo_indent(size_t spaces)
    475 {
    476         for (size_t i = 0; i < spaces; i++)
    477                 printf(" ");
     458 * @param depth Number of indentation characters to print.
     459 *
     460 */
     461NO_TRACE static void sysinfo_indent(unsigned int depth)
     462{
     463        unsigned int i;
     464        for (i = 0; i < depth; i++)
     465                printf("  ");
    478466}
    479467
     
    482470 * Should be called with sysinfo_lock held.
    483471 *
    484  * @param root   Root item of the current (sub)tree.
    485  * @param spaces Current indentation level.
    486  *
    487  */
    488 NO_TRACE static void sysinfo_dump_internal(sysinfo_item_t *root, size_t spaces)
    489 {
     472 * @param root  Root item of the current (sub)tree.
     473 * @param depth Current depth in the sysinfo tree.
     474 *
     475 */
     476NO_TRACE static void sysinfo_dump_internal(sysinfo_item_t *root, unsigned int depth)
     477{
     478        sysinfo_item_t *cur = root;
     479       
    490480        /* Walk all siblings */
    491         for (sysinfo_item_t *cur = root; cur; cur = cur->next) {
    492                 size_t length;
    493                
    494                 if (spaces == 0) {
    495                         printf("%s", cur->name);
    496                         length = str_length(cur->name);
    497                 } else {
    498                         sysinfo_indent(spaces);
    499                         printf(".%s", cur->name);
    500                         length = str_length(cur->name) + 1;
    501                 }
     481        while (cur != NULL) {
     482                sysinfo_indent(depth);
    502483               
    503484                sysarg_t val;
     
    507488                switch (cur->val_type) {
    508489                case SYSINFO_VAL_UNDEFINED:
    509                         printf(" [undefined]\n");
     490                        printf("+ %s\n", cur->name);
    510491                        break;
    511492                case SYSINFO_VAL_VAL:
    512                         printf(" -> %" PRIun" (%#" PRIxn ")\n", cur->val.val,
    513                             cur->val.val);
     493                        printf("+ %s -> %" PRIun" (%#" PRIxn ")\n", cur->name,
     494                            cur->val.val, cur->val.val);
    514495                        break;
    515496                case SYSINFO_VAL_DATA:
    516                         printf(" (%zu bytes)\n", cur->val.data.size);
     497                        printf("+ %s (%zu bytes)\n", cur->name,
     498                            cur->val.data.size);
    517499                        break;
    518500                case SYSINFO_VAL_FUNCTION_VAL:
    519                         val = cur->val.gen_val.fn(cur, cur->val.gen_val.data);
    520                         printf(" -> %" PRIun" (%#" PRIxn ") [generated]\n", val,
    521                             val);
     501                        val = cur->val.fn_val(cur);
     502                        printf("+ %s -> %" PRIun" (%#" PRIxn ") [generated]\n",
     503                            cur->name, val, val);
    522504                        break;
    523505                case SYSINFO_VAL_FUNCTION_DATA:
    524506                        /* N.B.: No data was actually returned (only a dry run) */
    525                         (void) cur->val.gen_data.fn(cur, &size, true,
    526                             cur->val.gen_data.data);
    527                         printf(" (%zu bytes) [generated]\n", size);
     507                        (void) cur->val.fn_data(cur, &size, true);
     508                        printf("+ %s (%zu bytes) [generated]\n", cur->name,
     509                            size);
    528510                        break;
    529511                default:
     
    536518                        break;
    537519                case SYSINFO_SUBTREE_TABLE:
    538                         sysinfo_dump_internal(cur->subtree.table, spaces + length);
     520                        sysinfo_dump_internal(cur->subtree.table, depth + 1);
    539521                        break;
    540522                case SYSINFO_SUBTREE_FUNCTION:
    541                         sysinfo_indent(spaces + length);
    542                         printf("<generated subtree>\n");
     523                        sysinfo_indent(depth + 1);
     524                        printf("+ [generated subtree]\n");
    543525                        break;
    544526                default:
    545                         sysinfo_indent(spaces + length);
    546                         printf("<unknown subtree>\n");
     527                        sysinfo_indent(depth + 1);
     528                        printf("+ [unknown subtree]\n");
    547529                }
     530               
     531                cur = cur->next;
    548532        }
    549533}
     
    610594                        break;
    611595                case SYSINFO_VAL_FUNCTION_VAL:
    612                         ret.val = item->val.gen_val.fn(item, item->val.gen_val.data);
     596                        ret.val = item->val.fn_val(item);
    613597                        break;
    614598                case SYSINFO_VAL_FUNCTION_DATA:
    615                         ret.data.data = item->val.gen_data.fn(item, &ret.data.size,
    616                             dry_run, item->val.gen_data.data);
     599                        ret.data.data = item->val.fn_data(item, &ret.data.size,
     600                            dry_run);
    617601                        break;
    618602                }
     
    651635        ASSERT(path);
    652636       
    653         if ((copy_from_uspace(path, ptr, size + 1) == 0) &&
    654             (path[size] == 0)) {
     637        if ((copy_from_uspace(path, ptr, size + 1) == 0)
     638            && (path[size] == 0)) {
    655639                /*
    656640                 * Prevent other functions from messing with sysinfo while we
     
    661645                mutex_unlock(&sysinfo_lock);
    662646        }
    663        
    664647        free(path);
    665648        return ret;
    666 }
    667 
    668 /** Return sysinfo keys determined by name
    669  *
    670  * Should be called with sysinfo_lock held.
    671  *
    672  * @param name    Sysinfo path.
    673  * @param root    Root item of the sysinfo (sub)tree.
    674  *                If it is NULL then consider the global
    675  *                sysinfo tree.
    676  * @param dry_run Do not actually get any generated
    677  *                binary data, just calculate the size.
    678  *
    679  * @return Item value (constant or generated).
    680  *
    681  */
    682 NO_TRACE static sysinfo_return_t sysinfo_get_keys(const char *name,
    683     sysinfo_item_t **root, bool dry_run)
    684 {
    685         if (root == NULL)
    686                 root = &global_root;
    687        
    688         sysinfo_item_t *subtree = NULL;
    689        
    690         if (name[0] != 0) {
    691                 /* Try to find the item */
    692                 sysinfo_item_t *item =
    693                     sysinfo_find_item(name, *root, NULL, dry_run);
    694                 if ((item != NULL) &&
    695                     (item->subtree_type == SYSINFO_SUBTREE_TABLE))
    696                         subtree = item->subtree.table;
    697         } else
    698                 subtree = *root;
    699        
    700         sysinfo_return_t ret;
    701        
    702         if (subtree != NULL) {
    703                 /*
    704                  * Calculate the size of subkeys.
    705                  */
    706                 size_t size = 0;
    707                 for (sysinfo_item_t *cur = subtree; cur; cur = cur->next)
    708                         size += str_size(cur->name) + 1;
    709                
    710                 if (dry_run) {
    711                         ret.tag = SYSINFO_VAL_DATA;
    712                         ret.data.data = NULL;
    713                         ret.data.size = size;
    714                 } else {
    715                         /* Allocate buffer for subkeys */
    716                         char *names = (char *) malloc(size, FRAME_ATOMIC);
    717                         if (names == NULL)
    718                                 return ret;
    719                        
    720                         size_t pos = 0;
    721                         for (sysinfo_item_t *cur = subtree; cur; cur = cur->next) {
    722                                 str_cpy(names + pos, size - pos, cur->name);
    723                                 pos += str_size(cur->name) + 1;
    724                         }
    725                        
    726                         /* Correct return value */
    727                         ret.tag = SYSINFO_VAL_DATA;
    728                         ret.data.data = (void *) names;
    729                         ret.data.size = size;
    730                 }
    731         } else {
    732                 /* No item in the fixed sysinfo tree */
    733                 ret.tag = SYSINFO_VAL_UNDEFINED;
    734         }
    735        
    736         return ret;
    737 }
    738 
    739 /** Return sysinfo keys determined by name from user space
    740  *
    741  * The path string passed from the user space has to be properly
    742  * null-terminated (the last passed character must be null).
    743  *
    744  * @param ptr     Sysinfo path in the user address space.
    745  * @param size    Size of the path string.
    746  * @param dry_run Do not actually get any generated
    747  *                binary data, just calculate the size.
    748  *
    749  */
    750 NO_TRACE static sysinfo_return_t sysinfo_get_keys_uspace(void *ptr, size_t size,
    751     bool dry_run)
    752 {
    753         sysinfo_return_t ret;
    754         ret.tag = SYSINFO_VAL_UNDEFINED;
    755        
    756         if (size > SYSINFO_MAX_PATH)
    757                 return ret;
    758        
    759         char *path = (char *) malloc(size + 1, 0);
    760         ASSERT(path);
    761        
    762         if ((copy_from_uspace(path, ptr, size + 1) == 0) &&
    763             (path[size] == 0)) {
    764                 /*
    765                  * Prevent other functions from messing with sysinfo while we
    766                  * are reading it.
    767                  */
    768                 mutex_lock(&sysinfo_lock);
    769                 ret = sysinfo_get_keys(path, NULL, dry_run);
    770                 mutex_unlock(&sysinfo_lock);
    771         }
    772        
    773         free(path);
    774         return ret;
    775 }
    776 
    777 /** Get the sysinfo keys size (syscall)
    778  *
    779  * The path string passed from the user space has
    780  * to be properly null-terminated (the last passed
    781  * character must be null).
    782  *
    783  * @param path_ptr  Sysinfo path in the user address space.
    784  * @param path_size Size of the path string.
    785  * @param size_ptr  User space pointer where to store the
    786  *                  keys size.
    787  *
    788  * @return Error code (EOK in case of no error).
    789  *
    790  */
    791 sysarg_t sys_sysinfo_get_keys_size(void *path_ptr, size_t path_size,
    792     void *size_ptr)
    793 {
    794         int rc;
    795        
    796         /*
    797          * Get the keys.
    798          *
    799          * N.B.: There is no need to free any potential keys
    800          * since we request a dry run.
    801          */
    802         sysinfo_return_t ret =
    803             sysinfo_get_keys_uspace(path_ptr, path_size, true);
    804        
    805         /* Check return data tag */
    806         if (ret.tag == SYSINFO_VAL_DATA)
    807                 rc = copy_to_uspace(size_ptr, &ret.data.size,
    808                     sizeof(ret.data.size));
    809         else
    810                 rc = EINVAL;
    811        
    812         return (sysarg_t) rc;
    813 }
    814 
    815 /** Get the sysinfo keys (syscall)
    816  *
    817  * The path string passed from the user space has
    818  * to be properly null-terminated (the last passed
    819  * character must be null).
    820  *
    821  * If the user space buffer size does not equal
    822  * the actual size of the returned data, the data
    823  * is truncated.
    824  *
    825  * The actual size of data returned is stored to
    826  * size_ptr.
    827  *
    828  * @param path_ptr    Sysinfo path in the user address space.
    829  * @param path_size   Size of the path string.
    830  * @param buffer_ptr  User space pointer to the buffer where
    831  *                    to store the binary data.
    832  * @param buffer_size User space buffer size.
    833  * @param size_ptr    User space pointer where to store the
    834  *                    binary data size.
    835  *
    836  * @return Error code (EOK in case of no error).
    837  *
    838  */
    839 sysarg_t sys_sysinfo_get_keys(void *path_ptr, size_t path_size,
    840     void *buffer_ptr, size_t buffer_size, size_t *size_ptr)
    841 {
    842         int rc;
    843        
    844         /* Get the keys */
    845         sysinfo_return_t ret = sysinfo_get_keys_uspace(path_ptr, path_size,
    846             false);
    847        
    848         /* Check return data tag */
    849         if (ret.tag == SYSINFO_VAL_DATA) {
    850                 size_t size = min(ret.data.size, buffer_size);
    851                 rc = copy_to_uspace(buffer_ptr, ret.data.data, size);
    852                 if (rc == EOK)
    853                         rc = copy_to_uspace(size_ptr, &size, sizeof(size));
    854                
    855                 free(ret.data.data);
    856         } else
    857                 rc = EINVAL;
    858        
    859         return (sysarg_t) rc;
    860649}
    861650
     
    883672       
    884673        /*
    885          * Map generated value types to constant types (user space does
    886          * not care whether the value is constant or generated).
     674         * Map generated value types to constant types (user space does not care
     675         * whether the value is constant or generated).
    887676         */
    888677        if (ret.tag == SYSINFO_VAL_FUNCTION_VAL)
     
    912701{
    913702        int rc;
    914        
     703
    915704        /*
    916705         * Get the item.
    917706         *
    918          * N.B.: There is no need to free any potential generated binary
    919          * data since we request a dry run.
     707         * N.B.: There is no need to free any potential generated binary data
     708         * since we request a dry run.
    920709         */
    921710        sysinfo_return_t ret = sysinfo_get_item_uspace(path_ptr, path_size, true);
     
    952741         * Get the item.
    953742         *
    954          * N.B.: There is no need to free any potential generated binary
    955          * data since we request a dry run.
     743         * N.B.: There is no need to free any potential generated binary data
     744         * since we request a dry run.
    956745         */
    957746        sysinfo_return_t ret = sysinfo_get_item_uspace(path_ptr, path_size, true);
  • tools/toolchain.sh

    r14f8fd4 r43cd499  
    5353EOF
    5454
    55 BINUTILS_VERSION="2.22"
    56 BINUTILS_RELEASE=""
    57 GCC_VERSION="4.6.3"
    58 GDB_VERSION="7.4"
     55BINUTILS_VERSION="2.21.1"
     56BINUTILS_RELEASE="a"
     57GCC_VERSION="4.6.2"
     58GDB_VERSION="7.3.1"
    5959
    6060BASEDIR="`pwd`"
     
    274274        GDB_SOURCE="ftp://ftp.gnu.org/gnu/gdb/"
    275275       
    276         download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "ee0f10756c84979622b992a4a61ea3f5"
    277         download_fetch "${GCC_SOURCE}" "${GCC_CORE}" "766091220c6a14fcaa2c06dd573e3758"
    278         download_fetch "${GCC_SOURCE}" "${GCC_OBJC}" "48ba23770c34b1cb468f72618b4452c5"
    279         download_fetch "${GCC_SOURCE}" "${GCC_CPP}" "37515158a0fb3d0800ec41a08c05e69e"
    280         download_fetch "${GDB_SOURCE}" "${GDB}" "95a9a8305fed4d30a30a6dc28ff9d060"
     276        download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "bde820eac53fa3a8d8696667418557ad"
     277        download_fetch "${GCC_SOURCE}" "${GCC_CORE}" "780f614ab18c7a9066dec6387d7490b2"
     278        download_fetch "${GCC_SOURCE}" "${GCC_OBJC}" "94043cc0d08394eddebed73f30ecad89"
     279        download_fetch "${GCC_SOURCE}" "${GCC_CPP}" "87ecd60431e41096419dd8a10f76e46b"
     280        download_fetch "${GDB_SOURCE}" "${GDB}" "b89a5fac359c618dda97b88645ceab47"
    281281}
    282282
  • uspace/Makefile

    r14f8fd4 r43cd499  
    4848        app/lsusb \
    4949        app/mkfat \
    50         app/mkexfat \
    5150        app/mkmfs \
    5251        app/redir \
  • uspace/app/sysinfo/sysinfo.c

    r14f8fd4 r43cd499  
    3737#include <stdio.h>
    3838#include <sysinfo.h>
    39 #include <malloc.h>
    4039#include <sys/types.h>
     40
     41static int print_item_val(char *ipath);
     42static int print_item_data(char *ipath);
     43
     44static void dump_bytes_hex(char *data, size_t size);
     45static void dump_bytes_text(char *data, size_t size);
     46
     47static void print_syntax(void);
     48
     49int main(int argc, char *argv[])
     50{
     51        int rc;
     52        char *ipath;
     53        sysinfo_item_val_type_t tag;
     54
     55        if (argc != 2) {
     56                print_syntax();
     57                return 1;
     58        }
     59
     60        ipath = argv[1];
     61
     62        tag = sysinfo_get_val_type(ipath);
     63
     64        /* Silence warning */
     65        rc = EOK;
     66
     67        switch (tag) {
     68        case SYSINFO_VAL_UNDEFINED:
     69                printf("Error: Sysinfo item '%s' not defined.\n", ipath);
     70                rc = 2;
     71                break;
     72        case SYSINFO_VAL_VAL:
     73                rc = print_item_val(ipath);
     74                break;
     75        case SYSINFO_VAL_DATA:
     76                rc = print_item_data(ipath);
     77                break;
     78        default:
     79                printf("Error: Sysinfo item '%s' with unknown value type.\n",
     80                    ipath);
     81                rc = 2;
     82                break;
     83        }
     84
     85        return rc;
     86}
     87
     88static int print_item_val(char *ipath)
     89{
     90        sysarg_t value;
     91        int rc;
     92
     93        rc = sysinfo_get_value(ipath, &value);
     94        if (rc != EOK) {
     95                printf("Error reading item '%s'.\n", ipath);
     96                return rc;
     97        }
     98
     99        printf("%s -> %" PRIu64 " (0x%" PRIx64 ")\n", ipath,
     100            (uint64_t) value, (uint64_t) value);
     101
     102        return EOK;
     103}
     104
     105static int print_item_data(char *ipath)
     106{
     107        void *data;
     108        size_t size;
     109
     110        data = sysinfo_get_data(ipath, &size);
     111        if (data == NULL) {
     112                printf("Error reading item '%s'.\n", ipath);
     113                return -1;
     114        }
     115
     116        printf("%s -> ", ipath);
     117        dump_bytes_hex(data, size);
     118        fputs(" ('", stdout);
     119        dump_bytes_text(data, size);
     120        fputs("')\n", stdout);
     121
     122        return EOK;
     123}
    41124
    42125static void dump_bytes_hex(char *data, size_t size)
    43126{
    44         for (size_t i = 0; i < size; i++) {
    45                 if (i > 0)
    46                         putchar(' ');
     127        size_t i;
     128
     129        for (i = 0; i < size; ++i) {
     130                if (i > 0) putchar(' ');
    47131                printf("0x%02x", (uint8_t) data[i]);
    48132        }
     
    51135static void dump_bytes_text(char *data, size_t size)
    52136{
    53         size_t offset = 0;
    54        
     137        wchar_t c;
     138        size_t offset;
     139
     140        offset = 0;
     141
    55142        while (offset < size) {
    56                 wchar_t c = str_decode(data, &offset, size);
     143                c = str_decode(data, &offset, size);
    57144                printf("%lc", (wint_t) c);
    58145        }
    59146}
    60147
    61 static int print_item_val(char *ipath)
     148
     149static void print_syntax(void)
    62150{
    63         sysarg_t value;
    64         int rc = sysinfo_get_value(ipath, &value);
    65         if (rc != EOK) {
    66                 printf("Error reading item '%s'.\n", ipath);
    67                 return rc;
    68         }
    69        
    70         printf("%s -> %" PRIu64 " (0x%" PRIx64 ")\n", ipath,
    71             (uint64_t) value, (uint64_t) value);
    72        
    73         return EOK;
    74 }
    75 
    76 static int print_item_data(char *ipath)
    77 {
    78         size_t size;
    79         void *data = sysinfo_get_data(ipath, &size);
    80         if (data == NULL) {
    81                 printf("Error reading item '%s'.\n", ipath);
    82                 return -1;
    83         }
    84        
    85         printf("%s -> ", ipath);
    86         dump_bytes_hex(data, size);
    87         fputs(" ('", stdout);
    88         dump_bytes_text(data, size);
    89         fputs("')\n", stdout);
    90        
    91         return EOK;
    92 }
    93 
    94 static int print_item_property(char *ipath, char *iprop)
    95 {
    96         size_t size;
    97         void *data = sysinfo_get_property(ipath, iprop, &size);
    98         if (data == NULL) {
    99                 printf("Error reading property '%s' of item '%s'.\n", iprop,
    100                     ipath);
    101                 return -1;
    102         }
    103        
    104         printf("%s property %s -> ", ipath, iprop);
    105         dump_bytes_hex(data, size);
    106         fputs(" ('", stdout);
    107         dump_bytes_text(data, size);
    108         fputs("')\n", stdout);
    109        
    110         return EOK;
    111 }
    112 
    113 static void print_spaces(size_t spaces)
    114 {
    115         for (size_t i = 0; i < spaces; i++)
    116                 printf(" ");
    117 }
    118 
    119 static void print_keys(const char *path, size_t spaces)
    120 {
    121         size_t size;
    122         char *keys = sysinfo_get_keys(path, &size);
    123         if ((keys == NULL) || (size == 0))
    124                 return;
    125        
    126         size_t pos = 0;
    127         while (pos < size) {
    128                 /* Process each key with sanity checks */
    129                 size_t cur_size = str_nsize(keys + pos, size - pos);
    130                 if (keys[pos + cur_size] != 0)
    131                         break;
    132                
    133                 size_t path_size = str_size(path) + cur_size + 2;
    134                 char *cur_path = (char *) malloc(path_size);
    135                 if (cur_path == NULL)
    136                         break;
    137                
    138                 size_t length;
    139                
    140                 if (path[0] != 0) {
    141                         print_spaces(spaces);
    142                         printf(".%s\n", keys + pos);
    143                         length = str_length(keys + pos) + 1;
    144                        
    145                         snprintf(cur_path, path_size, "%s.%s", path, keys + pos);
    146                 } else {
    147                         printf("%s\n", keys + pos);
    148                         length = str_length(keys + pos);
    149                        
    150                         snprintf(cur_path, path_size, "%s", keys + pos);
    151                 }
    152                
    153                 print_keys(cur_path, spaces + length);
    154                
    155                 free(cur_path);
    156                 pos += cur_size + 1;
    157         }
    158        
    159         free(keys);
    160 }
    161 
    162 int main(int argc, char *argv[])
    163 {
    164         int rc = 0;
    165        
    166         if (argc < 2) {
    167                 /* Print keys */
    168                 print_keys("", 0);
    169                 return rc;
    170         }
    171        
    172         char *ipath = argv[1];
    173        
    174         if (argc < 3) {
    175                 sysinfo_item_val_type_t tag = sysinfo_get_val_type(ipath);
    176                
    177                 switch (tag) {
    178                 case SYSINFO_VAL_UNDEFINED:
    179                         printf("Error: Sysinfo item '%s' not defined.\n", ipath);
    180                         rc = 2;
    181                         break;
    182                 case SYSINFO_VAL_VAL:
    183                         rc = print_item_val(ipath);
    184                         break;
    185                 case SYSINFO_VAL_DATA:
    186                         rc = print_item_data(ipath);
    187                         break;
    188                 default:
    189                         printf("Error: Sysinfo item '%s' with unknown value type.\n",
    190                             ipath);
    191                         rc = 2;
    192                         break;
    193                 }
    194                
    195                 return rc;
    196         }
    197        
    198         char *iprop = argv[2];
    199         rc = print_item_property(ipath, iprop);
    200         return rc;
     151        printf("Syntax: sysinfo <item_path>\n");
    201152}
    202153
  • uspace/drv/bus/usb/ehci/Makefile

    r14f8fd4 r43cd499  
    4343SOURCES = \
    4444        main.c \
    45         res.c
     45        pci.c
    4646
    4747include $(USPACE_PREFIX)/Makefile.common
  • uspace/drv/bus/usb/ehci/main.c

    r14f8fd4 r43cd499  
    4444#include <usb/host/hcd.h>
    4545
    46 #include "res.h"
     46#include "pci.h"
    4747
    4848#define NAME "ehci"
     
    8181        int irq = 0;
    8282
    83         int ret = get_my_registers(device, &reg_base, &reg_size, &irq);
     83        int ret = pci_get_my_registers(device, &reg_base, &reg_size, &irq);
    8484        CHECK_RET_RETURN(ret,
    8585            "Failed to get memory addresses for %" PRIun ": %s.\n",
     
    8888            reg_base, reg_size, irq);
    8989
    90         ret = disable_legacy(device, reg_base, reg_size);
     90        ret = pci_disable_legacy(device, reg_base, reg_size, irq);
    9191        CHECK_RET_RETURN(ret,
    9292            "Failed to disable legacy USB: %s.\n", str_error(ret));
  • uspace/drv/bus/usb/ohci/Makefile

    r14f8fd4 r43cd499  
    5050        ohci_batch.c \
    5151        ohci_endpoint.c \
    52         res.c \
     52        pci.c \
    5353        root_hub.c \
    5454        hw_struct/endpoint_descriptor.c \
  • uspace/drv/bus/usb/ohci/hw_struct/hcca.h

    r14f8fd4 r43cd499  
    4646        uint16_t pad1;
    4747        uint32_t done_head;
    48         uint32_t reserved[30];
    49 } hcca_t;
     48        uint32_t reserved[29];
     49} __attribute__((packed, aligned)) hcca_t;
    5050
    5151static inline void * hcca_get(void)
  • uspace/drv/bus/usb/ohci/ohci.c

    r14f8fd4 r43cd499  
    4242
    4343#include "ohci.h"
    44 #include "res.h"
     44#include "pci.h"
    4545#include "hc.h"
    4646
     
    180180        int irq = 0;
    181181
    182         ret = get_my_registers(device, &reg_base, &reg_size, &irq);
     182        ret = pci_get_my_registers(device, &reg_base, &reg_size, &irq);
    183183        CHECK_RET_DEST_FREE_RETURN(ret,
    184184            "Failed to get register memory addresses for %" PRIun ": %s.\n",
     
    211211        /* Try to enable interrupts */
    212212        bool interrupts = false;
    213         ret = enable_interrupts(device);
     213        ret = pci_enable_interrupts(device);
    214214        if (ret != EOK) {
    215215                usb_log_warning("Failed to enable interrupts: %s."
  • uspace/drv/bus/usb/uhci/Makefile

    r14f8fd4 r43cd499  
    4444        hc.c \
    4545        main.c \
    46         res.c \
     46        pci.c \
    4747        root_hub.c \
    4848        transfer_list.c \
  • uspace/drv/bus/usb/uhci/uhci.c

    r14f8fd4 r43cd499  
    4141
    4242#include "uhci.h"
    43 
    44 #include "res.h"
     43#include "pci.h"
     44
    4545#include "hc.h"
    4646#include "root_hub.h"
     
    4949 * and USB root hub */
    5050typedef struct uhci {
    51         /** Pointer to DDF representation of UHCI host controller */
     51        /** Pointer to DDF represenation of UHCI host controller */
    5252        ddf_fun_t *hc_fun;
    53         /** Pointer to DDF representation of UHCI root hub */
     53        /** Pointer to DDF represenation of UHCI root hub */
    5454        ddf_fun_t *rh_fun;
    5555
    56         /** Internal driver's representation of UHCI host controller */
     56        /** Internal driver's represenation of UHCI host controller */
    5757        hc_t hc;
    58         /** Internal driver's representation of UHCI root hub */
     58        /** Internal driver's represenation of UHCI root hub */
    5959        rh_t rh;
    6060} uhci_t;
     
    187187        int irq = 0;
    188188
    189         ret = get_my_registers(device, &reg_base, &reg_size, &irq);
     189        ret = pci_get_my_registers(device, &reg_base, &reg_size, &irq);
    190190        CHECK_RET_DEST_FREE_RETURN(ret,
    191191            "Failed to get I/O addresses for %" PRIun ": %s.\n",
     
    194194            (void *) reg_base, reg_size, irq);
    195195
    196         ret = disable_legacy(device);
     196        ret = pci_disable_legacy(device);
    197197        CHECK_RET_DEST_FREE_RETURN(ret,
    198198            "Failed to disable legacy USB: %s.\n", str_error(ret));
     
    220220
    221221        bool interrupts = false;
    222         ret = enable_interrupts(device);
     222        ret = pci_enable_interrupts(device);
    223223        if (ret != EOK) {
    224224                usb_log_warning("Failed to enable interrupts: %s."
  • uspace/lib/c/arch/amd64/include/fibril.h

    r14f8fd4 r43cd499  
    3838#include <sys/types.h>
    3939
    40 /*
    41  * According to ABI the stack MUST be aligned on
     40/* According to ABI the stack MUST be aligned on
    4241 * 16-byte boundary. If it is not, the va_arg calling will
    4342 * panic sooner or later
    4443 */
    45 #define SP_DELTA  16
     44#define SP_DELTA     16
    4645
    4746#define context_set(c, _pc, stack, size, ptls) \
  • uspace/lib/c/arch/arm32/include/fibril.h

    r14f8fd4 r43cd499  
    2727 */
    2828
    29 /** @addtogroup libcarm32
     29/** @addtogroup libcarm32       
    3030 * @{
    3131 */
     
    4242
    4343/** Size of a stack item */
    44 #define STACK_ITEM_SIZE  4
     44#define STACK_ITEM_SIZE         4
    4545
    4646/** Stack alignment - see <a href="http://www.arm.com/support/faqdev/14269.html">ABI</a> for details */
    47 #define STACK_ALIGNMENT  8
     47#define STACK_ALIGNMENT         8
    4848
    49 #define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
     49#define SP_DELTA        (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    5050
    5151
    52 /** Sets data to the context.
    53  *
     52/** Sets data to the context. 
     53 * 
    5454 *  @param c     Context (#context_t).
    5555 *  @param _pc   Program counter.
     
    6262                (c)->pc = (sysarg_t) (_pc); \
    6363                (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
    64                 (c)->tls = ((sysarg_t)(ptls)) + sizeof(tcb_t) + ARM_TP_OFFSET; \
     64                (c)->tls = ((sysarg_t)(ptls)) + sizeof(tcb_t) + ARM_TP_OFFSET; \
    6565                (c)->fp = 0; \
    6666        } while (0)
    6767
    68 /** Fibril context.
     68/** Fibril context. 
    6969 *
    7070 *  Only registers preserved accross function calls are included. r9 is used
     
    9191}
    9292
     93
    9394#endif
    9495
  • uspace/lib/c/arch/ia32/include/fibril.h

    r14f8fd4 r43cd499  
    3838#include <sys/types.h>
    3939
    40 /*
    41  * According to ABI the stack MUST be aligned on
     40/* According to ABI the stack MUST be aligned on
    4241 * 16-byte boundary. If it is not, the va_arg calling will
    4342 * panic sooner or later
  • uspace/lib/c/arch/ia64/include/fibril.h

    r14f8fd4 r43cd499  
    2727 */
    2828
    29 /** @addtogroup libcia64
     29/** @addtogroup libcia64       
    3030 * @{
    3131 */
     
    4545 * No need to allocate scratch area.
    4646 */
    47 #define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
     47#define SP_DELTA        (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    4848
    49 #define PFM_MASK  (~0x3fffffffff)
     49#define PFM_MASK        (~0x3fffffffff)
    5050
    51 #define PSTHREAD_INITIAL_STACK_PAGES_NO  2
     51#define PSTHREAD_INITIAL_STACK_PAGES_NO 2
     52/* Stack is divided into two equal parts (for memory stack and register stack). */
     53#define PSTHREAD_INITIAL_STACK_DIVISION 2 
    5254
    53 /* Stack is divided into two equal parts (for memory stack and register stack). */
    54 #define PSTHREAD_INITIAL_STACK_DIVISION  2
    55 
    56 #define context_set(c, _pc, stack, size, tls) \
    57         do { \
    58                 (c)->pc = (uint64_t) _pc; \
    59                 (c)->bsp = ((uint64_t) stack) + \
    60                     size / PSTHREAD_INITIAL_STACK_DIVISION; \
    61                 (c)->ar_pfs &= PFM_MASK; \
    62                 (c)->sp = ((uint64_t) stack) + \
    63                     ALIGN_UP((size / PSTHREAD_INITIAL_STACK_DIVISION), STACK_ALIGNMENT) - \
    64                     SP_DELTA; \
    65                 (c)->tp = (uint64_t) tls; \
    66         } while (0)
     55#define context_set(c, _pc, stack, size, tls)                                                           \
     56        do {                                                                                            \
     57                (c)->pc = (uint64_t) _pc;                                                               \
     58                (c)->bsp = ((uint64_t) stack) + size / PSTHREAD_INITIAL_STACK_DIVISION;                                                         \
     59                (c)->ar_pfs &= PFM_MASK;                                                                \
     60                (c)->sp = ((uint64_t) stack) + ALIGN_UP((size / PSTHREAD_INITIAL_STACK_DIVISION), STACK_ALIGNMENT) - SP_DELTA;          \
     61                (c)->tp = (uint64_t) tls;                                                               \
     62        } while (0);
     63       
    6764
    6865/*
  • uspace/lib/c/arch/mips32/Makefile.inc

    r14f8fd4 r43cd499  
    2828
    2929ARCH_SOURCES = \
    30         arch/$(UARCH)/src/entry.S \
    31         arch/$(UARCH)/src/entryjmp.S \
    32         arch/$(UARCH)/src/thread_entry.S \
     30        arch/$(UARCH)/src/entry.s \
     31        arch/$(UARCH)/src/entryjmp.s \
     32        arch/$(UARCH)/src/thread_entry.s \
    3333        arch/$(UARCH)/src/syscall.c \
    3434        arch/$(UARCH)/src/fibril.S \
  • uspace/lib/c/arch/mips32/include/atomic.h

    r14f8fd4 r43cd499  
    6767                "       ll %0, %1\n"
    6868                "       addu %0, %0, %3\n"      /* same as add, but never traps on overflow */
    69                 "       move %2, %0\n"
     69                "       move %2, %0\n"
    7070                "       sc %0, %1\n"
    7171                "       beq %0, %4, 1b\n"       /* if the atomic operation failed, try again */
  • uspace/lib/c/arch/mips32/include/config.h

    r14f8fd4 r43cd499  
    3636#define LIBC_mips32_CONFIG_H_
    3737
    38 #define PAGE_WIDTH  14
    39 #define PAGE_SIZE   (1 << PAGE_WIDTH)
     38#define PAGE_WIDTH      14
     39#define PAGE_SIZE       (1 << PAGE_WIDTH)
    4040
    4141#endif
  • uspace/lib/c/arch/mips32/include/faddr.h

    r14f8fd4 r43cd499  
    3838#include <libarch/types.h>
    3939
    40 #define FADDR(fptr)  ((uintptr_t) (fptr))
     40#define FADDR(fptr)             ((uintptr_t) (fptr))
    4141
    4242#endif
  • uspace/lib/c/arch/mips32/include/fibril.h

    r14f8fd4 r43cd499  
    3838
    3939#include <sys/types.h>
    40 #include <libarch/stack.h>
    41 #include <align.h>
    4240
    43 #define SP_DELTA  (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    44 
    45 /*
    46  * We define our own context_set, because we need to set
    47  * the TLS pointer to the tcb + 0x7000
     41/* We define our own context_set, because we need to set
     42 * the TLS pointer to the tcb+0x7000
    4843 *
    4944 * See tls_set in thread.h
    5045 */
    51 #define context_set(c, _pc, stack, size, ptls) \
    52         do { \
    53                 (c)->pc = (sysarg_t) (_pc); \
    54                 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
    55                 (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t); \
    56         } while (0)
     46#define context_set(c, _pc, stack, size, ptls)                  \
     47        (c)->pc = (sysarg_t) (_pc);                             \
     48        (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA;     \
     49        (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t);
     50
     51
     52/* +16 is just for sure that the called function
     53 * have space to store it's arguments
     54 */
     55#define SP_DELTA        (8+16)
    5756
    5857typedef struct  {
  • uspace/lib/c/arch/mips32/src/fibril.S

    r14f8fd4 r43cd499  
    3333
    3434#include <libarch/context_offset.h>
    35 
     35       
    3636.global context_save
    3737.global context_restore
    38 
     38       
    3939context_save:
    4040        CONTEXT_SAVE_ARCH_CORE $a0
    41        
     41
    4242        # context_save returns 1
    4343        j $ra
    44         li $v0, 1
    45 
     44        li $v0, 1       
     45       
    4646context_restore:
    4747        CONTEXT_RESTORE_ARCH_CORE $a0
    48        
    49         # Just for the jump into first function,
    50         # but one instruction should not bother us
    51         move $t9, $ra
    52        
     48
     49        # Just for the jump into first function, but one instruction
     50        # should not bother us
     51        move $t9, $ra   
    5352        # context_restore returns 0
    5453        j $ra
    55         xor $v0, $v0
     54        xor $v0, $v0   
     55
  • uspace/lib/c/arch/mips32/src/syscall.c

    r14f8fd4 r43cd499  
    5757                  "r" (__mips_reg_t1),
    5858                  "r" (__mips_reg_v0)
    59                 /*
    60                  * We are a function call, although C
    61                  * does not know it.
    62                  */
    63                 : "%ra"
     59                : "%ra" /* We are a function call, although C does not
     60                         * know it */
    6461        );
    6562       
  • uspace/lib/c/arch/mips32eb/Makefile.inc

    r14f8fd4 r43cd499  
    2828
    2929ARCH_SOURCES = \
    30         arch/$(UARCH)/src/entry.S \
    31         arch/$(UARCH)/src/entryjmp.S \
    32         arch/$(UARCH)/src/thread_entry.S \
     30        arch/$(UARCH)/src/entry.s \
     31        arch/$(UARCH)/src/entryjmp.s \
     32        arch/$(UARCH)/src/thread_entry.s \
    3333        arch/$(UARCH)/src/syscall.c \
    3434        arch/$(UARCH)/src/fibril.S \
  • uspace/lib/c/arch/mips64/Makefile.inc

    r14f8fd4 r43cd499  
    2828
    2929ARCH_SOURCES = \
    30         arch/$(UARCH)/src/entry.S \
    31         arch/$(UARCH)/src/entryjmp.S \
    32         arch/$(UARCH)/src/thread_entry.S \
     30        arch/$(UARCH)/src/entry.s \
     31        arch/$(UARCH)/src/entryjmp.s \
     32        arch/$(UARCH)/src/thread_entry.s \
    3333        arch/$(UARCH)/src/syscall.c \
    3434        arch/$(UARCH)/src/fibril.S \
  • uspace/lib/c/arch/mips64/include/fibril.h

    r14f8fd4 r43cd499  
    3838
    3939#include <sys/types.h>
    40 #include <libarch/stack.h>
    41 #include <align.h>
    4240
    43 #define SP_DELTA  (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    44 
    45 /*
    46  * We define our own context_set, because we need to set
    47  * the TLS pointer to the tcb + 0x7000
     41/* We define our own context_set, because we need to set
     42 * the TLS pointer to the tcb+0x7000
    4843 *
    4944 * See tls_set in thread.h
    5045 */
    5146#define context_set(c, _pc, stack, size, ptls) \
    52         do { \
    53                 (c)->pc = (sysarg_t) (_pc); \
    54                 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
    55                 (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t); \
    56         } while (0)
     47        (c)->pc = (sysarg_t) (_pc); \
     48        (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
     49        (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t);
     50
     51/* +16 is just for sure that the called function
     52 * have space to store it's arguments
     53 */
     54#define SP_DELTA  (8 + 16)
    5755
    5856typedef struct {
  • uspace/lib/c/arch/ppc32/include/fibril.h

    r14f8fd4 r43cd499  
    2727 */
    2828
    29 /** @addtogroup libcppc32
     29/** @addtogroup libcppc32       
    3030 * @{
    3131 */
     
    3838#include <sys/types.h>
    3939
    40 #define SP_DELTA  16
    41 
    42 /*
    43  * We define our own context_set, because we need to set
    44  * the TLS pointer to the tcb + 0x7000
     40/* We define our own context_set, because we need to set
     41 * the TLS pointer to the tcb+0x7000
    4542 *
    4643 * See tls_set in thread.h
    4744 */
    48 #define context_set(c, _pc, stack, size, ptls) \
    49         do { \
    50                 (c)->pc = (sysarg_t) (_pc); \
    51                 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
    52                 (c)->tls = ((sysarg_t) (ptls)) + 0x7000 + sizeof(tcb_t); \
    53         } while (0)
     45#define context_set(c, _pc, stack, size, ptls)                  \
     46        (c)->pc = (sysarg_t) (_pc);                             \
     47        (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA;     \
     48        (c)->tls = ((sysarg_t) (ptls)) + 0x7000 + sizeof(tcb_t);
     49
     50#define SP_DELTA        16
    5451
    5552typedef struct {
  • uspace/lib/c/arch/sparc64/include/fibril.h

    r14f8fd4 r43cd499  
    4040#include <align.h>
    4141
    42 #define SP_DELTA  (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE)
     42#define SP_DELTA        (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE)
    4343
    4444#define context_set(c, _pc, stack, size, ptls) \
     
    5050                (c)->tp = (uint64_t) ptls; \
    5151        } while (0)
    52 
     52       
    5353/*
    5454 * Save only registers that must be preserved across
  • uspace/lib/c/generic/str.c

    r14f8fd4 r43cd499  
    259259       
    260260        return offset;
    261 }
    262 
    263 /** Get size of string with size limit.
    264  *
    265  * Get the number of bytes which are used by the string @a str
    266  * (excluding the NULL-terminator), but no more than @max_size bytes.
    267  *
    268  * @param str      String to consider.
    269  * @param max_size Maximum number of bytes to measure.
    270  *
    271  * @return Number of bytes used by the string
    272  *
    273  */
    274 size_t str_nsize(const char *str, size_t max_size)
    275 {
    276         size_t size = 0;
    277        
    278         while ((*str++ != 0) && (size < max_size))
    279                 size++;
    280        
    281         return size;
    282 }
    283 
    284 /** Get size of wide string with size limit.
    285  *
    286  * Get the number of bytes which are used by the wide string @a str
    287  * (excluding the NULL-terminator), but no more than @max_size bytes.
    288  *
    289  * @param str      Wide string to consider.
    290  * @param max_size Maximum number of bytes to measure.
    291  *
    292  * @return Number of bytes used by the wide string
    293  *
    294  */
    295 size_t wstr_nsize(const wchar_t *str, size_t max_size)
    296 {
    297         return (wstr_nlength(str, max_size) * sizeof(wchar_t));
    298261}
    299262
  • uspace/lib/c/generic/sysinfo.c

    r14f8fd4 r43cd499  
    4040#include <bool.h>
    4141
    42 /** Get sysinfo keys size
    43  *
    44  * @param path  Sysinfo path.
    45  * @param value Pointer to store the keys size.
    46  *
    47  * @return EOK if the keys were successfully read.
    48  *
    49  */
    50 static int sysinfo_get_keys_size(const char *path, size_t *size)
    51 {
    52         return (int) __SYSCALL3(SYS_SYSINFO_GET_KEYS_SIZE, (sysarg_t) path,
    53             (sysarg_t) str_size(path), (sysarg_t) size);
    54 }
    55 
    56 /** Get sysinfo keys
    57  *
    58  * @param path  Sysinfo path.
    59  * @param value Pointer to store the keys size.
    60  *
    61  * @return Keys read from sysinfo or NULL if the
    62  *         sysinfo item has no subkeys.
    63  *         The returned non-NULL pointer should be
    64  *         freed by free().
    65  *
    66  */
    67 char *sysinfo_get_keys(const char *path, size_t *size)
    68 {
    69         /*
    70          * The size of the keys might change during time.
    71          * Unfortunatelly we cannot allocate the buffer
    72          * and transfer the keys as a single atomic operation.
    73          */
    74        
    75         /* Get the keys size */
    76         int ret = sysinfo_get_keys_size(path, size);
    77         if ((ret != EOK) || (size == 0)) {
    78                 /*
    79                  * Item with no subkeys.
    80                  */
    81                 *size = 0;
    82                 return NULL;
    83         }
    84        
    85         char *data = malloc(*size);
    86         if (data == NULL) {
    87                 *size = 0;
    88                 return NULL;
    89         }
    90        
    91         /* Get the data */
    92         size_t sz;
    93         ret = __SYSCALL5(SYS_SYSINFO_GET_KEYS, (sysarg_t) path,
    94             (sysarg_t) str_size(path), (sysarg_t) data, (sysarg_t) *size,
    95             (sysarg_t) &sz);
    96         if (ret == EOK) {
    97                 *size = sz;
    98                 return data;
    99         }
    100        
    101         free(data);
    102         *size = 0;
    103         return NULL;
    104 }
    105 
    10642/** Get sysinfo item type
    10743 *
     
    13470/** Get sysinfo binary data size
    13571 *
    136  * @param path Sysinfo path.
    137  * @param size Pointer to store the binary data size.
     72 * @param path  Sysinfo path.
     73 * @param value Pointer to store the binary data size.
    13874 *
    13975 * @return EOK if the value was successfully read and
     
    14985/** Get sysinfo binary data
    15086 *
    151  * @param path Sysinfo path.
    152  * @param size Pointer to store the binary data size.
     87 * @param path  Sysinfo path.
     88 * @param value Pointer to store the binary data size.
    15389 *
    15490 * @return Binary data read from sysinfo or NULL if the
     
    198134}
    199135
    200 /** Get sysinfo property
    201  *
    202  * @param path Sysinfo path.
    203  * @param name Property name.
    204  * @param size Pointer to store the binary data size.
    205  *
    206  * @return Property value read from sysinfo or NULL if the
    207  *         sysinfo item value type is not binary data.
    208  *         The returned non-NULL pointer should be
    209  *         freed by free().
    210  *
    211  */
    212 void *sysinfo_get_property(const char *path, const char *name, size_t *size)
    213 {
    214         size_t total_size;
    215         void *data = sysinfo_get_data(path, &total_size);
    216         if ((data == NULL) || (total_size == 0)) {
    217                 *size = 0;
    218                 return NULL;
    219         }
    220        
    221         size_t pos = 0;
    222         while (pos < total_size) {
    223                 /* Process each property with sanity checks */
    224                 size_t cur_size = str_nsize(data + pos, total_size - pos);
    225                 if (((char *) data)[pos + cur_size] != 0)
    226                         break;
    227                
    228                 bool found = (str_cmp(data + pos, name) == 0);
    229                
    230                 pos += cur_size + 1;
    231                 if (pos >= total_size)
    232                         break;
    233                
    234                 /* Process value size */
    235                 size_t value_size;
    236                 memcpy(&value_size, data + pos, sizeof(value_size));
    237                
    238                 pos += sizeof(value_size);
    239                 if ((pos >= total_size) || (pos + value_size > total_size))
    240                         break;
    241                
    242                 if (found) {
    243                         void *value = malloc(value_size);
    244                         if (value == NULL)
    245                                 break;
    246                        
    247                         memcpy(value, data + pos, value_size);
    248                         free(data);
    249                        
    250                         *size = value_size;
    251                         return value;
    252                 }
    253                
    254                 pos += value_size;
    255         }
    256        
    257         free(data);
    258        
    259         *size = 0;
    260         return NULL;
    261 }
    262 
    263136/** @}
    264137 */
  • uspace/lib/c/include/fibril.h

    r14f8fd4 r43cd499  
    4141
    4242#define context_set_generic(c, _pc, stack, size, ptls) \
    43         do { \
    44                 (c)->pc = (sysarg_t) (_pc); \
    45                 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
    46                 (c)->tls = (sysarg_t) (ptls); \
    47         } while (0)
     43        (c)->pc = (sysarg_t) (_pc); \
     44        (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
     45        (c)->tls = (sysarg_t) (ptls);
    4846
    4947#define FIBRIL_SERIALIZED  1
  • uspace/lib/c/include/str.h

    r14f8fd4 r43cd499  
    6060extern size_t str_size(const char *str);
    6161extern size_t wstr_size(const wchar_t *str);
    62 
    63 extern size_t str_nsize(const char *str, size_t max_size);
    64 extern size_t wstr_nsize(const wchar_t *str, size_t max_size);
    6562
    6663extern size_t str_lsize(const char *str, size_t max_len);
  • uspace/lib/c/include/sysinfo.h

    r14f8fd4 r43cd499  
    4040#include <abi/sysinfo.h>
    4141
    42 extern char *sysinfo_get_keys(const char *, size_t *);
    4342extern sysinfo_item_val_type_t sysinfo_get_val_type(const char *);
    4443extern int sysinfo_get_value(const char *, sysarg_t *);
    4544extern void *sysinfo_get_data(const char *, size_t *);
    46 extern void *sysinfo_get_property(const char *, const char *, size_t *);
    4745
    4846#endif
  • uspace/srv/fs/exfat/exfat_bitmap.c

    r14f8fd4 r43cd499  
    4848
    4949
    50 int exfat_bitmap_is_free(exfat_bs_t *bs, service_id_t service_id,
     50int bitmap_is_free(exfat_bs_t *bs, service_id_t service_id,
    5151    exfat_cluster_t clst)
    5252{
     
    8989}
    9090
    91 int exfat_bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id,
     91int bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id,
    9292    exfat_cluster_t clst)
    9393{
     
    124124}
    125125
    126 int exfat_bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id,
     126int bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id,
    127127    exfat_cluster_t clst)
    128128{
     
    160160}
    161161
    162 int exfat_bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id,
     162int bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id,
    163163    exfat_cluster_t firstc, exfat_cluster_t count)
    164164{
     
    168168
    169169        while (clst < firstc + count ) {
    170                 rc = exfat_bitmap_set_cluster(bs, service_id, clst);
     170                rc = bitmap_set_cluster(bs, service_id, clst);
    171171                if (rc != EOK) {
    172172                        if (clst - firstc > 0)
    173                                 (void) exfat_bitmap_clear_clusters(bs, service_id,
     173                                (void) bitmap_clear_clusters(bs, service_id,
    174174                                    firstc, clst - firstc);
    175175                        return rc;
     
    180180}
    181181
    182 int exfat_bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id,
     182int bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id,
    183183    exfat_cluster_t firstc, exfat_cluster_t count)
    184184{
     
    188188
    189189        while (clst < firstc + count) {
    190                 rc = exfat_bitmap_clear_cluster(bs, service_id, clst);
     190                rc = bitmap_clear_cluster(bs, service_id, clst);
    191191                if (rc != EOK)
    192192                        return rc;
     
    196196}
    197197
    198 int exfat_bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id,
     198int bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id,
    199199    exfat_cluster_t *firstc, exfat_cluster_t count)
    200200{
     
    204204        while (startc < DATA_CNT(bs) + 2) {
    205205                endc = startc;
    206                 while (exfat_bitmap_is_free(bs, service_id, endc) == EOK) {
     206                while (bitmap_is_free(bs, service_id, endc) == EOK) {
    207207                        if ((endc - startc) + 1 == count) {
    208208                                *firstc = startc;
    209                                 return exfat_bitmap_set_clusters(bs, service_id, startc, count);
     209                                return bitmap_set_clusters(bs, service_id, startc, count);
    210210                        } else
    211211                                endc++;
     
    217217
    218218
    219 int exfat_bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep,
     219int bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep,
    220220    exfat_cluster_t count)
    221221{
    222222        if (nodep->firstc == 0) {
    223                 return exfat_bitmap_alloc_clusters(bs, nodep->idx->service_id,
     223                return bitmap_alloc_clusters(bs, nodep->idx->service_id,
    224224                    &nodep->firstc, count);
    225225        } else {
     
    228228
    229229                clst = lastc + 1;
    230                 while (exfat_bitmap_is_free(bs, nodep->idx->service_id, clst) == EOK) {
     230                while (bitmap_is_free(bs, nodep->idx->service_id, clst) == EOK) {
    231231                        if (clst - lastc == count){
    232                                 return exfat_bitmap_set_clusters(bs, nodep->idx->service_id,
     232                                return bitmap_set_clusters(bs, nodep->idx->service_id,
    233233                                    lastc + 1, count);
    234234                        } else
     
    240240
    241241
    242 int exfat_bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep,
     242int bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep,
    243243    exfat_cluster_t count)
    244244{
     
    247247        lastc -= count;
    248248
    249         return exfat_bitmap_clear_clusters(bs, nodep->idx->service_id, lastc + 1, count);
    250 }
    251 
    252 
    253 int exfat_bitmap_replicate_clusters(exfat_bs_t *bs, exfat_node_t *nodep)
     249        return bitmap_clear_clusters(bs, nodep->idx->service_id, lastc + 1, count);
     250}
     251
     252
     253int bitmap_replicate_clusters(exfat_bs_t *bs, exfat_node_t *nodep)
    254254{
    255255        int rc;
  • uspace/srv/fs/exfat/exfat_bitmap.h

    r14f8fd4 r43cd499  
    4242struct exfat_bs;
    4343
    44 extern int exfat_bitmap_alloc_clusters(struct exfat_bs *, service_id_t,
     44extern int bitmap_alloc_clusters(struct exfat_bs *, service_id_t,
    4545    exfat_cluster_t *, exfat_cluster_t);
    46 extern int exfat_bitmap_append_clusters(struct exfat_bs *, struct exfat_node *,
     46extern int bitmap_append_clusters(struct exfat_bs *, struct exfat_node *,
    4747    exfat_cluster_t);
    48 extern int exfat_bitmap_free_clusters(struct exfat_bs *, struct exfat_node *,
     48extern int bitmap_free_clusters(struct exfat_bs *, struct exfat_node *,
    4949    exfat_cluster_t);
    50 extern int exfat_bitmap_replicate_clusters(struct exfat_bs *, struct exfat_node *);
     50extern int bitmap_replicate_clusters(struct exfat_bs *, struct exfat_node *);
    5151
    52 extern int exfat_bitmap_is_free(struct exfat_bs *, service_id_t, exfat_cluster_t);
    53 extern int exfat_bitmap_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t);
    54 extern int exfat_bitmap_clear_cluster(struct exfat_bs *, service_id_t,
     52extern int bitmap_is_free(struct exfat_bs *, service_id_t, exfat_cluster_t);
     53extern int bitmap_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t);
     54extern int bitmap_clear_cluster(struct exfat_bs *, service_id_t,
    5555    exfat_cluster_t);
    5656
    57 extern int exfat_bitmap_set_clusters(struct exfat_bs *, service_id_t,
     57extern int bitmap_set_clusters(struct exfat_bs *, service_id_t,
    5858    exfat_cluster_t, exfat_cluster_t);
    59 extern int exfat_bitmap_clear_clusters(struct exfat_bs *, service_id_t,
     59extern int bitmap_clear_clusters(struct exfat_bs *, service_id_t,
    6060    exfat_cluster_t, exfat_cluster_t);
    6161
  • uspace/srv/fs/exfat/exfat_dentry.c

    r14f8fd4 r43cd499  
    130130}
    131131
    132 size_t exfat_utf16_length(const uint16_t *wstr)
     132size_t utf16_length(const uint16_t *wstr)
    133133{
    134134        size_t len = 0;
  • uspace/srv/fs/exfat/exfat_dentry.h

    r14f8fd4 r43cd499  
    160160extern bool exfat_valid_name(const char *);
    161161
    162 extern size_t exfat_utf16_length(const uint16_t *);
     162extern size_t utf16_length(const uint16_t *);
    163163
    164164
  • uspace/srv/fs/exfat/exfat_directory.c

    r14f8fd4 r43cd499  
    371371        ds.stream.valid_data_size = 0;
    372372        ds.stream.data_size = 0;
    373         ds.stream.name_size = exfat_utf16_length(wname);
     373        ds.stream.name_size = utf16_length(wname);
    374374        ds.stream.hash = host2uint16_t_le(exfat_name_hash(wname, uctable,
    375375            uctable_chars));
  • uspace/srv/fs/exfat/exfat_fat.c

    r14f8fd4 r43cd499  
    314314            clst++) {
    315315                /* Need to rewrite because of multiple exfat_bitmap_get calls */
    316                 if (exfat_bitmap_is_free(bs, service_id, clst) == EOK) {
     316                if (bitmap_is_free(bs, service_id, clst) == EOK) {
    317317                        /*
    318318                         * The cluster is free. Put it into our stack
     
    325325                                goto exit_error;
    326326                        found++;
    327                         rc = exfat_bitmap_set_cluster(bs, service_id, clst);
     327                        rc = bitmap_set_cluster(bs, service_id, clst);
    328328                        if (rc != EOK)
    329329                                goto exit_error;
     
    346346        /* If something wrong - free the clusters */
    347347        while (found--) {
    348                 (void) exfat_bitmap_clear_cluster(bs, service_id, lifo[found]);
     348                (void) bitmap_clear_cluster(bs, service_id, lifo[found]);
    349349                (void) exfat_set_cluster(bs, service_id, lifo[found], 0);
    350350        }
     
    378378                if (rc != EOK)
    379379                        return rc;
    380                 rc = exfat_bitmap_clear_cluster(bs, service_id, firstc);
     380                rc = bitmap_clear_cluster(bs, service_id, firstc);
    381381                if (rc != EOK)
    382382                        return rc;
  • uspace/srv/fs/exfat/exfat_ops.c

    r14f8fd4 r43cd499  
    405405
    406406        if (!nodep->fragmented) {
    407                 rc = exfat_bitmap_append_clusters(bs, nodep, clusters);
     407                rc = bitmap_append_clusters(bs, nodep, clusters);
    408408                if (rc != ENOSPC)
    409409                        return rc;
     
    411411                        nodep->fragmented = true;
    412412                        nodep->dirty = true;            /* need to sync node */
    413                         rc = exfat_bitmap_replicate_clusters(bs, nodep);
     413                        rc = bitmap_replicate_clusters(bs, nodep);
    414414                        if (rc != EOK)
    415415                                return rc;
     
    457457
    458458                clsts = prev_clsts - new_clsts;
    459                 rc = exfat_bitmap_free_clusters(bs, nodep, clsts);
     459                rc = bitmap_free_clusters(bs, nodep, clsts);
    460460                if (rc != EOK)
    461461                        return rc;
     
    704704                                nodep->firstc);
    705705                else
    706                         rc = exfat_bitmap_free_clusters(bs, nodep,
     706                        rc = bitmap_free_clusters(bs, nodep,
    707707                            ROUND_UP(nodep->size, BPC(bs)) / BPC(bs));
    708708        }
     
    758758
    759759        fibril_mutex_unlock(&parentp->idx->lock);
     760        if (rc != EOK)
     761                return rc;
     762
    760763        fibril_mutex_lock(&childp->idx->lock);
     764
    761765
    762766        childp->idx->pfc = parentp->firstc;
     
    14591463        }
    14601464
    1461         int rc2 = exfat_node_put(fn);
    1462         if (rc == EOK && rc2 != EOK)
    1463                 rc = rc2;
    1464 
     1465        (void) exfat_node_put(fn);
    14651466        return rc;
    14661467}
Note: See TracChangeset for help on using the changeset viewer.