/* DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDS */ TW_UINT16 GPHOTO2_EnableDSUserInterface (pTW_IDENTITY pOrigin, TW_MEMREF pData) { pTW_USERINTERFACE pUserInterface = (pTW_USERINTERFACE) pData; load_filesystem("/"); TRACE ("DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDS\n"); if (activeDS.currentState != 4) { FIXME("Sequence error %d\n", activeDS.currentState); activeDS.twCC = TWCC_SEQERROR; return TWRC_FAILURE; } activeDS.hwndOwner = pUserInterface->hParent; if (pUserInterface->ShowUI) { BOOL rc; activeDS.currentState = 5; /* Transitions to state 5 */ rc = DoCameraUI(); if (!rc) { activeDS.pendingEvent.TWMessage = MSG_CLOSEDSREQ; } else { /* FIXME: The GUI should have marked the files to download... */ activeDS.pendingEvent.TWMessage = MSG_XFERREADY; activeDS.currentState = 6; /* Transitions to state 6 directly */ } } else { /* no UI will be displayed, so source is ready to transfer data */ activeDS.pendingEvent.TWMessage = MSG_XFERREADY; activeDS.currentState = 6; /* Transitions to state 6 directly */ } activeDS.hwndOwner = pUserInterface->hParent; activeDS.twCC = TWCC_SUCCESS; return TWRC_SUCCESS; }
/* Main */ void main(){ /* Init Disco Virtual */ vDisk = (virtualDisk*)malloc(sizeof(virtualDisk)); vDisk->disk = (void *)malloc(DISK_SIZE); /* Init Global Variables */ masterBootRecord * mbr = (masterBootRecord *)malloc(512); superblock = (masterBlock*)malloc(512); bitmap = (BM*)calloc(BITMAP_SIZE,1); inodemap = (IM*)calloc(INODEMAP_SIZE,1); /* Create & Init File System */ mbr = (masterBootRecord *)read_disk(vDisk->disk,0,mbr,BLOCK_SIZE,0); if ( mbr->existFS == 0 ){ init_filesystem("Chinux", mbr); }else{ load_filesystem(); } printf("mbr:%d\n",mbr->existFS); superblock = read_disk(vDisk->disk,1,superblock,BLOCK_SIZE,0); printf("name:%s\nblock:%d\nfreeBlocks:%d\nusedBlocks:%d\n",superblock->name, superblock->blockSize, superblock->freeBlocks, superblock->usedBlocks); printf("InodeSize:%d\n",sizeof(iNode)); printf("Directory:%d\n",sizeof(directoryEntry));//16 Directorios o archivos en bloques directos.. iNode * nodo = fs_creat_inode(DIRECTORY,777,512,superblock->root); fs_insert_inode(nodo); iNode * nodo3 = fs_creat_inode(DIRECTORY,737,512,superblock->root); fs_insert_inode(nodo3); //nodo->iNode_number = 20; printf("\n\nTABLA DATOS\n"); printf("inode-number:%d\n",nodo->iNode_number); printf("mode:%d\n",nodo->mode); printf("size:%d\n",nodo->size); printf("iden:%d\n",nodo->identifier); iNode * nodo2 = fs_get_inode(nodo->iNode_number); printf("inode-number:%d\n",nodo->iNode_number); printf("mode:%d\n",nodo2->mode); printf("size:%d\n",nodo2->size); printf("iden:%d\n",nodo2->identifier); insert_directory("Hola",superblock->root); //ls("asd"); makeDir("comostas"); print_directories(superblock->root); makeDir("Hola/Comocomo"); cd("Hola"); print_directories(current); }
/********************************************** Starting point of the whole OS *************************************************/ int kmain() { int i, h; char * buffer = calloc(512 , 1); _Cli(); k_clear_screen(); printf("screen clear\n"); //cache_initarray(); printf("array init\n"); //cache_sortarray(); printf("array sort\n"); initializeSemaphoreTable(); printf("semaphore init\n"); initializeIDT(); unmaskPICS(); initializePaging(); _StartCR3(); SetupScheduler(); //printf("after SetupScheduler\n"); for(h = 0; h < 200; h++){ write_disk(0,h,buffer,BLOCK_SIZE,0); } fd_table = (filedescriptor *)calloc(100,1); masterBootRecord * mbr = (masterBootRecord *)malloc(512); superblock = (masterBlock*)malloc(512); bitmap = (BM*)calloc(BITMAP_SIZE,1); inodemap = (IM*)calloc(INODEMAP_SIZE,1); read_disk(0,0,mbr,BLOCK_SIZE,0); if ( mbr->existFS == 0 ){ init_filesystem("Chinux", mbr); }else{ load_filesystem(); } ready = NULL; for(i = 0; i < 4; i++) startTerminal(i); //free(mbr); logPID = CreateProcessAt("Login", (int(*)(int, char**))logUser, 0, 0, (char**)0, PAGE_SIZE, 4, 1); _Sti(); while(TRUE) ; return 1; }
static void load_filesystem(const char *folder) { #ifdef HAVE_GPHOTO2 int i, count, ret; CameraList *list; ret = gp_list_new (&list); if (ret < GP_OK) return; ret = gp_camera_folder_list_files (activeDS.camera, folder, list, activeDS.context); if (ret < GP_OK) { gp_list_free (list); return; } count = gp_list_count (list); if (count < GP_OK) { gp_list_free (list); return; } for (i = 0; i < count; i++) { const char *name; struct gphoto2_file *gpfile; ret = gp_list_get_name (list, i, &name); if (ret < GP_OK) continue; gpfile = malloc(sizeof(struct gphoto2_file)); if (!gpfile) continue; TRACE("adding %s/%s\n", folder, name); gpfile->folder = strdup(folder); gpfile->filename = strdup(name); gpfile->download = FALSE; list_add_head( &activeDS.files, &gpfile->entry ); } gp_list_reset (list); ret = gp_camera_folder_list_folders (activeDS.camera, folder, list, activeDS.context); if (ret < GP_OK) { FIXME("list_folders failed\n"); gp_list_free (list); return; } count = gp_list_count (list); if (count < GP_OK) { FIXME("list_folders failed\n"); gp_list_free (list); return; } for (i = 0; i < count; i++) { const char *name; char *newfolder; ret = gp_list_get_name (list, i, &name); if (ret < GP_OK) continue; TRACE("recursing into %s\n", name); newfolder = malloc(strlen(folder)+1+strlen(name)+1); if (!strcmp(folder,"/")) sprintf (newfolder, "/%s", name); else sprintf (newfolder, "%s/%s", folder, name); load_filesystem (newfolder); /* recurse ... happily */ } gp_list_free (list); #endif }