Changeset 23a0368 in mainline for uspace/app/bdsh/cmds


Ignore:
Timestamp:
2017-03-30T19:52:23Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ae7bfbbd
Parents:
b5b5d84
Message:

Rename stat() to vfs_stat_path() and fstat() to vfs_stat()

Location:
uspace/app/bdsh/cmds/modules
Files:
5 edited

Legend:

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

    rb5b5d84 r23a0368  
    3131#include <stdlib.h>
    3232#include <unistd.h>
    33 #include <sys/stat.h>
    3433#include <getopt.h>
    3534#include <str.h>
     
    214213                struct stat st;
    215214
    216                 if (fstat(fd, &st) != EOK) {
     215                if (vfs_stat(fd, &st) != EOK) {
    217216                        close(fd);
    218217                        free(buff);
    219                         printf("Unable to fstat %d\n", fd);
     218                        printf("Unable to vfs_stat %d\n", fd);
    220219                        return 1;
    221220                }
  • uspace/app/bdsh/cmds/modules/cp/cp.c

    rb5b5d84 r23a0368  
    3737#include <fcntl.h>
    3838#include <sys/stat.h>
     39#include <vfs/vfs.h>
    3940#include <dirent.h>
    4041#include "config.h"
     
    8384        struct stat s;
    8485
    85         int r = stat(path, &s);
    86 
    87         if (r != 0)
     86        int r = vfs_stat_path(path, &s);
     87
     88        if (r != EOK)
    8889                return TYPE_NONE;
    8990        else if (s.is_directory)
     
    341342
    342343                        /* Check if we are copying a directory into itself */
    343                         stat(src_dent, &src_s);
    344                         stat(dest_path, &dest_s);
     344                        vfs_stat_path(src_dent, &src_s);
     345                        vfs_stat_path(dest_path, &dest_s);
    345346
    346347                        if (dest_s.index == src_s.index &&
     
    394395        }
    395396
    396         if (fstat(fd1, &st) != EOK) {
     397        if (vfs_stat(fd1, &st) != EOK) {
    397398                printf("Unable to fstat %d\n", fd1);
    398399                close(fd1);
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    rb5b5d84 r23a0368  
    3939#include <getopt.h>
    4040#include <sys/types.h>
    41 #include <sys/stat.h>
     41#include <vfs/vfs.h>
    4242#include <str.h>
    4343#include <sort.h>
     
    185185                buff[len] = '\0';
    186186
    187                 rc = stat(buff, &tosort[nbdirs++].s);
    188                 if (rc != 0) {
     187                rc = vfs_stat_path(buff, &tosort[nbdirs++].s);
     188                if (rc != EOK) {
    189189                        printf("ls: skipping bogus node %s\n", buff);
    190                         printf("error=%d\n", errno);
     190                        printf("error=%d\n", rc);
    191191                        goto out;
    192192                }
     
    315315static unsigned int ls_scope(const char *path, struct dir_elem_t *de)
    316316{
    317         if (stat(path, &de->s) != 0) {
     317        if (vfs_stat_path(path, &de->s) != EOK) {
    318318                cli_error(CL_ENOENT, "%s", path);
    319319                return LS_BOGUS;
  • uspace/app/bdsh/cmds/modules/ls/ls.h

    rb5b5d84 r23a0368  
    11#ifndef LS_H
    22#define LS_H
     3
     4#include <vfs/vfs.h>
    35
    46/* Various values that can be returned by ls_scope() */
  • uspace/app/bdsh/cmds/modules/touch/touch.c

    rb5b5d84 r23a0368  
    4040#include <str.h>
    4141#include <getopt.h>
    42 #include <sys/stat.h>
    4342#include <errno.h>
     43#include <vfs/vfs.h>
    4444
    4545#include "config.h"
     
    123123               
    124124                /* Check whether file exists if -c (--no-create) option is given */
    125                 if ((!no_create) || ((no_create) && (stat(buff, &file_stat) == 0)))
     125                if ((!no_create) ||
     126                    ((no_create) && (vfs_stat_path(buff, &file_stat) == EOK))) {
    126127                        fd = open(buff, O_RDWR | O_CREAT);
     128                }
    127129               
    128130                if (fd < 0) {
Note: See TracChangeset for help on using the changeset viewer.