Changeset 8ffedd8 in mainline
- Timestamp:
- 2017-03-16T16:50:29Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5a2b765
- Parents:
- 35b7d86e
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/mount/mount.c
r35b7d86e r8ffedd8 83 83 84 84 printf("%s", mtab_ent->fs_name); 85 if (mtab_ent->instance)86 printf("/%d", mtab_ent->instance);87 85 88 86 printf(" %s", mtab_ent->mp); … … 95 93 printf(" (%" PRIun ")", mtab_ent->service_id); 96 94 } 97 98 if (str_size(mtab_ent->opts) > 0)99 printf(" (%s)", mtab_ent->opts);100 95 101 96 putchar('\n'); -
uspace/lib/c/generic/vfs/vfs.c
r35b7d86e r8ffedd8 35 35 #include <vfs/canonify.h> 36 36 #include <vfs/vfs.h> 37 #include <vfs/vfs_mtab.h> 37 38 #include <vfs/vfs_sess.h> 38 39 #include <macros.h> … … 1104 1105 } 1105 1106 1107 static void process_mp(const char *path, struct stat *stat, list_t *mtab_list) 1108 { 1109 mtab_ent_t *ent; 1110 1111 ent = (mtab_ent_t *) malloc(sizeof(mtab_ent_t)); 1112 if (!ent) 1113 return; 1114 1115 link_initialize(&ent->link); 1116 str_cpy(ent->mp, sizeof(ent->mp), path); 1117 str_cpy(ent->fs_name, sizeof(ent->fs_name), "fixme"); 1118 ent->service_id = stat->service_id; 1119 1120 list_append(&ent->link, mtab_list); 1121 } 1122 1123 static int vfs_get_mtab_visit(const char *path, list_t *mtab_list, 1124 fs_handle_t fs_handle, service_id_t service_id) 1125 { 1126 DIR *dir; 1127 struct dirent *dirent; 1128 1129 dir = opendir(path); 1130 if (!dir) 1131 return -1; 1132 1133 while ((dirent = readdir(dir)) != NULL) { 1134 char *child; 1135 struct stat st; 1136 int rc; 1137 1138 rc = asprintf(&child, "%s/%s", path, dirent->d_name); 1139 if (rc < 0) { 1140 closedir(dir); 1141 errno = rc; 1142 return -1; 1143 } 1144 1145 rc = stat(child, &st); 1146 if (rc != 0) { 1147 free(child); 1148 closedir(dir); 1149 errno = rc; 1150 return -1; 1151 } 1152 1153 if (st.fs_handle != fs_handle || st.service_id != service_id) { 1154 /* 1155 * We have discovered a mountpoint. 1156 */ 1157 process_mp(child, &st, mtab_list); 1158 } 1159 1160 if (st.is_directory) { 1161 (void) vfs_get_mtab_visit(child, mtab_list, 1162 st.fs_handle, st.service_id); 1163 } 1164 1165 free(child); 1166 } 1167 1168 closedir(dir); 1169 return EOK; 1170 } 1171 1106 1172 int vfs_get_mtab_list(list_t *mtab_list) 1107 1173 { 1108 sysarg_t rc = ENOTSUP; 1109 1110 return rc; 1174 struct stat st; 1175 1176 int rc = stat("/", &st); 1177 if (rc != 0) 1178 return rc; 1179 1180 process_mp("/", &st, mtab_list); 1181 1182 return vfs_get_mtab_visit("", mtab_list, st.fs_handle, st.service_id); 1111 1183 } 1112 1184 -
uspace/lib/c/include/vfs/vfs_mtab.h
r35b7d86e r8ffedd8 43 43 link_t link; 44 44 char mp[MAX_PATH_LEN]; 45 char opts[MAX_MNTOPTS_LEN];46 45 char fs_name[FS_NAME_MAXLEN]; 47 unsigned int instance;48 46 service_id_t service_id; 49 47 } mtab_ent_t;
Note:
See TracChangeset
for help on using the changeset viewer.