Changeset 39330200 in mainline


Ignore:
Timestamp:
2018-01-15T21:40:49Z (6 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:
ba29018
Parents:
d8023313
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-15 21:20:07)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-15 21:40:49)
Message:

Rename struct stat and struct statfs to vfs_stat_t and vfs_statfs_t,
respectively. They are nonstandard vestiges of times when native file API
was modeled after POSIX API.

Files:
23 edited

Legend:

Unmodified
Added
Removed
  • contrib/arch/uspace/srv/vfs/vfs.bp

    rd8023313 r39330200  
    129129        ?fstat {
    130130                tentative {
    131                         ?ipc_m_data_read /* struct stat */ {
     131                        ?ipc_m_data_read /* vfs_stat_t */ {
    132132                                alternative (fs; tmpfs; fat; devfs) {
    133133                                        [fnc.vfs_grab_phone] ;
    134134                                        !fs.stat {
    135                                                 !fs.ipc_m_data_read /* forward struct stat */
     135                                                !fs.ipc_m_data_read /* forward vfs_stat_t */
    136136                                        } ;
    137137                                        [fnc.vfs_release_phone]
     
    144144                ?ipc_m_data_write /* path */ ;
    145145                tentative {
    146                         ?ipc_m_data_read /* struct stat */ {
     146                        ?ipc_m_data_read /* vfs_stat_t */ {
    147147                                alternative (fs; tmpfs; fat; devfs) {
    148148                                        [fnc.vfs_lookup_internal] ;
    149149                                        tentative {
    150150                                                !fs.stat {
    151                                                         !fs.ipc_m_data_read /* forward struct stat */
     151                                                        !fs.ipc_m_data_read /* forward vfs_stat_t */
    152152                                                }
    153153                                        }
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    rd8023313 r39330200  
    215215
    216216        if (tail != CAT_FULL_FILE) {
    217                 struct stat st;
     217                vfs_stat_t st;
    218218
    219219                if (vfs_stat(fd, &st) != EOK) {
  • uspace/app/bdsh/cmds/modules/cp/cp.c

    rd8023313 r39330200  
    8080static dentry_type_t get_type(const char *path)
    8181{
    82         struct stat s;
     82        vfs_stat_t s;
    8383
    8484        errno_t r = vfs_stat_path(path, &s);
     
    340340                 */
    341341                while ((dp = readdir(dir))) {
    342                         struct stat src_s;
    343                         struct stat dest_s;
     342                        vfs_stat_t src_s;
     343                        vfs_stat_t dest_s;
    344344
    345345                        char src_dent[PATH_MAX];
     
    392392        char *buff = NULL;
    393393        aoff64_t posr = 0, posw = 0;
    394         struct stat st;
     394        vfs_stat_t st;
    395395
    396396        if (vb)
  • uspace/app/bdsh/cmds/modules/ls/ls.h

    rd8023313 r39330200  
    2323struct dir_elem_t {
    2424        char *name;
    25         struct stat s;
     25        vfs_stat_t s;
    2626};
    2727
  • uspace/app/bdsh/cmds/modules/touch/touch.c

    rd8023313 r39330200  
    8282        int longind;
    8383        bool no_create = false;
    84         struct stat file_stat;
     84        vfs_stat_t file_stat;
    8585        int fd = -1;
    8686        char *buff = NULL;
  • uspace/app/bdsh/compl.c

    rd8023313 r39330200  
    360360                                char *ent_path;
    361361                                asprintf(&ent_path, "%s/%s", *cs->path, dent->d_name);
    362                                 struct stat ent_stat;
     362                                vfs_stat_t ent_stat;
    363363                                if (vfs_stat_path(ent_path, &ent_stat) != EOK) {
    364364                                        /* Error */
  • uspace/app/df/df.c

    rd8023313 r39330200  
    5858static errno_t size_to_human_readable(uint64_t, size_t, char **);
    5959static void print_header(void);
    60 static errno_t print_statfs(struct statfs *, char *, char *);
     60static errno_t print_statfs(vfs_statfs_t *, char *, char *);
    6161static void print_usage(void);
    6262
     
    6464{
    6565        int optres, errflg = 0;
    66         struct statfs st;
     66        vfs_statfs_t st;
    6767        errno_t rc;
    6868
     
    147147}
    148148
    149 static errno_t print_statfs(struct statfs *st, char *name, char *mountpoint)
     149static errno_t print_statfs(vfs_statfs_t *st, char *name, char *mountpoint)
    150150{
    151151        uint64_t const used_blocks = st->f_blocks - st->f_bfree;
  • uspace/app/init/init.c

    rd8023313 r39330200  
    152152static errno_t srv_startl(const char *path, ...)
    153153{
    154         struct stat s;
     154        vfs_stat_t s;
    155155        if (vfs_stat_path(path, &s) != EOK) {
    156156                printf("%s: Unable to stat %s\n", NAME, path);
  • uspace/app/sysinst/futil.c

    rd8023313 r39330200  
    108108        DIR *dir;
    109109        struct dirent *de;
    110         struct stat s;
     110        vfs_stat_t s;
    111111        char *srcp, *destp;
    112112        errno_t rc;
     
    165165        size_t fsize;
    166166        char *data;
    167         struct stat st;
     167        vfs_stat_t st;
    168168
    169169        rc = vfs_lookup_open(srcp, WALK_REGULAR, MODE_READ, &sf);
  • uspace/app/viewer/viewer.c

    rd8023313 r39330200  
    115115                return false;
    116116       
    117         struct stat stat;
     117        vfs_stat_t stat;
    118118        rc = vfs_stat(fd, &stat);
    119119        if (rc != EOK) {
  • uspace/drv/bus/isa/isa.c

    rd8023313 r39330200  
    279279        errno_t rc;
    280280        size_t nread;
    281         struct stat st;
     281        vfs_stat_t st;
    282282
    283283        rc = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ, &fd);
  • uspace/lib/bithenge/src/failure.c

    rd8023313 r39330200  
    225225}
    226226
    227 errno_t bithenge_failure_fstat(int fd, struct stat *buf)
     227errno_t bithenge_failure_fstat(int fd, vfs_stat_t *buf)
    228228{
    229229        if (bithenge_should_fail()) {
  • uspace/lib/bithenge/src/failure.h

    rd8023313 r39330200  
    5252char *bithenge_failure_str_ndup(const char *, size_t);
    5353errno_t bithenge_failure_open(const char *, int);
    54 errno_t bithenge_failure_fstat(int, struct stat *);
     54errno_t bithenge_failure_fstat(int, vfs_stat_t *);
    5555
    5656#ifndef BITHENGE_FAILURE_DECLS_ONLY
  • uspace/lib/bithenge/src/file.c

    rd8023313 r39330200  
    102102        assert(out);
    103103
    104         struct stat stat;
     104        vfs_stat_t stat;
    105105        errno_t rc = vfs_stat(fd, &stat);
    106106        if (rc != EOK) {
  • uspace/lib/c/generic/io/io.c

    rd8023313 r39330200  
    814814        stream->ungetc_chars = 0;
    815815
    816         struct stat st;
     816        vfs_stat_t st;
    817817        switch (whence) {
    818818        case SEEK_SET:
  • uspace/lib/c/generic/vfs/mtab.c

    rd8023313 r39330200  
    4242#include <str.h>
    4343
    44 static void process_mp(const char *path, struct stat *stat, list_t *mtab_list)
     44static void process_mp(const char *path, vfs_stat_t *stat, list_t *mtab_list)
    4545{
    4646        mtab_ent_t *ent;
     
    5454        ent->service_id = stat->service_id;
    5555
    56         struct statfs stfs;
     56        vfs_statfs_t stfs;
    5757        if (vfs_statfs_path(path, &stfs) == EOK)
    5858                str_cpy(ent->fs_name, sizeof(ent->fs_name), stfs.fs_name);
     
    7575        while ((dirent = readdir(dir)) != NULL) {
    7676                char *child;
    77                 struct stat st;
     77                vfs_stat_t st;
    7878                errno_t rc;
    7979                int ret;
     
    123123errno_t vfs_get_mtab_list(list_t *mtab_list)
    124124{
    125         struct stat st;
     125        vfs_stat_t st;
    126126
    127127        errno_t rc = vfs_stat_path("/", &st);
  • uspace/lib/c/generic/vfs/vfs.c

    rd8023313 r39330200  
    352352async_sess_t *vfs_fd_session(int file, iface_t iface)
    353353{
    354         struct stat stat;
     354        vfs_stat_t stat;
    355355        errno_t rc = vfs_stat(file, &stat);
    356356        if (rc != EOK)
     
    10521052 * @return              EOK on success or an error code
    10531053 */
    1054 errno_t vfs_stat(int file, struct stat *stat)
     1054errno_t vfs_stat(int file, vfs_stat_t *stat)
    10551055{
    10561056        errno_t rc;
     
    10601060       
    10611061        req = async_send_1(exch, VFS_IN_STAT, file, NULL);
    1062         rc = async_data_read_start(exch, (void *) stat, sizeof(struct stat));
     1062        rc = async_data_read_start(exch, (void *) stat, sizeof(vfs_stat_t));
    10631063        if (rc != EOK) {
    10641064                vfs_exchange_end(exch);
     
    10861086 * @return              EOK on success or an error code
    10871087 */
    1088 errno_t vfs_stat_path(const char *path, struct stat *stat)
     1088errno_t vfs_stat_path(const char *path, vfs_stat_t *stat)
    10891089{
    10901090        int file;
     
    11071107 * @return              EOK on success or an error code
    11081108 */
    1109 errno_t vfs_statfs(int file, struct statfs *st)
     1109errno_t vfs_statfs(int file, vfs_statfs_t *st)
    11101110{
    11111111        errno_t rc, ret;
     
    11321132 * @return              EOK on success or an error code
    11331133 */
    1134 errno_t vfs_statfs_path(const char *path, struct statfs *st)
     1134errno_t vfs_statfs_path(const char *path, vfs_statfs_t *st)
    11351135{
    11361136        int file;
  • uspace/lib/c/include/vfs/vfs.h

    rd8023313 r39330200  
    5757
    5858
    59 struct stat {
     59typedef struct {
    6060        fs_handle_t fs_handle;
    6161        service_id_t service_id;
     
    6666        aoff64_t size;
    6767        service_id_t service;
    68 };
     68} vfs_stat_t;
    6969
    70 struct statfs {
     70typedef struct {
    7171        char fs_name[FS_NAME_MAXLEN + 1];
    7272        uint32_t f_bsize;    /* fundamental file system block size */
    7373        uint64_t f_blocks;   /* total data blocks in file system */
    7474        uint64_t f_bfree;    /* free blocks in fs */
    75 };
     75} vfs_statfs_t;
    7676
    7777/** List of file system types */
     
    111111extern int vfs_root(void);
    112112extern errno_t vfs_root_set(int);
    113 extern errno_t vfs_stat(int, struct stat *);
    114 extern errno_t vfs_stat_path(const char *, struct stat *);
    115 extern errno_t vfs_statfs(int, struct statfs *);
    116 extern errno_t vfs_statfs_path(const char *, struct statfs *);
     113extern errno_t vfs_stat(int, vfs_stat_t *);
     114extern errno_t vfs_stat_path(const char *, vfs_stat_t *);
     115extern errno_t vfs_statfs(int, vfs_statfs_t *);
     116extern errno_t vfs_statfs_path(const char *, vfs_statfs_t *);
    117117extern errno_t vfs_sync(int);
    118118extern errno_t vfs_unlink(int, const char *, int);
  • uspace/lib/fs/libfs.c

    rd8023313 r39330200  
    733733        size_t size;
    734734        if ((!async_data_read_receive(&callid, &size)) ||
    735             (size != sizeof(struct stat))) {
     735            (size != sizeof(vfs_stat_t))) {
    736736                ops->node_put(fn);
    737737                async_answer_0(callid, EINVAL);
     
    740740        }
    741741
    742         struct stat stat;
    743         memset(&stat, 0, sizeof(struct stat));
     742        vfs_stat_t stat;
     743        memset(&stat, 0, sizeof(vfs_stat_t));
    744744
    745745        stat.fs_handle = fs_handle;
     
    755755
    756756
    757         async_data_read_finalize(callid, &stat, sizeof(struct stat));
     757        async_data_read_finalize(callid, &stat, sizeof(vfs_stat_t));
    758758        async_answer_0(rid, EOK);
    759759}
     
    772772        size_t size;
    773773        if ((!async_data_read_receive(&callid, &size)) ||
    774             (size != sizeof(struct statfs))) {
     774            (size != sizeof(vfs_statfs_t))) {
    775775                goto error;
    776776        }
    777777
    778         struct statfs st;
    779         memset(&st, 0, sizeof(struct statfs));
     778        vfs_statfs_t st;
     779        memset(&st, 0, sizeof(vfs_statfs_t));
    780780
    781781        str_cpy(st.fs_name, sizeof(st.fs_name), fs_name);
     
    800800
    801801        ops->node_put(fn);
    802         async_data_read_finalize(callid, &st, sizeof(struct statfs));
     802        async_data_read_finalize(callid, &st, sizeof(vfs_statfs_t));
    803803        async_answer_0(rid, EOK);
    804804        return;
  • uspace/lib/posix/source/sys/stat.c

    rd8023313 r39330200  
    5252 * @return 0 on success, -1 on error.
    5353 */
    54 static int stat_to_posix(struct posix_stat *dest, struct stat *src)
     54static int stat_to_posix(struct posix_stat *dest, vfs_stat_t *src)
    5555{
    5656        memset(dest, 0, sizeof(struct posix_stat));
     
    8888int posix_fstat(int fd, struct posix_stat *st)
    8989{
    90         struct stat hst;
     90        vfs_stat_t hst;
    9191        if (failed(vfs_stat(fd, &hst)))
    9292                return -1;
     
    116116int posix_stat(const char *restrict path, struct posix_stat *restrict st)
    117117{
    118         struct stat hst;
     118        vfs_stat_t hst;
    119119        if (failed(vfs_stat_path(path, &hst)))
    120120                return -1;
  • uspace/lib/posix/source/unistd.c

    rd8023313 r39330200  
    245245posix_off_t posix_lseek(int fildes, posix_off_t offset, int whence)
    246246{
    247         struct stat st;
     247        vfs_stat_t st;
    248248
    249249        switch (whence) {
  • uspace/srv/devman/driver.c

    rd8023313 r39330200  
    140140       
    141141        /* Check whether the driver's binary exists. */
    142         struct stat s;
     142        vfs_stat_t s;
    143143        if (vfs_stat_path(drv->binary_path, &s) != EOK) {
    144144                log_msg(LOG_DEFAULT, LVL_ERROR, "Driver not found at path `%s'.",
  • uspace/srv/devman/match.c

    rd8023313 r39330200  
    200200        int fd;
    201201        size_t len = 0;
    202         struct stat st;
     202        vfs_stat_t st;
    203203       
    204204        errno_t rc = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ, &fd);
Note: See TracChangeset for help on using the changeset viewer.