Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 5a2b765 in mainline


Ignore:
Timestamp:
2017-03-16T17:17:31Z (3 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
39c3b7f9
Parents:
8ffedd8
Message:

Add the FS name field to struct statfs

Location:
uspace/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/vfs/vfs.c

    r8ffedd8 r5a2b765  
    11151115        link_initialize(&ent->link);
    11161116        str_cpy(ent->mp, sizeof(ent->mp), path);
    1117         str_cpy(ent->fs_name, sizeof(ent->fs_name), "fixme");
    11181117        ent->service_id = stat->service_id;
     1118
     1119        struct statfs stfs;
     1120        if (statfs(path, &stfs) == EOK)
     1121                str_cpy(ent->fs_name, sizeof(ent->fs_name), stfs.fs_name);
     1122        else
     1123                str_cpy(ent->fs_name, sizeof(ent->fs_name), "?");
    11191124       
    11201125        list_append(&ent->link, mtab_list);
  • uspace/lib/c/include/sys/statfs.h

    r8ffedd8 r5a2b765  
    3737
    3838#include <sys/types.h>
     39#include <ipc/vfs.h>
    3940
    4041struct statfs {
    41         uint32_t    f_type;     /* type of file system  */
    42         uint32_t    f_bsize;    /* fundamental file system block size */
    43         uint64_t    f_blocks;   /* total data blocks in file system */
    44         uint64_t    f_bfree;    /* free blocks in fs */
     42        char fs_name[FS_NAME_MAXLEN + 1];
     43        uint32_t f_bsize;    /* fundamental file system block size */
     44        uint64_t f_blocks;   /* total data blocks in file system */
     45        uint64_t f_bfree;    /* free blocks in fs */
    4546};
    4647
  • uspace/lib/fs/libfs.c

    r8ffedd8 r5a2b765  
    4343#include <dirent.h>
    4444#include <mem.h>
     45#include <str.h>
    4546#include <sys/stat.h>
    4647#include <sys/statfs.h>
    4748#include <stdlib.h>
    4849#include <fibril_synch.h>
     50#include <ipc/vfs.h>
    4951
    5052#define on_error(rc, action) \
     
    7274static vfs_out_ops_t *vfs_out_ops = NULL;
    7375static libfs_ops_t *libfs_ops = NULL;
     76
     77static char fs_name[FS_NAME_MAXLEN + 1];
    7478
    7579static void libfs_link(libfs_ops_t *, fs_handle_t, ipc_callid_t,
     
    394398        vfs_out_ops = vops;
    395399        libfs_ops = lops;
     400
     401        str_cpy(fs_name, sizeof(fs_name), info->name);
    396402
    397403        /*
     
    817823        memset(&st, 0, sizeof(struct statfs));
    818824
     825        str_cpy(st.fs_name, sizeof(st.fs_name), fs_name);
     826
    819827        if (ops->size_block != NULL) {
    820828                rc = ops->size_block(service_id, &st.f_bsize);
Note: See TracChangeset for help on using the changeset viewer.