Ejemplo n.º 1
0
int login()
{
	int count=0;
	system("cls");
		login_scr();
	if (staff_cnt == 0) { 
		gotoxy(10, 31);
		printf("등록된 은행원이 없습니다.                                ");
		Sleep(3000);
		staff_join();
	}
	while(1) {
		system("cls");
		login_scr();
		name();
		gotoxy(10, 29);
		printf("                                             ");
		password();
		if (!passcmp()) {
			gotoxy(10, 31);
			printf("일치하지 않았습니다.                                     ");
			count ++;
			Sleep(1000);
			if (count == 3) {
				return 0;
			}
		} else {
			gotoxy(10, 31);
			printf("일치하였습니다.                                          ");
			Sleep(1000);
			return 1;
		}
	}
}
Ejemplo n.º 2
0
int apaOpen(u32 device, hdd_file_slot_t *fileSlot, input_param *params, int mode)
{
	int				rv=0;
	u32				emptyBlocks[32];
	apa_cache		*clink;
	apa_cache		*clink2;
	u32				sector=0;
	

	// walk all looking for any empty blocks & look for partition
	clink=cacheGetHeader(device, 0, 0, &rv);
	memset(&emptyBlocks, 0, sizeof(emptyBlocks));
	while(clink)
	{
		sector=clink->sector;
		if(!(clink->header->flags & APA_FLAG_SUB)) {
			if(memcmp(clink->header->id, params->id, APA_IDMAX) == 0)
				break;	// found :)
		}
		addEmptyBlock(clink->header, emptyBlocks);
		clink=apaGetNextHeader(clink, &rv);
	}

	if(rv!=0)
		return rv;
	rv=-ENOENT;

	if(clink==NULL && (mode & O_CREAT))
	{
		if((rv=apaCheckPartitionMax(device, params->size))>=0) {
			if((clink=apaAddPartitionHere(device, params, emptyBlocks, sector, &rv))!=NULL)
			{
				sector=clink->header->start;
				clink2=cacheGetFree();
				memset(clink2->header, 0, sizeof(apa_header));
				atadDmaTransfer(device, clink2->header, sector+8     , 2, ATAD_MODE_WRITE);
				atadDmaTransfer(device, clink2->header, sector+0x2000, 2, ATAD_MODE_WRITE);
				cacheAdd(clink2);
			}
		}
	}
	if(clink==NULL)
		return rv;
	fileSlot->start=clink->header->start;
	fileSlot->length=clink->header->length;
	memcpy(&fileSlot->subs, &clink->header->subs, APA_MAXSUB*sizeof(apa_subs));
	fileSlot->type=clink->header->type;
	fileSlot->nsub=clink->header->nsub;
	memcpy(&fileSlot->id, &clink->header->id, APA_IDMAX);
	cacheAdd(clink);
	rv=0; if(passcmp(clink->header->fpwd, NULL)!=0)
		rv=-EACCES;
	return rv;
}
Ejemplo n.º 3
0
int hddGetStat(iop_file_t *f, const char *name, iox_stat_t *stat)
{
	apa_cache	*clink;
	input_param	params;
	int			rv;

	if((rv=fioGetInput(name, &params))<0)
		return rv;

	WaitSema(fioSema);
	if((clink=apaFindPartition(f->unit, params.id, &rv))){
		if((rv=passcmp(clink->header->rpwd, NULL))==0)
				fioGetStatFiller(clink, stat);
		cacheAdd(clink);
	}
	SignalSema(fioSema);
	return rv;
}
Ejemplo n.º 4
0
int apaRemove(u32 device, char *id)
{
	int			i;
	u32			nsub;
	apa_cache	*clink;
	apa_cache	*clink2;
	int			rv;

	for(i=0;i<maxOpen;i++)	// look to see if open
	{
		if(fileSlots[i].f!=0) {
			if(memcmp(fileSlots[i].id, id, APA_IDMAX)==0)
				return -EBUSY;
		}
	}
	if(id[0]=='_' && id[1]=='_')
		return -EACCES;
	if((clink=apaFindPartition(device, id, &rv))==NULL)
		return rv;
	if(passcmp(clink->header->fpwd, NULL))
	{
		cacheAdd(clink);
		return -EACCES;
	}
	// remove all subs frist...
	nsub=clink->header->nsub;
	clink->header->nsub=0;
	clink->flags|=CACHE_FLAG_DIRTY;
	cacheFlushAllDirty(device);
	for(i=nsub-1;i!=-1;i--)
	{
		if((clink2=cacheGetHeader(device, clink->header->subs[i].start, 0, &rv))){
			if((rv=apaDelete(clink2))){
				cacheAdd(clink);
				return rv;
			}
		}
	}
	if(rv==0)
		return apaDelete(clink);

	cacheAdd(clink);
	return rv;
}
Ejemplo n.º 5
0
int devctlSwapTemp(u32 device, char *argp)
{
	int			rv;
	input_param	params;
	char		szBuf[APA_IDMAX];
	apa_cache	*partTemp;
	apa_cache	*partNew;


	if((rv=fioGetInput(argp, &params)) < 0)
		return rv;

	if(*(u16 *)(params.id)==(u16)0x5F5F)// test for '__' system partition
		return -EINVAL;

	memset(szBuf, 0, APA_IDMAX);
	strcpy(szBuf, "_tmp");
	if(!(partTemp=apaFindPartition(device, szBuf, &rv)))
		return rv;

	if((partNew=apaFindPartition(device, params.id, &rv))) {
		if((rv=passcmp(partNew->header->fpwd, NULL))==0) {
			memcpy(partTemp->header->id, partNew->header->id, APA_IDMAX);
			memcpy(partTemp->header->rpwd, partNew->header->rpwd, APA_PASSMAX);
			memcpy(partTemp->header->fpwd, partNew->header->fpwd, APA_PASSMAX);
			//memset(partNew->header->id, 0, 8);// BUG! can make it so can not open!!
			memset(partNew->header->id, 0, APA_IDMAX);
			strcpy(partNew->header->id, "_tmp");
			memset(partNew->header->rpwd, 0, APA_PASSMAX);
			memset(partNew->header->fpwd, 0, APA_PASSMAX);
			partTemp->flags|=CACHE_FLAG_DIRTY;
			partNew->flags|=CACHE_FLAG_DIRTY;
			cacheFlushAllDirty(device);
		}
		cacheAdd(partNew);
	}
	cacheAdd(partTemp);
	return rv;
}