Re: preempt_disable() as synchronization tool

2009-10-09 Thread askb

> >
> > Lastly, is it allowable to schedule / sleep immediately after a call
> > to preempt_disable()?
> 
> No I guess kernel will panic with some error like , "scheduling while
> in Atomic Context".

Sorry, I somehow missed out reading this. Can you let me know why its
not possible to schedule within preempt_disable() and preempt_enable()?
>From the code the schedule functions starts by disabling preemption?
Thanks in advance. - Anil


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: preempt_disable() as a synchronization tool

2009-10-09 Thread askb
> Firstly, Does preempt_disable() disable the preemption on all the
> processors or on just the local processor?
Only on the local cpu. This is for disabling preemption and protecting your 
critical section 
for per-cpu kernel space process context data.

> Lastly, is it allowable to schedule / sleep immediately after a call
> to preempt_disable()?
IMO: schedule() internally disables preemption before doing a context
switch, so may be ok to schedule between preempt disable and enable. 




--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: preempt_disable() as synchronization tool

2009-10-09 Thread vinit dhatrak
On Fri, Oct 9, 2009 at 9:13 AM, Daniel Rodrick  wrote:
> Hi List,
>
> I have few queries related to preempt_disable() and would appreciate
> any answers to it.
>
> Firstly, Does preempt_disable() disable the preemption on all the
> processors or on just the local processor?

I guess just local processor as the preempt count is maintained in
current thread_info struct. Correct me if I am wrong here.

>
> Secondly, a preempt_disable() a sufficient synchronization technique
> to guard a data that is shared only among process context code on a
> Uni-processor? And on SMP?

It is sufficient only in case of uni-processor (Actually spin_lock
also just disables preemption in case of uni-processor)

>
> Lastly, is it allowable to schedule / sleep immediately after a call
> to preempt_disable()?

No I guess kernel will panic with some error like , "scheduling while
in Atomic Context".

>
> Thanks & Best Regards,
>
> Dan
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecar...@nl.linux.org
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Repository of Active Projects

2009-10-09 Thread Mohit Varma
Hi,

I am looking a good repository of Active linux projects.Have been to sourge
forge already !!

any suggetsions...

Regards,

Mohit.


Re: C question

2009-10-09 Thread microbit
Hi,

On Thu, 8 Oct 2009 11:13:32 +0530, sandeep lahane
 wrote:
> On Thu, Oct 8, 2009 at 8:32 AM, mayur nande  wrote:
> 
>> Hi Rick,
>>
>> Some days ago i had the same question in my mind. While going through
>> "The
>> Linux Kernel Architecture" book (by Wolfgang Mauerer), i got the
answer:
>>
>> The GNU compiler supports arithmetic with void pointers as well as
>> function
>> pointers. The increment step is 1 byte. These are used by the kernel at
>> various points.
>>
>> Have fun.
>>
>> Regards
>> Mayur
>>
>> On Thu, Oct 8, 2009 at 7:42 AM, Rick Brown 
>> wrote:
>>
>>> Hello list,
>>>
>>> As far as I recall from K&R, isn't pointer arithmetic on a void
>>> pointer banned? And any effort to do that results in an error -
>>> because the compiler won't know by how much size to increment the
>>> pointer for a statement like "ptr++"? But then how about this:
>>>
>>> [r...@linux rick]$ cat t.c
>>> #include 
>>> int main()
>>> {
>>>void *ptr = 0;
>>>printf("%d \n", ptr+1);
>>> }
>>> [r...@linux rick]$ gcc t.c
>>> [r...@linux rick]$ ./a.out
>>> 1
>>> [r...@linux rick]$
>>>
>>> It compiles and runs fine ... !
>>>
>>> TIA,
>>>
>>> Rick
>>>
>>> --
>>> To unsubscribe from this list: send an email with
>>> "unsubscribe kernelnewbies" to ecar...@nl.linux.org
>>> Please read the FAQ at http://kernelnewbies.org/FAQ
>>>
>>>
>>
> Arithmetic on void and function pointers is part of GNU C extensions, C
> standard
> does not support it (size of void and functions is taken as 1). There
are
> many such
> GNU extensions which are used in kernel. One way to figure out which all
> extensions
> are used is by providing -pedantic flag, this will emit warning for such
> usage.
> 
> I think many of these extensions have became part of C99 standard
already.
> 
> 
> Regards,
> Sandeep.

