[ECOS] jffs2 problem: cannt mkdir
liu hua
rongye_liu@hotmail.com
Fri Sep 24 14:24:00 GMT 2004
hi,
I try to use the JFFS2 in my S3C4510B platform(like SNDS). When I run
my test program,"mount" and "chdir" can run normally,but "mkdir" cannt
run.When I use the eCos configure tools set the JFFS2 debug level to "1",I
can view some message when run "mkdir",it is "dirty size 0x00000000 +
unchecked_size 0x00000000 < nospc_dirty_size 0x00010000, returning
-ENOSPC".
What is wrong? Who can tell me how solve it and help me? Thanks!
Follow is some message,test program source code and run resoult:
***************************************************************************************
--------------create jffs2 in redboot------------------------------------
RedBoot> fis create -b 0x40000 -l 0x40000 -f 0x1020000 JFFS2
RedBoot> fi li
RAM: 0x00000000-0x01000000, [0x0002e820-0x00fed000] available
FLASH: 0x01000000 - 0x01200000, 32 blocks of 0x00010000 bytes each.
RedBoot> ^C
RedBoot> fis li
Name FLASH addr Mem addr Length Entry point
RedBoot 0x01000000 0x01000000 0x00020000 0x00000000
JFFS2 0x01020000 0x01020000 0x00040000 0xFFFFFFFF
FIS directory 0x011F0000 0x011F0000 0x0000F000 0x00000000
RedBoot config 0x011FF000 0x011FF000 0x00001000 0x00000000
RedBoot>
--------------load and run the test program------------------------------
RedBoot> load test.out
Using default protocol (TFTP)
Entry point: 0x00040040, address range: 0x00040000-0x000b5f4c
RedBoot>
mount ok
chdir ok
jffs2_lookup()
<7>jffs2_reserve_space(): Requested 0x44 bytes
<7>jffs2_reserve_space(): alloc sem got
<7>dirty size 0x00000000 + unchecked_size 0x00000000 < nospc_dirty_size
0x000100
00, returning -ENOSPC
mkdir fail
------------------test.c-------------------------------------
int main( int argc, char **argv )
{
int fd;
int wrote, len;
char test_string[] = "This is a test string";
// Mounting filesystem (JFFS2)
if (mount("/dev/flash1", "/", "jffs2") < 0)
{
printf("mount fail\n");
return ;
}
printf("mount ok\n");
// Change directory to ¡¯/¡¯
if (chdir("/") < 0)
{
printf("chdir fail\n");
return ;
}
printf("chdir ok\n");
// Make a directory
if (mkdir("testdir", 0) < 0)
{
printf("mkdir fail\n");
return ;
}
printf("mkdir ok\n");
// Create a new file
fd = open("testdir/testfile.txt", O_WRONLY|O_CREAT);
if(fd < 0)
{
printf("create new file fail\n");
return ;
}
printf("create new file ok\n");
// Write a string to the file
wrote = write(fd, test_string, strlen(test_string));
if(wrote != strlen(test_string))
{
printf("write file fail\n");
return ;
}
printf("write file ok\n");
// Close file
close( fd );
}
****************************************************************************************
_________________________________________________________________
Ãëê»úµÃÃ
óÃýøÃý»Ã÷£¬ÃëùÃà MSN Messenger: http://messenger.msn.com/cn
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
More information about the Ecos-discuss
mailing list