Changeset 39330200 in mainline for uspace/lib
- Timestamp:
- 2018-01-15T21:40:49Z (8 years ago)
- 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)
- Location:
- uspace/lib
- Files:
-
- 10 edited
-
bithenge/src/failure.c (modified) (1 diff)
-
bithenge/src/failure.h (modified) (1 diff)
-
bithenge/src/file.c (modified) (1 diff)
-
c/generic/io/io.c (modified) (1 diff)
-
c/generic/vfs/mtab.c (modified) (4 diffs)
-
c/generic/vfs/vfs.c (modified) (6 diffs)
-
c/include/vfs/vfs.h (modified) (3 diffs)
-
fs/libfs.c (modified) (5 diffs)
-
posix/source/sys/stat.c (modified) (3 diffs)
-
posix/source/unistd.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/bithenge/src/failure.c
rd8023313 r39330200 225 225 } 226 226 227 errno_t bithenge_failure_fstat(int fd, struct stat *buf)227 errno_t bithenge_failure_fstat(int fd, vfs_stat_t *buf) 228 228 { 229 229 if (bithenge_should_fail()) { -
uspace/lib/bithenge/src/failure.h
rd8023313 r39330200 52 52 char *bithenge_failure_str_ndup(const char *, size_t); 53 53 errno_t bithenge_failure_open(const char *, int); 54 errno_t bithenge_failure_fstat(int, struct stat *);54 errno_t bithenge_failure_fstat(int, vfs_stat_t *); 55 55 56 56 #ifndef BITHENGE_FAILURE_DECLS_ONLY -
uspace/lib/bithenge/src/file.c
rd8023313 r39330200 102 102 assert(out); 103 103 104 struct stat stat;104 vfs_stat_t stat; 105 105 errno_t rc = vfs_stat(fd, &stat); 106 106 if (rc != EOK) { -
uspace/lib/c/generic/io/io.c
rd8023313 r39330200 814 814 stream->ungetc_chars = 0; 815 815 816 struct stat st;816 vfs_stat_t st; 817 817 switch (whence) { 818 818 case SEEK_SET: -
uspace/lib/c/generic/vfs/mtab.c
rd8023313 r39330200 42 42 #include <str.h> 43 43 44 static void process_mp(const char *path, struct stat *stat, list_t *mtab_list)44 static void process_mp(const char *path, vfs_stat_t *stat, list_t *mtab_list) 45 45 { 46 46 mtab_ent_t *ent; … … 54 54 ent->service_id = stat->service_id; 55 55 56 struct statfsstfs;56 vfs_statfs_t stfs; 57 57 if (vfs_statfs_path(path, &stfs) == EOK) 58 58 str_cpy(ent->fs_name, sizeof(ent->fs_name), stfs.fs_name); … … 75 75 while ((dirent = readdir(dir)) != NULL) { 76 76 char *child; 77 struct stat st;77 vfs_stat_t st; 78 78 errno_t rc; 79 79 int ret; … … 123 123 errno_t vfs_get_mtab_list(list_t *mtab_list) 124 124 { 125 struct stat st;125 vfs_stat_t st; 126 126 127 127 errno_t rc = vfs_stat_path("/", &st); -
uspace/lib/c/generic/vfs/vfs.c
rd8023313 r39330200 352 352 async_sess_t *vfs_fd_session(int file, iface_t iface) 353 353 { 354 struct stat stat;354 vfs_stat_t stat; 355 355 errno_t rc = vfs_stat(file, &stat); 356 356 if (rc != EOK) … … 1052 1052 * @return EOK on success or an error code 1053 1053 */ 1054 errno_t vfs_stat(int file, struct stat *stat)1054 errno_t vfs_stat(int file, vfs_stat_t *stat) 1055 1055 { 1056 1056 errno_t rc; … … 1060 1060 1061 1061 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)); 1063 1063 if (rc != EOK) { 1064 1064 vfs_exchange_end(exch); … … 1086 1086 * @return EOK on success or an error code 1087 1087 */ 1088 errno_t vfs_stat_path(const char *path, struct stat *stat)1088 errno_t vfs_stat_path(const char *path, vfs_stat_t *stat) 1089 1089 { 1090 1090 int file; … … 1107 1107 * @return EOK on success or an error code 1108 1108 */ 1109 errno_t vfs_statfs(int file, struct statfs*st)1109 errno_t vfs_statfs(int file, vfs_statfs_t *st) 1110 1110 { 1111 1111 errno_t rc, ret; … … 1132 1132 * @return EOK on success or an error code 1133 1133 */ 1134 errno_t vfs_statfs_path(const char *path, struct statfs*st)1134 errno_t vfs_statfs_path(const char *path, vfs_statfs_t *st) 1135 1135 { 1136 1136 int file; -
uspace/lib/c/include/vfs/vfs.h
rd8023313 r39330200 57 57 58 58 59 struct stat {59 typedef struct { 60 60 fs_handle_t fs_handle; 61 61 service_id_t service_id; … … 66 66 aoff64_t size; 67 67 service_id_t service; 68 } ;68 } vfs_stat_t; 69 69 70 struct statfs { 70 typedef struct { 71 71 char fs_name[FS_NAME_MAXLEN + 1]; 72 72 uint32_t f_bsize; /* fundamental file system block size */ 73 73 uint64_t f_blocks; /* total data blocks in file system */ 74 74 uint64_t f_bfree; /* free blocks in fs */ 75 } ;75 } vfs_statfs_t; 76 76 77 77 /** List of file system types */ … … 111 111 extern int vfs_root(void); 112 112 extern 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*);113 extern errno_t vfs_stat(int, vfs_stat_t *); 114 extern errno_t vfs_stat_path(const char *, vfs_stat_t *); 115 extern errno_t vfs_statfs(int, vfs_statfs_t *); 116 extern errno_t vfs_statfs_path(const char *, vfs_statfs_t *); 117 117 extern errno_t vfs_sync(int); 118 118 extern errno_t vfs_unlink(int, const char *, int); -
uspace/lib/fs/libfs.c
rd8023313 r39330200 733 733 size_t size; 734 734 if ((!async_data_read_receive(&callid, &size)) || 735 (size != sizeof( struct stat))) {735 (size != sizeof(vfs_stat_t))) { 736 736 ops->node_put(fn); 737 737 async_answer_0(callid, EINVAL); … … 740 740 } 741 741 742 struct stat stat;743 memset(&stat, 0, sizeof( struct stat));742 vfs_stat_t stat; 743 memset(&stat, 0, sizeof(vfs_stat_t)); 744 744 745 745 stat.fs_handle = fs_handle; … … 755 755 756 756 757 async_data_read_finalize(callid, &stat, sizeof( struct stat));757 async_data_read_finalize(callid, &stat, sizeof(vfs_stat_t)); 758 758 async_answer_0(rid, EOK); 759 759 } … … 772 772 size_t size; 773 773 if ((!async_data_read_receive(&callid, &size)) || 774 (size != sizeof( struct statfs))) {774 (size != sizeof(vfs_statfs_t))) { 775 775 goto error; 776 776 } 777 777 778 struct statfsst;779 memset(&st, 0, sizeof( struct statfs));778 vfs_statfs_t st; 779 memset(&st, 0, sizeof(vfs_statfs_t)); 780 780 781 781 str_cpy(st.fs_name, sizeof(st.fs_name), fs_name); … … 800 800 801 801 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)); 803 803 async_answer_0(rid, EOK); 804 804 return; -
uspace/lib/posix/source/sys/stat.c
rd8023313 r39330200 52 52 * @return 0 on success, -1 on error. 53 53 */ 54 static int stat_to_posix(struct posix_stat *dest, struct stat *src)54 static int stat_to_posix(struct posix_stat *dest, vfs_stat_t *src) 55 55 { 56 56 memset(dest, 0, sizeof(struct posix_stat)); … … 88 88 int posix_fstat(int fd, struct posix_stat *st) 89 89 { 90 struct stat hst;90 vfs_stat_t hst; 91 91 if (failed(vfs_stat(fd, &hst))) 92 92 return -1; … … 116 116 int posix_stat(const char *restrict path, struct posix_stat *restrict st) 117 117 { 118 struct stat hst;118 vfs_stat_t hst; 119 119 if (failed(vfs_stat_path(path, &hst))) 120 120 return -1; -
uspace/lib/posix/source/unistd.c
rd8023313 r39330200 245 245 posix_off_t posix_lseek(int fildes, posix_off_t offset, int whence) 246 246 { 247 struct stat st;247 vfs_stat_t st; 248 248 249 249 switch (whence) {
Note:
See TracChangeset
for help on using the changeset viewer.
