void fs_sis_try_unlink_hash_file(struct fs *fs, struct fs *super, const char *path) { struct stat st1, st2; const char *dir, *hash, *hash_path, *hash_dir; if (fs_sis_path_parse(fs, path, &dir, &hash) == 0 && fs_stat(super, path, &st1) == 0 && st1.st_nlink == 2) { /* this may be the last link. if hashes/ file is the same, delete it. */ hash_path = t_strdup_printf("%s/"HASH_DIR_NAME"/%s", dir, hash); if (fs_stat(super, hash_path, &st2) == 0 && st1.st_ino == st2.st_ino && CMP_DEV_T(st1.st_dev, st2.st_dev)) { if (fs_unlink(super, hash_path) < 0) i_error("%s", fs_last_error(super)); else { /* try to rmdir the hashes/ directory */ hash_dir = t_strdup_printf("%s/"HASH_DIR_NAME, dir); (void)fs_rmdir(super, hash_dir); } } } }
void ide_fs_unmount(UINT32 param) { int i; char mount_name[16]; int result; struct statvfs sfs; int fd; char dirbuf[sizeof(struct dirent) + 32]; struct dirent *dire = (struct dirent *)dirbuf; unlink_device("/c", MNT_TYPE_IDE); unlink_device("/r", MNT_TYPE_IDE); fd = fs_opendir("/mnt"); while (fs_readdir(fd, dire) > 0) { fs_get_mount_name(MNT_TYPE_IDE, 0, 0, mount_name); if(!MEMCMP(&dire->d_name, &mount_name[5], 3)) { STRCPY(mount_name, "/mnt/"); strcat(mount_name, dire->d_name); FS_PRINTF("unmount: %s ...\n", mount_name); result = fs_statvfs(mount_name, &sfs); if (result < 0) { FS_PRINTF("%s is not mounted! err = %d\n", mount_name, result); FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, MNT_MSG_PARAM(UNMNT_FAILED, MNT_TYPE_IDE, 0)); // IDE_MESSAGE(MP_FS_UNMOUNT, UNMNT_FAILED); continue; } result = fs_unmount(mount_name, 1); if (result < 0) { FS_PRINTF("%s unmounted failed! err = %d\n", mount_name, result); FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, MNT_MSG_PARAM(UNMNT_FAILED, MNT_TYPE_IDE, 0)); // IDE_MESSAGE(MP_FS_UNMOUNT, UNMNT_FAILED); } else { FS_PRINTF("%s unmounted successed!\n", mount_name); } result = fs_rmdir(mount_name); if (result < 0) { FS_PRINTF("remove dir %s failed! err = %d\n", mount_name, result); } } } fs_closedir(fd); ide_hdd_cleanup(0); FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, MNT_MSG_PARAM(UNMNT_UNMOUNT_OK, MNT_TYPE_IDE, 0)); // IDE_MESSAGE(MP_FS_UNMOUNT, UNMNT_UNMOUNT_OK); }
int frmdir(const char *path) { int ret = -EIO; ret = femptydirre(path); ret = fs_rmdir(path); fsync(path); return ret; }
/* rmdir command */ LOCAL void cmd_rmdir(INT ac, B *av[]) { ER er; if (ac < 2) return; er = fs_rmdir(av[1]); if (er >= E_OK) { P("directory '%s' removed\n", av[1]); } else { P("fs_rmdir(%s) ERR [%#x]\n", av[1], er); } }
bool test_fs_dir() { char *path; printf("testing directories... "); fs_mkdir("./tmp-test"); if(!fs_isdir("./tmp-test")) return printf("failed\n"), false; fs_rmdir("./tmp-test"); path = fs_mktmpdir("./tmp-"); if(!fs_isdir(path)) return printf("failed\n"), false; fs_rmdir(path); mem_free(path); printf("okay\n"); return true; }
static int mount_device(const char *dev_name, const char *vol_name) { int result = 0; result = fs_mkdir(vol_name, 0); if(result < 0) { FS_PRINTF("mkdir: %s failed! ret = %d\n", vol_name, result); return result; } FS_PRINTF("mount: %s -> %s...", dev_name, vol_name); result = fs_mount(vol_name, dev_name, "FAT", 0, NULL); if(result == -EINVAL) { result = fs_mount(vol_name, dev_name, "NTFS", 0, NULL); if (result == -EBUSY) { fs_unmount(vol_name, 1); result = fs_mount(vol_name, dev_name, "NTFS", 0, NULL); } } else if(result == -EBUSY) { fs_unmount(vol_name, 1); result = fs_mount(vol_name, dev_name, "FAT", 0, NULL); if(result == -EINVAL) { result = fs_mount(vol_name, dev_name, "NTFS", 0, NULL); if(result == -EBUSY) { fs_unmount(vol_name, 1); result = fs_mount(vol_name, dev_name, "NTFS", 0, NULL); } } } if(result >= 0) { FS_PRINTF("successed!\n"); } else { FS_PRINTF("failed! err = %d\n", result); fs_rmdir(vol_name); } return result; }
int process_request(const char *line, FILE *fp, FileSystem *fs) { char command[4096]; #ifdef DEBUG fprintf(stderr, "process request `%s`\n", line); #endif sscanf(line, "%s", command); #ifdef DEBUG fprintf(stderr, "command is `%s`\n", command); #endif if (0 == strcmp("f", command)) { fs_format(fs); return RESULT_DONE; } else if (0 == strcmp("mk", command)) { char f[4096]; char parent_path[4096]; sscanf(line + 2, "%s", f); #ifdef DEBUG fprintf(stderr, "> mk `%s`\n", f); #endif if (fs_exists(fs, f)) { #ifdef DEBUG fprintf(stderr, "> `%s` already exists\n", f); #endif return RESULT_NO; } else { #ifdef DEBUG fprintf(stderr, "> going to create `%s`\n", f); #endif } fs_split_path(f, parent_path, NULL); if (fs_isdir(fs, parent_path)) { if (fs_create(fs, f)) { #ifdef DEBUG fprintf(stderr, "> failed to create `%s`\n", f); #endif return RESULT_NO; } return RESULT_YES; } #ifdef DEBUG fprintf(stderr, "> parent path `%s` is not a directory\n", parent_path); #endif return RESULT_NO; } else if (0 == strcmp("mkdir", command)) { char d[4096]; char parent_path[4096]; sscanf(line + 5, "%s", d); if (fs_exists(fs, d)) { return RESULT_NO; } fs_split_path(d, parent_path, NULL); if (fs_isdir(fs, parent_path)) { if (fs_mkdir(fs, d)) { return RESULT_NO; } return RESULT_YES; } return RESULT_NO; } else if (0 == strcmp("rm", command)) { char f[4096]; sscanf(line + 2, "%s", f); if (fs_isfile(fs, f)) { if (fs_unlink(fs, f)) { return RESULT_NO; } return RESULT_YES; } return RESULT_NO; } else if (0 == strcmp("cd", command)) { char path[4096]; sscanf(line + 2, "%s", path); if (fs_isdir(fs, path)) { if (fs_chdir(fs, path)) { return RESULT_NO; } return RESULT_YES; } #ifdef DEBUG fprintf(stderr, "`%s` is not a directory\n", path); #endif return RESULT_NO; } else if (0 == strcmp("rmdir", command)) { char d[4096]; sscanf(line + 5, "%s", d); if (fs_isdir(fs, d)) { if (fs_rmdir(fs, d)) { return RESULT_NO; } return RESULT_YES; } return RESULT_NO; } else if (0 == strcmp("ls", command)) { fs_ls(fs, fp); return RESULT_ELSE; } else if (0 == strcmp("cat", command)) { char f[4096]; sscanf(line + 3, "%s", f); if (fs_isfile(fs, f)) { fs_cat(fs, f, fp); return RESULT_ELSE; } return RESULT_NO; } else if (0 == strcmp("w", command)) { char f[4096]; int l; char data[4096]; sscanf(line + 1, "%s %d %[^\n]", f, &l, data); if (fs_isfile(fs, f)) { if (fs_write(fs, f, l, data)) { return RESULT_NO; } return RESULT_YES; } return RESULT_NO; } else if (0 == strcmp("i", command)) { char f[4096]; int pos; int l; char data[4096]; sscanf(line + 1, "%s %d %d %[^\n]", f, &pos, &l, data); if (fs_isfile(fs, f)) { if (fs_insert(fs, f, pos, l, data)) { return RESULT_NO; } return RESULT_YES; } return RESULT_NO; } else if (0 == strcmp("d", command)) { char f[4096]; int pos; int l; sscanf(line + 1, "%s %d %d", f, &pos, &l); if (fs_isfile(fs, f)) { if (fs_delete(fs, f, pos, l)) { return RESULT_NO; } return RESULT_YES; } return RESULT_NO; } else if (0 == strcmp("e", command)) { return RESULT_EXIT; } return RESULT_ELSE; }
int rmdir(const char *pathname) { return fs_rmdir(pathname); }
void gd_ripper_StartRip() { file_t fd; CDROM_TOC toc ; int status, disc_type ,cdcr ,start ,s_end ,nsec ,type ,tn ,session,terr=0; char dst_folder[MAX_FN_LEN]; char dst_file[MAX_FN_LEN]; char riplabel[64]; char text[MAX_FN_LEN]; uint64 stoptimer , starttimer , riptime; starttimer = timer_ms_gettime64 (); // timer cdrom_reinit(); snprintf(text ,MAX_FN_LEN,"%s", GUI_TextEntryGetText(self.gname)); if(GUI_WidgetGetState(self.sd_c)) { snprintf(dst_folder, MAX_FN_LEN, "/sd/%s", text); }else if(GUI_WidgetGetState(self.hdd_c)) { snprintf(dst_folder, MAX_FN_LEN, "/ide/%s", text); }else if(GUI_WidgetGetState(self.net_c)) { snprintf(dst_folder, MAX_FN_LEN, "/net/%s", text); } //ds_printf("Dst file1 %s\n" ,dst_folder); getstatus: if((cdcr = cdrom_get_status(&status, &disc_type)) != ERR_OK) { switch (cdcr){ case ERR_NO_DISC : ds_printf("DS_ERROR: Disk not inserted\n"); return; case ERR_DISC_CHG : cdrom_reinit(); goto getstatus; case CD_STATUS_BUSY : thd_sleep(200); goto getstatus; case CD_STATUS_SEEKING : thd_sleep(200); goto getstatus; case CD_STATUS_SCANNING : thd_sleep(200); goto getstatus; default: ds_printf("DS_ERROR: GD-rom error\n"); return; } } if (disc_type == CD_CDROM_XA){ rname: snprintf(dst_file,MAX_FN_LEN, "%s.iso", dst_folder); if ((fd=fs_open(dst_file , O_RDONLY)) != FILEHND_INVALID) { fs_close(fd); strcpy(dst_file,"\0"); strcat(dst_folder , "0"); goto rname ; } else disc_type = 1; } else if (disc_type == CD_GDROM){ rname1: if ((fd=fs_open (dst_folder , O_DIR)) != FILEHND_INVALID) { fs_close(fd); strcat(dst_folder , "0"); goto rname1 ; } else {strcpy(dst_file,"\0"); snprintf(dst_file,MAX_FN_LEN,"%s", dst_folder); disc_type = 2; fs_mkdir(dst_file); } while(cdrom_read_toc(&toc, 1) != CMD_OK) { terr++; cdrom_reinit(); if (terr > 100){ ds_printf("DS_ERROR: Toc read error for gdlast\n"); fs_rmdir(dst_folder); return; } } terr=0; self.lastgdtrack = TOC_TRACK(toc.last); } else { ds_printf("DS_ERROR: This is not game disk\nInserted %d disk\n",disc_type); return; } //ds_printf("Dst file %s\n" ,dst_file); for (session=0; session < disc_type; session++) { cdrom_set_sector_size(2048); while(cdrom_read_toc(&toc, session) != CMD_OK) { terr++; if(terr==5) cdrom_reinit(); thd_sleep(500); if (terr > 10) { ds_printf("DS_ERROR: Toc read error\n"); if (disc_type == 1) { if(fs_unlink(dst_file) != 0) ds_printf("Error delete file: %s\n" ,dst_file); }else { if ((fd=fs_open (dst_folder , O_DIR)) == FILEHND_INVALID) { ds_printf("Error folder '%s' not found\n" ,dst_folder); return; } dirent_t *dir; while ((dir = fs_readdir(fd))){ if (!strcmp(dir->name,".") || !strcmp(dir->name,"..")) continue; strcpy(dst_file,"\0"); snprintf(dst_file, MAX_FN_LEN, "%s/%s", dst_folder, dir->name); fs_unlink(dst_file); } fs_close(fd); fs_rmdir(dst_folder); } return; } } terr = 0; int first = TOC_TRACK(toc.first); int last = TOC_TRACK(toc.last); for (tn=first; tn <= last; tn++ ) { if (disc_type == 1) tn = last; type = TOC_CTRL(toc.entry[tn-1]); if (disc_type == 2) { strcpy(dst_file,"\0"); snprintf(dst_file,MAX_FN_LEN,"%s/track%02d.%s", dst_folder, tn, (type == 4 ? "iso" : "raw")); } start = TOC_LBA(toc.entry[tn-1]); s_end = TOC_LBA((tn == last ? toc.leadout_sector : toc.entry[tn])); nsec = s_end - start; if (disc_type == 1 && type == 4) nsec -= 2 ; else if (session==1 && tn != last && type != TOC_CTRL(toc.entry[tn])) nsec -= 150; else if (session==0 && type == 4) nsec -= 150; if (disc_type == 2 && session == 0) { strcpy(riplabel,"\0"); sprintf(riplabel,"Track %d of %d\n",tn ,self.lastgdtrack ); } else if (disc_type == 2 && session == 1 && tn != self.lastgdtrack) { strcpy(riplabel,"\0"); sprintf(riplabel,"Track %d of %d\n",tn ,self.lastgdtrack ); } else { strcpy(riplabel,"\0"); sprintf(riplabel,"Last track\n"); } GUI_LabelSetText(self.track_label, riplabel); if (rip_sec(tn, start, nsec, type, dst_file, disc_type) != CMD_OK) { GUI_LabelSetText(self.track_label, " "); stoptimer = timer_ms_gettime64 (); // timer GUI_ProgressBarSetPosition(self.pbar, 0.0); cdrom_spin_down(); if (disc_type == 1) { if(fs_unlink(dst_file) != 0) ds_printf("Error delete file: %s\n" ,dst_file); } else { if ((fd=fs_open (dst_folder , O_DIR)) == FILEHND_INVALID) { ds_printf("Error folder '%s' not found\n" ,dst_folder); return; } dirent_t *dir; while ((dir = fs_readdir(fd))){ if (!strcmp(dir->name,".") || !strcmp(dir->name,"..")) continue; strcpy(dst_file,"\0"); snprintf(dst_file, MAX_FN_LEN, "%s/%s", dst_folder, dir->name); fs_unlink(dst_file); } fs_close(fd); fs_rmdir(dst_folder); } return ; } GUI_LabelSetText(self.track_label, " "); GUI_ProgressBarSetPosition(self.pbar, 0.0); } } GUI_LabelSetText(self.track_label, " "); GUI_WidgetMarkChanged(self.app->body); if (disc_type == 2){ if (gdfiles(dst_folder, dst_file, text) != CMD_OK){ cdrom_spin_down(); if ((fd=fs_open (dst_folder , O_DIR)) == FILEHND_INVALID) { ds_printf("Error folder '%s' not found\n" ,dst_folder); return; } dirent_t *dir; while ((dir = fs_readdir(fd))){ if (!strcmp(dir->name,".") || !strcmp(dir->name,"..")) continue; strcpy(dst_file,"\0"); snprintf(dst_file, MAX_FN_LEN, "%s/%s", dst_folder, dir->name); fs_unlink(dst_file); } fs_close(fd); fs_rmdir(dst_folder); return; } } GUI_ProgressBarSetPosition(self.pbar, 0.0); cdrom_spin_down(); stoptimer = timer_ms_gettime64 (); // timer riptime = stoptimer - starttimer; int ripmin = riptime / 60000 ; int ripsec = riptime % 60 ; ds_printf("DS_OK: End ripping. Save at %d:%d\n",ripmin,ripsec); }
void sd_fs_unmount(UINT32 param) { int i; char mount_name[16]; int result; struct statvfs sfs; int fd; struct stat st; char dirbuf[sizeof(struct dirent) + 32]; struct dirent *dire = (struct dirent *)dirbuf; #ifdef USB_SUPPORT_HUB UINT32 msg_code = 0; struct fs_sto_param fs_param; fs_param.type = MNT_TYPE_SD; fs_param.id = 0; fs_param.partition_id = 0; #endif #if (SYS_CHIP_MODULE != ALI_S3602) unlink_device("/c", MNT_TYPE_SD); unlink_device("/r", MNT_TYPE_SD); #endif fd = fs_opendir("/mnt"); while(fs_readdir(fd, dire) > 0) { fs_get_mount_name(MNT_TYPE_SD, 0, 0, mount_name); if(!MEMCMP(&dire->d_name, &mount_name[5], 3)) { STRCPY(mount_name, "/mnt/"); strcat(mount_name, dire->d_name); FS_PRINTF("unmount: %s ...", mount_name); result = fs_statvfs(mount_name, &sfs); if(result < 0) { FS_PRINTF("the %s is not mounted!\n", mount_name); #if (SYS_CHIP_MODULE == ALI_S3602) FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, MNT_MSG_PARAM(UNMNT_FAILED, MNT_TYPE_SD, 0)); // SD_MESSAGE(MP_FS_UNMOUNT, UNMNT_FAILED); #else #ifdef USB_SUPPORT_HUB fs_param.msg_code = UNMNT_FAILED; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 1; #endif FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, msg_code); #endif continue; } result = fs_unmount(mount_name, 1); if(result < 0) { FS_PRINTF("the %s is unmounted failed!\n", mount_name); #if (SYS_CHIP_MODULE == ALI_S3602) FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, MNT_MSG_PARAM(UNMNT_FAILED, MNT_TYPE_SD, 0)); // SD_MESSAGE(MP_FS_UNMOUNT, UNMNT_FAILED); #else #ifdef USB_SUPPORT_HUB fs_param.msg_code = UNMNT_FAILED; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 1; #endif FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, msg_code); #endif FS_PRINTF("failed! err = %d\n", result); } else { FS_PRINTF("successed!\n"); } result = fs_rmdir(mount_name); if (result < 0) { FS_PRINTF("remove dir %s failed! err = %d\n", mount_name, result); } } } #if (SYS_CHIP_MODULE != ALI_S3602) #ifdef USB_SUPPORT_HUB fs_param.msg_code = UNMNT_PLUGOUT; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 0; #endif FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, msg_code); #ifdef USB_SUPPORT_HUB fs_param.msg_code = 102; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 102; #endif FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, msg_code); #endif fs_closedir(fd); sdio_hdd_cleanup(0); #if (SYS_CHIP_MODULE == ALI_S3602) FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, MNT_MSG_PARAM(UNMNT_UNMOUNT_OK, MNT_TYPE_SD, 0)); // SD_MESSAGE(MP_FS_UNMOUNT, UNMNT_UNMOUNT_OK); #endif }
void sata_fs_unmount(UINT32 param) { int i; char mount_name[16]; int result; struct statvfs sfs; int fd; char dirbuf[sizeof(struct dirent) + 32]; struct dirent *dire = (struct dirent *)dirbuf; struct fs_sto_param fs_param; fs_param.type = MNT_TYPE_SATA; fs_param.id = 0; fs_param.partition_id = 0; fd = fs_opendir("/mnt"); while (fs_readdir(fd, dire) > 0) { fs_get_mount_name(MNT_TYPE_SATA, 0, 0, mount_name); if(!MEMCMP(&dire->d_name, &mount_name[5], 3)) { STRCPY(mount_name, "/mnt/"); strcat(mount_name, dire->d_name); FS_PRINTF("unmount: %s ...\n", mount_name); result = fs_statvfs(mount_name, &sfs); if (result < 0) { FS_PRINTF("%s is not mounted! err = %d\n", mount_name, result); fs_param.msg_code = UNMNT_FAILED; PUT_MESSAGE(MP_FS_UNMOUNT, fs_param); continue; } result = fs_unmount(mount_name, 1); if (result < 0) { FS_PRINTF("%s unmounted failed! err = %d\n", mount_name, result); fs_param.msg_code = UNMNT_FAILED; PUT_MESSAGE(MP_FS_UNMOUNT, fs_param); } else { FS_PRINTF("%s unmounted successed!\n", mount_name); } result = fs_rmdir(mount_name); if (result < 0) { FS_PRINTF("remove dir %s failed! err = %d\n", mount_name, result); } } } fs_closedir(fd); sata_hdd_cleanup(0); fs_param.msg_code = UNMNT_UNMOUNT_OK; PUT_MESSAGE(MP_FS_UNMOUNT, fs_param); return; }
void usb_fs_unmount(UINT32 nodeid) { int i; char mount_name[16]; int result; int devid; struct statvfs sfs; char dirbuf[sizeof(struct dirent) + 32]; struct dirent *dire = (struct dirent *)dirbuf; int fd; struct stat st; UINT32 msg_code = 0; int lunlist[16]; INT32 lun_num = usb_hdd_get_lunlist(nodeid, lunlist, 16); #ifdef USB_SUPPORT_HUB struct fs_sto_param fs_param; fs_param.type = MNT_TYPE_USB; fs_param.id = 0; fs_param.partition_id = 0; #endif unlink_device("/c", MNT_TYPE_USB); #if (SYS_CHIP_MODULE != ALI_S3602) unlink_device("/r", MNT_TYPE_USB); #endif for( i = 0; i<lun_num; ++i) { devid = usb_hdd_get_dev(nodeid, lunlist[i]); if(devid < 0) continue; #ifdef USB_SUPPORT_HUB fs_param.id = devid; #endif fd = fs_opendir("/mnt"); while(fs_readdir(fd, dire) > 0) { fs_get_mount_name(MNT_TYPE_USB, devid, 0, mount_name); if(!MEMCMP(&dire->d_name, &mount_name[5], 3)) { STRCPY(mount_name, "/mnt/"); strcat(mount_name, dire->d_name); FS_PRINTF("unmount: %s ...", mount_name); result = fs_statvfs(mount_name, &sfs); if(result < 0) { FS_PRINTF("the %s is not mounted!\n", mount_name); #if (SYS_CHIP_MODULE == ALI_S3602) #ifdef USB_SUPPORT_HUB FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, MNT_MSG_PARAM(UNMNT_FAILED, fs_param.type, fs_param.id)); #else FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, MNT_MSG_PARAM(UNMNT_FAILED, MNT_TYPE_USB, 0)); // USB_MESSAGE(MP_FS_UNMOUNT, UNMNT_FAILED); #endif #else #ifdef USB_SUPPORT_HUB fs_param.msg_code = UNMNT_FAILED; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 1; #endif FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, msg_code); #endif continue; } result = fs_unmount(mount_name, 1); if(result < 0) { FS_PRINTF("the %s is unmounted failed!\n", mount_name); #if (SYS_CHIP_MODULE == ALI_S3602) #ifdef USB_SUPPORT_HUB FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, MNT_MSG_PARAM(UNMNT_FAILED, fs_param.type, fs_param.id)); #else FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, MNT_MSG_PARAM(UNMNT_FAILED, MNT_TYPE_USB, 0)); // USB_MESSAGE(MP_FS_UNMOUNT, UNMNT_FAILED); #endif #else #ifdef USB_SUPPORT_HUB fs_param.msg_code = UNMNT_FAILED; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 1; #endif FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, msg_code); #endif FS_PRINTF("failed! err = %d\n", result); } else { FS_PRINTF("successed!\n"); } fs_rmdir(mount_name); } } //FS_PRINTF("fs_unmount ok!\n"); #ifdef USB_SUPPORT_HUB //fix for usb with multi-device, every device should notify APP #if (SYS_CHIP_MODULE != ALI_S3602) fs_param.msg_code = UNMNT_PLUGOUT; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, msg_code); fs_param.msg_code = UNMNT_UNMOUNT; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, msg_code); #endif #endif fs_closedir(fd); usb_hdd_cleanup(nodeid, lunlist[i]); #if (SYS_CHIP_MODULE == ALI_S3602) #ifdef USB_SUPPORT_HUB FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, MNT_MSG_PARAM(UNMNT_UNMOUNT_OK, fs_param.type, fs_param.id)); #else FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, MNT_MSG_PARAM(UNMNT_UNMOUNT_OK, MNT_TYPE_USB, 0)); #endif #endif } #ifndef USB_SUPPORT_HUB #if (SYS_CHIP_MODULE != ALI_S3602) #ifdef USB_SUPPORT_HUB fs_param.msg_code = UNMNT_PLUGOUT; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 0; #endif FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, msg_code); #ifdef USB_SUPPORT_HUB fs_param.msg_code = UNMNT_UNMOUNT; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 2; #endif FS_NOTICE_MESSAGE(MP_FS_UNMOUNT, msg_code); #endif #endif }