That's weird, Seems I'll need to bone up there too.
Dereferencing a void pointer is clearly defined as an illegal operation.
But I thought manipulating a void pointer was vendor specific (IOW not
clearly defined).

Personally, I don't even see the point in doing arithmetic on void
pointers.
The whole idea is to be able to typecast to different logical sizes, so
the pointer manipulation should use typecasts in this case.
So, arithmetic on void pointers is - as far as I'm concerned - bad
coding...

But that's my opinion. 

In analogy : a while ago I came across a tricky bug in uIP V1.00
uIP used 2 function calls' return result in one of its protothread
operations, BUT was relying on the calling order
of functions (their result) within that single line statement.
ISO (AFAIK) nowhere defines a compulsory "calling order". 
So this is a bug IMO.
The code was written on GCC, but I used it on MSP430 with CrossWorks
toolchain, and there the function calling order was reversed,
thus the uIP code was badly broken. (even though it's supposed to be ANSI
compliant).

I reported the bug to Adam but never got any feedback.

Surely this is strictly a standards issue, and not "a matter of opinion"
??

Best regards,
Kris

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: Changing Kernel 3g / 1g memory split

2009-10-09 Thread Chetan Nanda
On Thu, Oct 8, 2009 at 2:23 PM, Rajat Jain  wrote:

