Changeset b5b5d84 in mainline
- Timestamp:
- 2017-03-30T18:58:28Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 23a0368
- Parents:
- fe91f66
- Location:
- uspace
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/df/df.c
rfe91f66 rb5b5d84 40 40 #include <stdint.h> 41 41 #include <getopt.h> 42 #include <sys/statfs.h>43 42 #include <errno.h> 44 43 #include <adt/list.h> … … 124 123 print_header(); 125 124 list_foreach(mtab_list, link, mtab_ent_t, mtab_ent) { 126 if ( statfs(mtab_ent->mp, &st) == 0) {125 if (vfs_statfs_path(mtab_ent->mp, &st) == 0) { 127 126 print_statfs(&st, mtab_ent->fs_name, mtab_ent->mp); 128 127 } else { -
uspace/lib/c/generic/vfs/vfs.c
rfe91f66 rb5b5d84 44 44 #include <stdio.h> 45 45 #include <sys/stat.h> 46 #include <sys/statfs.h>47 46 #include <sys/types.h> 48 47 #include <ipc/services.h> … … 1084 1083 1085 1084 struct statfs stfs; 1086 if ( statfs(path, &stfs) == EOK)1085 if (vfs_statfs_path(path, &stfs) == EOK) 1087 1086 str_cpy(ent->fs_name, sizeof(ent->fs_name), stfs.fs_name); 1088 1087 else … … 1164 1163 /** Get filesystem statistics. 1165 1164 * 1165 * @param file File located on the queried file system 1166 * @param st Buffer for storing information 1167 * @return 0 on success. On error -1 is returned and errno is set. 1168 */ 1169 int vfs_statfs(int file, struct statfs *st) 1170 { 1171 sysarg_t rc, ret; 1172 aid_t req; 1173 1174 async_exch_t *exch = vfs_exchange_begin(); 1175 1176 req = async_send_1(exch, VFS_IN_STATFS, file, NULL); 1177 rc = async_data_read_start(exch, (void *) st, sizeof(*st)); 1178 1179 vfs_exchange_end(exch); 1180 async_wait_for(req, &ret); 1181 1182 rc = (ret != EOK ? ret : rc); 1183 1184 return rc; 1185 } 1186 /** Get filesystem statistics. 1187 * 1166 1188 * @param path Mount point path 1167 1189 * @param st Buffer for storing information 1168 * @return 0 on success. On error -1 is returned and errno is set. 1169 */ 1170 int statfs(const char *path, struct statfs *st) 1171 { 1172 int fd = vfs_lookup(path, 0); 1173 if (fd < 0) { 1174 errno = fd; 1175 return -1; 1176 } 1177 1178 sysarg_t rc, ret; 1179 aid_t req; 1180 1181 async_exch_t *exch = vfs_exchange_begin(); 1182 1183 req = async_send_1(exch, VFS_IN_STATFS, fd, NULL); 1184 rc = async_data_read_start(exch, (void *) st, sizeof(*st)); 1185 1186 vfs_exchange_end(exch); 1187 async_wait_for(req, &ret); 1188 close(fd); 1189 1190 rc = (ret != EOK ? ret : rc); 1191 if (rc != EOK) { 1192 errno = rc; 1193 return -1; 1194 } 1195 1196 return 0; 1190 * @return EOK on success or a negative error code otherwise. 1191 */ 1192 int vfs_statfs_path(const char *path, struct statfs *st) 1193 { 1194 int file = vfs_lookup(path, 0); 1195 if (file < 0) 1196 return file; 1197 1198 int rc = vfs_statfs(file, st); 1199 1200 close(file); 1201 1202 return rc; 1197 1203 } 1198 1204 -
uspace/lib/c/include/vfs/vfs.h
rfe91f66 rb5b5d84 49 49 }; 50 50 51 struct statfs { 52 char fs_name[FS_NAME_MAXLEN + 1]; 53 uint32_t f_bsize; /* fundamental file system block size */ 54 uint64_t f_blocks; /* total data blocks in file system */ 55 uint64_t f_bfree; /* free blocks in fs */ 56 }; 57 51 58 extern char *vfs_absolutize(const char *, size_t *); 52 59 … … 72 79 extern int vfs_root(void); 73 80 extern void vfs_root_set(int); 81 extern int vfs_statfs(int, struct statfs *); 82 extern int vfs_statfs_path(const char *, struct statfs *); 74 83 75 84 int vfs_mount(int, const char *, service_id_t, const char *, unsigned, unsigned, int *); -
uspace/lib/fs/libfs.c
rfe91f66 rb5b5d84 45 45 #include <str.h> 46 46 #include <sys/stat.h> 47 #include <sys/statfs.h>48 47 #include <stdlib.h> 49 48 #include <fibril_synch.h> 50 49 #include <ipc/vfs.h> 50 #include <vfs/vfs.h> 51 51 52 52 #define on_error(rc, action) \
Note:
See TracChangeset
for help on using the changeset viewer.