Changeset ce04ea44 in mainline for uspace/app


Ignore:
Timestamp:
2017-04-02T12:27:14Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d4067a7
Parents:
163fc09
Message:

Rename read() to vfs_read() and write() to vfs_write()

Location:
uspace/app
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    r163fc09 rce04ea44  
    251251                }
    252252               
    253                 bytes = read(fd, &pos, buff + copied_bytes, bytes_to_read);
     253                bytes = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read);
    254254                copied_bytes = 0;
    255255
  • uspace/app/bdsh/cmds/modules/cmp/cmp.c

    r163fc09 rce04ea44  
    9494                        ssize_t size;
    9595                        do {
    96                                 size = read(fd[i], &pos[i],
     96                                size = vfs_read(fd[i], &pos[i],
    9797                                    buffer[i] + offset[i],
    9898                                    CMP_BUFLEN - offset[i]);
    9999                                if (size < 0) {
    100                                         rc = errno;
     100                                        rc = size;
    101101                                        printf("Error reading from %s\n",
    102102                                            fn[i]);
  • uspace/app/bdsh/cmds/modules/cp/cp.c

    r163fc09 rce04ea44  
    413413        }
    414414
    415         while ((bytes = read(fd1, &posr, buff, blen)) > 0) {
    416                 if ((bytes = write(fd2, &posw, buff, bytes)) < 0)
     415        while ((bytes = vfs_read(fd1, &posr, buff, blen)) > 0) {
     416                if ((bytes = vfs_write(fd2, &posw, buff, bytes)) < 0)
    417417                        break;
    418418                copied += bytes;
     
    420420
    421421        if (bytes < 0) {
    422                 printf("\nError copying %s, (%d)\n", src, errno);
     422                printf("\nError copying %s, (%d)\n", src, bytes);
    423423                copied = bytes;
    424424        }
  • uspace/app/bdsh/cmds/modules/mkfile/mkfile.c

    r163fc09 rce04ea44  
    166166               
    167167                pos = file_size - 1;
    168                 rc2 = write(fd, &pos, &byte, sizeof(char));
     168                rc2 = vfs_write(fd, &pos, &byte, sizeof(char));
    169169                if (rc2 < 0) {
    170170                        vfs_put(fd);
     
    183183        while (total_written < file_size) {
    184184                to_write = min(file_size - total_written, BUFFER_SIZE);
    185                 rc = write(fd, &pos, buffer, to_write);
     185                rc = vfs_write(fd, &pos, buffer, to_write);
    186186                if (rc <= 0) {
    187187                        printf("%s: Error writing file (%d).\n", cmdname, errno);
  • uspace/app/sysinst/futil.c

    r163fc09 rce04ea44  
    7272
    7373        do {
    74                 nr = read(sf, &posr, buf, BUF_SIZE);
     74                nr = vfs_read(sf, &posr, buf, BUF_SIZE);
    7575                if (nr == 0)
    7676                        break;
     
    7878                        return EIO;
    7979
    80                 nw = write(df, &posw, buf, nr);
     80                nw = vfs_write(df, &posw, buf, nr);
    8181                if (nw <= 0)
    8282                        return EIO;
     
    178178        }
    179179
    180         nr = read(sf, (aoff64_t []) { 0 }, data, fsize);
     180        nr = vfs_read(sf, (aoff64_t []) { 0 }, data, fsize);
    181181        if (nr != (ssize_t)fsize) {
    182182                vfs_put(sf);
  • uspace/app/taskdump/elf_core.c

    r163fc09 rce04ea44  
    207207        }
    208208
    209         rc = write(fd, &pos, &elf_hdr, sizeof(elf_hdr));
     209        rc = vfs_write(fd, &pos, &elf_hdr, sizeof(elf_hdr));
    210210        if (rc != sizeof(elf_hdr)) {
    211211                printf("Failed writing ELF header.\n");
     
    215215
    216216        for (i = 0; i < n_ph; ++i) {
    217                 rc = write(fd, &pos, &p_hdr[i], sizeof(p_hdr[i]));
     217                rc = vfs_write(fd, &pos, &p_hdr[i], sizeof(p_hdr[i]));
    218218                if (rc != sizeof(p_hdr[i])) {
    219219                        printf("Failed writing program header.\n");
     
    232232        note.type = NT_PRSTATUS;
    233233
    234         rc = write(fd, &pos, &note, sizeof(elf_note_t));
     234        rc = vfs_write(fd, &pos, &note, sizeof(elf_note_t));
    235235        if (rc != sizeof(elf_note_t)) {
    236236                printf("Failed writing note header.\n");
     
    239239        }
    240240
    241         rc = write(fd, &pos, "CORE", note.namesz);
     241        rc = vfs_write(fd, &pos, "CORE", note.namesz);
    242242        if (rc != (ssize_t) note.namesz) {
    243243                printf("Failed writing note header.\n");
     
    248248        pos = ALIGN_UP(pos, word_size);
    249249
    250         rc = write(fd, &pos, &pr_status, sizeof(elf_prstatus_t));
     250        rc = vfs_write(fd, &pos, &pr_status, sizeof(elf_prstatus_t));
    251251        if (rc != sizeof(elf_prstatus_t)) {
    252252                printf("Failed writing register data.\n");
     
    310310                }
    311311
    312                 rc = write(fd, pos, buffer, to_copy);
     312                rc = vfs_write(fd, pos, buffer, to_copy);
    313313                if (rc != (ssize_t) to_copy) {
    314314                        printf("Failed writing memory contents.\n");
  • uspace/app/taskdump/symtab.c

    r163fc09 rce04ea44  
    8888        }
    8989
    90         rc = read(fd, &pos, &elf_hdr, sizeof(elf_header_t));
     90        rc = vfs_read(fd, &pos, &elf_hdr, sizeof(elf_header_t));
    9191        if (rc != sizeof(elf_header_t)) {
    9292                printf("failed reading elf header\n");
     
    306306        aoff64_t pos = elf_hdr->e_shoff + idx * sizeof(elf_section_header_t);
    307307
    308         rc = read(fd, &pos, sec_hdr, sizeof(elf_section_header_t));
     308        rc = vfs_read(fd, &pos, sec_hdr, sizeof(elf_section_header_t));
    309309        if (rc != sizeof(elf_section_header_t))
    310310                return EIO;
     
    335335        }
    336336
    337         rc = read(fd, &pos, *ptr, size);
     337        rc = vfs_read(fd, &pos, *ptr, size);
    338338        if (rc != (ssize_t) size) {
    339339                printf("failed reading chunk\n");
  • uspace/app/tester/mm/pager1.c

    r163fc09 rce04ea44  
    5353        (void) vfs_unlink_path(TEST_FILE);
    5454
    55         if (write(fd, (aoff64_t []) {0}, text, sizeof(text)) != sizeof(text)) {
     55        if (vfs_write(fd, (aoff64_t []) {0}, text, sizeof(text)) < 0) {
    5656                vfs_put(fd);
    5757                return NULL;
  • uspace/app/tester/vfs/vfs1.c

    r163fc09 rce04ea44  
    8585       
    8686        size_t size = sizeof(text);
    87         ssize_t cnt = write(fd0, &pos, text, size);
     87        ssize_t cnt = vfs_write(fd0, &pos, text, size);
    8888        if (cnt < 0)
    8989                return "write() failed";
     
    9494        char buf[BUF_SIZE];
    9595        TPRINTF("read..\n");
    96         while ((cnt = read(fd0, &pos, buf, BUF_SIZE))) {
     96        while ((cnt = vfs_read(fd0, &pos, buf, BUF_SIZE))) {
    9797                TPRINTF("read returns %zd\n", cnt);
    9898                if (cnt < 0)
  • uspace/app/viewer/viewer.c

    r163fc09 rce04ea44  
    126126        }
    127127
    128         ssize_t rd = read(fd, (aoff64_t []) {0}, tga, stat.size);
     128        ssize_t rd = vfs_read(fd, (aoff64_t []) {0}, tga, stat.size);
    129129        if ((rd < 0) || (rd != (ssize_t) stat.size)) {
    130130                free(tga);
  • uspace/app/websrv/websrv.c

    r163fc09 rce04ea44  
    240240        aoff64_t pos = 0;
    241241        while (true) {
    242                 ssize_t nr = read(fd, &pos, fbuf, BUFFER_SIZE);
     242                ssize_t nr = vfs_read(fd, &pos, fbuf, BUFFER_SIZE);
    243243                if (nr == 0)
    244244                        break;
Note: See TracChangeset for help on using the changeset viewer.