> Hi,
>
> >>> 3) And finally, in order to complete this change and to ensure my
> > >>> applications are awrae of it and are doing the needful to restrict
> > >>> themselves in only 2G, do I also need to make changes in
> > >> the glibc or
> > >>> the gcc?
> > >>
> > >> No, you don't need changes to glibc or gcc.
> > >>
> > >
> > > I think he will need to. In the ELF user space executables
> > in most of
> > > the cases, the address at which each synbol (function / data) will
> > > go is
> > > generally fixed at compile time. So I think mosty of the
> > > applications in
> > > user space will need a recomile with a compiler that is
> > aware of the
> > > new
> > > 2G/2G split.
> > >
> >
> > Interesting. I've previously used 2G/2G split (some years
> > ago, before
> > 64b was prevalent) quite a bit and never needed to recompile
> > existing
> > binaries and libraries on the distro, and never had issues. Perhaps
> > the default addresses are quite low (well below 2G)?
>
> I think so. See below:
>
> [ra...@linux-server module]$ cat t.c
> int main()
> {
>for(;;);
>return 0;
> }
> [ra...@linux-server module]$ gcc t.c
> [ra...@linux-server module]$ ./a.out &
> [1] 18189
> [ra...@linux-server module]$ readelf -S a.out | grep "test\|data\|bss"
>  [14] .rodata   PROGBITS0804842c 00042c 08 00   A
> 0   0  4
>  [22] .data PROGBITS08049528 000528 0c 00  WA
> 0   0  4
>  [23] .bss  NOBITS  08049534 000534 04 00  WA
> 0   0  4
>
> The above the virtual addresses of the code and data sections (which are
> well under 2G).
>
> [ra...@linux-server module]$
> [ra...@linux-server module]$ cat /proc/18189/maps |grep "a.out"
> 08048000-08049000 r-xp  00:13 1594602
> /netapp_filer/users/rajat/linux/module/a.out
> 08049000-0804a000 rw-p  00:13 1594602
> /netapp_filer/users/rajat/linux/module/a.out
>
> The same memory pages have been mapped into user application as evident
> above. Also, all the symbols in the application are well below 2G:
>
> [ra...@linux-server module]$ readelf -s a.out
>
> Symbol table '.dynsym' contains 5 entries:
>   Num:Value  Size TypeBind   Vis  Ndx Name
> 0:  0 NOTYPE  LOCAL  DEFAULT  UND
> 1:    239 FUNCGLOBAL DEFAULT  UND
> __libc_start_m...@glibc_2.0 (2)
> 2: 08048430 4 OBJECT  GLOBAL DEFAULT   14 _IO_stdin_used
> 3:  0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
> 4:  0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
>
> Symbol table '.symtab' contains 69 entries:
>   Num:Value  Size TypeBind   Vis  Ndx Name
> 0:  0 NOTYPE  LOCAL  DEFAULT  UND
> 1: 08048114 0 SECTION LOCAL  DEFAULT1
> 2: 08048128 0 SECTION LOCAL  DEFAULT2
> 3: 08048148 0 SECTION LOCAL  DEFAULT3
> 4: 08048170 0 SECTION LOCAL  DEFAULT4
> 5: 080481c0 0 SECTION LOCAL  DEFAULT5
> 6: 0804821a 0 SECTION LOCAL  DEFAULT6
> 7: 08048224 0 SECTION LOCAL  DEFAULT7
> 8: 08048244 0 SECTION LOCAL  DEFAULT8
> 9: 0804824c 0 SECTION LOCAL  DEFAULT9
>10: 08048254 0 SECTION LOCAL  DEFAULT   10
>11: 0804826c 0 SECTION LOCAL  DEFAULT   11
>12: 0804828c 0 SECTION LOCAL  DEFAULT   12
>13: 08048410 0 SECTION LOCAL  DEFAULT   13
>14: 0804842c 0 SECTION LOCAL  DEFAULT   14
>15: 08048434 0 SECTION LOCAL  DEFAULT   15
>16: 08049438 0 SECTION LOCAL  DEFAULT   16
>17: 08049440 0 SECTION LOCAL  DEFAULT   17
>18: 08049448 0 SECTION LOCAL  DEFAULT   18
>19: 0804944c 0 SECTION LOCAL  DEFAULT   19
>20: 08049514 0 SECTION LOCAL  DEFAULT   20
>21: 08049518 0 SECTION LOCAL  DEFAULT   21
>22: 08049528 0 SECTION LOCAL  DEFAULT   22
>23: 08049534 0 SECTION LOCAL  DEFAULT   23
>24:  0 SECTION LOCAL  DEFAULT   24
>25:  0 SECTION LOCAL  DEFAULT   25
>26:  0 SECTION LOCAL  DEFAULT   26
>27:  0 SECTION LOCAL  DEFAULT   27
>28: 080482b0 0 FUNCLOCAL  DEFAULT   12 call_gmon_start
>29:  0 FILELOCAL  DEFAULT  ABS crtstuff.c
>30: 08049438 0 OBJECT  LOCAL  DEFAULT   16 __CTOR_LIST__
>31: 08049440 0 OBJECT  LOCAL  DEFAULT   17 __DTOR_LIST__
>32: 08049448 0 OBJECT  LOCAL  DEFAULT   18 __JCR_LIST__
>33: 08049530 0 OBJECT  LOCAL  DEFAULT   22 p.0
>34: 08049534 1 OBJECT  LOCAL  DEFAULT   23 completed.1
>35: 080482d4 0 FUNCLOCAL  DEFAULT   12 __do_global_dtors_aux
>36: 08048308 0 FUNCLOCAL  DEFAULT   12 frame_dummy
>37:  0 FILELOCAL  DEFAULT  ABS crtstuff.c
>38: 0804943c 0 OBJECT  LOCAL  DEFAULT   16 __CTOR_END__
>39: 08049444 0 OBJECT  LOCAL  DEFAULT   17 __DTOR_END__
>40: 08048434 0 OBJECT  LOCAL  DEFAULT   15 __FRAME

Re: invalid storage class : error in compilation of module

2009-10-09 Thread chaitanya
Remove "static" and give it a try, don't remember clearly but I think it
worked for me once.

2009/10/9 nidhi mittal hada 

