int main(void) { int total_deleted = 0; DIR *d; struct dirent *de; cleanup(); create_files(); d = opendir(TESTDIR); /* skip past . and .. */ de = readdir(d); strcmp(de->d_name, ".") == 0 || FAILED("match ."); de = readdir(d); strcmp(de->d_name, "..") == 0 || FAILED("match .."); while (1) { int n = os2_delete(d); if (n == 0) break; total_deleted += n; } closedir(d); printf("Deleted %d files of %d\n", total_deleted, NUM_FILES); rmdir(TESTDIR) == 0 || FAILED("rmdir"); return 0; }
void *thread_worker_create(void *arg) { struct my_thread_arg *arg1 = (struct my_thread_arg*)arg; create_files(arg1->dir, arg1->nums); return NULL; }
static int internal_create_group(struct kobject *kobj, int update, const struct attribute_group *grp) { struct sysfs_dirent *sd; int error; BUG_ON(!kobj || (!update && !kobj->sd)); /* Updates may happen before the object has been instantiated */ if (unlikely(update && !kobj->sd)) return -EINVAL; if (!grp->attrs && !grp->bin_attrs) { WARN(1, "sysfs: (bin_)attrs not set by subsystem for group: %s/%s\n", kobj->name, grp->name ? "" : grp->name); return -EINVAL; } if (grp->name) { error = sysfs_create_subdir(kobj, grp->name, &sd); if (error) return error; } else sd = kobj->sd; sysfs_get(sd); error = create_files(sd, kobj, grp, update); if (error) { if (grp->name) sysfs_remove_subdir(sd); } sysfs_put(sd); return error; }
static int internal_create_group(struct kobject *kobj, int update, const struct attribute_group *grp) { struct sysfs_dirent *sd; int error; BUG_ON(!kobj || (!update && !kobj->sd)); /* Updates may happen before the object has been instantiated */ if (unlikely(update && !kobj->sd)) return -EINVAL; if (grp->name) { error = sysfs_create_subdir(kobj, grp->name, &sd); if (error) return error; } else sd = kobj->sd; sysfs_get(sd); error = create_files(sd, kobj, grp, update); if (error) { if (grp->name) sysfs_remove_subdir(sd); } sysfs_put(sd); return error; }
int main (int argc, char *argv[]) { struct dirent *de; DIR *dir; unsigned i, j; unsigned n; u64 l; punyopt(argc, argv, myopt, "k:"); n = Option.iterations; mkdir(Option.dir, 0777); chdirq(Option.dir); create_files(Numfiles); for (l = 0; l < Option.loops; l++) { startTimer(); for (j = 0; j < n; ++j) { dir = opendir("."); if (!dir) { perror("."); exit(1); } for (i = 0;; ++i) { de = readdir(dir); if (!de) break; } closedir(dir); } stopTimer(); prTimer(); printf(" n=%d l=%lld\n", n, l); } return 0; }
static int internal_create_group(struct kobject *kobj, int update, const struct attribute_group *grp) { struct kernfs_node *kn; int error; BUG_ON(!kobj || (!update && !kobj->sd)); /* Updates may happen before the object has been instantiated */ if (unlikely(update && !kobj->sd)) return -EINVAL; if (!grp->attrs && !grp->bin_attrs) { WARN(1, "sysfs: (bin_)attrs not set by subsystem for group: %s/%s\n", kobj->name, grp->name ? "" : grp->name); return -EINVAL; } if (grp->name) { kn = kernfs_create_dir(kobj->sd, grp->name, S_IRWXU | S_IRUGO | S_IXUGO, kobj); if (IS_ERR(kn)) { if (PTR_ERR(kn) == -EEXIST) sysfs_warn_dup(kobj->sd, grp->name); return PTR_ERR(kn); } } else kn = kobj->sd; kernfs_get(kn); error = create_files(kn, kobj, grp, update); if (error) { if (grp->name) kernfs_remove(kn); } kernfs_put(kn); return error; }
void fillup_test() { MPI_Barrier_Sync(); root_printf("Test %d: Random fillup test\n", testno); if (rank == 0) { create_and_prep_dir(); create_files("fptestfile", operated_entries); sync_mmap(); random_unlink(operated_entries); sync_mmap(); } MPI_Barrier_Sync(); if (rank) { random_fill_empty_entries(operated_entries / size); sync_mmap(); } MPI_Barrier_Sync(); sleep(2); if (rank == 0) { verify_dirents(); } MPI_Barrier_Sync(); if (rank == 0) destroy_dir(); testno++; }
void unlink_test() { MPI_Barrier_Sync(); root_printf("Test %d: Random concurrent unlink test\n", testno); if (rank == 0) { create_and_prep_dir(); create_files("uktestfile", operated_entries); sync_mmap(); } MPI_Barrier_Sync(); if (rank) { random_unlink(operated_entries / 2); sync_mmap(); } MPI_Barrier_Sync(); sleep(2); if (rank == 0) { verify_dirents(); } MPI_Barrier_Sync(); if (rank == 0) destroy_dir(); testno++; }
void rw_test() { MPI_Barrier_Sync(); root_printf("Test %d: Concurrent rename test\n", testno); if (rank == 0) { create_and_prep_dir(); create_files("rwtestfile", operated_entries); sync_mmap(); } MPI_Barrier_Sync(); if (rank) { random_rename_same_reclen(operated_entries / 2); sync_mmap(); } MPI_Barrier_Sync(); sleep(2); if (rank == 0) { verify_dirents(); } sleep(2); MPI_Barrier_Sync(); if (rank == 0) destroy_dir(); testno++; }
void grow_test() { MPI_Barrier_Sync(); root_printf("Test %d: Growing tests\n", testno); if (rank == 0) { create_and_prep_dir(); sync_mmap(); } MPI_Barrier_Sync(); if (rank) { create_files("filename", operated_entries); sync_mmap(); } MPI_Barrier_Sync(); if (rank == 0) { verify_dirents(); } sleep(2); MPI_Barrier_Sync(); testno++; }
void get_directory_almost_full(int minus_this_many) { int almost_full_entries; almost_full_entries = get_max_inlined_entries(max_inline_size); almost_full_entries -= minus_this_many; /* Need up to 20 characters to get a 32 byte entry */ create_files("filename-", almost_full_entries); }
int main(int argc, char **argv){ ssh_session session; if(opts(argc,argv)<0) return EXIT_FAILURE; session=connect_ssh(host,NULL,verbosity); if(session == NULL) return EXIT_FAILURE; create_files(session); fetch_files(session); ssh_disconnect(session); ssh_finalize(); return 0; }
static int _mklmfs(char *disk, char *dir) { struct lmfs_address *paddress = &address; int inode; int ret; format_disk(disk, paddress, MAX_FILE); ret = create_files(dir, 0); dump_super_block(address.p_sb); return ret; }
int main(int argc, char *argv[]) { tomoyo_test_init(); printf("***** Testing file hooks in enforce mode. *****\n"); create_files(); should_fail = 1; set_file_enforce(1); stage_file_test(); set_file_enforce(0); clear_status(); creanup_files(); printf("***** Testing file hooks in permissive mode. *****\n"); should_fail = 0; create_files(); set_file_enforce(0); stage_file_test(); creanup_files(); clear_status(); return 0; }
int C_Errors::execute() { int result; if (!isOk()) { fprintf( stderr, _("Class did not initialize properly.\n") ); return( 1 ); } result=create_files(); if (result) return( result ); result=parse_errors(); if (result) { close_files(); return( result ); } return( close_files() ); }
int file_cmd_prepare(void) { if (parse_arguments()) return 1; /* Make sure that files do not exist for 'sequential write' test mode, create test files for other test modes */ if (test_mode == MODE_WRITE) return remove_files(); return create_files(); }
void start_final_installation( void ) { gtk_frame_set_label( GTK_FRAME( body_frame), "Installation step - 5/5 ( managing source files )" ); gtk_button_set_label( GTK_BUTTON( cancel_button), "Finish" ); gtk_widget_set_sensitive( GTK_WIDGET( cancel_button), FALSE ); pattern_label = gtk_label_new( "" ); gtk_container_add( GTK_CONTAINER( body_frame), pattern_label ); gtk_widget_show_all( main_window ); fd = popen( "whoami", "r" ); fscanf( fd, "%s", system_user_name ); pclose(fd); create_directories(); create_files(); manage_files(); }
int main(int argc, char **argv) { int ret; if (parse_opts(argc, argv)) { usage(); return 1; } srand(time(NULL) ^ getpid()); qprintf("blocksize: %u, #blocks: %llu, ratio: %u, numfiles: %u\n", blocksize, size_blocks, ratio, numfiles); ret = create_files(); qprintf("Wrote %llu blocks, %llu zeroed, actual ratio: %f\n", wtotal, wzeroed, (double)wzeroed/wtotal); return ret; }
int main(void) { int total_deleted = 0; DIR *d; struct dirent *de; cleanup(); create_files(); d = opendir(TESTDIR); chdir(TESTDIR) == 0 || FAILED(); /* skip past . and .. */ de = readdir(d); strcmp(de->d_name, ".") == 0 || FAILED(); de = readdir(d); strcmp(de->d_name, "..") == 0 || FAILED(); while ((de = readdir(d))) { off_t ofs = telldir(d); unlink(de->d_name) == 0 || FAILED(); /* move one more position on */ readdir(d); /* seek to just after the first readdir() */ seekdir(d, ofs); total_deleted++; } closedir(d); printf("Deleted %d files of %d\n", total_deleted, NUM_FILES); chdir("..") == 0 || FAILED(); rmdir(TESTDIR) == 0 || FAILED(); return 0; }
int test_readdir_os2_delete(void) { int total_deleted = 0; DIR *d; struct dirent *de; test_readdir_os2_delete_ret = 0; cleanup(); create_files(); d = opendir(TESTDIR "/test0.txt"); if (d != NULL) FAILED("opendir() on file succeed"); if (errno != ENOTDIR) FAILED("opendir() on file didn't give ENOTDIR"); d = opendir(TESTDIR); /* skip past . and .. */ de = readdir(d); strcmp(de->d_name, ".") == 0 || FAILED("match ."); de = readdir(d); strcmp(de->d_name, "..") == 0 || FAILED("match .."); while (1) { int n = os2_delete(d); if (n == 0) break; total_deleted += n; } closedir(d); fprintf(stderr, "Deleted %d files of %d\n", total_deleted, NUM_FILES); rmdir(TESTDIR) == 0 || FAILED("rmdir"); if (system("rm -rf " TESTDIR) == -1) { FAILED("system"); } return test_readdir_os2_delete_ret; }
int main(int argc, char *argv[]) { int ret; if(argc != 2) { printf("usage:%s metafile\n",argv[0]); exit(-1); } // 设置信号处理函数 ret = set_signal_hander(); if(ret != 0) { printf("%s:%d error\n",__FILE__,__LINE__); return -1; } // 解析种子文件 ret = parse_metafile(argv[1]); if(ret != 0) { printf("%s:%d error\n",__FILE__,__LINE__); return -1; } // 初始化非阻塞peer init_unchoke_peers(); // 创建用于保存下载数据的文件 ret = create_files(); if(ret != 0) { printf("%s:%d error\n",__FILE__,__LINE__); return -1; } // 创建位图 ret = create_bitfield(); if(ret != 0) { printf("%s:%d error\n",__FILE__,__LINE__); return -1; } // 创建缓冲区 ret = create_btcache(); if(ret != 0) { printf("%s:%d error\n",__FILE__,__LINE__); return -1; } // 负责与所有Peer收发数据、交换消息 download_upload_with_peers(); // 做一些清理工作,主要是释放动态分配的内存 do_clear_work(); return 0; }
/**ltl * 功能: 创建一个文件组 * 参数: * 返回值: * 说明: 在/sys下创建一下目录,并在此目录新建文件 */ int sysfs_create_group(struct kobject * kobj, const struct attribute_group * grp) { struct dentry * dir; int error; BUG_ON(!kobj || !kobj->dentry); if (grp->name) { /* 创建目录 */ error = sysfs_create_subdir(kobj,grp->name,&dir); if (error) return error; } else dir = kobj->dentry; dir = dget(dir); if ((error = create_files(dir,grp))) { /* 创建文件 */ if (grp->name) sysfs_remove_subdir(dir); } dput(dir); return error; }
int sysfs_create_group(struct kobject * kobj, const struct attribute_group * grp) { struct sysfs_dirent *sd; int error; BUG_ON(!kobj || !kobj->sd); if (grp->name) { error = sysfs_create_subdir(kobj, grp->name, &sd); if (error) return error; } else sd = kobj->sd; sysfs_get(sd); error = create_files(sd, grp); if (error) { if (grp->name) sysfs_remove_subdir(sd); } sysfs_put(sd); return error; }
void allTests() { int err=chdir("C:\\"); test(err==0); make_tree(); create_files(); renaming(); directory(); attributes(); searching(); deletion(); temporary_files(); if (close_console) { test_Close(); close(0); close(1); close(2); CloseSTDLIB(); } }
int main(int argc, char* argv[]) { std::vector<std::string> files; std::string path; int ch; while ((ch = getopt(argc, argv, "hf:d:")) > 0) { switch (ch) { case 'h': usage(argv[0]); return 0; case 'f': files.push_back(optarg); break; case 'd': path = optarg; break; default: break; } } char buf[1024]; if (getcwd(buf, sizeof(buf)) == NULL) { printf("getcwd error %s\r\n", acl::last_serror()); return 1; } if (!path.empty()) { if (chdir(path.c_str()) < 0) { printf("chdir to %s error %s\r\n", path.c_str(), acl::last_serror()); return 1; } scan_path(files); } if (files.empty()) { usage(argv[0]); return 1; } create_files(files); // return the saved working path if (chdir(buf) < 0) { printf("chdir to %s error %s\r\n", buf, acl::last_serror()); return 1; } if(path.empty()) { path = files.front(); std::size_t pos = path.find_last_of('/'); if (pos == std::string::npos) pos = path.find_last_of('\\'); if (pos == std::string::npos) return 0; path = path.substr(0, pos); if(path.empty() == false) copy_files(path.c_str()); } return 0; }
static int create_files(char *dir_name, int inode) { DIR *dir; struct dirent *pdir; struct file_buffer *bdir; struct file_buffer *bfile; char *name; char *tmp; int len = 0; int file; int ret = 0; int finode = 0; dir = opendir(dir_name); if (dir == NULL) { printf("Can not open dir %s\n", dir_name); return -EACCES; } bdir = allocate_file_buffer(); if (!bdir) { ret = -ENOMEM; goto close_dir; } init_file_buffer(bdir, DT_DIR); bdir->inode = inode; bfile = allocate_file_buffer(); if (!bdir) { ret = -ENOMEM; goto release_bdir; } name = malloc(1024); if (!name) { ret = -ENOMEM; goto release_bfile; } memset(name, 0, 1024); init_inode_entry(bdir, inode, DT_DIR); while (pdir = readdir(dir)) { if (!strcmp(pdir->d_name, ".")) continue; if(!strcmp(pdir->d_name, "..")) continue; finode = pop_inode(); if (!finode) goto release_bfile; strcpy(name, dir_name); len = strlen(name); if (name[len - 1] != '/') strcat(name, "/"); strcat(name, pdir->d_name); printf("Add file [ %s ] to disk\n", name); if (pdir->d_type == DT_DIR) { write_entry_to_dir(bdir, pdir->d_name, finode, DT_DIR); create_files(name, finode); } else { write_entry_to_dir(bdir, pdir->d_name, finode, DT_BLK); init_file_buffer(bfile, TYPE_FILE); bfile->inode = finode; init_inode_entry(bfile, finode, DT_BLK); file = open(name, O_RDONLY); if(file < 0) { printf("can not open file %s\n", name); continue; } write_file(file, bfile); } } write_inode(bdir); release_file_name_buffer: free(name); release_bdir: free_file_buffer(bfile); release_bfile: free_file_buffer(bdir); close_dir: closedir(dir); return ret; }
int main(int argc, char* argv[]) { h_begin(); URL.getenvdata(); URL.parser(); h_table(); NowRun = 0; FD_ZERO(&afds); for(int i = 0; i<5 ; i++){ if(URL.on[i]){ //printf("%d onnnnnnnnnnnn <br>",i); conncet_server(i); create_files(i); } } ////////////////////////////////////////////////////////////////////////////////////////////////// //讀server的資訊 fd_set rfds; char inputline[1000]; while(1){ for(int i = 0; i<5 ; i++){ if(URL.on[i]){ if(STARDREAD[i]==1){ //sleep(1); //加這行可以慢速trace XD read_files_send(i); if(!strcmp(readtxt_buf,"exit")){ URL.on[i] = 881; sleep(1); //printf("<script>document.all['m%d'].innerHTML += \"<xmp>set 881 readtxt_buf = %s</xmp>\";</script>\n",i,readtxt_buf); } } if(serv_addr[i].sin_addr.s_addr == inet_addr("255.255.255.255")){ //host找不到都丟掉 URL.on[i] = 881; //printf("<script>document.all['m%d'].innerHTML += \"<b>Can't find host</b><br>\";</script>\n",i); } if (fp[i] == NULL) { //讀不到檔案踢掉 URL.on[i] = 881; //printf("<script>document.all['m%d'].innerHTML += \"<b>File doesn't exist</b><br>\";</script>\n",i); } } } FD_ZERO(&rfds); memcpy(&rfds, &afds, sizeof(rfds)); if(select(100,&rfds,NULL,NULL,NULL) < 0) exit(1); for(int i = 0; i<5 ; i++){ if(URL.on[i]){ if(FD_ISSET(client_fd[i],&rfds)){ for(int j = 0 ;j<1000;j++) inputline[j] = '\0'; //如果用read會把socket一口氣讀進來不換行 if(readline(client_fd[i], i, inputline,1000) == -1){ sleep(1); continue; } if(inputline[strlen(inputline)-1] == '\n'){ inputline[strlen(inputline)-1] ='\0'; printf("<script>document.all['m%d'].innerHTML += \"<xmp>%s</xmp>\";</script>\n",i,inputline); } else{ //ip對port錯,FD_ISSET會一直當有訊息會被%洗版,所以加上STARDREAD[i]==1 if( URL.on[i] != 881 && STARDREAD[i]==1) printf("<script>document.all['m%d'].innerHTML += \"<b>%% </b>\";</script>\n",i); } fflush(stdout); //這行不加cgi會卡住 //打exit後不會第一時間訊息到socket所以這個條件式要放在FD_ISSET內 if(URL.on[i] == 881 ){ fclose(fp[i]); close(client_fd[i]); NowRun--; FD_CLR(client_fd[i], &afds); URL.on[i] = 0; } } } } if(NowRun == 0) break; } h_end(); return 0; }
static int etm_probe(struct platform_device *pdev) { static int first_device = 0; struct etm_driver_data *data = dev_get_platdata(&pdev->dev); int ret = 0; void __iomem **new_regs; struct etm_info *new_info; int new_count; u32 id, config_code, config_code_extension, system_config; mutex_lock(&tracer.mutex); new_count = tracer.nr_etm_regs + 1; new_regs = krealloc(tracer.etm_regs, sizeof(tracer.etm_regs[0]) * new_count, GFP_KERNEL); if (!new_regs) { pr_err("Failed to allocate ETM register array\n"); ret = -ENOMEM; goto out; } tracer.etm_regs = new_regs; new_info = krealloc(tracer.etm_info, sizeof(tracer.etm_info[0]) * new_count, GFP_KERNEL); if (!new_info) { pr_err("Failed to allocate ETM info array\n"); ret = -ENOMEM; goto out; } tracer.etm_info = new_info; tracer.etm_regs[tracer.nr_etm_regs] = data->etm_regs; if (!first_device) { first_device = 1; if (unlikely((ret = misc_register(&etm_device)) != 0)) { pr_err("Fail to register etm device\n"); goto out; } if (unlikely((ret = create_files()) != 0)) { pr_err("Fail to create device files\n"); goto deregister; } } memset(&(tracer.etm_info[tracer.nr_etm_regs]), 0, sizeof(struct etm_info)); tracer.etm_info[tracer.nr_etm_regs].enable = 1; tracer.etm_info[tracer.nr_etm_regs].is_ptm = data->is_ptm; tracer.etm_info[tracer.nr_etm_regs].pwr_down = data->pwr_down; id = etm_readl(&tracer, tracer.nr_etm_regs, ETMIDR); config_code = etm_readl(&tracer, tracer.nr_etm_regs, ETMCCR); config_code_extension = etm_readl(&tracer, tracer.nr_etm_regs, ETMCCER); system_config = etm_readl(&tracer, tracer.nr_etm_regs, ETMSCR); tracer.nr_etm_regs = new_count; out: mutex_unlock(&tracer.mutex); return ret; deregister: misc_deregister(&etm_device); mutex_unlock(&tracer.mutex); return ret; }
static void *handle_clients(void* args) { char s[MM_PROBE_MAX_DATA_SEND_SIZE + sizeof(probeHeader_t)] = {0}; int num, fd = -1; boolean run = true; client_terminated = false; FILE *binFile = NULL; //Used for combined bin-file int server_store_location = 0; //0=>PC 1=>sdcard FILE *wavSpeechFilePaths[MM_PROBE_NUMBER_OF_SPEECH_PROBES] = {NULL}; //Used for Speech probes wav-files char wavSpeechFormatWritten[MM_PROBE_NUMBER_OF_SPEECH_PROBES] = {0}; //to store enabled probes for filepath creation int probeDataCnt = 0; //How much data from a read has been used int moreProbeData = 1; //to see if one read contain more than one probe char tmpProbe[MM_PROBE_MAX_DATA_SEND_SIZE + sizeof(probeHeader_t)] = {0}; //Temp store for next probe to be written to file int tmpProbeHeaderSize = 0; int tmpProbePayloadSize = 0; threadInputData_t *input = (threadInputData_t*) args; char probeIDs[MM_PROBE_NUMBER_OF_SPEECH_PROBES * 3 + 1] = {0}; //to store enabled probes for filepath creation char *tmpBinFileBuffer = malloc(MM_PROBE_MAX_DATA_SEND_SIZE); int tmpBinFileBufferCounter = 0; log_message(L_INFO, "client: waiting for data..."); fd = open(FIFO_NAME, O_RDONLY); if (input->enabledProbes != NULL) { strncat(probeIDs, input->enabledProbes, MM_PROBE_NUMBER_OF_SPEECH_PROBES * 3); } // To make read blocking we must always have a writer connected to the pipe int dummy_client = open(FIFO_NAME, O_WRONLY); while (run) { if ((num = read(fd, s, MM_PROBE_MAX_DATA_SEND_SIZE)) == -1) { log_message(L_INFO, "client: failed to read from pipe"); run = false; // Silly temporary solution to kill the client. // Works only for 1 client. The rest will still be running since // there is a race of which client gets the read. // I need to use select with multiple fds instead (I think)... } else if (strcmp(s, "die") == 0) { log_message(L_INFO, "client: die message received"); run = false; } else if (strcmp(s, "PC") == 0) { server_store_location = 0; log_message(L_INFO, "client: server_store_location=PC"); } else if (strcmp(s, "Phone") == 0) { server_store_location = 1; log_message(L_INFO, "client: server_store_location=Phone"); } else if (strcmp(s, "Path") == 0) { //Check if LogDecoder or commandline interface is used //If LogDecoder is used set logDecoderFormat to combined file if (probeIDs[0] == '\0') { input->logDecoderFormat = 1; } //Create necessary files for probing to locally on phone if (create_files(probeIDs, input->logDecoderFormat, &binFile, wavSpeechFilePaths) != 0) { run = false; } } else if(num > 0) { if (server_store_location == 1) { if (input->logDecoderFormat != 0) { //write all probe data to a single combined file in LogDecoder file format if (binFile != NULL) { //if the tmp-buffer is full write data to filesystem. Buffer used to reduce no of fwrite which takes long time if (num >= (MM_PROBE_MAX_DATA_SEND_SIZE - tmpBinFileBufferCounter)) { fwrite(tmpBinFileBuffer, 1, tmpBinFileBufferCounter, binFile); tmpBinFileBufferCounter = 0; } //Copy probe-data to tmp-buffer memcpy(tmpBinFileBuffer + tmpBinFileBufferCounter, s, num); tmpBinFileBufferCounter += num; } } else { //write probe data to multiple files, one per pid, pcm .wav format char* probe_p = s; probeHeader_t * header_p = (probeHeader_t *)tmpProbe; probeDataCnt = 0; moreProbeData = 1; while (moreProbeData) { //Copy header if (tmpProbeHeaderSize < (int)sizeof(probeHeader_t)) { int toBeCopied = ( (sizeof(probeHeader_t)-tmpProbeHeaderSize) <= (num -probeDataCnt) ? (sizeof(probeHeader_t)-tmpProbeHeaderSize) : (num -probeDataCnt) ); memcpy(tmpProbe, probe_p, toBeCopied); probe_p += toBeCopied; probeDataCnt += toBeCopied; tmpProbeHeaderSize += toBeCopied; } //Copy payload if (tmpProbeHeaderSize == sizeof(probeHeader_t)) { if ( tmpProbePayloadSize < header_p->Size ) { int toBeCopied = ( ( header_p->Size - tmpProbePayloadSize) <= (num -probeDataCnt) ? header_p->Size - tmpProbePayloadSize : (num -probeDataCnt) ); memcpy( (tmpProbe + tmpProbeHeaderSize + tmpProbePayloadSize), probe_p, toBeCopied); probe_p += toBeCopied; probeDataCnt += toBeCopied; tmpProbePayloadSize += toBeCopied; } } //If a complete full probe exist write to file if ( (tmpProbeHeaderSize == sizeof(probeHeader_t)) && (header_p->Size == tmpProbePayloadSize) ) { int probeId = header_p->ProbeId; //Check if a file has been open for writing //Speech probes if ( (probeId < MM_PROBE_NUMBER_OF_SPEECH_PROBES) && (wavSpeechFilePaths[probeId] != NULL) ) { if (wavSpeechFormatWritten[probeId] == false) { //Speech probes that uses v1 have to override samplerate if (header_p->DataFormat.SampleRate == MM_PROBE_SAMPLE_RATE_UNKNOWN) { //20 ms probes in CScall if ( (probeId == MM_PROBE_RX_SPD_OUTPUT) || (probeId == MM_PROBE_TX_SPE_INPUT) || (probeId == MM_PROBE_TX_CS_CALL_INPUT) || (probeId == MM_PROBE_RX_CS_CALL_OUTPUT) ) { if (header_p->Size == 320) header_p->DataFormat.SampleRate = MM_PROBE_SAMPLE_RATE_8KHZ; else header_p->DataFormat.SampleRate = MM_PROBE_SAMPLE_RATE_16KHZ; } else { //10 ms probes in Speech_proc if (header_p->Size == 160) header_p->DataFormat.SampleRate = MM_PROBE_SAMPLE_RATE_8KHZ; else header_p->DataFormat.SampleRate = MM_PROBE_SAMPLE_RATE_16KHZ; } } writeWavHeader((DataFormat_t*) &header_p->DataFormat, wavSpeechFilePaths[probeId]); wavSpeechFormatWritten[probeId] = true; } fwrite(tmpProbe + sizeof(probeHeader_t), 1, tmpProbePayloadSize, wavSpeechFilePaths[probeId]); } else if (probeId > MM_PROBE_NUMBER_OF_SPEECH_PROBES) { //ADM/OMX probes int i; for (i=0; i<MM_PROBE_MAX_NUMBER_ADM_PROBES; i++) { if ( (deviceProbeList[i].pid == probeId) && (deviceProbeList[i].file != NULL) ) { if (deviceProbeList[i].formatWritten == false) { writeWavHeader((DataFormat_t*) &header_p->DataFormat, deviceProbeList[i].file); deviceProbeList[i].formatWritten = true; } fwrite(tmpProbe + sizeof(probeHeader_t), 1, tmpProbePayloadSize, deviceProbeList[i].file); break; } } } tmpProbeHeaderSize = 0; tmpProbePayloadSize = 0; } //all read data used if ( probeDataCnt == num ) { moreProbeData = 0; } } } } else { send(input->clientfd, s, num, 0); } } else { log_message(L_INFO, "client: this should never happen!"); run = false; } } if ((server_store_location == 1) && (binFile != NULL)) { fclose(binFile); } else if ((server_store_location == 1) && (input->logDecoderFormat == 0)) { int i; //Running without LogDecoder i.e. each active probe file should be closed //Speech probes for (i=1; i < MM_PROBE_NUMBER_OF_SPEECH_PROBES; i++) { if (probe_list[i-1] == 1) { if (wavSpeechFilePaths[i] != NULL) { if (wavSpeechFormatWritten[i] == true) { updateWavHeader(wavSpeechFilePaths[i]); } fclose(wavSpeechFilePaths[i]); wavSpeechFilePaths[i] = NULL; } } } //ADM/OMX probes for (i=0; i <MM_PROBE_MAX_NUMBER_ADM_PROBES; i++) { if (deviceProbeList[i].file != NULL) { if (deviceProbeList[i].formatWritten == true) { updateWavHeader(deviceProbeList[i].file); } fclose(deviceProbeList[i].file); deviceProbeList[i].file = NULL; } } } close(fd); close(dummy_client); client_terminated = true; disable_all_probes(); // Client process can now go and die. log_message(L_INFO, "client: shutting down."); close(input->clientfd); return NULL; }
void create_filesystem_impl(unsigned char * out_file){ unsigned char * root_dir; struct unsigned_char_ptr_to_unsigned_char_ptr_map files; struct unsigned_char_ptr_to_unsigned_char_ptr_map directories; struct unsigned_char_ptr_list directory_keys; struct unsigned_char_list tmp; struct memory_pool_collection mpc; const char * filesystem_files[NUM_FILES][2] = { {"./data-structures/void_ptr_compare.h", "/./data-structures/void_ptr_compare.h"}, {"./data-structures/void_ptr_memory_pool.h", "/./data-structures/void_ptr_memory_pool.h"}, {"./data-structures/generic.h.memory_pool", "/./data-structures/generic.h.memory_pool"}, {"./data-structures/void_ptr_to_unsigned_int_map.h", "/./data-structures/void_ptr_to_unsigned_int_map.h"}, {"./data-structures/generic.h.binary_search", "/./data-structures/generic.h.binary_search"}, {"./data-structures/struct_constant_description_ptr_list.h", "/./data-structures/struct_constant_description_ptr_list.h"}, {"./data-structures/struct_type_description_memory_pool.h", "/./data-structures/struct_type_description_memory_pool.h"}, {"./data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair_binary_search.h"}, {"./data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair_merge_sort.h"}, {"./data-structures/unsigned_char_ptr_to_unsigned_char_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_unsigned_char_ptr_map.h"}, {"./data-structures/struct_normalized_declarator_ptr_list.h", "/./data-structures/struct_normalized_declarator_ptr_list.h"}, {"./data-structures/struct_c_lexer_token_ptr_to_unsigned_char_ptr_map.h", "/./data-structures/struct_c_lexer_token_ptr_to_unsigned_char_ptr_map.h"}, {"./data-structures/struct_macro_definition_ptr_list.h", "/./data-structures/struct_macro_definition_ptr_list.h"}, {"./data-structures/unsigned_char_ptr_to_struct_macro_definition_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_macro_definition_ptr_map.h"}, {"./data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair_binary_search.h"}, {"./data-structures/struct_namespace_object_ptr_list.h", "/./data-structures/struct_namespace_object_ptr_list.h"}, {"./data-structures/generic.h.list", "/./data-structures/generic.h.list"}, {"./data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair_merge_sort.h"}, {"./data-structures/generic.h.map", "/./data-structures/generic.h.map"}, {"./data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair_binary_search.h"}, {"./data-structures/struct_macro_parameter_ptr_list.h", "/./data-structures/struct_macro_parameter_ptr_list.h"}, {"./data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair_binary_search.h"}, {"./data-structures/generic.h.merge_sort", "/./data-structures/generic.h.merge_sort"}, {"./data-structures/unsigned_char_ptr_to_struct_special_macro_definition_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_special_macro_definition_ptr_map.h"}, {"./data-structures/struct_constant_initializer_level_ptr_list.h", "/./data-structures/struct_constant_initializer_level_ptr_list.h"}, {"./data-structures/struct_normalized_declaration_element_ptr_list.h", "/./data-structures/struct_normalized_declaration_element_ptr_list.h"}, {"./data-structures/unsigned_int_list.h", "/./data-structures/unsigned_int_list.h"}, {"./data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair_merge_sort.h"}, {"./data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair_merge_sort.h"}, {"./data-structures/replace_tool.h", "/./data-structures/replace_tool.h"}, {"./data-structures/struct_preprocessor_file_context_ptr_list.h", "/./data-structures/struct_preprocessor_file_context_ptr_list.h"}, {"./data-structures/struct_switch_frame_ptr_list.h", "/./data-structures/struct_switch_frame_ptr_list.h"}, {"./data-structures/unsigned_int_binary_search.h", "/./data-structures/unsigned_int_binary_search.h"}, {"./data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair_merge_sort.h"}, {"./data-structures/struct_void_ptr_to_unsigned_int_key_value_pair_binary_search.h", "/./data-structures/struct_void_ptr_to_unsigned_int_key_value_pair_binary_search.h"}, {"./data-structures/struct_asm_lexer_token_ptr_list.h", "/./data-structures/struct_asm_lexer_token_ptr_list.h"}, {"./data-structures/binary_exponential_buffer.h", "/./data-structures/binary_exponential_buffer.h"}, {"./data-structures/struct_void_ptr_to_unsigned_int_key_value_pair_merge_sort.h", "/./data-structures/struct_void_ptr_to_unsigned_int_key_value_pair_merge_sort.h"}, {"./data-structures/struct_linker_symbol_ptr_list.h", "/./data-structures/struct_linker_symbol_ptr_list.h"}, {"./data-structures/unsigned_char_ptr_to_struct_macro_parameter_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_macro_parameter_ptr_map.h"}, {"./data-structures/struct_type_traversal_ptr_list.h", "/./data-structures/struct_type_traversal_ptr_list.h"}, {"./data-structures/char_list.h", "/./data-structures/char_list.h"}, {"./data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair_binary_search.h"}, {"./data-structures/struct_scope_level_ptr_list.h", "/./data-structures/struct_scope_level_ptr_list.h"}, {"./data-structures/struct_asm_instruction_ptr_list.h", "/./data-structures/struct_asm_instruction_ptr_list.h"}, {"./data-structures/struct_c_lexer_state_ptr_list.h", "/./data-structures/struct_c_lexer_state_ptr_list.h"}, {"./data-structures/struct_unsigned_char_list_ptr_list.h", "/./data-structures/struct_unsigned_char_list_ptr_list.h"}, {"./data-structures/unsigned_char_ptr_to_struct_linker_symbol_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_linker_symbol_ptr_map.h"}, {"./data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair_merge_sort.h"}, {"./data-structures/struct_asm_lexer_state_ptr_list.h", "/./data-structures/struct_asm_lexer_state_ptr_list.h"}, {"./data-structures/unsigned_int_merge_sort.h", "/./data-structures/unsigned_int_merge_sort.h"}, {"./data-structures/struct_c_lexer_token_memory_pool.h", "/./data-structures/struct_c_lexer_token_memory_pool.h"}, {"./data-structures/unsigned_char_ptr_list.h", "/./data-structures/unsigned_char_ptr_list.h"}, {"./data-structures/struct_parser_node_memory_pool.h", "/./data-structures/struct_parser_node_memory_pool.h"}, {"./data-structures/unsigned_char_ptr_to_struct_namespace_object_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_namespace_object_ptr_map.h"}, {"./data-structures/struct_preloader_instruction_list.h", "/./data-structures/struct_preloader_instruction_list.h"}, {"./data-structures/struct_normalized_specifier_ptr_list.h", "/./data-structures/struct_normalized_specifier_ptr_list.h"}, {"./data-structures/struct_linker_symbol_memory_pool.h", "/./data-structures/struct_linker_symbol_memory_pool.h"}, {"./data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair_merge_sort.h"}, {"./data-structures/unsigned_char_list.h", "/./data-structures/unsigned_char_list.h"}, {"./data-structures/struct_asm_lexer_token_memory_pool.h", "/./data-structures/struct_asm_lexer_token_memory_pool.h"}, {"./data-structures/struct_linker_object_ptr_merge_sort.h", "/./data-structures/struct_linker_object_ptr_merge_sort.h"}, {"./data-structures/struct_special_macro_definition_ptr_list.h", "/./data-structures/struct_special_macro_definition_ptr_list.h"}, {"./data-structures/struct_parser_operation_stack.h", "/./data-structures/struct_parser_operation_stack.h"}, {"./data-structures/struct_struct_c_lexer_token_ptr_list_ptr_list.h", "/./data-structures/struct_struct_c_lexer_token_ptr_list_ptr_list.h"}, {"./data-structures/unsigned_char_ptr_compare.h", "/./data-structures/unsigned_char_ptr_compare.h"}, {"./data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair_merge_sort.h"}, {"./data-structures/struct_linker_object_ptr_list.h", "/./data-structures/struct_linker_object_ptr_list.h"}, {"./data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair_binary_search.h"}, {"./data-structures/struct_c_lexer_token_ptr_list.h", "/./data-structures/struct_c_lexer_token_ptr_list.h"}, {"./data-structures/unsigned_int_stack.h", "/./data-structures/unsigned_int_stack.h"}, {"./data-structures/char_ptr_list.h", "/./data-structures/char_ptr_list.h"}, {"./data-structures/generic.h.stack", "/./data-structures/generic.h.stack"}, {"./data-structures/void_ptr_list.h", "/./data-structures/void_ptr_list.h"}, {"./data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair_binary_search.h"}, {"./data-structures/struct_c_lexer_token_ptr_compare.h", "/./data-structures/struct_c_lexer_token_ptr_compare.h"}, {"./data-structures/struct_preprocessor_if_branch_ptr_list.h", "/./data-structures/struct_preprocessor_if_branch_ptr_list.h"}, {"./data-structures/struct_asm_instruction_memory_pool.h", "/./data-structures/struct_asm_instruction_memory_pool.h"}, {"./data-structures/unsigned_int_ptr_list.h", "/./data-structures/unsigned_int_ptr_list.h"}, {"./data-structures/struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_map.h", "/./data-structures/struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_map.h"}, {"./data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair_binary_search.h"}, {"./data-structures/struct_type_description_ptr_list.h", "/./data-structures/struct_type_description_ptr_list.h"}, {"./data-structures/unsigned_char_ptr_to_struct_constant_description_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_constant_description_ptr_map.h"}, {"./data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair_binary_search.h"}, {"./data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair_merge_sort.h"}, {"./parser.h", "/./parser.h"}, {"./linker.h", "/./linker.h"}, {"./filesystem/filesystem_compiler.h", "/./filesystem/filesystem_compiler.h"}, {"./heap_memory_pool.h", "/./heap_memory_pool.h"}, {"./io.h", "/./io.h"}, {"./kernel/private_kernel_interface.h", "/./kernel/private_kernel_interface.h"}, {"./kernel/user_proc.h", "/./kernel/user_proc.h"}, {"./kernel/public_kernel_interface.h", "/./kernel/public_kernel_interface.h"}, {"./kernel/kernel_state.h", "/./kernel/kernel_state.h"}, {"./kernel/core_data_types.h", "/./kernel/core_data_types.h"}, {"./kernel/queue.h", "/./kernel/queue.h"}, {"./core_data_types.h", "/./core_data_types.h"}, {"./libc/size_t.h", "/./libc/size_t.h"}, {"./libc/common.h", "/./libc/common.h"}, {"./libc/putchar.h", "/./libc/putchar.h"}, {"./libc/stdio.h", "/./libc/stdio.h"}, {"./libc/unistd.h", "/./libc/unistd.h"}, {"./libc/string.h", "/./libc/string.h"}, {"./libc/stdarg.h", "/./libc/stdarg.h"}, {"./libc/stdlib.h", "/./libc/stdlib.h"}, {"./libc/assert.h", "/./libc/assert.h"}, {"./libc/filesystem.h", "/./libc/filesystem.h"}, {"./lexer.h", "/./lexer.h"}, {"./preloader.h", "/./preloader.h"}, {"./memory_pool_collection.h", "/./memory_pool_collection.h"}, {"./emulators/javascript/index.html", "/./emulators/javascript/index.html"}, {"./emulators/c/op-cpu.h", "/./emulators/c/op-cpu.h"}, {"./builtin/includetest2.h", "/./builtin/includetest2.h"}, {"./builtin/includetest1.h", "/./builtin/includetest1.h"}, {"./preprocessor.h", "/./preprocessor.h"}, {"./code_generator.h", "/./code_generator.h"}, {"code_generator.c", "/code_generator.c"}, {"io.c", "/io.c"}, {"lexer.c", "/lexer.c"}, {"linker.c", "/linker.c"}, {"parser.c", "/parser.c"}, {"preloader.c", "/preloader.c"}, {"preprocessor.c", "/preprocessor.c"}, {"test/c89/basic-operations.c", "/test/c89/basic-operations.c"}, {"test/c89/basic-putchar-aa.c", "/test/c89/basic-putchar-aa.c"}, {"test/c89/basic-putchar-a.c", "/test/c89/basic-putchar-a.c"}, {"test/c89/basic-putchar-b.c", "/test/c89/basic-putchar-b.c"}, {"test/c89/constants.c", "/test/c89/constants.c"}, {"test/c89/empty-main-return-zero.c", "/test/c89/empty-main-return-zero.c"}, {"test/c89/exotic-declarators.c", "/test/c89/exotic-declarators.c"}, {"test/c89/filesystem.c", "/test/c89/filesystem.c"}, {"test/c89/for-loop.c", "/test/c89/for-loop.c"}, {"test/c89/ignore-local.c", "/test/c89/ignore-local.c"}, {"test/c89/main_with_parameters.c", "/test/c89/main_with_parameters.c"}, {"test/c89/malloc-test.c", "/test/c89/malloc-test.c"}, {"test/c89/many-types.c", "/test/c89/many-types.c"}, {"test/c89/nested-putchar-a.c", "/test/c89/nested-putchar-a.c"}, {"test/c89/nested-putchar-a-param-ignored.c", "/test/c89/nested-putchar-a-param-ignored.c"}, {"test/c89/nested-putchar-a-param-used.c", "/test/c89/nested-putchar-a-param-used.c"}, {"test/c89/preprocessor_test.c", "/test/c89/preprocessor_test.c"}, {"test/c89/print.c", "/test/c89/print.c"}, {"test/c89/putchar-return.c", "/test/c89/putchar-return.c"}, {"test/c89/string-literal.c", "/test/c89/string-literal.c"}, {"test/c89/typedef.c", "/test/c89/typedef.c"}, {"test/c89/use-array.c", "/test/c89/use-array.c"}, {"test/c89/use-local.c", "/test/c89/use-local.c"}, {"test/c89/use-reference.c", "/test/c89/use-reference.c"}, {"test/c89/va_list_call.c", "/test/c89/va_list_call.c"}, {"test/c89/while-loop.c", "/test/c89/while-loop.c"}, {"libc/assert.c", "/libc/assert.c"}, {"libc/filesystem.c", "/libc/filesystem.c"}, {"libc/fopen.c", "/libc/fopen.c"}, {"libc/getcwd.c", "/libc/getcwd.c"}, {"libc/Makefile", "/libc/Makefile"}, {"libc/malloc.c", "/libc/malloc.c"}, {"libc/printf.c", "/libc/printf.c"}, {"libc/l2/putchar.l2", "/libc/l2/putchar.l2"}, {"libc/string.c", "/libc/string.c"}, {"kernel/filesystem.c", "/kernel/filesystem.c"}, {"kernel/kernel_impl.c", "/kernel/kernel_impl.c"}, {"kernel/kernel_state.c", "/kernel/kernel_state.c"}, {"kernel/main.c", "/kernel/main.c"}, {"kernel/putchar.c", "/kernel/putchar.c"}, {"kernel/queue.c", "/kernel/queue.c"}, {"kernel/user_proc.c", "/kernel/user_proc.c"}, {"filesystem/filesystem_compiler.c", "/filesystem/filesystem_compiler.c"}, {"types/struct_l0_build_info.h","/types/struct_l0_build_info.h"}, {"types/data-structures/struct_struct_linker_symbol_ptr_list.h","/types/data-structures/struct_struct_linker_symbol_ptr_list.h"}, {"types/data-structures/struct_struct_preprocessor_macro_level_ptr_list.h","/types/data-structures/struct_struct_preprocessor_macro_level_ptr_list.h"}, {"types/data-structures/struct_void_ptr_list.h","/types/data-structures/struct_void_ptr_list.h"}, {"types/data-structures/struct_struct_constant_description_ptr_list.h","/types/data-structures/struct_struct_constant_description_ptr_list.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_map.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair.h"}, {"types/data-structures/struct_unsigned_int_ptr_list.h","/types/data-structures/struct_unsigned_int_ptr_list.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_map.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_map.h"}, {"types/data-structures/struct_struct_c_lexer_token_ptr_list.h","/types/data-structures/struct_struct_c_lexer_token_ptr_list.h"}, {"types/data-structures/unsigned_int.h","/types/data-structures/unsigned_int.h"}, {"types/data-structures/struct_struct_namespace_object_ptr_list.h","/types/data-structures/struct_struct_namespace_object_ptr_list.h"}, {"types/data-structures/struct_struct_asm_instruction_ptr_list.h","/types/data-structures/struct_struct_asm_instruction_ptr_list.h"}, {"types/data-structures/struct_struct_c_lexer_state_ptr_list.h","/types/data-structures/struct_struct_c_lexer_state_ptr_list.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair.h"}, {"types/data-structures/struct_struct_normalized_declaration_element_ptr_list.h","/types/data-structures/struct_struct_normalized_declaration_element_ptr_list.h"}, {"types/data-structures/struct_char_list.h","/types/data-structures/struct_char_list.h"}, {"types/data-structures/struct_struct_macro_definition_ptr_list.h","/types/data-structures/struct_struct_macro_definition_ptr_list.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_map.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair.h"}, {"types/data-structures/struct_struct_asm_lexer_state_ptr_list.h","/types/data-structures/struct_struct_asm_lexer_state_ptr_list.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_map.h"}, {"types/data-structures/struct_char_ptr_list.h","/types/data-structures/struct_char_ptr_list.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair.h"}, {"types/data-structures/struct_struct_normalized_declarator_ptr_list.h","/types/data-structures/struct_struct_normalized_declarator_ptr_list.h"}, {"types/data-structures/struct_struct_struct_c_lexer_token_ptr_list_ptr_list.h","/types/data-structures/struct_struct_struct_c_lexer_token_ptr_list_ptr_list.h"}, {"types/data-structures/struct_struct_preprocessor_if_branch_ptr_list.h","/types/data-structures/struct_struct_preprocessor_if_branch_ptr_list.h"}, {"types/data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_map.h","/types/data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_map.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_build_target_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_build_target_ptr_key_value_pair.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_linker_object_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_linker_object_ptr_key_value_pair.h"}, {"types/data-structures/struct_struct_scope_level_ptr_list.h","/types/data-structures/struct_struct_scope_level_ptr_list.h"}, {"types/data-structures/struct_void_ptr_to_unsigned_int_key_value_pair.h","/types/data-structures/struct_void_ptr_to_unsigned_int_key_value_pair.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_map.h"}, {"types/data-structures/struct_unsigned_char_list.h","/types/data-structures/struct_unsigned_char_list.h"}, {"types/data-structures/struct_struct_unsigned_char_list_ptr_list.h","/types/data-structures/struct_struct_unsigned_char_list_ptr_list.h"}, {"types/data-structures/struct_unsigned_char_ptr_list.h","/types/data-structures/struct_unsigned_char_ptr_list.h"}, {"types/data-structures/struct_struct_build_target_ptr_list.h","/types/data-structures/struct_struct_build_target_ptr_list.h"}, {"types/data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair.h","/types/data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair.h"}, {"types/data-structures/struct_struct_special_macro_definition_ptr_list.h","/types/data-structures/struct_struct_special_macro_definition_ptr_list.h"}, {"types/data-structures/struct_struct_macro_parameter_ptr_list.h","/types/data-structures/struct_struct_macro_parameter_ptr_list.h"}, {"types/data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair.h","/types/data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_build_target_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_build_target_ptr_map.h"}, {"types/data-structures/struct_unsigned_int_list.h","/types/data-structures/struct_unsigned_int_list.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair.h"}, {"types/data-structures/struct_struct_linker_object_ptr_list.h","/types/data-structures/struct_struct_linker_object_ptr_list.h"}, {"types/data-structures/struct_linker_object_ptr.h","/types/data-structures/struct_linker_object_ptr.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_map.h"}, {"types/data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_map.h","/types/data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_map.h"}, {"types/data-structures/struct_struct_preprocessor_file_context_ptr_list.h","/types/data-structures/struct_struct_preprocessor_file_context_ptr_list.h"}, {"types/data-structures/struct_struct_type_traversal_ptr_list.h","/types/data-structures/struct_struct_type_traversal_ptr_list.h"}, {"types/data-structures/struct_void_ptr_to_unsigned_int_map.h","/types/data-structures/struct_void_ptr_to_unsigned_int_map.h"}, {"types/data-structures/struct_struct_type_description_ptr_list.h","/types/data-structures/struct_struct_type_description_ptr_list.h"}, {"types/data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair.h"}, {"types/data-structures/struct_struct_constant_initializer_level_ptr_list.h","/types/data-structures/struct_struct_constant_initializer_level_ptr_list.h"}, {"types/data-structures/struct_struct_preloader_instruction_list.h","/types/data-structures/struct_struct_preloader_instruction_list.h"}, {"types/data-structures/struct_struct_normalized_specifier_ptr_list.h","/types/data-structures/struct_struct_normalized_specifier_ptr_list.h"}, {"types/data-structures/struct_struct_switch_frame_ptr_list.h","/types/data-structures/struct_struct_switch_frame_ptr_list.h"}, {"types/data-structures/struct_struct_asm_lexer_token_ptr_list.h","/types/data-structures/struct_struct_asm_lexer_token_ptr_list.h"}, {"types/lexer/struct_common_lexer_state.h","/types/lexer/struct_common_lexer_state.h"}, {"types/lexer/struct_asm_lexer_token.h","/types/lexer/struct_asm_lexer_token.h"}, {"types/lexer/enum_c_token_type.h","/types/lexer/enum_c_token_type.h"}, {"types/lexer/enum_asm_token_type.h","/types/lexer/enum_asm_token_type.h"}, {"types/lexer/struct_c_lexer_token.h","/types/lexer/struct_c_lexer_token.h"}, {"types/lexer/struct_c_lexer_state.h","/types/lexer/struct_c_lexer_state.h"}, {"types/lexer/struct_asm_lexer_state.h","/types/lexer/struct_asm_lexer_state.h"}, {"types/struct_heap_memory_pool.h","/types/struct_heap_memory_pool.h"}, {"types/preprocessor/struct_macro_definition.h","/types/preprocessor/struct_macro_definition.h"}, {"types/preprocessor/struct_preprocessor_file_context.h","/types/preprocessor/struct_preprocessor_file_context.h"}, {"types/preprocessor/struct_preprocessor_macro_level.h","/types/preprocessor/struct_preprocessor_macro_level.h"}, {"types/preprocessor/enum_macro_definition_type.h","/types/preprocessor/enum_macro_definition_type.h"}, {"types/preprocessor/struct_preprocessor_if_branch.h","/types/preprocessor/struct_preprocessor_if_branch.h"}, {"types/preprocessor/struct_special_macro_definition.h","/types/preprocessor/struct_special_macro_definition.h"}, {"types/preprocessor/struct_preprocessor_state.h","/types/preprocessor/struct_preprocessor_state.h"}, {"types/preprocessor/struct_macro_parameter.h","/types/preprocessor/struct_macro_parameter.h"}, {"types/preprocessor/enum_special_macro_type.h","/types/preprocessor/enum_special_macro_type.h"}, {"types/code_generator/struct_switch_frame.h","/types/code_generator/struct_switch_frame.h"}, {"types/code_generator/struct_compile_time_constant.h","/types/code_generator/struct_compile_time_constant.h"}, {"types/code_generator/struct_constant_initializer_level.h","/types/code_generator/struct_constant_initializer_level.h"}, {"types/code_generator/struct_type_traversal.h","/types/code_generator/struct_type_traversal.h"}, {"types/code_generator/enum_copy_method.h","/types/code_generator/enum_copy_method.h"}, {"types/code_generator/struct_code_gen_state.h","/types/code_generator/struct_code_gen_state.h"}, {"types/linker/struct_asm_instruction.h","/types/linker/struct_asm_instruction.h"}, {"types/linker/struct_linker_object.h","/types/linker/struct_linker_object.h"}, {"types/linker/struct_linker_symbol.h","/types/linker/struct_linker_symbol.h"}, {"types/enum_build_target_type.h","/types/enum_build_target_type.h"}, {"types/parser/enum_normalized_declarator_type.h","/types/parser/enum_normalized_declarator_type.h"}, {"types/parser/enum_add_or_remove.h","/types/parser/enum_add_or_remove.h"}, {"types/parser/struct_scope_level.h","/types/parser/struct_scope_level.h"}, {"types/parser/enum_normalized_specifier_type.h","/types/parser/enum_normalized_specifier_type.h"}, {"types/parser/enum_object_location.h","/types/parser/enum_object_location.h"}, {"types/parser/struct_normalized_declaration_element.h","/types/parser/struct_normalized_declaration_element.h"}, {"types/parser/struct_namespace_object.h","/types/parser/struct_namespace_object.h"}, {"types/parser/struct_first_and_last_namespace_object.h","/types/parser/struct_first_and_last_namespace_object.h"}, {"types/parser/struct_constant_description.h","/types/parser/struct_constant_description.h"}, {"types/parser/struct_current_function_change.h","/types/parser/struct_current_function_change.h"}, {"types/parser/struct_normalized_declarator.h","/types/parser/struct_normalized_declarator.h"}, {"types/parser/enum_node_type.h","/types/parser/enum_node_type.h"}, {"types/parser/struct_type_description.h","/types/parser/struct_type_description.h"}, {"types/parser/struct_namespace_object_change.h","/types/parser/struct_namespace_object_change.h"}, {"types/parser/struct_namespace_modification.h","/types/parser/struct_namespace_modification.h"}, {"types/parser/struct_parser_node.h","/types/parser/struct_parser_node.h"}, {"types/parser/struct_normalized_declaration_set.h","/types/parser/struct_normalized_declaration_set.h"}, {"types/parser/enum_declaration_or_definition.h","/types/parser/enum_declaration_or_definition.h"}, {"types/parser/struct_normalized_specifier.h","/types/parser/struct_normalized_specifier.h"}, {"types/parser/enum_type_class.h","/types/parser/enum_type_class.h"}, {"types/parser/enum_value_type.h","/types/parser/enum_value_type.h"}, {"types/parser/enum_normalized_declaration_type.h","/types/parser/enum_normalized_declaration_type.h"}, {"types/parser/struct_parser_state.h","/types/parser/struct_parser_state.h"}, {"types/parser/enum_scope_type.h","/types/parser/enum_scope_type.h"}, {"types/struct_memory_pool_collection.h","/types/struct_memory_pool_collection.h"}, {"types/preloader/struct_preloader_instruction.h","/types/preloader/struct_preloader_instruction.h"}, {"types/preloader/enum_preloader_instruction_type.h","/types/preloader/enum_preloader_instruction_type.h"}, {"types/struct_build_state.h","/types/struct_build_state.h"}, {"types/struct_build_target.h","/types/struct_build_target.h"} }; unsigned int i; memory_pool_collection_create(&mpc); initialize_filesystem_datastructures(); unsigned_char_ptr_to_unsigned_char_ptr_map_create(&files); unsigned_char_ptr_to_unsigned_char_ptr_map_create(&directories); unsigned_char_list_create(&tmp); for(i = 0; i < NUM_FILES; i++){ unsigned int j = 0; if(unsigned_char_ptr_to_unsigned_char_ptr_map_exists(&files, (unsigned char *)filesystem_files[i][1])){ printf("Duplicate file: %s\n", filesystem_files[i][1]); assert(0 && "Duplicate file in target filesystem."); }else{ unsigned_char_ptr_to_unsigned_char_ptr_map_put(&files, (unsigned char *)&filesystem_files[i][1][0], (unsigned char *)&filesystem_files[i][0][0]); } while(filesystem_files[i][1][j]){ unsigned_char_list_add_end(&tmp, (unsigned char)filesystem_files[i][1][j]); if(filesystem_files[i][1][j] == '/'){ unsigned char * s = copy_string(unsigned_char_list_data(&tmp), ((unsigned char *)unsigned_char_list_data(&tmp)) + j, &mpc); if(unsigned_char_ptr_to_unsigned_char_ptr_map_exists(&directories, s)){ heap_memory_pool_free(mpc.heap_pool, s); }else{ unsigned_char_ptr_to_unsigned_char_ptr_map_put(&directories, s, s); } } j++; } unsigned_char_list_destroy(&tmp); unsigned_char_list_create(&tmp); } /* Remove the root directory because its inode has already been created */ root_dir = unsigned_char_ptr_to_unsigned_char_ptr_map_get(&directories, (unsigned char *)"/"); unsigned_char_ptr_to_unsigned_char_ptr_map_remove(&directories, (unsigned char *)"/"); heap_memory_pool_free(mpc.heap_pool, root_dir); directory_keys = unsigned_char_ptr_to_unsigned_char_ptr_map_keys(&directories); create_directories(&directory_keys, &mpc); for(i = 0; i < unsigned_char_ptr_list_size(&directory_keys); i++){ unsigned char * dir = unsigned_char_ptr_list_get(&directory_keys, i); printf("Unique Directory: %s\n", dir); heap_memory_pool_free(mpc.heap_pool, dir); } create_files(&files, &mpc); unsigned_char_list_destroy(&tmp); unsigned_char_ptr_list_destroy(&directory_keys); unsigned_char_ptr_to_unsigned_char_ptr_map_destroy(&files); unsigned_char_ptr_to_unsigned_char_ptr_map_destroy(&directories); memory_pool_collection_destroy(&mpc); output_filesystem_impl(out_file); /* Create l2 file the represents filesystem state */ }