int fix = 0;
se = get_seg_entry(sbi, GET_SEGNO(sbi, blk));
- if (se->type < 0 || se->type >= NO_CHECK_TYPE)
+ if (se->type >= NO_CHECK_TYPE)
fix = 1;
else if (IS_DATASEG(se->type) != IS_DATASEG(type))
fix = 1;
int dentries = 0;
u32 blk_cnt;
u8 *name;
- u32 ino;
u16 name_len;;
int ret = 0;
int fixed = 0;
/* readahead inode blocks */
for (i = 0; i < max; i++) {
+ u32 ino;
+
if (test_bit_le(i, bitmap) == 0)
continue;
ftype = dentry[i].file_type;
if ((ftype <= F2FS_FT_UNKNOWN || ftype > F2FS_FT_LAST_FILE_TYPE)) {
- ASSERT_MSG("Bad dentry 0x%x with unexpected ftype 0x%x", ino, ftype);
+ ASSERT_MSG("Bad dentry 0x%x with unexpected ftype 0x%x",
+ le32_to_cpu(dentry[i].ino), ftype);
if (config.fix_on) {
FIX_MSG("Clear bad dentry 0x%x with bad ftype 0x%x",
i, ftype);
u_int16_t *outp = output;
wchar_t wc;
- while (inp - input < insize && *inp) {
+ while ((size_t)(inp - input) < insize && *inp) {
inp = utf8_to_wchar(inp, &wc, insize - (inp - input));
if (inp == NULL) {
DBG(0, "illegal UTF-8 sequence\n");
char *outp = output;
wchar_t wc;
- while (inp - input < insize && le16_to_cpu(*inp)) {
+ while ((size_t)(inp - input) < insize && le16_to_cpu(*inp)) {
inp = utf16_to_wchar(inp, &wc, insize - (inp - input));
if (inp == NULL) {
DBG(0, "illegal UTF-16 sequence\n");
c->ro = 0;
}
-static int is_mounted(struct f2fs_configuration *c,
- const char *mpt, const char *device)
+static int is_mounted(const char *mpt, const char *device)
{
FILE *file = NULL;
struct mntent *mnt = NULL;
while ((mnt = getmntent(file)) != NULL) {
if (!strcmp(device, mnt->mnt_fsname)) {
+#ifdef MNTOPT_RO
if (hasmntopt(mnt, MNTOPT_RO))
config.ro = 1;
+#endif
break;
}
}
struct stat st_buf;
int ret = 0;
- ret = is_mounted(c, MOUNTED, c->device_name);
+ ret = is_mounted(MOUNTED, c->device_name);
if (ret) {
MSG(0, "Info: Mounted device!\n");
return -1;
* if failed due to /etc/mtab file not present
* try with /proc/mounts.
*/
- ret = is_mounted(c, "/proc/mounts", c->device_name);
+ ret = is_mounted("/proc/mounts", c->device_name);
if (ret) {
MSG(0, "Info: Mounted device!\n");
return -1;
return 0;
}
+#ifndef WITH_ANDROID
static int discard_obsolete_dnode(struct f2fs_node *raw_node, u_int64_t offset)
{
do {
return 0;
}
+#endif
static int f2fs_write_root_inode(void)
{
main_area_node_seg_blk_offset += config.cur_seg[CURSEG_WARM_NODE] *
config.blks_per_seg;
+#ifndef WITH_ANDROID
if (discard_obsolete_dnode(raw_node, main_area_node_seg_blk_offset)) {
free(raw_node);
return -1;
}
+#endif
free(raw_node);
return 0;