Changeset b7fd2a0 in mainline for uspace/srv/net/udp/service.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (7 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/udp/service.c

    r36f0738 rb7fd2a0  
    7070 * @return EOK on success, ENOMEM if out of memory
    7171 */
    72 static int udp_cassoc_queue_msg(udp_cassoc_t *cassoc, inet_ep2_t *epp,
     72static errno_t udp_cassoc_queue_msg(udp_cassoc_t *cassoc, inet_ep2_t *epp,
    7373    udp_msg_t *msg)
    7474{
     
    123123 * @return EOK on soccess, ENOMEM if out of memory
    124124 */
    125 static int udp_cassoc_create(udp_client_t *client, udp_assoc_t *assoc,
     125static errno_t udp_cassoc_create(udp_client_t *client, udp_assoc_t *assoc,
    126126    udp_cassoc_t **rcassoc)
    127127{
     
    168168 *         is found.
    169169 */
    170 static int udp_cassoc_get(udp_client_t *client, sysarg_t id,
     170static errno_t udp_cassoc_get(udp_client_t *client, sysarg_t id,
    171171    udp_cassoc_t **rcassoc)
    172172{
     
    207207 * @return EOK on success or an error code
    208208 */
    209 static int udp_assoc_create_impl(udp_client_t *client, inet_ep2_t *epp,
     209static errno_t udp_assoc_create_impl(udp_client_t *client, inet_ep2_t *epp,
    210210    sysarg_t *rassoc_id)
    211211{
    212212        udp_assoc_t *assoc;
    213213        udp_cassoc_t *cassoc;
    214         int rc;
     214        errno_t rc;
    215215
    216216        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_create_impl");
     
    252252 * @return EOK on success, ENOENT if no such association is found
    253253 */
    254 static int udp_assoc_destroy_impl(udp_client_t *client, sysarg_t assoc_id)
     254static errno_t udp_assoc_destroy_impl(udp_client_t *client, sysarg_t assoc_id)
    255255{
    256256        udp_cassoc_t *cassoc;
    257         int rc;
     257        errno_t rc;
    258258
    259259        rc = udp_cassoc_get(client, assoc_id, &cassoc);
     
    278278 * @return EOK on success, ENOENT if no such association is found
    279279 */
    280 static int udp_assoc_set_nolocal_impl(udp_client_t *client, sysarg_t assoc_id)
     280static errno_t udp_assoc_set_nolocal_impl(udp_client_t *client, sysarg_t assoc_id)
    281281{
    282282        udp_cassoc_t *cassoc;
    283         int rc;
     283        errno_t rc;
    284284
    285285        rc = udp_cassoc_get(client, assoc_id, &cassoc);
     
    307307 * @return EOK on success or an error code
    308308 */
    309 static int udp_assoc_send_msg_impl(udp_client_t *client, sysarg_t assoc_id,
     309static errno_t udp_assoc_send_msg_impl(udp_client_t *client, sysarg_t assoc_id,
    310310    inet_ep_t *dest, void *data, size_t size)
    311311{
    312312        udp_msg_t msg;
    313313        udp_cassoc_t *cassoc;
    314         int rc;
     314        errno_t rc;
    315315
    316316        rc = udp_cassoc_get(client, assoc_id, &cassoc);
     
    365365        inet_ep2_t epp;
    366366        sysarg_t assoc_id;
    367         int rc;
     367        errno_t rc;
    368368
    369369        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_create_srv()");
     
    409409{
    410410        sysarg_t assoc_id;
    411         int rc;
     411        errno_t rc;
    412412
    413413        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_destroy_srv()");
     
    430430{
    431431        sysarg_t assoc_id;
    432         int rc;
     432        errno_t rc;
    433433
    434434        log_msg(LOG_DEFAULT, LVL_NOTE, "udp_assoc_set_nolocal_srv()");
     
    455455        sysarg_t assoc_id;
    456456        void *data;
    457         int rc;
     457        errno_t rc;
    458458
    459459        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send_msg_srv()");
     
    552552        udp_crcv_queue_entry_t *enext;
    553553        sysarg_t assoc_id;
    554         int rc;
     554        errno_t rc;
    555555
    556556        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_rmsg_info_srv()");
     
    601601        size_t size;
    602602        size_t off;
    603         int rc;
     603        errno_t rc;
    604604
    605605        log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_rmsg_read_srv()");
     
    752752 * @return EOK on success or an error code.
    753753 */
    754 int udp_service_init(void)
    755 {
    756         int rc;
     754errno_t udp_service_init(void)
     755{
     756        errno_t rc;
    757757        service_id_t sid;
    758758
Note: See TracChangeset for help on using the changeset viewer.