Lines Matching +full:- +full:wc
52 #ifndef ANDROID_WINDOWS_HOST /* O_BINARY is windows-specific flag */
62 static const char *utf8_to_wchar(const char *input, wchar_t *wc, in utf8_to_wchar() argument
66 *wc = (wchar_t) input[0]; in utf8_to_wchar()
70 *wc = (((wchar_t) input[0] & 0x1f) << 6) | in utf8_to_wchar()
75 *wc = (((wchar_t) input[0] & 0x0f) << 12) | in utf8_to_wchar()
81 *wc = (((wchar_t) input[0] & 0x07) << 18) | in utf8_to_wchar()
88 *wc = (((wchar_t) input[0] & 0x03) << 24) | in utf8_to_wchar()
96 *wc = (((wchar_t) input[0] & 0x01) << 30) | in utf8_to_wchar()
107 static u_int16_t *wchar_to_utf16(u_int16_t *output, wchar_t wc, size_t outsize) in wchar_to_utf16() argument
109 if (wc <= 0xffff) { in wchar_to_utf16()
112 output[0] = cpu_to_le16(wc); in wchar_to_utf16()
117 wc -= 0x10000; in wchar_to_utf16()
118 output[0] = cpu_to_le16(0xd800 | ((wc >> 10) & 0x3ff)); in wchar_to_utf16()
119 output[1] = cpu_to_le16(0xdc00 | (wc & 0x3ff)); in wchar_to_utf16()
128 wchar_t wc; in utf8_to_utf16() local
130 while ((size_t)(inp - input) < insize && *inp) { in utf8_to_utf16()
131 inp = utf8_to_wchar(inp, &wc, insize - (inp - input)); in utf8_to_utf16()
133 DBG(0, "illegal UTF-8 sequence\n"); in utf8_to_utf16()
134 return -EILSEQ; in utf8_to_utf16()
136 outp = wchar_to_utf16(outp, wc, outsize - (outp - output)); in utf8_to_utf16()
139 return -ENAMETOOLONG; in utf8_to_utf16()
146 static const u_int16_t *utf16_to_wchar(const u_int16_t *input, wchar_t *wc, in utf16_to_wchar() argument
152 *wc = ((wchar_t) (le16_to_cpu(input[0]) & 0x3ff) << 10); in utf16_to_wchar()
153 *wc |= (le16_to_cpu(input[1]) & 0x3ff); in utf16_to_wchar()
154 *wc += 0x10000; in utf16_to_wchar()
157 *wc = le16_to_cpu(*input); in utf16_to_wchar()
162 static char *wchar_to_utf8(char *output, wchar_t wc, size_t outsize) in wchar_to_utf8() argument
164 if (wc <= 0x7f) { in wchar_to_utf8()
167 *output++ = (char) wc; in wchar_to_utf8()
168 } else if (wc <= 0x7ff) { in wchar_to_utf8()
171 *output++ = 0xc0 | (wc >> 6); in wchar_to_utf8()
172 *output++ = 0x80 | (wc & 0x3f); in wchar_to_utf8()
173 } else if (wc <= 0xffff) { in wchar_to_utf8()
176 *output++ = 0xe0 | (wc >> 12); in wchar_to_utf8()
177 *output++ = 0x80 | ((wc >> 6) & 0x3f); in wchar_to_utf8()
178 *output++ = 0x80 | (wc & 0x3f); in wchar_to_utf8()
179 } else if (wc <= 0x1fffff) { in wchar_to_utf8()
182 *output++ = 0xf0 | (wc >> 18); in wchar_to_utf8()
183 *output++ = 0x80 | ((wc >> 12) & 0x3f); in wchar_to_utf8()
184 *output++ = 0x80 | ((wc >> 6) & 0x3f); in wchar_to_utf8()
185 *output++ = 0x80 | (wc & 0x3f); in wchar_to_utf8()
186 } else if (wc <= 0x3ffffff) { in wchar_to_utf8()
189 *output++ = 0xf8 | (wc >> 24); in wchar_to_utf8()
190 *output++ = 0x80 | ((wc >> 18) & 0x3f); in wchar_to_utf8()
191 *output++ = 0x80 | ((wc >> 12) & 0x3f); in wchar_to_utf8()
192 *output++ = 0x80 | ((wc >> 6) & 0x3f); in wchar_to_utf8()
193 *output++ = 0x80 | (wc & 0x3f); in wchar_to_utf8()
194 } else if (wc <= 0x7fffffff) { in wchar_to_utf8()
197 *output++ = 0xfc | (wc >> 30); in wchar_to_utf8()
198 *output++ = 0x80 | ((wc >> 24) & 0x3f); in wchar_to_utf8()
199 *output++ = 0x80 | ((wc >> 18) & 0x3f); in wchar_to_utf8()
200 *output++ = 0x80 | ((wc >> 12) & 0x3f); in wchar_to_utf8()
201 *output++ = 0x80 | ((wc >> 6) & 0x3f); in wchar_to_utf8()
202 *output++ = 0x80 | (wc & 0x3f); in wchar_to_utf8()
214 wchar_t wc; in utf16_to_utf8() local
216 while ((size_t)(inp - input) < insize && le16_to_cpu(*inp)) { in utf16_to_utf8()
217 inp = utf16_to_wchar(inp, &wc, insize - (inp - input)); in utf16_to_utf8()
219 DBG(0, "illegal UTF-16 sequence\n"); in utf16_to_utf8()
220 return -EILSEQ; in utf16_to_utf8()
222 outp = wchar_to_utf8(outp, wc, outsize - (outp - output)); in utf16_to_utf8()
225 return -ENAMETOOLONG; in utf16_to_utf8()
235 if (num <= 0 || (num & (num - 1)) != 0) in log_base_2()
236 return -1; in log_base_2()
303 mask = 1 << (7 - (nr & 0x07)); in f2fs_test_bit()
313 mask = 1 << (7 - (nr & 0x07)); in f2fs_set_bit()
325 mask = 1 << (7 - (nr & 0x07)); in f2fs_clear_bit()
349 #define BITMAP_FIRST_BYTE_MASK(start) (0xff << ((start) & (BITS_PER_BYTE - 1)))
402 } while (--n); in TEA_transform()
428 num--; in str2hashbuf()
431 if (--num >= 0) in str2hashbuf()
433 while (--num >= 0) in str2hashbuf()
469 len -= 16; in __f2fs_dentry_hash()
487 return -ENOMEM; in f2fs_dentry_hash()
488 dlen = table->ops->casefold(table, name, len, buff, PATH_MAX); in f2fs_dentry_hash()
505 unsigned int addrs = CUR_ADDRS_PER_INODE(i) - get_inline_xattr_addrs(i); in addrs_per_inode()
507 if (!LINUX_S_ISREG(le16_to_cpu(i->i_mode)) || in addrs_per_inode()
508 !(le32_to_cpu(i->i_flags) & F2FS_COMPR_FL)) in addrs_per_inode()
510 return ALIGN_DOWN(addrs, 1 << i->i_log_cluster_size); in addrs_per_inode()
515 if (!LINUX_S_ISREG(le16_to_cpu(i->i_mode)) || in addrs_per_block()
516 !(le32_to_cpu(i->i_flags) & F2FS_COMPR_FL)) in addrs_per_block()
518 return ALIGN_DOWN(DEF_ADDRS_PER_BLOCK, 1 << i->i_log_cluster_size); in addrs_per_block()
530 while (len--) { in f2fs_cal_crc32()
548 return -1; in f2fs_crc_valid()
555 struct f2fs_inode *ri = &node->i; in f2fs_inode_chksum()
556 __le32 ino = node->footer.ino; in f2fs_inode_chksum()
557 __le32 gen = ri->i_generation; in f2fs_inode_chksum()
571 F2FS_BLKSIZE - offset); in f2fs_inode_chksum()
577 unsigned int chksum_ofs = le32_to_cpu(cp->checksum_offset); in f2fs_checkpoint_chksum()
584 F2FS_BLKSIZE - chksum_ofs); in f2fs_checkpoint_chksum()
592 inode->i.i_inode_checksum = in write_inode()
611 if (stat("/", &sb) == -1) in get_rootdev()
625 if (ret == -1) { in get_rootdev()
673 c.wanted_total_sectors = -1; in f2fs_init_configuration()
674 c.wanted_sector_size = -1; in f2fs_init_configuration()
683 c.devices[i].fd = -1; in f2fs_init_configuration()
685 c.devices[i].end_blkaddr = -1; in f2fs_init_configuration()
695 c.kd = -1; in f2fs_init_configuration()
696 c.fixed_time = -1; in f2fs_init_configuration()
721 if (!strcmp(device, mnt->mnt_fsname)) { in is_mounted()
758 return -1; in f2fs_dev_is_umounted()
768 return -1; in f2fs_dev_is_umounted()
781 return -1; in f2fs_dev_is_umounted()
787 * If f2fs is umounted with -l, the process can still use in f2fs_dev_is_umounted()
793 if (stat(path, st_buf) == 0 && S_ISBLK(st_buf->st_mode)) { in f2fs_dev_is_umounted()
801 return -1; in f2fs_dev_is_umounted()
815 return -1; in f2fs_devs_are_umounted()
826 memset(version + i, 0, VERSION_LEN + 1 - i); in get_kernel_version()
872 return -1; in open_check_fs()
897 fd = open(dev->path, O_RDWR | O_CREAT | O_BINARY, 0644); in get_device_info()
899 fd = open_check_fs(dev->path, O_BINARY); in get_device_info()
902 return -1; in get_device_info()
911 if (stat(dev->path, stat_buf) < 0 ) { in get_device_info()
914 return -1; in get_device_info()
917 if (S_ISBLK(stat_buf->st_mode) && in get_device_info()
919 fd = open(dev->path, O_RDWR | O_EXCL); in get_device_info()
921 fd = open_check_fs(dev->path, O_EXCL); in get_device_info()
923 fd = open(dev->path, O_RDWR); in get_device_info()
925 fd = open_check_fs(dev->path, 0); in get_device_info()
931 return -1; in get_device_info()
934 dev->fd = fd; in get_device_info()
939 return -1; in get_device_info()
943 if (c.kd == -1) { in get_device_info()
949 c.kd = -2; in get_device_info()
954 dev->total_sectors = c.device_size / dev->sector_size; in get_device_info()
955 } else if (S_ISREG(stat_buf->st_mode)) { in get_device_info()
956 dev->total_sectors = stat_buf->st_size / dev->sector_size; in get_device_info()
957 } else if (S_ISBLK(stat_buf->st_mode)) { in get_device_info()
961 else if (dev->sector_size < sector_size) in get_device_info()
962 dev->sector_size = sector_size; in get_device_info()
965 if (ioctl(fd, BLKGETSIZE64, &dev->total_sectors) < 0) { in get_device_info()
968 return -1; in get_device_info()
974 return -1; in get_device_info()
976 dev->total_sectors = total_sectors; in get_device_info()
978 dev->total_sectors /= dev->sector_size; in get_device_info()
1004 dev->path, reply_buffer+16); in get_device_info()
1010 return -1; in get_device_info()
1014 c.sector_size = dev->sector_size; in get_device_info()
1019 return -1; in get_device_info()
1023 if (S_ISBLK(stat_buf->st_mode)) { in get_device_info()
1026 return -1; in get_device_info()
1030 if (dev->zoned_model != F2FS_ZONED_NONE) { in get_device_info()
1036 return -1; in get_device_info()
1041 * multi-device volume, conventional zones are needed. in get_device_info()
1046 return -1; in get_device_info()
1048 MSG(0, "Info: Host-%s zoned block device:\n", in get_device_info()
1049 (dev->zoned_model == F2FS_ZONED_HA) ? in get_device_info()
1052 dev->nr_zones, dev->nr_rnd_zones); in get_device_info()
1054 dev->zone_blocks); in get_device_info()
1058 if (c.wanted_total_sectors != -1) { in get_device_info()
1061 if (c.wanted_sector_size == -1) { in get_device_info()
1062 c.wanted_sector_size = dev->sector_size; in get_device_info()
1063 } else if (dev->sector_size != c.wanted_sector_size) { in get_device_info()
1065 c.wanted_total_sectors /= dev->sector_size; in get_device_info()
1069 c.total_sectors += dev->total_sectors; in get_device_info()
1126 return -1;
1143 if (win_get_device_size(dev->path, &device_size)) { in get_device_info()
1145 return -1; in get_device_info()
1151 fd = open((char *)dev->path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); in get_device_info()
1153 fd = open((char *)dev->path, O_RDWR | O_BINARY); in get_device_info()
1157 return -1; in get_device_info()
1159 dev->fd = fd; in get_device_info()
1160 dev->total_sectors = device_size / dev->sector_size; in get_device_info()
1162 c.sector_size = dev->sector_size; in get_device_info()
1164 c.total_sectors += dev->total_sectors; in get_device_info()
1167 return -1; in get_device_info()
1178 return -1; in f2fs_get_device_info()
1189 return -1; in f2fs_get_device_info()
1194 * - If all devices are regular block devices, default operation. in f2fs_get_device_info()
1195 * - If at least one HM device is found, operate in HM mode (BLKZONED in f2fs_get_device_info()
1197 * - If an HA device is found, let mkfs decide based on the -m option in f2fs_get_device_info()
1228 return -1; in f2fs_get_device_info()
1245 return -1; in f2fs_get_device_info()
1275 return size - F2FS_EXTRA_ISIZE_OFFSET; in calc_extra_isize()
1311 return -EINVAL; in f2fs_str2encoding()
1351 if (!strcmp(fl->param, f)) { in f2fs_str2encoding_flags()
1353 MSG(0, "Sub %s\n", fl->param); in f2fs_str2encoding_flags()
1354 *flags &= ~fl->flag; in f2fs_str2encoding_flags()
1356 MSG(0, "Add %s\n", fl->param); in f2fs_str2encoding_flags()
1357 *flags |= fl->flag; in f2fs_str2encoding_flags()
1364 return -EINVAL; in f2fs_str2encoding_flags()