Changeset 6fa9a99d in mainline for uspace


Ignore:
Timestamp:
2014-01-05T17:50:01Z (11 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
91db0280
Parents:
208b5f5
Message:

Rename klog to kio

Location:
uspace
Files:
7 edited
4 moved

Legend:

Unmodified
Added
Removed
  • uspace/Makefile

    r208b5f5 r6fa9a99d  
    5050        app/kill \
    5151        app/killall \
    52         app/klog \
     52        app/kio \
    5353        app/loc \
    5454        app/logset \
  • uspace/app/kio/Makefile

    r208b5f5 r6fa9a99d  
    3131LIBS = $(LIBCLUI_PREFIX)/libclui.a
    3232EXTRA_CFLAGS = -I$(LIBCLUI_PREFIX)
    33 BINARY = klog
     33BINARY = kio
    3434
    3535SOURCES = \
    36         klog.c
     36        kio.c
    3737
    3838include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/kio/kio.c

    r208b5f5 r6fa9a99d  
    2727 */
    2828
    29 /** @addtogroup klog KLog
    30  * @brief HelenOS KLog
     29/** @addtogroup kio KIO
     30 * @brief HelenOS KIO
    3131 * @{
    3232 */
     
    4242#include <errno.h>
    4343#include <str_error.h>
    44 #include <io/klog.h>
     44#include <io/kio.h>
    4545#include <sysinfo.h>
    4646#include <malloc.h>
     
    5050#include <tinput.h>
    5151
    52 #define NAME       "klog"
    53 #define LOG_FNAME  "/log/klog"
     52#define NAME       "kio"
     53#define LOG_FNAME  "/log/kio"
    5454
    5555/* Producer/consumer buffers */
     
    6262static prodcons_t pc;
    6363
    64 /* Pointer to klog area */
    65 static wchar_t *klog;
    66 static size_t klog_length;
     64/* Pointer to kio area */
     65static wchar_t *kio;
     66static size_t kio_length;
    6767
    6868/* Notification mutex */
     
    7575 *
    7676 * @param length Number of characters to copy.
    77  * @param data   Pointer to the kernel klog buffer.
     77 * @param data   Pointer to the kernel kio buffer.
    7878 *
    7979 */
     
    142142/** Kernel notification handler
    143143 *
    144  * Receives kernel klog notifications.
     144 * Receives kernel kio notifications.
    145145 *
    146146 * @param callid IPC call ID
     
    156156         * starving.
    157157         *
    158          * Note: Usually the automatic masking of the klog
     158         * Note: Usually the automatic masking of the kio
    159159         * notifications on the kernel side does the trick
    160160         * of limiting the chance of accidentally copying
    161161         * the same data multiple times. However, due to
    162          * the non-blocking architecture of klog notifications,
     162         * the non-blocking architecture of kio notifications,
    163163         * this possibility cannot be generally avoided.
    164164         */
     
    166166        fibril_mutex_lock(&mtx);
    167167       
    168         size_t klog_start = (size_t) IPC_GET_ARG1(*call);
    169         size_t klog_len = (size_t) IPC_GET_ARG2(*call);
    170         size_t klog_stored = (size_t) IPC_GET_ARG3(*call);
    171        
    172         size_t offset = (klog_start + klog_len - klog_stored) % klog_length;
     168        size_t kio_start = (size_t) IPC_GET_ARG1(*call);
     169        size_t kio_len = (size_t) IPC_GET_ARG2(*call);
     170        size_t kio_stored = (size_t) IPC_GET_ARG3(*call);
     171       
     172        size_t offset = (kio_start + kio_len - kio_stored) % kio_length;
    173173       
    174174        /* Copy data from the ring buffer */
    175         if (offset + klog_stored >= klog_length) {
    176                 size_t split = klog_length - offset;
    177                
    178                 producer(split, klog + offset);
    179                 producer(klog_stored - split, klog);
     175        if (offset + kio_stored >= kio_length) {
     176                size_t split = kio_length - offset;
     177               
     178                producer(split, kio + offset);
     179                producer(kio_stored - split, kio);
    180180        } else
    181                 producer(klog_stored, klog + offset);
    182        
    183         event_unmask(EVENT_KLOG);
     181                producer(kio_stored, kio + offset);
     182       
     183        event_unmask(EVENT_KIO);
    184184        fibril_mutex_unlock(&mtx);
    185185}
     
    188188{
    189189        size_t pages;
    190         int rc = sysinfo_get_value("klog.pages", &pages);
    191         if (rc != EOK) {
    192                 fprintf(stderr, "%s: Unable to get number of klog pages\n",
     190        int rc = sysinfo_get_value("kio.pages", &pages);
     191        if (rc != EOK) {
     192                fprintf(stderr, "%s: Unable to get number of kio pages\n",
    193193                    NAME);
    194194                return rc;
     
    196196       
    197197        uintptr_t faddr;
    198         rc = sysinfo_get_value("klog.faddr", &faddr);
    199         if (rc != EOK) {
    200                 fprintf(stderr, "%s: Unable to get klog physical address\n",
     198        rc = sysinfo_get_value("kio.faddr", &faddr);
     199        if (rc != EOK) {
     200                fprintf(stderr, "%s: Unable to get kio physical address\n",
    201201                    NAME);
    202202                return rc;
     
    204204       
    205205        size_t size = pages * PAGE_SIZE;
    206         klog_length = size / sizeof(wchar_t);
     206        kio_length = size / sizeof(wchar_t);
    207207       
    208208        rc = physmem_map(faddr, pages, AS_AREA_READ | AS_AREA_CACHEABLE,
    209             (void *) &klog);
    210         if (rc != EOK) {
    211                 fprintf(stderr, "%s: Unable to map klog\n", NAME);
     209            (void *) &kio);
     210        if (rc != EOK) {
     211                fprintf(stderr, "%s: Unable to map kio\n", NAME);
    212212                return rc;
    213213        }
     
    215215        prodcons_initialize(&pc);
    216216        async_set_interrupt_received(notification_received);
    217         rc = event_subscribe(EVENT_KLOG, 0);
    218         if (rc != EOK) {
    219                 fprintf(stderr, "%s: Unable to register klog notifications\n",
     217        rc = event_subscribe(EVENT_KIO, 0);
     218        if (rc != EOK) {
     219                fprintf(stderr, "%s: Unable to register kio notifications\n",
    220220                    NAME);
    221221                return rc;
     
    236236
    237237        fibril_add_ready(fid);
    238         event_unmask(EVENT_KLOG);
    239         klog_update();
    240        
    241         tinput_set_prompt(input, "klog> ");
     238        event_unmask(EVENT_KIO);
     239        kio_update();
     240       
     241        tinput_set_prompt(input, "kio> ");
    242242
    243243        char *str;
     
    248248                }
    249249
    250                 klog_command(str, str_size(str));
     250                kio_command(str, str_size(str));
    251251                free(str);
    252252        }
  • uspace/app/trace/syscalls.c

    r208b5f5 r6fa9a99d  
    3838
    3939const sc_desc_t syscall_desc[] = {
    40     [SYS_KLOG] ={ "klog",                               3,      V_INT_ERRNO },
     40    [SYS_KIO] ={ "kio",                                 3,      V_INT_ERRNO },
    4141    [SYS_TLS_SET] = { "tls_set",                        1,      V_ERRNO },
    4242
  • uspace/lib/c/Makefile

    r208b5f5 r6fa9a99d  
    107107        generic/io/log.c \
    108108        generic/io/logctl.c \
    109         generic/io/klog.c \
     109        generic/io/kio.c \
    110110        generic/io/snprintf.c \
    111111        generic/io/vprintf.c \
  • uspace/lib/c/generic/assert.c

    r208b5f5 r6fa9a99d  
    3333#include <assert.h>
    3434#include <stdio.h>
    35 #include <io/klog.h>
     35#include <io/kio.h>
    3636#include <stdlib.h>
    3737#include <atomic.h>
     
    4444{
    4545        /*
    46          * Send the message safely to klog. Nested asserts should not occur.
     46         * Send the message safely to kio. Nested asserts should not occur.
    4747         */
    48         klog_printf("Assertion failed (%s) in file \"%s\", line %u.\n",
     48        kio_printf("Assertion failed (%s) in file \"%s\", line %u.\n",
    4949            cond, file, line);
    5050       
  • uspace/lib/c/generic/io/io.c

    r208b5f5 r6fa9a99d  
    4242#include <malloc.h>
    4343#include <async.h>
    44 #include <io/klog.h>
     44#include <io/kio.h>
    4545#include <vfs/vfs.h>
    4646#include <vfs/vfs_sess.h>
     
    5757        .error = true,
    5858        .eof = true,
    59         .klog = false,
     59        .kio = false,
    6060        .sess = NULL,
    6161        .btype = _IONBF,
     
    6767};
    6868
    69 static FILE stdout_klog = {
     69static FILE stdout_kio = {
    7070        .fd = -1,
    7171        .error = false,
    7272        .eof = false,
    73         .klog = true,
     73        .kio = true,
    7474        .sess = NULL,
    7575        .btype = _IOLBF,
     
    8181};
    8282
    83 static FILE stderr_klog = {
     83static FILE stderr_kio = {
    8484        .fd = -1,
    8585        .error = false,
    8686        .eof = false,
    87         .klog = true,
     87        .kio = true,
    8888        .sess = NULL,
    8989        .btype = _IONBF,
     
    113113                stdout = fdopen(1, "w");
    114114        } else {
    115                 stdout = &stdout_klog;
     115                stdout = &stdout_kio;
    116116                list_append(&stdout->link, &files);
    117117        }
     
    120120                stderr = fdopen(2, "w");
    121121        } else {
    122                 stderr = &stderr_klog;
     122                stderr = &stderr_kio;
    123123                list_append(&stderr->link, &files);
    124124        }
     
    267267        stream->error = false;
    268268        stream->eof = false;
    269         stream->klog = false;
     269        stream->kio = false;
    270270        stream->sess = NULL;
    271271        stream->need_sync = false;
     
    289289        stream->error = false;
    290290        stream->eof = false;
    291         stream->klog = false;
     291        stream->kio = false;
    292292        stream->sess = NULL;
    293293        stream->need_sync = false;
     
    314314       
    315315        if ((stream != &stdin_null)
    316             && (stream != &stdout_klog)
    317             && (stream != &stderr_klog))
     316            && (stream != &stdout_kio)
     317            && (stream != &stderr_kio))
    318318                free(stream);
    319319       
     
    382382                ssize_t wr;
    383383               
    384                 if (stream->klog)
    385                         wr = klog_write(buf + done, left);
     384                if (stream->kio)
     385                        wr = kio_write(buf + done, left);
    386386                else
    387387                        wr = write(stream->fd, buf + done, left);
     
    705705        _fflushbuf(stream);
    706706       
    707         if (stream->klog) {
    708                 klog_update();
     707        if (stream->kio) {
     708                kio_update();
    709709                return EOK;
    710710        }
     
    740740int fileno(FILE *stream)
    741741{
    742         if (stream->klog) {
     742        if (stream->kio) {
    743743                errno = EBADF;
    744744                return -1;
  • uspace/lib/c/generic/io/kio.c

    r208b5f5 r6fa9a99d  
    3939#include <unistd.h>
    4040#include <errno.h>
    41 #include <abi/klog.h>
    42 #include <io/klog.h>
     41#include <abi/kio.h>
     42#include <io/kio.h>
    4343#include <io/printf_core.h>
    4444
    45 size_t klog_write(const void *buf, size_t size)
     45size_t kio_write(const void *buf, size_t size)
    4646{
    47         ssize_t ret = (ssize_t) __SYSCALL3(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf, size);
     47        ssize_t ret = (ssize_t) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) buf, size);
    4848       
    4949        if (ret >= 0)
     
    5353}
    5454
    55 void klog_update(void)
     55void kio_update(void)
    5656{
    57         (void) __SYSCALL3(SYS_KLOG, KLOG_UPDATE, (uintptr_t) NULL, 0);
     57        (void) __SYSCALL3(SYS_KIO, KIO_UPDATE, (uintptr_t) NULL, 0);
    5858}
    5959
    60 void klog_command(const void *buf, size_t size)
     60void kio_command(const void *buf, size_t size)
    6161{
    62         (void) __SYSCALL3(SYS_KLOG, KLOG_COMMAND, (sysarg_t) buf, (sysarg_t) size);
     62        (void) __SYSCALL3(SYS_KIO, KIO_COMMAND, (sysarg_t) buf, (sysarg_t) size);
    6363}
    6464
    65 /** Print formatted text to klog.
     65/** Print formatted text to kio.
    6666 *
    6767 * @param fmt Format string
     
    7070 *
    7171 */
    72 int klog_printf(const char *fmt, ...)
     72int kio_printf(const char *fmt, ...)
    7373{
    7474        va_list args;
    7575        va_start(args, fmt);
    7676       
    77         int ret = klog_vprintf(fmt, args);
     77        int ret = kio_vprintf(fmt, args);
    7878       
    7979        va_end(args);
     
    8282}
    8383
    84 static int klog_vprintf_str_write(const char *str, size_t size, void *data)
     84static int kio_vprintf_str_write(const char *str, size_t size, void *data)
    8585{
    86         size_t wr = klog_write(str, size);
     86        size_t wr = kio_write(str, size);
    8787        return str_nlength(str, wr);
    8888}
    8989
    90 static int klog_vprintf_wstr_write(const wchar_t *str, size_t size, void *data)
     90static int kio_vprintf_wstr_write(const wchar_t *str, size_t size, void *data)
    9191{
    9292        size_t offset = 0;
     
    9898               
    9999                if (chr_encode(str[chars], buf, &sz, STR_BOUNDS(1)) == EOK)
    100                         klog_write(buf, sz);
     100                        kio_write(buf, sz);
    101101               
    102102                chars++;
     
    107107}
    108108
    109 /** Print formatted text to klog.
     109/** Print formatted text to kio.
    110110 *
    111111 * @param fmt Format string
     
    115115 *
    116116 */
    117 int klog_vprintf(const char *fmt, va_list ap)
     117int kio_vprintf(const char *fmt, va_list ap)
    118118{
    119119        printf_spec_t ps = {
    120                 klog_vprintf_str_write,
    121                 klog_vprintf_wstr_write,
     120                kio_vprintf_str_write,
     121                kio_vprintf_wstr_write,
    122122                NULL
    123123        };
  • uspace/lib/c/generic/private/stdio.h

    r208b5f5 r6fa9a99d  
    5353        int eof;
    5454       
    55         /** Klog indicator */
    56         int klog;
     55        /** KIO indicator */
     56        int kio;
    5757       
    5858        /** Session to the file provider */
  • uspace/lib/c/include/io/kio.h

    r208b5f5 r6fa9a99d  
    3333 */
    3434
    35 #ifndef LIBC_IO_KLOG_H_
    36 #define LIBC_IO_KLOG_H_
     35#ifndef LIBC_IO_KIO_H_
     36#define LIBC_IO_KIO_H_
    3737
    3838#include <sys/types.h>
     
    4040#include <io/verify.h>
    4141
    42 extern size_t klog_write(const void *, size_t);
    43 extern void klog_update(void);
    44 extern void klog_command(const void *, size_t);
    45 extern int klog_printf(const char *, ...)
     42extern size_t kio_write(const void *, size_t);
     43extern void kio_update(void);
     44extern void kio_command(const void *, size_t);
     45extern int kio_printf(const char *, ...)
    4646    PRINTF_ATTRIBUTE(1, 2);
    47 extern int klog_vprintf(const char *, va_list);
     47extern int kio_vprintf(const char *, va_list);
    4848
    4949#endif
  • uspace/lib/c/include/stdio.h

    r208b5f5 r6fa9a99d  
    4040#include <str.h>
    4141#include <io/verify.h>
    42 #include <abi/klog.h>
     42#include <abi/kio.h>
    4343
    4444#define EOF  (-1)
     
    5252                int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \
    5353                if (_n > 0) \
    54                         (void) __SYSCALL3(SYS_KLOG, KLOG_WRITE, (sysarg_t) _buf, str_size(_buf)); \
     54                        (void) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) _buf, str_size(_buf)); \
    5555        }
    5656
Note: See TracChangeset for help on using the changeset viewer.