> Pasting the code giving error
>
> static void myfs_exit(void)
> {
> int err=0;
> #ifdef DEBUG
> printk(KERN_INFO"Unregistering Filesystem myfs");
> #endif
> if( (err=unregister_filesystem(&myfs)) !=0)
> printk(KERN_INFO"Error Unloading filesystem %d ",err);
> kmem_cache_destroy(myfs_inode_info_p);
> return;
> }
>
>
>
> static int myfs_init(void)
> {
> int err;
> #ifdef DEBUG
> printk(KERN_INFO"Registering Filesystem myfs \n");
> #endif
> err = register_filesystem(&myfs);
> err = init_myfs_inodecache();
> if(err)
> {
> // kmem_cache_destroy(myfs_inode_info_p);
>  return err;
> }
> return err;
> }
> module_exit(myfs_exit);
> module_init(myfs_init);
>
>
> On Fri, Oct 9, 2009 at 4:20 PM, Bian Jiang  wrote:
>
>>
>>
>> On Fri, Oct 9, 2009 at 6:25 PM, nidhi mittal hada <
>> nidhimitta...@gmail.com> wrote:
>>
>>> Hello i wrote a kernel module
>>> and when i compiled it using make
>>> it gave this type of errors
>>> where i am unable to comprehend why this storage class error is coming in
>>>
>>> very simple functions
>>>
>>> static int myfs_init(void)
>>> {
>>> .
>>> .
>>> .
>>>
>>> }
>>> static void myfs_exit(void)
>>> {
>>> .
>>> .
>>> .
>>> }
>>>
>>> module_init(myfs_init);
>>> module_exit(myfs_exit);
>>>
>>>
>>>
>>>
>>>
>>>
>>>  error: invalid storage class for function ‘myfs_exit’
>>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:481: error:
>>> invalid storage class for function ‘init_myfs_inodecache’
>>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:493: error:
>>> invalid storage class for function ‘myfs_init’
>>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:507: error:
>>> invalid storage class for function ‘__inittest’
>>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:507: warning:
>>> ‘alias’ attribute ignored
>>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: error:
>>> invalid storage class for function ‘__exittest’
>>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: warning: ISO
>>> C90 forbids mixed declarations and code
>>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: warning:
>>> ‘alias’ attribute ignored
>>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:510: warning: ISO
>>> C90 forbids mixed declarations and code
>>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:512: error:
>>> expected declaration or statement at end of input
>>>
>>>
>>>
>>> can someone help in telling in which situation this error comes ?
>>>
>>>
>>>
>>> --
>>> Thanks & Regards
>>> Nidhi Mittal Hada
>>>
>>
>>
>> Please put your complete source code.
>>
>> --
>> Bian Jiang
>> Blog:  http://www.wifihack.net/
>>
>>
>
>
> --
> Thanks & Regards
> Nidhi Mittal Hada
>



-- 
Regards
Chaitanya
+60146458258


Re: invalid storage class : error in compilation of module

2009-10-09 Thread nidhi mittal hada
Pasting the code giving error

static void myfs_exit(void)
{
int err=0;
#ifdef DEBUG
printk(KERN_INFO"Unregistering Filesystem myfs");
#endif
if( (err=unregister_filesystem(&myfs)) !=0)
printk(KERN_INFO"Error Unloading filesystem %d ",err);
kmem_cache_destroy(myfs_inode_info_p);
return;
}



static int myfs_init(void)
{
int err;
#ifdef DEBUG
printk(KERN_INFO"Registering Filesystem myfs \n");
#endif
err = register_filesystem(&myfs);
err = init_myfs_inodecache();
if(err)
{
// kmem_cache_destroy(myfs_inode_info_p);
 return err;
}
return err;
}
module_exit(myfs_exit);
module_init(myfs_init);


On Fri, Oct 9, 2009 at 4:20 PM, Bian Jiang  wrote:

