Changeset b4af128 in mainline
- Timestamp:
- 2011-08-15T21:44:16Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bca3eac
- Parents:
- e0d98b2
- Location:
- uspace/srv/fs/exfat
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat_dentry.c
re0d98b2 rb4af128 70 70 } 71 71 72 uint16_t exfat_name_hash(const uint16_t *name )72 uint16_t exfat_name_hash(const uint16_t *name, const uint16_t *uctable, size_t chars) 73 73 { 74 /* TODO */ 75 return 0; 76 } 74 uint16_t hash = 0; 75 uint16_t ch; 76 while (*name) { 77 if (*name < chars) 78 ch = uint16_t_le2host(uctable[*name]); 79 else 80 ch = *name; 81 name++; 77 82 78 void exfat_set_checksum(const exfat_dentry_t *d, uint16_t *chksum) 79 { 80 /* TODO */ 83 hash = ((hash << 15) | (hash >> 1)) + (ch & 0xff); 84 hash = ((hash << 15) | (hash >> 1)) + (ch >> 8); 85 } 86 87 return hash; 81 88 } 82 89 … … 90 97 } 91 98 dst[*offset] = '\0'; 92 }93 94 void exfat_dentry_set_name(const uint16_t *src, size_t *offset, exfat_name_dentry_t *name)95 {96 /* TODO */97 size_t idx=0;98 while (src[*offset] && idx < EXFAT_NAME_PART_LEN) {99 name->name[idx] = src[*offset];100 (*offset)++;101 idx++;102 }103 99 } 104 100 … … 115 111 } 116 112 113 size_t utf16_length(const uint16_t *wstr) 114 { 115 size_t len = 0; 116 117 while (*wstr++ != 0) 118 len++; 119 120 return len; 121 } 122 117 123 /** 118 124 * @} -
uspace/srv/fs/exfat/exfat_dentry.h
re0d98b2 rb4af128 151 151 extern exfat_dentry_clsf_t exfat_classify_dentry(const exfat_dentry_t *d); 152 152 153 extern uint16_t exfat_name_hash(const uint16_t *name );154 extern void exfat_set_checksum(const exfat_dentry_t *d, uint16_t *chksum);153 extern uint16_t exfat_name_hash(const uint16_t *name, const uint16_t *uctable, 154 size_t chars); 155 155 156 extern void exfat_dentry_get_name(const exfat_name_dentry_t *name, size_t size, uint16_t *dst, size_t *offset); 157 extern void exfat_dentry_set_name(const uint16_t *src, size_t *offset, exfat_name_dentry_t *name); 156 extern void exfat_dentry_get_name(const exfat_name_dentry_t *name, size_t size, 157 uint16_t *dst, size_t *offset); 158 158 159 159 160 extern bool exfat_valid_char(wchar_t ch); 160 161 extern bool exfat_valid_name(const char *name); 162 163 extern size_t utf16_length(const uint16_t *wstr); 161 164 162 165
Note:
See TracChangeset
for help on using the changeset viewer.