Changeset b7fd2a0 in mainline for kernel/generic/src/mm


Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

Location:
kernel/generic/src/mm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/as.c

    r36f0738 rb7fd2a0  
    111111as_t *AS_KERNEL = NULL;
    112112
    113 NO_TRACE static int as_constructor(void *obj, unsigned int flags)
     113NO_TRACE static errno_t as_constructor(void *obj, unsigned int flags)
    114114{
    115115        as_t *as = (as_t *) obj;
     
    760760 *
    761761 */
    762 int as_area_resize(as_t *as, uintptr_t address, size_t size, unsigned int flags)
     762errno_t as_area_resize(as_t *as, uintptr_t address, size_t size, unsigned int flags)
    763763{
    764764        if (!IS_ALIGNED(address, PAGE_SIZE))
     
    969969 *
    970970 */
    971 int as_area_destroy(as_t *as, uintptr_t address)
     971errno_t as_area_destroy(as_t *as, uintptr_t address)
    972972{
    973973        mutex_lock(&as->lock);
     
    10851085 *
    10861086 */
    1087 int as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size,
     1087errno_t as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size,
    10881088    as_t *dst_as, unsigned int dst_flags_mask, uintptr_t *dst_base,
    10891089    uintptr_t bound)
     
    12481248 *
    12491249 */
    1250 int as_area_change_flags(as_t *as, unsigned int flags, uintptr_t address)
     1250errno_t as_area_change_flags(as_t *as, unsigned int flags, uintptr_t address)
    12511251{
    12521252        /* Flags for the new memory mapping */
     
    22082208}
    22092209
    2210 sysarg_t sys_as_area_resize(uintptr_t address, size_t size, unsigned int flags)
    2211 {
    2212         return (sysarg_t) as_area_resize(AS, address, size, 0);
    2213 }
    2214 
    2215 sysarg_t sys_as_area_change_flags(uintptr_t address, unsigned int flags)
    2216 {
    2217         return (sysarg_t) as_area_change_flags(AS, flags, address);
    2218 }
    2219 
    2220 sysarg_t sys_as_area_destroy(uintptr_t address)
    2221 {
    2222         return (sysarg_t) as_area_destroy(AS, address);
     2210sys_errno_t sys_as_area_resize(uintptr_t address, size_t size, unsigned int flags)
     2211{
     2212        return (sys_errno_t) as_area_resize(AS, address, size, 0);
     2213}
     2214
     2215sys_errno_t sys_as_area_change_flags(uintptr_t address, unsigned int flags)
     2216{
     2217        return (sys_errno_t) as_area_change_flags(AS, flags, address);
     2218}
     2219
     2220sys_errno_t sys_as_area_destroy(uintptr_t address)
     2221{
     2222        return (sys_errno_t) as_area_destroy(AS, address);
    22232223}
    22242224
  • kernel/generic/src/mm/backend_user.c

    r36f0738 rb7fd2a0  
    126126        IPC_SET_ARG5(data, pager_info->id3);
    127127
    128         int rc = ipc_req_internal(pager_info->pager, &data, (sysarg_t) true);
     128        errno_t rc = ipc_req_internal(pager_info->pager, &data, (sysarg_t) true);
    129129
    130130        if (rc != EOK) {
  • kernel/generic/src/mm/page.c

    r36f0738 rb7fd2a0  
    190190}
    191191
    192 int page_find_mapping(uintptr_t virt, uintptr_t *phys)
     192errno_t page_find_mapping(uintptr_t virt, uintptr_t *phys)
    193193{
    194194        page_table_lock(AS, true);
     
    215215 *
    216216 */
    217 sysarg_t sys_page_find_mapping(uintptr_t virt, uintptr_t *phys_ptr)
     217sys_errno_t sys_page_find_mapping(uintptr_t virt, uintptr_t *phys_ptr)
    218218{
    219219        uintptr_t phys;
    220         int rc = page_find_mapping(virt, &phys);
     220        errno_t rc = page_find_mapping(virt, &phys);
    221221        if (rc != EOK)
    222222                return rc;
    223223       
    224224        rc = copy_to_uspace(phys_ptr, &phys, sizeof(phys));
    225         return (sysarg_t) rc;
     225        return (sys_errno_t) rc;
    226226}
    227227
  • kernel/generic/src/mm/slab.c

    r36f0738 rb7fd2a0  
    608608 */
    609609NO_TRACE static void _slab_cache_create(slab_cache_t *cache, const char *name,
    610     size_t size, size_t align, int (*constructor)(void *obj,
     610    size_t size, size_t align, errno_t (*constructor)(void *obj,
    611611    unsigned int kmflag), size_t (*destructor)(void *obj), unsigned int flags)
    612612{
     
    662662 */
    663663slab_cache_t *slab_cache_create(const char *name, size_t size, size_t align,
    664     int (*constructor)(void *obj, unsigned int kmflag),
     664    errno_t (*constructor)(void *obj, unsigned int kmflag),
    665665    size_t (*destructor)(void *obj), unsigned int flags)
    666666{
Note: See TracChangeset for help on using the changeset viewer.