>
>
> On Fri, Oct 9, 2009 at 6:25 PM, nidhi mittal hada  > wrote:
>
>> Hello i wrote a kernel module
>> and when i compiled it using make
>> it gave this type of errors
>> where i am unable to comprehend why this storage class error is coming in
>> very simple functions
>>
>> static int myfs_init(void)
>> {
>> .
>> .
>> .
>>
>> }
>> static void myfs_exit(void)
>> {
>> .
>> .
>> .
>> }
>>
>> module_init(myfs_init);
>> module_exit(myfs_exit);
>>
>>
>>
>>
>>
>>
>>  error: invalid storage class for function ‘myfs_exit’
>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:481: error:
>> invalid storage class for function ‘init_myfs_inodecache’
>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:493: error:
>> invalid storage class for function ‘myfs_init’
>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:507: error:
>> invalid storage class for function ‘__inittest’
>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:507: warning:
>> ‘alias’ attribute ignored
>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: error:
>> invalid storage class for function ‘__exittest’
>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: warning: ISO
>> C90 forbids mixed declarations and code
>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: warning:
>> ‘alias’ attribute ignored
>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:510: warning: ISO
>> C90 forbids mixed declarations and code
>> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:512: error:
>> expected declaration or statement at end of input
>>
>>
>>
>> can someone help in telling in which situation this error comes ?
>>
>>
>>
>> --
>> Thanks & Regards
>> Nidhi Mittal Hada
>>
>
>
> Please put your complete source code.
>
> --
> Bian Jiang
> Blog:  http://www.wifihack.net/
>
>


-- 
Thanks & Regards
Nidhi Mittal Hada


Re: invalid storage class : error in compilation of module

2009-10-09 Thread Bian Jiang
On Fri, Oct 9, 2009 at 6:25 PM, nidhi mittal hada
wrote:

> Hello i wrote a kernel module
> and when i compiled it using make
> it gave this type of errors
> where i am unable to comprehend why this storage class error is coming in
> very simple functions
>
> static int myfs_init(void)
> {
> .
> .
> .
>
> }
> static void myfs_exit(void)
> {
> .
> .
> .
> }
>
> module_init(myfs_init);
> module_exit(myfs_exit);
>
>
>
>
>
>
>  error: invalid storage class for function ‘myfs_exit’
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:481: error: invalid
> storage class for function ‘init_myfs_inodecache’
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:493: error: invalid
> storage class for function ‘myfs_init’
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:507: error: invalid
> storage class for function ‘__inittest’
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:507: warning:
> ‘alias’ attribute ignored
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: error: invalid
> storage class for function ‘__exittest’
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: warning: ISO
> C90 forbids mixed declarations and code
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: warning:
> ‘alias’ attribute ignored
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:510: warning: ISO
> C90 forbids mixed declarations and code
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:512: error:
> expected declaration or statement at end of input
>
>
>
> can someone help in telling in which situation this error comes ?
>
>
>
> --
> Thanks & Regards
> Nidhi Mittal Hada
>


Please put your complete source code.

-- 
Bian Jiang
Blog:  http://www.wifihack.net/


Re: invalid storage class : error in compilation of module

2009-10-09 Thread Daniel Baluta
On Fri, Oct 9, 2009 at 1:25 PM, nidhi mittal hada
 wrote:
> Hello i wrote a kernel module
> and when i compiled it using make
> it gave this type of errors
> where i am unable to comprehend why this storage class error is coming in
> very simple functions
>
> static int myfs_init(void)
> {
> .
> .
> .
>
> }
> static void myfs_exit(void)
> {
> .
> .
> .
> }
>
> module_init(myfs_init);
> module_exit(myfs_exit);
>
>
>
>
>
>

Can you please put the code somewhere so that we can see it?

>  error: invalid storage class for function ‘myfs_exit’
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:481: error: invalid
> storage class for function ‘init_myfs_inodecache’
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:493: error: invalid
> storage class for function ‘myfs_init’
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:507: error: invalid
> storage class for function ‘__inittest’
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:507: warning:
> ‘alias’ attribute ignored
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: error: invalid
> storage class for function ‘__exittest’
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: warning: ISO
> C90 forbids mixed declarations and code

All your variable declarations should be placed at the beginning of
their function.

> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: warning:
> ‘alias’ attribute ignored
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:510: warning: ISO
> C90 forbids mixed declarations and code
> /home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:512: error: expected
> declaration or statement at end of input
>
>
>
> can someone help in telling in which situation this error comes ?

