Changeset b7fd2a0 in mainline for uspace/lib/hound/include


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:
uspace/lib/hound/include/hound
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/hound/include/hound/client.h

    r36f0738 rb7fd2a0  
    5353void hound_context_destroy(hound_context_t *hound);
    5454
    55 int hound_context_set_main_stream_params(hound_context_t *hound,
     55errno_t hound_context_set_main_stream_params(hound_context_t *hound,
    5656    pcm_format_t format, size_t bsize);
    5757
    58 int hound_context_get_available_targets(hound_context_t *hound,
     58errno_t hound_context_get_available_targets(hound_context_t *hound,
    5959    const char ***names, size_t *count);
    60 int hound_context_get_connected_targets(hound_context_t *hound,
     60errno_t hound_context_get_connected_targets(hound_context_t *hound,
    6161    const char ***names, size_t *count);
    6262
    63 int hound_context_connect_target(hound_context_t *hound, const char* target);
    64 int hound_context_disconnect_target(hound_context_t *hound, const char* target);
     63errno_t hound_context_connect_target(hound_context_t *hound, const char* target);
     64errno_t hound_context_disconnect_target(hound_context_t *hound, const char* target);
    6565
    6666hound_stream_t *hound_stream_create(hound_context_t *hound, unsigned flags,
     
    6868void hound_stream_destroy(hound_stream_t *stream);
    6969
    70 int hound_stream_write(hound_stream_t *stream, const void *data, size_t size);
    71 int hound_stream_read(hound_stream_t *stream, void *data, size_t size);
    72 int hound_stream_drain(hound_stream_t *stream);
     70errno_t hound_stream_write(hound_stream_t *stream, const void *data, size_t size);
     71errno_t hound_stream_read(hound_stream_t *stream, void *data, size_t size);
     72errno_t hound_stream_drain(hound_stream_t *stream);
    7373
    74 int hound_write_main_stream(hound_context_t *hound,
     74errno_t hound_write_main_stream(hound_context_t *hound,
    7575    const void *data, size_t size);
    76 int hound_read_main_stream(hound_context_t *hound, void *data, size_t size);
    77 int hound_write_replace_main_stream(hound_context_t *hound,
     76errno_t hound_read_main_stream(hound_context_t *hound, void *data, size_t size);
     77errno_t hound_write_replace_main_stream(hound_context_t *hound,
    7878    const void *data, size_t size);
    79 int hound_write_immediate(hound_context_t *hound,
     79errno_t hound_write_immediate(hound_context_t *hound,
    8080    pcm_format_t format, const void *data, size_t size);
    8181
  • uspace/lib/hound/include/hound/protocol.h

    r36f0738 rb7fd2a0  
    6161void hound_service_disconnect(hound_sess_t *sess);
    6262
    63 int hound_service_register_context(hound_sess_t *sess,
     63errno_t hound_service_register_context(hound_sess_t *sess,
    6464    const char *name, bool record, hound_context_id_t *id);
    65 int hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id);
     65errno_t hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id);
    6666
    67 int hound_service_get_list(hound_sess_t *sess, const char ***ids, size_t *count,
     67errno_t hound_service_get_list(hound_sess_t *sess, const char ***ids, size_t *count,
    6868    int flags, const char *connection);
    6969
     
    7676 * @return Error code.
    7777 */
    78 static inline int hound_service_get_list_all(hound_sess_t *sess,
     78static inline errno_t hound_service_get_list_all(hound_sess_t *sess,
    7979    const char ***ids, size_t *count, int flags)
    8080{
     
    8282}
    8383
    84 int hound_service_connect_source_sink(hound_sess_t *sess, const char *source,
     84errno_t hound_service_connect_source_sink(hound_sess_t *sess, const char *source,
    8585    const char *sink);
    86 int hound_service_disconnect_source_sink(hound_sess_t *sess, const char *source,
     86errno_t hound_service_disconnect_source_sink(hound_sess_t *sess, const char *source,
    8787    const char *sink);
    8888
    89 int hound_service_stream_enter(async_exch_t *exch, hound_context_id_t id,
     89errno_t hound_service_stream_enter(async_exch_t *exch, hound_context_id_t id,
    9090    int flags, pcm_format_t format, size_t bsize);
    91 int hound_service_stream_drain(async_exch_t *exch);
    92 int hound_service_stream_exit(async_exch_t *exch);
     91errno_t hound_service_stream_drain(async_exch_t *exch);
     92errno_t hound_service_stream_exit(async_exch_t *exch);
    9393
    94 int hound_service_stream_write(async_exch_t *exch, const void *data, size_t size);
    95 int hound_service_stream_read(async_exch_t *exch, void *data, size_t size);
     94errno_t hound_service_stream_write(async_exch_t *exch, const void *data, size_t size);
     95errno_t hound_service_stream_read(async_exch_t *exch, void *data, size_t size);
    9696
    9797/* Server */
     
    100100typedef struct hound_server_iface {
    101101        /** Create new context */
    102         int (*add_context)(void *, hound_context_id_t *, const char *, bool);
     102        errno_t (*add_context)(void *, hound_context_id_t *, const char *, bool);
    103103        /** Destroy existing context */
    104         int (*rem_context)(void *, hound_context_id_t);
     104        errno_t (*rem_context)(void *, hound_context_id_t);
    105105        /** Query context direction */
    106106        bool (*is_record_context)(void *, hound_context_id_t);
    107107        /** Get string identifiers of specified objects */
    108         int (*get_list)(void *, const char ***, size_t *, const char *, int);
     108        errno_t (*get_list)(void *, const char ***, size_t *, const char *, int);
    109109        /** Create connection between source and sink */
    110         int (*connect)(void *, const char *, const char *);
     110        errno_t (*connect)(void *, const char *, const char *);
    111111        /** Destroy connection between source and sink */
    112         int (*disconnect)(void *, const char *, const char *);
     112        errno_t (*disconnect)(void *, const char *, const char *);
    113113        /** Create new stream tied to the context */
    114         int (*add_stream)(void *, hound_context_id_t, int, pcm_format_t, size_t,
     114        errno_t (*add_stream)(void *, hound_context_id_t, int, pcm_format_t, size_t,
    115115            void **);
    116116        /** Destroy existing stream */
    117         int (*rem_stream)(void *, void *);
     117        errno_t (*rem_stream)(void *, void *);
    118118        /** Block until the stream buffer is empty */
    119         int (*drain_stream)(void *);
     119        errno_t (*drain_stream)(void *);
    120120        /** Write new data to the stream */
    121         int (*stream_data_write)(void *, const void *, size_t);
     121        errno_t (*stream_data_write)(void *, const void *, size_t);
    122122        /** Read data from the stream */
    123         int (*stream_data_read)(void *, void *, size_t);
     123        errno_t (*stream_data_read)(void *, void *, size_t);
    124124        void *server;
    125125} hound_server_iface_t;
  • uspace/lib/hound/include/hound/server.h

    r36f0738 rb7fd2a0  
    4141
    4242typedef void (*dev_change_callback_t)(void);
    43 typedef int (*device_callback_t)(service_id_t, const char *);
     43typedef errno_t (*device_callback_t)(service_id_t, const char *);
    4444
    45 int hound_server_register(const char *name, service_id_t *id);
     45errno_t hound_server_register(const char *name, service_id_t *id);
    4646void hound_server_unregister(service_id_t id);
    47 int hound_server_set_device_change_callback(dev_change_callback_t cb);
    48 int hound_server_devices_iterate(device_callback_t callback);
     47errno_t hound_server_set_device_change_callback(dev_change_callback_t cb);
     48errno_t hound_server_devices_iterate(device_callback_t callback);
    4949
    5050#endif
Note: See TracChangeset for help on using the changeset viewer.