Changeset 45e7868 in mainline for uspace/lib
- Timestamp:
- 2011-11-07T23:02:28Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8c62a71
- Parents:
- a0c05e7 (diff), 7b5f4c9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib
- Files:
-
- 1 added
- 6 edited
-
c/generic/str.c (modified) (1 diff)
-
c/generic/vfs/vfs.c (modified) (1 diff)
-
c/include/ipc/vfs.h (modified) (2 diffs)
-
c/include/str.h (modified) (1 diff)
-
c/include/vfs/vfs.h (modified) (2 diffs)
-
c/include/vfs/vfs_mtab.h (added)
-
drv/generic/driver.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/str.c
ra0c05e7 r45e7868 839 839 840 840 return NULL; 841 } 842 843 /** Removes specified trailing characters from a string. 844 * 845 * @param str String to remove from. 846 * @param ch Character to remove. 847 */ 848 void str_rtrim(char *str, wchar_t ch) 849 { 850 size_t off = 0; 851 size_t pos = 0; 852 wchar_t c; 853 bool update_last_chunk = true; 854 char *last_chunk = NULL; 855 856 while ((c = str_decode(str, &off, STR_NO_LIMIT))) { 857 if (c != ch) { 858 update_last_chunk = true; 859 last_chunk = NULL; 860 } else if (update_last_chunk) { 861 update_last_chunk = false; 862 last_chunk = (str + pos); 863 } 864 pos = off; 865 } 866 867 if (last_chunk) 868 *last_chunk = '\0'; 869 } 870 871 /** Removes specified leading characters from a string. 872 * 873 * @param str String to remove from. 874 * @param ch Character to remove. 875 */ 876 void str_ltrim(char *str, wchar_t ch) 877 { 878 wchar_t acc; 879 size_t off = 0; 880 size_t pos = 0; 881 size_t str_sz = str_size(str); 882 883 while ((acc = str_decode(str, &off, STR_NO_LIMIT)) != 0) { 884 if (acc != ch) 885 break; 886 else 887 pos = off; 888 } 889 890 if (pos > 0) { 891 memmove(str, &str[pos], str_sz - pos); 892 pos = str_sz - pos; 893 str[str_sz - pos] = '\0'; 894 } 841 895 } 842 896 -
uspace/lib/c/generic/vfs/vfs.c
ra0c05e7 r45e7868 831 831 } 832 832 833 int get_mtab_list(list_t *mtab_list) 834 { 835 sysarg_t rc; 836 aid_t req; 837 size_t i; 838 sysarg_t num_mounted_fs; 839 840 async_exch_t *exch = vfs_exchange_begin(); 841 842 req = async_send_0(exch, VFS_IN_MTAB_GET, NULL); 843 844 /* Ask VFS how many filesystems are mounted */ 845 rc = async_req_0_1(exch, VFS_IN_PING, &num_mounted_fs); 846 if (rc != EOK) 847 goto exit; 848 849 for (i = 0; i < num_mounted_fs; ++i) { 850 mtab_ent_t *mtab_ent; 851 852 mtab_ent = malloc(sizeof(mtab_ent_t)); 853 if (!mtab_ent) { 854 rc = ENOMEM; 855 goto exit; 856 } 857 858 memset(mtab_ent, 0, sizeof(mtab_ent_t)); 859 860 rc = async_data_read_start(exch, (void *) mtab_ent->mp, 861 MAX_PATH_LEN); 862 if (rc != EOK) 863 goto exit; 864 865 rc = async_data_read_start(exch, (void *) mtab_ent->opts, 866 MAX_MNTOPTS_LEN); 867 if (rc != EOK) 868 goto exit; 869 870 rc = async_data_read_start(exch, (void *) mtab_ent->fs_name, 871 FS_NAME_MAXLEN); 872 if (rc != EOK) 873 goto exit; 874 875 sysarg_t p[2]; 876 877 rc = async_req_0_2(exch, VFS_IN_PING, &p[0], &p[1]); 878 if (rc != EOK) 879 goto exit; 880 881 mtab_ent->instance = p[0]; 882 mtab_ent->service_id = p[1]; 883 884 link_initialize(&mtab_ent->link); 885 list_append(&mtab_ent->link, mtab_list); 886 } 887 888 exit: 889 async_wait_for(req, &rc); 890 vfs_exchange_end(exch); 891 return rc; 892 } 893 833 894 /** @} 834 895 */ -
uspace/lib/c/include/ipc/vfs.h
ra0c05e7 r45e7868 42 42 #define FS_NAME_MAXLEN 20 43 43 #define MAX_PATH_LEN (64 * 1024) 44 #define MAX_MNTOPTS_LEN 256 44 45 #define PLB_SIZE (2 * MAX_PATH_LEN) 45 46 … … 80 81 VFS_IN_DUP, 81 82 VFS_IN_WAIT_HANDLE, 83 VFS_IN_MTAB_GET, 82 84 } vfs_in_request_t; 83 85 -
uspace/lib/c/include/str.h
ra0c05e7 r45e7868 91 91 extern char *str_rchr(const char *str, wchar_t ch); 92 92 93 extern void str_rtrim(char *str, wchar_t ch); 94 extern void str_ltrim(char *str, wchar_t ch); 95 93 96 extern bool wstr_linsert(wchar_t *str, wchar_t ch, size_t pos, size_t max_pos); 94 97 extern bool wstr_remove(wchar_t *str, size_t pos); -
uspace/lib/c/include/vfs/vfs.h
ra0c05e7 r45e7868 39 39 #include <ipc/vfs.h> 40 40 #include <ipc/loc.h> 41 #include <adt/list.h> 41 42 #include <stdio.h> 42 43 #include <async.h> 44 #include "vfs_mtab.h" 43 45 44 46 enum vfs_change_state_type { … … 55 57 56 58 extern int fd_wait(void); 59 extern int get_mtab_list(list_t *mtab_list); 57 60 58 61 extern async_exch_t *vfs_exchange_begin(void); -
uspace/lib/drv/generic/driver.c
ra0c05e7 r45e7868 970 970 971 971 match_id->id = str_dup(match_id_str); 972 match_id->score = 90;972 match_id->score = match_score; 973 973 974 974 add_match_id(&fun->match_ids, match_id);
Note:
See TracChangeset
for help on using the changeset viewer.