thanks,
Daniel.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



invalid storage class : error in compilation of module

2009-10-09 Thread nidhi mittal hada
Hello i wrote a kernel module
and when i compiled it using make
it gave this type of errors
where i am unable to comprehend why this storage class error is coming in
very simple functions

static int myfs_init(void)
{
.
.
.

}
static void myfs_exit(void)
{
.
.
.
}

module_init(myfs_init);
module_exit(myfs_exit);






 error: invalid storage class for function ‘myfs_exit’
/home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:481: error: invalid
storage class for function ‘init_myfs_inodecache’
/home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:493: error: invalid
storage class for function ‘myfs_init’
/home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:507: error: invalid
storage class for function ‘__inittest’
/home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:507: warning:
‘alias’ attribute ignored
/home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: error: invalid
storage class for function ‘__exittest’
/home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: warning: ISO
C90 forbids mixed declarations and code
/home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:508: warning:
‘alias’ attribute ignored
/home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:510: warning: ISO
C90 forbids mixed declarations and code
/home/nidhi/STUDY/LINUX/LINUX_Projects/FS/MyFs4/myfs4.c:512: error: expected
declaration or statement at end of input



can someone help in telling in which situation this error comes ?



-- 
Thanks & Regards
Nidhi Mittal Hada


SDMK2410 Ethernet Driver

2009-10-09 Thread J.H.Kim
Hi, everyone

When I compiled 2.6.26.5 kernel, the ethernet driver DM9000
initialized, but its corresponding
platform device is not defined, so the probe function of DM900 seems
not to be called.
It is right?

Does current kernel of ARM SMDK2410 board support Ethernet Driver such
as DM9000?

Thanks in advance.
Best Regards,
J.Hwan Kim

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



SMDK2410 Ethernet Driver

2009-10-09 Thread J.Hwan.Kim

Hi, everyone

When I compiled 2.6.26.5 kernel, the ethernet driver DM9000 initialized, 
but its corresponding
platform device is not defined, so the probe function of DM900 seems not 
to be called.

It is right?

Does current kernel of ARM SMDK2410 board support Ethernet Driver such 
as DM9000?


Thanks in advance.
Best Regards,
J.Hwan Kim

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: Mounting block device fails.

2009-10-09 Thread Prasad Joshi
On Fri, Oct 9, 2009 at 11:34 AM, Manish Katiyar  wrote:
> On Fri, Oct 9, 2009 at 11:28 AM, Manish Katiyar  wrote:
>> On Fri, Oct 9, 2009 at 11:16 AM, Prasad Joshi  
>> wrote:
>>> Thanks Manish,
>>>
>>> The issue was with filesystem creation. It was not getting created
>>> properly. I used dumpe2fs command to verify the file system. Actually
>>> Superblock was written correctly but, few other fields like free block
>>> and free inode list etc were incorrect
>>>
>>> It seems to be working properly now
>>> # dumpe2fs /dev/ftl
>>> ...
>>> ...
>>> Group 0: (Blocks 0-65527)
>>>  Primary superblock at 0, Group descriptors at 1-1
>>>  Reserved GDT blocks at 2-8
>>>  Block bitmap at 9 (+9), Inode bitmap at 10 (+10)
>>>  Inode table at 11-1034 (+11)
>>>  64489 free blocks, 32757 free inodes, 2 directories
>>>  Free blocks: 1039-65527
>>>  Free inodes: 12-32768
>>> Group 1: (Blocks 65528-131055)
>>>  Backup superblock at 65528, Group descriptors at 65529-65529
>>>  Reserved GDT blocks at 65530-65536
>>>  Block bitmap at 65537 (+9), Inode bitmap at 65538 (+10)
>>>  Inode table at 65539-66562 (+11)
>>>  64493 free blocks, 32768 free inodes, 0 directories
>>>  Free blocks: 66563-131055
>>>  Free inodes: 32769-65536
>>>
>>> # mount
>>> ...
>>> ...
>>> /dev/ftl on /mntpt type ext2 (rw,relatime,errors=continue)
>>>
>>>
>>> The other problem which I am facing is with the blocksize.
>>>
>>> mkfs allows ext2 file system be created with blocksize=8192,
>>> overriding the default 4096. But, when I try to mount the file system
>>> it fails
>>>
>>> # mkfs -t ext2 -b 8192 /dev/ftl
>>> Warning: blocksize 8192 not usable on most systems.
>>> mke2fs 1.41.4 (27-Jan-2009)
>>> mkfs.ext2: 8192-byte blocks too big for system (max 4096)
>>> Proceed anyway? (y,n) y
>>> Warning: 8192-byte blocks too big for system (max 4096), forced to continue
>>> warning: 16 blocks unused.
>>>
>>> Filesystem label=
>>> OS type: Linux
>>> Block size=8192 (log=3)
>>> Fragment size=8192 (log=3)
>>> 65536 inodes, 131056 blocks
>>> 
>>> 
>>>
>>> # mount -t ext2 /dev/ftl /mntpt
>>> [54658.092031] EXT2-fs: blocksize too small for device.
>>> mount: mounting /dev/ftl on /mntpt failed: Invalid argument
>>>
>>> I tried specifying blocksize with the mount command, but it also fails
>
> Have a look at these patches
>
> http://lkml.indiana.edu/hypermail/linux/kernel/0708.3/1847.html
>
>
>>>
>>> # mount -t ext2 /dev/ftl /mntpt -o blocksize=8192
>>> mount: mounting /dev/ftl on /mntpt failed: Invalid argument
>>>
>>> The above command fails in parsing the options passed to the command
>>>
>>> The section "Mount options for ext2" of mount manpage does not mention
>>> blocksize option.
>>
>> Yes, there is no "blocksize" option in ext2. For a list of valid
>> options see "tokens" table in ext2/super.c
>>
>>
>>>
>>> Is there anyway I can create ext2 filesystem with blocksize 8192?
>>
>> No ... as far as I know.
>>
>> Man  page of mke2fs says :
>>
>>     -b block-size
>>              Specify  the  size of blocks in bytes.  Valid block-size
>> values are 1024, 2048 and 4096 bytes per  block.
>>
>> And the kernel code says :
>>
>> int sb_set_blocksize(struct super_block *sb, int size)
>> {
>>        if (set_blocksize(sb->s_bdev, size))
>>                return 0;
>>        /* If we get here, we know size is power of two
>>         * and it's value is between 512 and PAGE_SIZE */
>>        sb->s_blocksize = size;
>>        sb->s_blocksize_bits = blksize_bits(size);
>>        return sb->s_blocksize;
>> }
>>
>> and the PAGE_SIZE is 4096.

Ya, I see thanks.

>>
>> Reiserfs supports blocksizes of 8192 , but its man page says :-
>>
>>      -b | --block-size N
>>              N  is block size in bytes. It may only be set to a power
>> of 2 within the 512-8192 interval.  Note
>>              that current versions of the kernel ( 2.6.19 ) do NOT
>> support any size other than 4096.
>>
>>
>> But is there any specific reason you want to use block sizes of 8192 ?

It is hardware's recommendation. The flash hardware uses 8192
blocksize for IOs. Using smaller block size will result in more IOs on
flash device.

Thanks and Regards,
Prasad
>>
>>>
>>> Thanks and Regards,
>>> Prasad
>>>
>>> On Thu, Oct 8, 2009 at 6:41 PM, Manish Katiyar  wrote:
 On Thu, Oct 8, 2009 at 12:38 PM, Prasad Joshi  
 wrote:
> Hi,
>
> I am working on translation layer for flash. For the purpose testing I am
> using a disk file to simulate the flash behavior. So every read and write 
> on
> the block device finally goes to a disk file, something similar to loop
> device, but in addition maintaining the flash property.
>
> I am able to create the file system on the device (/dev/ftl) but when I 
> try
> to mount the device it fails with error "Invalid Argument".

 From the code I can see -EINVAL can be returned at lot of places. You
 need to see dmesg to see the message which can help tracing.

>
> I thought it is failing to read the super b