Re: ext3_inode_info i_datasync_tid field

2010-12-17 Thread Manish Katiyar
On Fri, Dec 10, 2010 at 10:27 AM, Onkar Mahajan kern.de...@gmail.com wrote:
 What is the use of i_datasync_tid in the ext3_inode_info struct ?

Hi Onkar,

This seems to be in conjunction with the field i_sync_tid in the inode
structure. They are used to store the transaction id of the journal.
Depending on what system call you use fsync() or fdatasync() to flush
the contents of your file, it will use i_sync_tid or i_datasync_tid
and will commit the appropriate transaction to disk.


Hope that helps...
-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: VFS layer filesytem tracking

2010-12-08 Thread Manish Katiyar
On Wed, Dec 8, 2010 at 8:00 AM, sanoj k.u.sa...@gmail.com wrote:
 Hello all,
 I want to track the read/write operations for a particular inode at the vfs
 layer.
 I added the following structure as a field to struct inode.
 struct meta_info
 {
  unsigned int read_count;
  unsigned int write_count;
 };

Looking at the fields it seems you want this only incore...and I guess
you want to count how many reads or writes came to a particular file.

 This caused a problem in mounting the root device , what could be the cause
 ?

Can you tell us what was the error/problem ? Stack trace would be better.

 Am i allowed modify the struct inode by adding a new field ?

Sure :-) ... you are allowed to modify incore ondisk anything as long
as you make code understand those structures (or if you are adding
something in spare bytes which might get ignored). If you change
something ondisk structure you will need to fix other userspace
utilities which may parse this (in the worst case throw away your old
filesystem and create new one if it changes the size of ondisk inode).

 Also, i would like to know if there are any existing mechanisms that can
 help me track the workload .
 at various levels
 Thanks,

HTH
 sanoj




-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: hi

2010-11-17 Thread Manish Katiyar
On Wed, Nov 17, 2010 at 10:54 PM, Mulyadi Santosa
mulyadi.sant...@gmail.com wrote:
 On Thu, Nov 18, 2010 at 13:12, navatha reddy navat...@gmail.com wrote:
 Hi,
  plz send the information about file system.its not supporting the
 usb file system without ext2 and ext3.

 guys, have we ever heard usb filesystem? Or is this Reddy is talking
 about something that we need deep meditation first?

Mulyadi,

Take a deep breath..press Delete




 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer and consultant

 blog: the-hydra.blogspot.com
 training: mulyaditraining.blogspot.com

 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: about EXT3_SUPER_MAGIC

2010-11-13 Thread Manish Katiyar
On Sat, Nov 13, 2010 at 8:29 PM, Onkar Mahajan kern.de...@gmail.com wrote:
 What is EXT3_SUPER_MAGIC ? How is it arrived at ?

There is no formula... it is just an identifier. Most of the times it
is the name of filesystem in hex.

 I am writing a file system for which I am referring to
 the ext3 code... I am not able to arrive at a magic number
 for my filesystem please help

Have you put a name for your filesystem... else you can try 0x6d796673 :-)


 #define EXT3_SUPER_MAGIC    0xEF53  How this is arrived at ?


 Regards,
 Onkar




-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Beginner books/articles/papers for Filesystems

2010-11-03 Thread Manish Katiyar
On Wed, Nov 3, 2010 at 9:14 AM, Nobin Mathew nobin.mat...@gmail.com wrote:
 See this
 http://www.amazon.com/UNIX-Filesystems-Evolution-Design-Implementation/dp/0471164836

 On Wed, Nov 3, 2010 at 8:50 PM, Anand Arumugam anand.aru...@gmail.com wrote:
 Try Maurice J Bach's book.

 On Wed, Nov 3, 2010 at 9:17 AM, Sankar P sankar.curios...@gmail.com wrote:

 Hi,

 Are there any articles or books or whitepapers that are useful for
 understanding the basics of filesystems (like what are extents,
 backing-device-infos, caching etc.) ? I dont want a generic OS book,
 but something that explains about linux filesystems. Any
 recommendations ?

Shankar,

As I see, there are two aspects of learning filesystems.

a) Understanding the ondisk layout. Once you are comfortable with it,
you will be able to understand how it works, and how various ops
commands manipulate the ondisk layout. This is file system specific.
So if you are looking for this I would suggest some simple filesystem
first like ext23 (not ext4 or some other btree based filesystems).

b) Upper supporting layers for the filesystem ops. VFS, caching etc.
They are generally common to all filesystems and will tell you how to
reach to your filesystem, get data from it, and other things perform
IO etc.


-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: BUG: sleeping function called from invalid context at mm/slab.c

2010-10-14 Thread Manish Katiyar
On Wed, Oct 13, 2010 at 11:54 PM, Amit Nagal helloin.a...@gmail.com wrote:
 Hi ,

 i am getting this kernel log .

 BUG: sleeping function called from invalid context at mm/slab.c:3055
 in_atomic(): 1, irqs_disabled(): 128, pid: 192, name: Front Display
 Backtrace:
 [c002cf94] (dump_backtrace+0x0/0x110) from [c02fb048] 
 (dump_stack+0x18/0x1c)
  r6:c4c0 r5:00d0 r4:c41f1160 r3:4093
 [c02fb030] (dump_stack+0x0/0x1c) from [c004cf08] 
 (__might_sleep+0x108/0x128)
 [c004ce00] (__might_sleep+0x0/0x128) from [c00ccfd0]
 (kmem_cache_alloc+0x30/0x148)
 [c00ccfa0] (kmem_cache_alloc+0x0/0x148) from [bf0edf80]
 (spi_write+0x29c/0x4d4 [fpi])

I guess the interesting part is spi_write+0x0/0x4d4 . Looks like it
is trying to do some memory allocation from the place where it is not
supposed to do ie... where the code isn't expected to sleep.


  r8:8013 r7:83bd8d08 r6:a013 r5:0004 r4:c41f1160
 [bf0edce4] (spi_write+0x0/0x4d4 [fpi]) from [c00d1498]
 (vfs_write+0xb4/0x128)
 [c00d13e4] (vfs_write+0x0/0x128) from [c00d15d4] (sys_write+0x44/0x70)
  r6:0004 r5:83bd8d08 r4:c1000a60 r3:c77adf70
 [c00d1590] (sys_write+0x0/0x70) from [c0028980] 
 (ret_fast_syscall+0x0/0x2c)
  r9:c77ac000 r8:c0028b28 r6:02b90784 r5:0004 r4:83bd8d08


 can anybody guide me what is meant by this bug :

 BUG: sleeping function called from invalid context at mm/slab.c:3055

 and what kernel functions it points to where problem lies .

 Thanx  Regards
 Amit

 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: link list implementation in linux kernel easy question syntax not clear

2010-10-09 Thread Manish Katiyar
On Fri, Oct 8, 2010 at 11:38 PM, Bond jamesbond.2...@gmail.com wrote:
 Hi,in
 http://lxr.linux.no/#linux+v2.6.18/include/linux/list.h
 following section of code
 there is a structure which is defined as

 struct list_head {
        struct list_head *next, *prev;
 };

 It is used in another file as

 #define LIST_HEAD_INIT(name) { (name), (name) }

 #define LIST_HEAD(name) \
        struct list_head name = LIST_HEAD_INIT(name)

 static inline void INIT_LIST_HEAD(struct list_head *list)
 {
        list-next = list;
        list-prev = list;
 }


 I came across a book where the code is given as follows in an example

 include/linux/list.h
 struct list_head {
 struct list_head *next,*prev;
 };
 #define LIST_HEAD_INIT(name) {(name),(name)}

 #define LIST_HEAD(name) struct list_head name = LIST_HEAD_INIT(name)
 #define INIT_LIST_HEAD(prt) do {\
 (ptr)-next = (ptr);(ptr)-prev= (ptr);\
 }while(0)


 I was not able to understand above code segment.
 I am aware of what a #define is but still I could not understand above thing.
 Can some one help in understanding with some example.
 Not related to Linux Kernel a normal example where I
 can make a link list with above defined way.

http://kernelnewbies.org/FAQ/LinkedLists



 --
 http://vger.kernel.org/vger-lists.html

 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Digest of Questions Solutions

2010-10-05 Thread Manish Katiyar
On Tue, Oct 5, 2010 at 12:21 PM, Linux Kernel Explorer
mylinux...@gmail.com wrote:
 Hi James Bond  John Mahoney,

 Thanks a ton for replying. I guess, I did my share of search  experiments
 before posting this one out.I am good on Hygiene factors.

 John - appreciate you posting that link for me but I guess, I already have
 it. Infact, if you read my mail once again you will realize that I asked for
 a compilation of queries posted  solutions offered over the years in the
 pdf format (if not all the years then probably for all months of this year).
 However, really appreciate your effort.

I haven't tried so I am not sure... but with little scripting and all
those free pdf convertors it should be easy. And then you can post
your script for others too use too :-)


 Regards,

 Linux Kernel Explorer

 On Tue, Oct 5, 2010 at 4:24 PM, Bond jamesbond.2...@gmail.com wrote:

 On Sun, Oct 3, 2010 at 2:25 PM, Linux Explorer mylinux...@gmail.com
 wrote:
  Hello Everyone,
 
 
 Hi explorer things do not work that way as you asked.
 Do some experiment and then mail here may be some of us can point you
 to right thing.





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Debugging a kernel oops message

2010-10-01 Thread Manish Katiyar
On Fri, Oct 1, 2010 at 3:52 AM, Tushar Dadlani tush...@gmail.com wrote:
 Hi,
 What is the best way to debug a kernel oops message? I see some call
 trace , and some memory addresses , but I am not able to figure out
 the main reason for my module to fail.

Most useful data that I have found is the code data that is sprayed.

Have a look at below thread. It might help
http://kerneltrap.org/mailarchive/linux-kernel-newbies/2009/9/2/6373273/thread



 Regards,

 --
 Tushar Dadlani
 Manipal Institute of Technology
 +919986292434

 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: open file related system calls

2010-09-30 Thread Manish Katiyar
On Thu, Sep 30, 2010 at 5:50 AM, mohit verma mohit89m...@gmail.com wrote:
 hi all,
 if my system is shared among several root users . and one of my (say root
 user S5)  process opens a file .
 is there any system call  or any kernel function that can be used by root
 user S2 to trace my opened file?

Question is not clear (atleast to me)... what are root users ? (uid ==
0  ?). When you say shared do you mean root logged  in from different
sessions ? What does tracing an opened file mean ?


 please reply, guys



-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: my kmalloc implementation

2010-09-28 Thread Manish Katiyar
Bond,

You might want to look at the example of malloc at the end of KnR.

On Mon, Sep 27, 2010 at 11:05 PM, Bond jamesbond.2...@gmail.com wrote:
 I have to write my own kmalloc.
 I am not given any sort of Kernel API to assign or delete memory.
 Suppose I have 4GB of memory on Ram.
 Some of which is filled and some of which is not filled.
 My question is what data structure do I need to maintain in order to be able
 to assign memory
 to any userspace program when the program requests some bytes of memory
 which can be 1 or
 more.
 My logic for this implementation was to maintain a hashtable.
 For example
 1-- points to all the memory addresses which are 1 byte and free
 2-- points to all the memory addresses which are 2 byte and free
 3-- points to all the memory addresses which are 3 byte and free
 4-- points to all the memory addresses which are 4 byte and free
 .
 .
 .
 .
 .
 .
 .
 n-- points to all the memory addresses which are n byte and free
 How can I improve the above schema because to know the location where 1byte
 memory is free
 I will maintain a pointer which can be u64 or u32 which itself is costlier
 than the free memory itself.
 So what should I be doing to be able to do above.



-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: printk and \n

2010-09-25 Thread Manish Katiyar
On Sat, Sep 25, 2010 at 9:15 AM, mohit verma mohit89m...@gmail.com wrote:
 hello guys,
 are there any gains ( in terms of security or anything else)  to flush the
 buffer in kernel printk() as soon as \n is  encountred ?
  i am asking because this does not happen in the user space as all of us
 know.

This happens in userspace too.





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: why mknod() ??

2010-09-21 Thread Manish Katiyar
On Tue, Sep 21, 2010 at 8:06 AM, mohit verma mohit89m...@gmail.com wrote:
 hey guys,
 i have a question silly question :

 as we can create the simple files with open,creat and for directories there
 is mkdir  system calls.
 so what is the need of mknod() to create special files and as well as 
 ordinary files ?
 why can't  we wrap the special file building code in one of  open,creat or
 mkdir system calls?


Because they are special files and some of the commands/operations
(eg.. truncate) may not be available for them. If you look at the
implementation if is kind of a wrapper over regular create.



-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: difference between read permission and executing permission

2010-09-12 Thread Manish Katiyar
On Sun, Sep 12, 2010 at 9:07 PM, Parmenides mobile.parmeni...@gmail.com wrote:
 2010/9/12 Mulyadi Santosa mulyadi.sant...@gmail.com:
 On Sun, Sep 12, 2010 at 00:28, Parmenides mobile.parmeni...@gmail.com 
 wrote:
 Hi,

   For a specified directory, we can go through it when the kernel
 parsing path, though we can not read it. Actually, parsing path also
 need read the directory file. So, how does the kernel distinguish
 between these two permission?

 Sorry for replying so late due to some trifles. For a directory, if it
 is allowed to read, that means we can list all items in its directory
 file, namely that we can read it completely.

May be I understood the question wrong but you can't ls in a
directory if it doesn't have execute permission. Or rather even if a
directory has read/exectue permission you can't ls on it till all the
directories in its path have execute permission. Is there something
else that you are asking ?

/home/mkatiyar/codetree/main cd /tmp
/tmp mkdir -p a/b/c/d
/tmp ls -lR a
a:
total 4
drwxr-xr-x 3 mkatiyar mkatiyar 4096 2010-09-12 22:26 b

a/b:
total 4
drwxr-xr-x 3 mkatiyar mkatiyar 4096 2010-09-12 22:26 c

a/b/c:
total 4
drwxr-xr-x 2 mkatiyar mkatiyar 4096 2010-09-12 22:26 d

a/b/c/d:
total 0
/tmp chmod 000 a/b
/tmp ls -lR a
a:
total 4
d- 3 mkatiyar mkatiyar 4096 2010-09-12 22:26 b
ls: cannot open directory a/b: Permission denied
/tmp cd a/b
ksh: cd: a/b: [Permission denied]
/tmp ls a/b
ls: cannot open directory a/b: Permission denied


 If it is allowed to
 execute, that means we can go through it in a process of path parsing.
 Path parsing will open every directory in a specified path. For
 example, when parsing a path like /home/parmenides/src/hello.c, the
 kernel will open a sequence of directory files, namely /, /home,
 /home/parmenides and /home/parmenides/src, and read its subdirectory
 for each. So, both of read permission and executing permission mean
 that the kernel need to read the corresponding directory file. As
 such, the common 'readable' has two meanings for a directory. One
 corresponds to read the directory file when listing it, the other
 corresponds to read the directory file when paring path.

 On the other hand, system call opendir(const char *pathname) has no
 way to distinguish these two meanings whereas both listing and path
 parsing need call opendir(). My quesition is exactly that how these
 two permissions take their effect.

 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: question about linked list implementation in kernel.h

2010-09-11 Thread Manish Katiyar
On Sat, Sep 11, 2010 at 5:33 AM, Bond jamesbond.2...@gmail.com wrote:
 I read
 I was going through include/linux/kernel.h
 encountered following code

 #define container_of(ptr, type, member) ({  \
     const typeof( ((type *)0)-member ) *__mptr = (ptr);    \

 in above code I am not clear with (type *)0

If you want some more details about this macro.
http://www.spinics.net/lists/linux-usb-devel/msg11766.html


 how is it working any link?




-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Query related to mount point identification.

2010-09-07 Thread Manish Katiyar
On Tue, Sep 7, 2010 at 4:27 AM, Tayade, Nilesh
nilesh.tay...@netscout.com wrote:
 Hi,

 I am currently working on parsing the packets for NFS protocol. I want
 to know, in case of a file operation, how can we identify the mount
 point where the file is mounted?

 E.g. scenario is-
 Client has mounted the node already. You apply the NFS parser and start
 reading/writing to the file. Here, parser did not know if the node is
 mounted or not (as we enabled the parser after mounting the node. And I
 want to identify that at the arrival of first packet). So is there any
 way to identify that based on the file name (or inode may be)? I am
 looking at the fstat() system call, but unable to find anything useful.

Looks like given the filename you want to find the mountpoint. May be
this will help.
http://www.mail-archive.com/bug-coreut...@gnu.org/msg20630.html


-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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 variables at run time

2010-09-07 Thread Manish Katiyar
On Tue, Sep 7, 2010 at 10:29 AM, Tapas Mishra mightydre...@gmail.com wrote:
 How can one change the value of Kernel Variables at run time.

Depending on what you what to change, you may want to look at /proc /sys

-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: multiple alternate superblocks

2010-07-07 Thread Manish Katiyar
On 7/7/10, Onkar Mahajan kern.de...@gmail.com wrote:
 Is it possible to supply multiple alternate superblocks
 while doing a mount in Linux ?

Why would you want to do that ? What is the expected behavior in such cases ?



 -Regards,
 Onkar

 --
 

 Your work is going to fill a large part of your
 life, and the only way to be truly satisfied is
 to do what you believe is great work. And the
 only way to do great work is to love what
 you do. If you haven’t found it yet, keep
 looking, and don’t settle. As with all matters
 of the heart, you’ll know when you find it.
-  Steve Jobs
 



-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Understanding NULL pointer dereference

2010-06-18 Thread Manish Katiyar
On Fri, Jun 18, 2010 at 10:11 AM, Prasad Joshi prasadjoshi...@gmail.com wrote:
 Hi All,

 I am trying to understand a a kernel oops report. Here are some of the
 fields from the report

 BUG: unable to handle kernel NULL pointer dereference at 0034
 Oops:  [#1] SMP
 Pid: 6478, comm: cp Tainted: P 2.6.31.5-127.fc12.x86_64 #1 Inspiron 1525
 RIP: 0010:[810faac1] [810faac1] do_sys_open+0x7a/0x10f
 CR2: 0034

 As I know, when a page fault occurs, the address the program attempted to
 access is stored in the CR2 register. So probably the pointer is pointing to
 address 0034 and is being access.

 The BUG string is bit confusing, it says NULL pointer dereference at 0034, I
 know the address 00034 is not valid but why is it interpreted as NULL
 pointer? The NULL pointer as I know should point to address 0.

As ppl have already mentioned, this is some offset into a structure.
Next thing you can try is to do a disas do_sys_open and find out which
member/structure is being accessed which has this offset. You can also
try to get the assembly instructions from the code dumped. if you
already have the source code for your running kernel you can also try
l *do_sys_open+0x7a.



 Thanks and Regards,
 Prasad




-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Understanding NULL pointer dereference

2010-06-18 Thread Manish Katiyar
On Fri, Jun 18, 2010 at 5:09 PM, Prasad Joshi prasadjoshi...@gmail.com wrote:


 On Fri, Jun 18, 2010 at 1:19 PM, Manish Katiyar mkati...@gmail.com wrote:

 On Fri, Jun 18, 2010 at 10:11 AM, Prasad Joshi prasadjoshi...@gmail.com
 wrote:
  Hi All,
 
  I am trying to understand a a kernel oops report. Here are some of the
  fields from the report
 
  BUG: unable to handle kernel NULL pointer dereference at
  0034
  Oops:  [#1] SMP
  Pid: 6478, comm: cp Tainted: P 2.6.31.5-127.fc12.x86_64 #1 Inspiron 1525
  RIP: 0010:[810faac1] [810faac1]
  do_sys_open+0x7a/0x10f
  CR2: 0034
 
  As I know, when a page fault occurs, the address the program attempted
  to
  access is stored in the CR2 register. So probably the pointer is
  pointing to
  address 0034 and is being access.
 
  The BUG string is bit confusing, it says NULL pointer dereference at
  0034, I
  know the address 00034 is not valid but why is it interpreted as NULL
  pointer? The NULL pointer as I know should point to address 0.

 As ppl have already mentioned, this is some offset into a structure.
 Next thing you can try is to do a disas do_sys_open and find out which
 member/structure is being accessed which has this offset. You can also
 try to get the assembly instructions from the code dumped. if you
 already have the source code for your running kernel you can also try
 l *do_sys_open+0x7a.


 Thanks Manish for your reply. The problem was with the return value in FS
 create() call. The create() call was returning the +ve error code. I looked
 into some of the other file systems, they use PTR_ERR to return the error
 code. Basically the -ve error code is assigned to unsigned long causing,
 thus converting it in a big number.


     struct file *f = do_filp_open(dfd, tmp, flags, mode, 0);
     if (IS_ERR(f)) {
     put_unused_fd(fd);
     fd = PTR_ERR(f);
     } else {
     fsnotify_open(f-f_path.dentry); === OOPs
     fd_install(fd, f);
     }

 So IS_ERR() was returning false and causing panic in else path.

Cool so looks like you crashed while dereferencing d_parent of a
negative dentry.

(gdb) p (int)(((struct dentry *)0)-d_parent)
$5 = 52

(gdb) p/x (int)(((struct dentry *)0)-d_parent)
$6 = 0x34

Thanks -
Manish

 Thanks a lot for your help.

 Regards,
 Prasad


 
  Thanks and Regards,
  Prasad
 



 --
 Thanks -
 Manish
 ==
 [$\*.^ -- I miss being one of them
 ==





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Question about do_sync_read()

2010-06-18 Thread Manish Katiyar
[adding krenel newbies in cc, as there might be others who have better answers]

On Sat, Jun 19, 2010 at 12:49 AM, Anand Pai anand_...@yahoo.com wrote:

 Manish:

 You are absolutely correct ! I agree with you that once I decide to use the 
 filp, then the inode operations will be used.

 But ...your response has caused me to ask a more fundamental question.

 This is the scenario I am trying to initiate a read of LKM read of a file 
 into a kernel buffer.

 So .. I do a kernel_read.

 This ... does a vfs_read.

 vfs_read uses file-f_op and file-f_op-read to decide ... WHICH read it 
 will do:

     do_sync_read OR file-f_op-read

 Now ... I dont see where file-f_op-read  or file-f_op are being initialized.

kernel_read needs a file * as the first argument, What are you passing
there ? How did you get file* there.

Thanks -
Manish



 I have shown all the greps etc. Thias has been awhile. Please help me if you 
 can.

 Also, another question is ... when IS do_synch_read SUPPOSED to be used (over 
 file-f_op-read) anyway ? What is the philisophy if you will ?

 Thanks so much Manish. I do look forward to your response. Regards

 -Anand

 --- On Wed, 6/16/10, Manish Katiyar mkati...@gmail.com wrote:

 From: Manish Katiyar mkati...@gmail.com
 Subject: Re: Question about do_sync_read()
 To: Anand Pai anand_...@yahoo.com
 Date: Wednesday, June 16, 2010, 8:32 AM

 If you happened to trace the code enough, you will realise that from the 
 pathname we try to get a file * (filp)... tracing somemore you will find that 
 ultimately __dentry_open(...) will be called which has the below line :-
 static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
   struct file *f,
   int (*open)(struct inode *, struct file *),
   const struct cred *cred)
 {
 .
 ...
   f-f_mapping = inode-i_mapping;
   f-f_path.dentry = dentry;
   f-f_path.mnt = mnt;
   f-f_pos = 0;
   f-f_op = fops_get(inode-i_fop);
 ..

 Hope that clears your doubt.


 On Wed, Jun 16, 2010 at 3:48 AM, Anand Pai anand_...@yahoo.com wrote:

 Hi Manish:

 Thanks so much for your response. As you can see from the attached screen 
 shots,
 ext3_file_operations is getting attached to inode--i_fop.

 kernel_read (and vfs_read used by it) uses file-f_op, and I cant see where 
 the appropriate
 plave where any function/ method gets attached to file-f_op.

 This is noted in the third jpg (File Operations 3.jpg).  I just cant find 
 which method of file
  read is used by vfs_read. Could you please advise ?

 Thanks, Regards

 -Anand

 --- On Sun, 6/13/10, Manish Katiyar mkati...@gmail.com wrote:

 From: Manish Katiyar mkati...@gmail.com
 Subject: Re: Question about do_sync_read()
 To: Anand Pai anand_...@yahoo.com
 Date: Sunday, June 13, 2010, 7:38 PM

 For ext3 filesystem, see the structure ext3_file_operations{} in 
 ext3/file.c. Similar thing is done for other filesystems. and trace the 
 function generic_file_aio_read().

 On Mon, Jun 14, 2010 at 1:58 AM, Anand Pai anand_...@yahoo.com wrote:

 Hi Manish:

 Cane across your question on do_sych_read I was wondering if you could
 help point me to exactly where the buf is getting written on the read from 
 file

 I am trying to do a kernel_read of a file from within an LKM, but the buf 
 is not
 getting updated after completion of the kernel_read.

 I would appreciate any help at all. Thanks so much

 -Anand






 --
 Thanks -
 Manish
 ==
 [$\*.^ -- I miss being one of them
 ==




 --
 Thanks -
 Manish
 ==
 [$\*.^ -- I miss being one of them
 ==




--
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: why is Size of sigset_t 128 bytes ?

2010-06-15 Thread Manish Katiyar
On Tue, Jun 15, 2010 at 6:30 PM, Siddu siddu.s...@gmail.com wrote:
 Hello all,

 I came across an article (http://www.linuxjournal.com/article/6483) about
 signals . Its a very nice article

 It says and also i verified that the size of sigset_t showing 128 bytes ?

 while code from /* /usr/include/bits/sigset.h */

 Maybe this is not the right place to ask this  Sorry, Hoping someone
 would be knowing the answer 

 # define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
 typedef struct
   {
     unsigned long int __val[_SIGSET_NWORDS];
   } __sigset_t;

 typedef __sigset_t sigset_t;

 which is definitely not 128 bytes .

Why not ???

Assuming 32 bit machines unsigned long int is 4 bytes, and you are
declaring and array of 32 elements of 4 bytes each.



 Thanks for your inputs !

 --
 Regards,
 ~Sid~
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 - - -
 Gazing through the window at the world outside,
 Wondering will mother earth survive ?
 Hoping that the mankind will stop abusing her
 Sometime !
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 - - -




-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Stack Tracing using Ftrace

2010-05-03 Thread Manish Katiyar
On Mon, May 3, 2010 at 7:02 PM, Neependra Khare
neependra.kh...@gmail.com wrote:
 Hi,

 I wrote a module and somehow it is corrupting the thread_info of the
 process.
 After some debugging I concluded that its corrupting the kernel stack.

 Then I came across Ftrace to get the stack trace, which confirmed high stack
 usage.
 http://lwn.net/Articles/366796/

 I see around 7K in the depth section of first entry in stack_trace.

 At the same time I run a stap script to get the current stack usage using
 stack_used  function.
 It comes around 4k.

Given that you are eating so much of stack space, you must have lots
of local variables or some *big* ones. It might be easy to just open
your .ko check the sizes of the variables and compute from there.  You
can also enable below variables in your .config.

CONFIG_DEBUG_STACKOVERFLOW=y
CONFIG_DEBUG_STACK_USAGE=y

Thanks -
Manish



 To my understanding the depth section of first entry in stack_trace and
 value retuned by
 stack_used should match.

 Is my understanding correct?

 Thanks
 Neependra








-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Dynamic Kernel Module Section Addresses

2010-04-28 Thread Manish Katiyar
On Wed, Apr 28, 2010 at 11:33 AM, Venkatram Tummala
venkatram...@gmail.com wrote:
 On Tue, Apr 27, 2010 at 8:01 PM, Manish Katiyar mkati...@gmail.com wrote:

 On Wed, Apr 28, 2010 at 6:38 AM, Venkatram Tummala
 venkatram...@gmail.com wrote:
  On Tue, Apr 27, 2010 at 5:04 PM, Mulyadi Santosa
  mulyadi.sant...@gmail.com
  wrote:
 
  Hi Venkatram...
 
  On Wed, Apr 28, 2010 at 05:34, Venkatram Tummala
  venkatram...@gmail.com
  wrote:
  
   1) Is there any way to tell the kernel not to load these module
   sections
   at
   different addresses every time the module is inserted  removed .
   That
   is,
   can we have the module loaded at exactly the same address everytime?
 
  None that I know. AFAIK the only way is to recheck the /sys entry and
  reinsert the symbol file (your kernel module file, which has been
  compiled with -g before) to proper position
 
  With this approach, i can set breakpoints in every function except for
  the
  function that initializes the module because i have to insert the module
  to
  get the kernel module section addresses from /sys  as a result of which,
  the
  initializition routine finishes executing which means i can not set any
  breakpoints in the module initialize function.
 
  This is not a problem for the the module exit function or any other
  function
  though.
 
  There should be a way to tell the kernel that Look, I dont care where
  you
  put the segments of this module but put them at the same place everytime
  i
  re-insert the module again (atleast until the next reboot).
  Conceptually,
  this should not be hard to implement (if its not there already) because
  it
  is the same kernel  the same unchanged KO module that i am asking it to
  insert.
 
   2) Is there any way to overcome this problem so that i can debug the
   module
   using vmware even though the module is loaded at different addresses?

 Probably i didn't understand the question. Can't you find it by
 looking at p modules from gdb ?

 Hey Manish,

 to find these addresses by p modules, the module has to be already
 loaded.right? So, the initialization function of the module must have
 been  already executedright? So, the question is how can we step through
 the initialization function of the module..?
Yes, you can't step through initialization function using this.

Thanks -
Manish
  p modules won't help
 us..probably looking at /sys is a faster way to find module segment
 addresses, or am I missing something here in p modules??

 I will try out Mulyadi's trick  get back !

 Regards,
 Venkatram Tummala

 Thanks -
 Manish


 
  AFAIK, again none that I know.
 
  --
  regards,
 
  Mulyadi Santosa
  Freelance Linux trainer and consultant
 
  blog: the-hydra.blogspot.com
  training: mulyaditraining.blogspot.com
 
 



 --
 Thanks -
 Manish
 ==
 [$\*.^ -- I miss being one of them
 ==





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: question about get_user

2010-04-28 Thread Manish Katiyar
On Wed, Apr 28, 2010 at 12:24 PM, Yang Fangkai wolfgang.y...@gmail.com wrote:
 Hi, Nidhi,

      Thanks! Now I know what is the problem.

      But in my project, I am developing a virtual char device driver
 such that user can read any process's memory contents by specifying
 its pid and virtual address. Therefore, a device /dev/gh is
 registered, and the user try to do something like:

 echo -n targetpid/dev/gh  echo -n addr/dev/gh

 Therefore, the target process can't be modified. The device driver
 will retrieve the value by pid and virtual address and return it to
 user at terminal.

Isn't it something similar to ptrace with PTRACE_PEEKTEXT, PTRACE_PEEKDATA

Thanks -
Manish
  I don't know how to solve this problem with get_user
 under my scenario. Thank you!

 Fangkai

 On Wed, Apr 28, 2010 at 1:42 AM, nidhi mittal hada
 nidhimitta...@gmail.com wrote:
 you should somehow call the kernel module from user space program ...
 may be using ioctl ..
 so that you are in same process context --- as the one you are sending
 address from .

 write char dev driver with ioctl method defined
 then call ioctl from user space

 ioctl(fd,IOCTL_CMD,addrees you want to send)


 Now in kernel module

 get_user(kernel data variable, user space address);

 Nidhi







 On Wed, Apr 28, 2010 at 11:55 AM, Yang Fangkai wolfgang.y...@gmail.com
 wrote:

 Hi, Nidhi,

        Thanks for your reply! Yes, you are right. I pass the address
 to the module from bash command echo, therefore when the address is
 referred, the current pid is bash's pid, instead of the simple program
 I wrote.

         But how can I fix this problem?

         Thank you!

 Fangkai

 On Wed, Apr 28, 2010 at 1:01 AM, nidhi mittal hada
 nidhimitta...@gmail.com wrote:
 
  in your kernel module try to print current-pid
  is it same as the user space process id ?
  i think when in kernel module you are not in the same process context
  whihc
  you want to refer ...
 
 
  Nidhi
 
  On Wed, Apr 28, 2010 at 10:38 AM, Yang Fangkai wolfgang.y...@gmail.com
  wrote:
 
  Hi, all,
 
  I have a problem with get_user() macro. What I did is as follows:
 
  I run the following program
 
  int main()
  {
        int a = 20;
        printf(address of a: %p, a);
        sleep(200);
        return 0;
  }
 
  When the program runs, it outputs the address of a, say, 0xbff91914.
 
  Then I pass this address to a module running in Kernel Mode that
  retrieves the contents at this address (at the time when I did this, I
  also made sure the process didn't terminate, because I put it to sleep
  for 200 seconds... ):
 
  The address is firstly sent as a string, and I cast them into pointer
  type.
 
  int * ptr = (int*)simple_strtol(buffer, NULL,16);
  printk(address: %p,ptr); // I use this line to make sure the cast is
  correct. When running, it does output bff91914
  int val = 0;
  int res;
  res= get_user(val, (int*) ptr);
 
  However, res is always not 0, meaning that get_user returns error. I
  am wondering what is the problem
 
  Thank you!!
 
  --
  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
 
 
 
 
  --
  Thanks  Regards
  Nidhi Mittal Hada
  Scientific officer D
  Computer Division
  Bhabha Atomic Research Center
  Mumbai
 
 
 



 --
 Thanks  Regards
 Nidhi Mittal Hada
 Scientific officer D
 Computer Division
 Bhabha Atomic Research Center
 Mumbai




 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Dynamic Kernel Module Section Addresses

2010-04-27 Thread Manish Katiyar
On Wed, Apr 28, 2010 at 6:38 AM, Venkatram Tummala
venkatram...@gmail.com wrote:
 On Tue, Apr 27, 2010 at 5:04 PM, Mulyadi Santosa mulyadi.sant...@gmail.com
 wrote:

 Hi Venkatram...

 On Wed, Apr 28, 2010 at 05:34, Venkatram Tummala venkatram...@gmail.com
 wrote:
 
  1) Is there any way to tell the kernel not to load these module sections
  at
  different addresses every time the module is inserted  removed . That
  is,
  can we have the module loaded at exactly the same address everytime?

 None that I know. AFAIK the only way is to recheck the /sys entry and
 reinsert the symbol file (your kernel module file, which has been
 compiled with -g before) to proper position

 With this approach, i can set breakpoints in every function except for the
 function that initializes the module because i have to insert the module to
 get the kernel module section addresses from /sys  as a result of which, the
 initializition routine finishes executing which means i can not set any
 breakpoints in the module initialize function.

 This is not a problem for the the module exit function or any other function
 though.

 There should be a way to tell the kernel that Look, I dont care where you
 put the segments of this module but put them at the same place everytime i
 re-insert the module again (atleast until the next reboot). Conceptually,
 this should not be hard to implement (if its not there already) because it
 is the same kernel  the same unchanged KO module that i am asking it to
 insert.

  2) Is there any way to overcome this problem so that i can debug the
  module
  using vmware even though the module is loaded at different addresses?

Probably i didn't understand the question. Can't you find it by
looking at p modules from gdb ?

Thanks -
Manish



 AFAIK, again none that I know.

 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer and consultant

 blog: the-hydra.blogspot.com
 training: mulyaditraining.blogspot.com





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: delete from hlist ???

2010-04-08 Thread Manish Katiyar
On Thu, Apr 8, 2010 at 11:28 AM, Onkar Mahajan kern.de...@gmail.com wrote:
 I am not able to understand how the marked like skips the node n :

 static inline void __hlist_del(struct hlist_node *n)
 {
     struct hlist_node *next = n-next;
     struct hlist_node **pprev = n-pprev;
     *pprev = next; --- 
     if (next)
         next-pprev = pprev;
 }

 in this case

 static inline void __list_del(struct list_head * prev, struct list_head *
 next)
 {
     next-prev = prev;
     prev-next = next;
 }

 It is clear ...

Why is not clear in the first case. It is doing exactly the same
thing. Except the fact the in list_head both the fields prev and next
are pointers while in hlist next is pointer but prev is pointer to
pointer.

NO ?

Thanks -
Manish




 Please help.

 Regards,
 Onkar





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: list query

2010-04-08 Thread Manish Katiyar
2010/4/8 Cédric Augonnet cedric.augon...@gmail.com:
 2010/4/8 Onkar Mahajan kern.de...@gmail.com:
 What is LIST_POISON1 and LIST_POISON2  ??

 #define LIST_POISON1  ((void *) 0x00100100 + POISON_POINTER_DELTA)
 #define LIST_POISON2  ((void *) 0x00200200 + POISON_POINTER_DELTA)

 and why they are used ?

 Regards,
 Onkar


 Hi Onkar,

 A poison value is a convenient value that you can detect when
 debugging. For instance if you find out that a pointer is 0xdeadbeef,
 you can easily imagine this is some uninitialized value. If you had
 used a NULL value, it would be harder to determine whether it's
 something uninitialized ...

yes... specially if it is some special value (like LIST_POISON1) in
the core and you can immediately go and look at the places where all
they get set and you can start from there.  Setting it to NULL or
something generic like 0xdeadbeef will make this hard.

thanks -
Manish


 Hope this helps,
 Cédric

 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: need to get blocks per group in user space

2010-04-07 Thread Manish Katiyar
On Wed, Apr 7, 2010 at 1:06 PM, nidhi mittal hada
nidhimitta...@gmail.com wrote:
 hello All

 I want to get some of filesystem specific information
 like blocksize , s_blocks_per_group
 etc in userspace c program

 How do i get it ?

Use libext2fs or see the code of dumpe2fs

 i have obtained block size by stat() function
 but not more than that :(




 --
 Thanks  Regards
 Nidhi Mittal Hada
 Scientific officer D
 Computer Division
 Bhabha Atomic Research Center
 Mumbai






-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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



Allocating memory with spinlock held

2010-03-03 Thread Manish Katiyar
Hello all,

Is the following code valid ???

foo() {
...
spin_lock(lock);
ptr = kzalloc(size, GFP_KERNEL);
spin_unlock(lock);
.
}


I guess the answer is no, but would like to confirm. Detailed/all
possible reasons for not doing so are welcome. IIRC, I was getting a
kernel crash with similar code with error message as spinlock bug :
unlocked on wrong CPU which looked like it was getting locked on one
cpu and due to memory allocation was getting unlocked from another
cpu.

-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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



Allocating memory with spinlock held

2010-03-03 Thread Manish Katiyar
Hello all,

Is the following code valid ???

foo() {
...
spin_lock(lock);
ptr = kzalloc(size, GFP_KERNEL);
spin_unlock(lock);
.
}


I guess the answer is no, but would like to confirm. Detailed/all
possible reasons for not doing so are welcome. IIRC, I was getting a
kernel crash with similar code with error message as spinlock bug :
unlocked on wrong CPU which looked like it was getting locked on one
cpu and due to memory allocation was getting unlocked from another
cpu.

-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Allocating memory with spinlock held

2010-03-03 Thread Manish Katiyar
On Thu, Mar 4, 2010 at 2:16 AM, Frederic Weisbecker fweis...@gmail.com wrote:
 On Tue, Mar 02, 2010 at 09:32:16AM +0530, Manish Katiyar wrote:
 Hello all,

 Is the following code valid ???

 foo() {
 ...
 spin_lock(lock);
 ptr = kzalloc(size, GFP_KERNEL);
 spin_unlock(lock);
 .
 }



 You can't because GFP_KERNEL involves the fact
 kzalloc might sleep while looking for memory
 somewhere (swapping out pages to get some free
 rooms).

 And sleeping while holding a spinlock may
 lead to a deadlock:

 Task A holds spinlock in cpu0. Task A sleeps.
 Task B is scheduled in cpu0, tries to take the
 spinlock and then deadlock for ever.

 You can use GFP_ATOMIC instead, but it's usually
 not recommended as the GFP_ATOMIC pool is a pretty
 limited resource.

Hi,

Thanks for the clarification. That is what I had suspected too and
wanted to clarify.


 The best is to allocate before you take the spinlock.
Yes, that is what I ended coding up.

Thanks again -
Manish





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: [ANNOUNCE] Online Hierarchical Storage Manager (OHSM v1.2)

2010-02-23 Thread Manish Katiyar
On Tue, Feb 23, 2010 at 7:57 PM, Jan Kara j...@ucw.cz wrote:
  Hello Manish,

    We are pleased to announce the first official functional release of Online
 Hierarchical Storage Manager (OHSM v1.2).  This is a RFC release and
 not yet aimed at mainline inclusion.

 OHSM is a tool to manage and move data across various class of storage.
 It can help users to selectively place and move data across tiers such
 as SSD, Raid 10, Raid 6 based on the attributes of the data. OHSM
 supports background movement of data
 without any visible change in a files namespace to users and user 
 applications.
 OHSM is built as an external module with recompilation required for
 ext4. The current version of OHSM is based upon kernel 2.6.32.2

 This release includes 3 core kernel patches:

 1) An initial ext4 patch to adjust ext4's block allocation to use a
 preferred block range per Ted
 Tso's Dec 2008 write-up
 (http://markmail.org/message/qp7zjhhdzxum7rfn).  This patch is not
 ohsm specific.
 2) A ohsm specific ext4 patch to provide callouts to the ohsm module.
 3) The ohsm module itself

 The source code for OHSM v1.2 is freely distributable under GPL.
 The latest stable OHSM v1.2 is available at :
 http://sourceforge.net/projects/ohsm/files/OHSMv1.2.tar.gz/download
 Sources are available as git repository at :
 git://ohsm.git.sourceforge.net/gitroot/ohsm/ohsm
  Looking at the code, the code deciding where to put a given file isn't
 really tied to ext4, is it?
Hi Jan,

ext4 was our default choice to get started, because of the ioctls
provided by Akira and since e4defrag already exists it was much easier
for us to refer. Though we have tried to keep the OHSM code as
independant as possible so that it would be possible to support other
filesystems in future too.

  Using pathnames to decide where to put files is ... natural but it has
 its downsides. For example your code in build_path() is racy because the
 directory hiearchy can change while you climb the tree - not mentioning the
 fact that the static buffer of 4096 for pathname is ugly and implementing
 that simple walk recursively isn't good either. Kernel already has a d_path
 function for constructing path in at least somewhat reliable way.

Thanks a lot for your feedback. We have fixed some bugs recently to
get rid of static allocations so they will go away. I will have a look
at d_path().

  Anyway I suggest you have a look at Tomoyo which implements pathname based
 security module so that you can avoid mistakes they did...

Sure, will do. Definitely it will help us learn more and make the code
base better.

Thanks -
Manish


                                                                Honza





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Absolute Path from linux_dirent64

2010-02-22 Thread Manish Katiyar
On Sat, Feb 13, 2010 at 11:14 PM, Sam Carter sam.w.car...@gmail.com wrote:
 Hi guys,
 Can I get the string of the full path to a linux_dirent64 file somehow?
If I understand your question correctly, that is not possible. a
linux_dirent64 will have information about your current filename (ie..
name, record len etc.). Just by using this it is not possible to get a
unique parent for the filename. For example if you have a filename foo
you may have different parents like

/home/mkatiyar/A/foo
/home/mkatiyar/B/foo

In such cases what would you expect to get ? the parent should be 'A' or 'B'

Thanks -
Manish
 I've looked at stat() but it wasnt very helpful. Also d_path(), but that
 takes a dentry struct, not a dirent like I have.
 Thanks,
 Sam



-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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



[ANNOUNCE] Online Hierarchical Storage Manager (OHSM v1.2)

2010-02-22 Thread Manish Katiyar
Hello all,
   We are pleased to announce the first official functional release of Online
Hierarchical Storage Manager (OHSM v1.2).  This is a RFC release and
not yet aimed at mainline inclusion.

OHSM is a tool to manage and move data across various class of storage.
It can help users to selectively place and move data across tiers such
as SSD, Raid 10, Raid 6 based on the attributes of the data. OHSM
supports background movement of data
without any visible change in a files namespace to users and user applications.
OHSM is built as an external module with recompilation required for
ext4. The current version of OHSM is based upon kernel 2.6.32.2

This release includes 3 core kernel patches:

1) An initial ext4 patch to adjust ext4's block allocation to use a
preferred block range per Ted
Tso's Dec 2008 write-up
(http://markmail.org/message/qp7zjhhdzxum7rfn).  This patch is not
ohsm specific.
2) A ohsm specific ext4 patch to provide callouts to the ohsm module.
3) The ohsm module itself

The source code for OHSM v1.2 is freely distributable under GPL.
The latest stable OHSM v1.2 is available at :
http://sourceforge.net/projects/ohsm/files/OHSMv1.2.tar.gz/download
Sources are available as git repository at :
git://ohsm.git.sourceforge.net/gitroot/ohsm/ohsm

The following list describes the features of OHSM
* Support for Ext4.
* File System callouts
* Policy based File Migration
* Per inode information maintainer in user xattr area
* XML based policy files
* Support for RAID
* DTD based XML validation
- Automatic Relocation engine
* Selective Relocation of mountpoint/Subdirectories
* Selection Relocation based on specific rule
* File Placement based on:
 + UID
 + GID
 +  File Type
 + Directory Name
* File Migration based on
 + UID
 + GID
 + FILE SIZE
 + ACCESS AGE
 + MODIFICATION AGE
 - File Access Temperatue
 - File I/O Temperature
+
(*=current features, -= on our todo list, +=support already present)

Here are some simple examples :-
$ ohsm enable sample/ohsm.xml
OHSM enabled successfully on '/tmp/mnt'

$ ohsm relocate -m /tmp/mnt
Relocation performed successfully.

$ ohsm status /tmp/mnt
OHSM is enabled on '/tmp/mnt'

$ ohsm disable /tmp/mnt
OHSM disabled successfully on '/tmp/mnt'

$ ohsm
Usage: ohsm subcommand [optstring ..] [parameters ..]
 Subcommands :
  enable  - Enable OHSM
  disable - Disable OHSM
  status  - Show status of OHSM
  relocate -Trigger relocation on filesystem
  update  - Update OHSM instance parameters
  help -Show usage

*Note* that the code for OHSM is still in early stages
Feedback, bug reports and patches, as always, are welcomed.
(ohsm-de...@lists.sourceforge.net)


-- 
Thanks -
OHSM team

--
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: ieee papers

2010-02-19 Thread Manish Katiyar
On Fri, Feb 19, 2010 at 12:47 AM, Krushnaal Pai krisonea...@gmail.com wrote:
 OK... SORRY FOR USING UR PORTAL FOR IEEE PAPERS
 WONT DO IT AGAIN

And typing in caps is again *something to avoid* while posting in mailing lists.

Thanks -
Manish



 On Thu, Feb 18, 2010 at 11:29 PM, Denis Kirjanov kirja...@gmail.com wrote:

 Recently there are too many messages not related to the Linux kernel
 topic. And this is a bad sign :/

 On Thu, Feb 18, 2010 at 7:04 PM, Mulyadi Santosa
 mulyadi.sant...@gmail.com wrote:

 On Thu, Feb 18, 2010 at 4:24 PM, Krushnaal Pai krisonea...@gmail.com
 wrote:
  Anybody got any full sample ieee papers/abstracts?...
  Plz
  mail me guyz..
 

 Since when kernelnewbies becomes the new place to ask for IEEE paper?

 PS: Rik, could these things happen because they don't read the
 kernelnewbies' posting rule?

 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer and consultant

 blog: the-hydra.blogspot.com
 training: mulyaditraining.blogspot.com

 --
 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




 --
 Regards,
 Denis





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: latest kernel compile-- system panic

2010-01-28 Thread Manish Katiyar
On Thu, Jan 28, 2010 at 5:05 PM, waqar afridi afridi.wa...@gmail.com wrote:
 I used to get these errors when I started with kernel compilation and by
 this I mean a few weeks back.

 Where do u put the kernel source when you compile it, I used to download it
 and extract it to my home Directory and then the list of commands above, but
 it never worked.

 The Solution to this problem is to Extract the Kernel source to /usr/src/
 and then do the above process (make etc), may be this will help...

Where you put the kernel sources to build is not at all related to
these panics (Otherwise you don't need a build symlink in your
/lib/modules/version). Did you build the same config ?

Thanks -
Manish



 On Thu, Jan 28, 2010 at 3:25 PM, nidhi mittal hada nidhimitta...@gmail.com
 wrote:

 Hello
 This time also . i just copied the .config of my running kernel to the
 downloaded new kernel's directory
 and
 did make and further steps.
 and it executed successfully.
 no kernel panic.

 is it the right way .?
 But i helplessly do it as last resort everytime
 when after my all efforts new kernel panics on boot everytime.


 Nidhi

 On Thu, Jan 28, 2010 at 2:53 PM, nidhi mittal hada
 nidhimitta...@gmail.com wrote:

 hi all
 i compiled latest kernel linux2.6.32.6

 after 4 steps of
  make menuconfig
 make
 make modules
 make modules_install
 make install

 when i rebooted these error messages came



 Unable to access resume device (/dev/sda3)
 mount: could not find filesystem /dev/root'
 setuproot : moving /dev failed : No such file or directory
 setuproot : error mounting /proc  : No such file or directory
  setuproot : error mounting /Sys : No such file or directory

 switchroot: mount failed No such file or directory


 earlier also whenever i compiled new kernel .. i used to copy the .config
 of old running kernel into new liinux folder
 as everytime if i create .config file with make menuconfig .. some
 unknown mistake gives kernel panic

 i need to know how to set proper .config so that it caters to all
 requirement of my present machine hardware
 i got to know
 make cloneconfig but it gives error as
 make[1]: *** No rule to make target `cloneconfig'.  Stop.
 make: *** [cloneconfig] Error 2

 will make oldconfig work ??
 what to do

 Nidhi
 --
 Thanks  Regards
 Nidhi Mittal Hada



 --
 Thanks  Regards
 Nidhi Mittal Hada



 --
 Waqar Afridi

 Android Developer
 SERG IM|Sciences




-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: latest kernel compile-- system panic

2010-01-28 Thread Manish Katiyar
On Thu, Jan 28, 2010 at 6:02 PM, nidhi mittal hada
nidhimitta...@gmail.com wrote:
 yes
 when i get unhinting errors -- i guessed something , changed a few params in
 .config and did make make modules so on
 but again same errors .
 finally
 i copied earlier running kernel's .config into this ...didnot do make
 menuconfig at all
 and in .config changed my required parameter of ext4 to be build as module.
 that's all
 now make , make modules , make modules_install , make install and
 it worked well

 now my ques is ...is it right what i am doing ...
 if not how to know correct parameter of .config
 isnt there some
 make someconfig   instead of menuconfig
 which prepares correct .config file seeing hardware requirement on my pc or
 working kernel's .config file ...

make oldconfig
make help


 Please CMIIW anywhere.
 Nidhi




 On Thu, Jan 28, 2010 at 5:13 PM, Manish Katiyar mkati...@gmail.com wrote:

 On Thu, Jan 28, 2010 at 5:05 PM, waqar afridi afridi.wa...@gmail.com
 wrote:
  I used to get these errors when I started with kernel compilation and by
  this I mean a few weeks back.
 
  Where do u put the kernel source when you compile it, I used to download
  it
  and extract it to my home Directory and then the list of commands above,
  but
  it never worked.
 
  The Solution to this problem is to Extract the Kernel source to
  /usr/src/
  and then do the above process (make etc), may be this will help...

 Where you put the kernel sources to build is not at all related to
 these panics (Otherwise you don't need a build symlink in your
 /lib/modules/version). Did you build the same config ?

 Thanks -
 Manish

 
 
  On Thu, Jan 28, 2010 at 3:25 PM, nidhi mittal hada
  nidhimitta...@gmail.com
  wrote:
 
  Hello
  This time also . i just copied the .config of my running kernel to the
  downloaded new kernel's directory
  and
  did make and further steps.
  and it executed successfully.
  no kernel panic.
 
  is it the right way .?
  But i helplessly do it as last resort everytime
  when after my all efforts new kernel panics on boot everytime.
 
 
  Nidhi
 
  On Thu, Jan 28, 2010 at 2:53 PM, nidhi mittal hada
  nidhimitta...@gmail.com wrote:
 
  hi all
  i compiled latest kernel linux2.6.32.6
 
  after 4 steps of
   make menuconfig
  make
  make modules
  make modules_install
  make install
 
  when i rebooted these error messages came
 
 
 
  Unable to access resume device (/dev/sda3)
  mount: could not find filesystem /dev/root'
  setuproot : moving /dev failed : No such file or directory
  setuproot : error mounting /proc  : No such file or directory
   setuproot : error mounting /Sys : No such file or directory
 
  switchroot: mount failed No such file or directory
 
 
  earlier also whenever i compiled new kernel .. i used to copy the
  .config
  of old running kernel into new liinux folder
  as everytime if i create .config file with make menuconfig .. some
  unknown mistake gives kernel panic
 
  i need to know how to set proper .config so that it caters to all
  requirement of my present machine hardware
  i got to know
  make cloneconfig but it gives error as
  make[1]: *** No rule to make target `cloneconfig'.  Stop.
  make: *** [cloneconfig] Error 2
 
  will make oldconfig work ??
  what to do
 
  Nidhi
  --
  Thanks  Regards
  Nidhi Mittal Hada
 
 
 
  --
  Thanks  Regards
  Nidhi Mittal Hada
 
 
 
  --
  Waqar Afridi
 
  Android Developer
  SERG IM|Sciences
 



 --
 Thanks -
 Manish
 ==
 [$\*.^ -- I miss being one of them
 ==



 --
 Thanks  Regards
 Nidhi Mittal Hada




-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Needs the complete definition user_path_walk()

2010-01-27 Thread Manish Katiyar
On Wed, Jan 27, 2010 at 1:35 PM, waqar afridi afridi.wa...@gmail.com wrote:
 I wasnt expecting that much quick reply, Zellux and specially Manish for for
 sharing this great Ocean of Knowledge (Google)...

 On Wed, Jan 27, 2010 at 12:33 PM, Manish Katiyar mkati...@gmail.com wrote:

 On Wed, Jan 27, 2010 at 12:36 PM, waqar afridi afridi.wa...@gmail.com
 wrote:
  Hello Every One
 
  This is my First mail to this community, so dont know much about the
  Rules
  and Regulations.
 In general doing google is a good idea.
 
  I want the Definition of user_path_walk() function, If any one had,
  Please
  send it and if not, can any one tell me where could I find it.

I guess it was removed after 2.6.6 . And now this function is called
as user_path. Look at the following commit which can give you some
idea.

commit 2d8f30380ab8c706f4e0a8f1aaa22b5886e9ac8a
Author: Al Viro v...@zeniv.linux.org.uk
Date:   Tue Jul 22 09:59:21 2008 -0400

[PATCH] sanitize __user_walk_fd() et.al.
...
...
+asmlinkage long compat_sys_statfs(const char __user *pathname, struct
compat_statfs __user *buf)
 {
-   struct nameidata nd;
+   struct path path;
int error;

-   error = user_path_walk(path, nd);
+   error = user_path(pathname, path);
if (!error) {
struct kstatfs tmp;
-   error = vfs_statfs(nd.path.dentry, tmp);
+   error = vfs_statfs(path.dentry, tmp);
if (!error)
error = put_compat_statfs(buf, tmp);
-   path_put(nd.path);
+   path_put(path);
}

...


Thanks -
Manish


 This is the first link in google.
 http://www.developerweb.net/forum/archive/index.php/t-3466.html

 I already had tried this link but it did gave me anything, The reason might
 be that I am newbie, But things will improve...

 Thanx Alot

 
  Thanx In advance
 
  --
  Waqar Afridi
 



 --
 Thanks -
 Manish
 ==
 [$\*.^ -- I miss being one of them
 ==



 --
 Waqar Afridi




-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: dentry path name lookup

2010-01-27 Thread Manish Katiyar
On Wed, Jan 27, 2010 at 1:37 PM, er krishna erkris...@gmail.com wrote:
 Dear All,

 Can anybody please help me how does dentry does path resolution. I want to
 undersatnd the whole process in detail. Any link or comments are most
 welcome.

 Just asking for my understanding,

Have a look at function link_path_walk().

Thanks -
Manish

 Dentry maintains a relationship between file object  inode for path name
 lookup ? Is it right ?

 If the pathname is /home/krishna/myfile, how it will be resolve ?

 Best Regards,
 Krishna



-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Needs the complete definition user_path_walk()

2010-01-27 Thread Manish Katiyar
On Wed, Jan 27, 2010 at 12:36 PM, waqar afridi afridi.wa...@gmail.com wrote:
 Hello Every One

 This is my First mail to this community, so dont know much about the Rules
 and Regulations.
In general doing google is a good idea.

 I want the Definition of user_path_walk() function, If any one had, Please
 send it and if not, can any one tell me where could I find it.
This is the first link in google.
http://www.developerweb.net/forum/archive/index.php/t-3466.html

 Thanx In advance

 --
 Waqar Afridi




-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Kernel Build fail on Ubuntu

2010-01-19 Thread Manish Katiyar
On Tue, Jan 19, 2010 at 5:56 PM, Ramya Desai ramya.de...@gmail.com wrote:
 Dear Experts,

 I am not able to compile the required kernel on Ubuntu system. When I
 do the make modules command it showed the following messages. Due to
 these messages, it does not creates the initrd image file in the /boot
 directory to that specified kernel.

 WARNING: modpost: Found 2 section mismatch (es)
 To see full details build your kernel with:
 make CONFIG_DEBUG_SECTION_MISMATCH=y

 I have tried in different ways as suggested in some of the google
 links as well. However, there is no luck.

 Could you please any one suggest me how can I resolve the issue?

You can ignore this and run mkinitramfs your kernel version in /boot.

Thanks -
Manish


 Thanks in advance.
 RD

 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: copy-on-write overhead

2010-01-11 Thread Manish Katiyar
On Mon, Jan 11, 2010 at 3:01 PM, Pete greg.p...@gmail.com wrote:

 On Mon, Jan 11, 2010 at 6:22 AM, Mulyadi Santosa
 mulyadi.sant...@gmail.com wrote:
  On 1/11/10, Joel Fernandes agnel.j...@gmail.com wrote:
  Oh I'm sorry, if you were talking about copying of the address space
  information that can be avoided, that does not happen because it
  would've already been copied before exec() in the child gets a chance
  to execute.. the fork system call calls do_fork somewhere which calls
  copy_process which does this copying so it can't be avoided in any
  case. The book says copy-on-write itself has more overhead that is
  avoided with exec() in the child, but I'm trying to figure how.
 
  -Joel
 
 
  Hi Joel...
 
  Manish is right. Please notice that he talked about why do we do copy
  on write (COW) if soon after child is forked, it quickly does exec().
  So yes, COW has overhead, but imagine if parent ran first. COW will be
  triggered for parent address space, then child soon runs too. Then it
  issues exec(). Clearly, this waste certain amout of memory which can
  be fairly avoided if child runs first.


 After going through this thread, I just tried out the following simple
 code:

 int main (void) {

 int pid;

 int *testVar = (int *) malloc (sizeof (int));

 *testVar = 10;

 printf (%d [%d] Main \n, *testVar, testVar);

 pid=vfork();                    // works fine if we use fork instead.

 if (pid==0) {

 printf (Child %d [%d]\n, *testVar, testVar);

 return 1;

 } else if (pid  0) {

 printf (Parent %d [%d]\n, *testVar, testVar);

 *testVar=11; // segfault if we use vfork, as vfork blocks until child
 returns call exec/exits.

 wait(NULL);

 printf (Parent %d [%d]\n, *testVar, testVar);

 return 1;

 }

 exit(0);
 }

 can someone let me know why this segfaults with vfork and not with fork?

Man page says most of the stuff :-


The  use  of  vfork()  was  tricky:  for example, not modifying data
in the parent process  depended on knowing which variables are held in
a register.

In particular, the programmer cannot rely on  the  parent  remaining  blocked
until  the  child  either  terminates or calls execve(2), and cannot
rely on any specific behavior with  respect to shared memory.


Thanks -
Manish
 From my understanding - it is because the parent is blocked until the
 child exec's/exits AND in the mean time when the program is being
 executed the child/parent process is trying to change the *testVar is
 causing to modify the parents read-only memory. CMIAW.

 Another thing I noticed is on linux the child always gets to run first
 in case of fork() and vfork()?

 Cheers
 ~Pete



 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: compiling ext2 outside source tree

2010-01-10 Thread Manish Katiyar
On Sun, Jan 10, 2010 at 10:37 PM, Onkar onkar@gmail.com wrote:
 Hi ,
     I want to take the folder ext2 from linux-2.6.31.5/fs/ext2  compile it
 outside the tree and
 insmod ext2.ko. What changes should I make to the Makefile ?

/tmp cp -r /home/mkatiyar/personal/kernel/linux-2.6.32.2/fs/ext2 .
/tmp cd ext2
/tmp/ext2 make -C /lib/modules/`uname -r`/build M=$PWD
make: Entering directory `/home/mkatiyar/personal/kernel/linux-2.6.32.2'
  LD  /tmp/ext2/built-in.o
  CC [M]  /tmp/ext2/balloc.o
  CC [M]  /tmp/ext2/dir.o
  CC [M]  /tmp/ext2/file.o
  CC [M]  /tmp/ext2/ialloc.o
  CC [M]  /tmp/ext2/inode.o
  CC [M]  /tmp/ext2/ioctl.o
  CC [M]  /tmp/ext2/namei.o
  CC [M]  /tmp/ext2/super.o
  CC [M]  /tmp/ext2/symlink.o
  CC [M]  /tmp/ext2/xattr.o
  CC [M]  /tmp/ext2/xattr_user.o
  CC [M]  /tmp/ext2/xattr_trusted.o
  LD [M]  /tmp/ext2/ext2.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC  /tmp/ext2/ext2.mod.o
  LD [M]  /tmp/ext2/ext2.ko
make: Leaving directory `/home/mkatiyar/personal/kernel/linux-2.6.32.2'


Thanks -
Manish

 Please help me get going with this.

 Regards,
 Onkar




-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: copy-on-write overhead

2010-01-10 Thread Manish Katiyar
On Mon, Jan 11, 2010 at 12:02 AM, Joel Fernandes agnel.j...@gmail.com wrote:
 Hi,
 The book Linux Kernel Development mentions a certain overhead which is
 reduced in linux because the child is made to run first after it is
 forked (instead of the parent) and if the child executes the exec
 system call.

 Quoting Pg 32 (2nd edition):
 In do_fork() the child is woken up and run. Deliberately the kernel
 runs the child process first. In the common case of the child simply
 calling exec() immediately, this eliminates any copy-on-write overhead
 that would occur if the parent ran first and began writing to the
 address space

 How does running exec() in child more efficient than having
 copy-on-write trigger in the parent?

Hi,

In order to create a new process (fork), you will copy the whole of
relevant info of address space from the parent. Now if the address
space is shared and parent runs first for any change it makes, it will
need to copy and then modify because it doesn't know if child needs it
or not. Since mostly after fork, if you do an exec it is guaranteed
that child will not need this address space and the whole of copy can
be avoided by making child to run first. (In simple terms you can take
decision early whether this address space is useful or not for child).

Thanks -
Manish




 Let me know if my question is clear, or if I should rephrase.

 Thanks!
 -Joel

 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Out of memory vs memory leak

2010-01-08 Thread Manish Katiyar
On Thu, Jan 7, 2010 at 8:34 PM, Anand Raj Manickam anan...@gmail.com wrote:
 I have a few doubts regarding Out of Memory  .

 1.Does memory leak in the kernel always lead to OOM ?

 2. I wrote a kernel  test module testing the memory leak , which on
 exit kmallocs

 exit_module ()
 {
   while(1)
   kmalloc((8*1024),GFP_KERNEL);
 }

 so when i rmmod test , the kernel never panicked on OOM , but it
 panicked on the page allocation stat (sorry for not attaching the
 dump)
 Does the kernel differentiate between a Memory Leak and a Out of
 memory situation ?

You don't panic immediately. Memory leaks eventually leads to out of
memory because the memory manager has given all the memory to someone
and hasn't got back (leaked !!). So if a new requestor comes he
doesn't have anything to allocate and you get out of memory.

Thanks -
Manish


 Google didnt help me in the releation between memory leak and OOM .

 Thanks,
 Anand

 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: question about __v annotation

2010-01-03 Thread Manish Katiyar
On Sat, Jan 2, 2010 at 6:40 PM, Shawn cit...@gmail.com wrote:
 hello guys,
  I got a newbie confused when I was looking into the source code of
 s3c2440's RTC driver.I dont know what is __v excatly means
A local variable name.
..anyone can
 tell?thanks anyway!

 #define readb(c) ({ __u8  __v = __raw_readb(__mem_pci(c)); __v; })

 --
 GNU powered it...
 GPL protect it...
 God blessing it...

 regards
 HFG--Shawn the R0ck




-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Kernel compilation problem.........

2009-12-21 Thread Manish Katiyar
On Mon, Dec 21, 2009 at 11:07 PM, Mulyadi Santosa
mulyadi.sant...@gmail.com wrote:
 Hi...

 On Tue, Dec 22, 2009 at 12:10 AM, bajrangi pandey
 bajrangi12pan...@gmail.com wrote:
 Hi ,

 suppose i am making changes in kernel file fs.h

 Is it necessary to perform all three steps
 1 make

I think you can just do make fs

 2 make modules_install
 3 make install
 to rebuilt the kernel (compiling same kernel version source code 2nd time)?
 can i skip step
                 make modules_install

 My best guess is yes, you need to do all the above step. The reason is
 to make sure all the related code pick your modification.

 You don't need to worry if compilation time is your concern. make
 will make sure only .c files that depends on this fs.h that get
 recompiled. So theoritically, it should be done relatively faster.

 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer and consultant

 blog: the-hydra.blogspot.com
 training: mulyaditraining.blogspot.com

 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: How does ls command work in Linux in detail?

2009-12-02 Thread Manish Katiyar
On Thu, Dec 3, 2009 at 9:18 AM, Daniel (Youngwhan) Song
breadn...@gmail.com wrote:
 Thanks, krushnaal and Greg,

 By looking at the Greg's strace, it gives me great insight of the command.

 So, It looks like it calls a library which can be in glib(?), and the
 library actually calls kernel device drivers like console or something like
 that, and they were communicating each other back and forth, and finally, it
 outputs the result of ls onto the screen. Is my understanding correct?

Actually what you have told is true for any command and is not limited
to ls. If you want to know how ls works you will need to understand
a little about how files are stored on disk and how they are indexed.
And then you can try to read about readdir(), opendir(),stat() system
calls and finally implement your own ls :-)



 Best Regards,
 Daniel (Youngwhan) Song



 On Wed, Dec 2, 2009 at 7:41 PM, Greg Freemyer greg.freem...@gmail.com
 wrote:

 On Wed, Dec 2, 2009 at 9:12 PM, Daniel (Youngwhan) Song
 breadn...@gmail.com wrote:
  Hi,
 
  Could somebody explain me how exactly ls command work in Unix/Linux?
 
  When we type ls command in linux shell, what does process/procedure
  work
  with linux library or linux kernel, and how exactly does it show
  directory
  information to the standard output (1)?
 
  Thanks in advance.
 
  Best Regards,
  Daniel Song
 

 read the source of course, but a very handy shortcut is:

 # strace ls

 The key part with a couple comments is:

 # Get the directory entries
 open(., O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
 fcntl64(3, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)
 getdents64(3, /* 53 entries */, 32768)  = 1744
 getdents64(3, /* 0 entries */, 32768)   = 0
 close(3)                                = 0

 # Verify stdout is a character device
 fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0

 # map stdin into memory.  (Not sure why, see the source)
 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
 0) = 0xb73ff000

 # write the directory entries to stdout and wrap-up
 write(1, bin  Desktop  Documents  Downloa..., 91bin  Desktop
 Documents  Download  Music  Pictures  Public  public_html  Templates
 Videos
 ) = 91
 close(1)                                = 0
 munmap(0xb73ff000, 4096)                = 0
 close(2)                                = 0
 exit_group(0)                           = ?

 Greg





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: How does ls command work in Linux in detail?

2009-12-02 Thread Manish Katiyar
On Thu, Dec 3, 2009 at 10:23 AM, Daniel (Youngwhan) Song
breadn...@gmail.com wrote:
 Thanks, Greg and Manish,

 What I am trying to understand is not only for ls itself. I just wanted to
 know how general command such like ps, top, or something like that works
 in linux. Also, I wanted to know the path from user-level application to how
 it accesses to kernel resources.

 I guess I could understand roughly about the mechanism of an application in
 linux, but I feel to study more. If you know some resources I need to dig
 into and share of it, it would be great helpful to me.

Hi Daniel,

Then you would need to learn about system calls and do google search
about how they work. Each of the unix commands call some set of system
calls underneath which actually does the job in kernel space. What you
see in the output of strace are the system calls made to kernel.

searching for system calls in google will give you plethora of results.

HTH


 Thanks,

 Best Regards,
 Daniel (Youngwhan) Song



 On Wed, Dec 2, 2009 at 8:36 PM, Manish Katiyar mkati...@gmail.com wrote:

 On Thu, Dec 3, 2009 at 9:18 AM, Daniel (Youngwhan) Song
 breadn...@gmail.com wrote:
  Thanks, krushnaal and Greg,
 
  By looking at the Greg's strace, it gives me great insight of the
  command.
 
  So, It looks like it calls a library which can be in glib(?), and the
  library actually calls kernel device drivers like console or something
  like
  that, and they were communicating each other back and forth, and
  finally, it
  outputs the result of ls onto the screen. Is my understanding correct?

 Actually what you have told is true for any command and is not limited
 to ls. If you want to know how ls works you will need to understand
 a little about how files are stored on disk and how they are indexed.
 And then you can try to read about readdir(), opendir(),stat() system
 calls and finally implement your own ls :-)


 
  Best Regards,
  Daniel (Youngwhan) Song
 
 
 
  On Wed, Dec 2, 2009 at 7:41 PM, Greg Freemyer greg.freem...@gmail.com
  wrote:
 
  On Wed, Dec 2, 2009 at 9:12 PM, Daniel (Youngwhan) Song
  breadn...@gmail.com wrote:
   Hi,
  
   Could somebody explain me how exactly ls command work in
   Unix/Linux?
  
   When we type ls command in linux shell, what does process/procedure
   work
   with linux library or linux kernel, and how exactly does it show
   directory
   information to the standard output (1)?
  
   Thanks in advance.
  
   Best Regards,
   Daniel Song
  
 
  read the source of course, but a very handy shortcut is:
 
  # strace ls
 
  The key part with a couple comments is:
 
  # Get the directory entries
  open(., O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
  fcntl64(3, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)
  getdents64(3, /* 53 entries */, 32768)  = 1744
  getdents64(3, /* 0 entries */, 32768)   = 0
  close(3)                                = 0
 
  # Verify stdout is a character device
  fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
 
  # map stdin into memory.  (Not sure why, see the source)
  mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
  0) = 0xb73ff000
 
  # write the directory entries to stdout and wrap-up
  write(1, bin  Desktop  Documents  Downloa..., 91bin  Desktop
  Documents  Download  Music  Pictures  Public  public_html  Templates
  Videos
  ) = 91
  close(1)                                = 0
  munmap(0xb73ff000, 4096)                = 0
  close(2)                                = 0
  exit_group(0)                           = ?
 
  Greg
 
 



 --
 Thanks -
 Manish
 ==
 [$\*.^ -- I miss being one of them
 ==





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Query on File Creation time in Linux

2009-11-19 Thread Manish Katiyar
On Thu, Nov 19, 2009 at 5:59 PM, Indraneel Mukherjee indro...@gmail.com wrote:
 Hi,
 It seems that Linux does NOT provide a File Creation Time field.

 There is atime(file access time)  ctime(inode change time)  mtime(file
 modification time) but NO field for File Creation Time. Why is it so?

Actually if you see the comments in ext2_inode structure in kernel
sources i_ctime says it is creation time. However everywhere it is
changed frequently along with the mtime, so from the code looks like
c stands for change time and not creation time.

242 struct ext2_inode {
243 __le16  i_mode; /* File mode */
244 __le16  i_uid;  /* Low 16 bits of Owner Uid */
245 __le32  i_size; /* Size in bytes */
246 __le32  i_atime;/* Access time */
247 __le32  i_ctime;/* Creation time */


A bit of googling showed that creation time is supported by some
non-posix filesystems.


 Regards,
 Indro




-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: kernel panic about kernel unaligned access

2009-10-29 Thread Manish Katiyar
On Thu, Oct 29, 2009 at 11:13 AM, Mulyadi Santosa
mulyadi.sant...@gmail.com wrote:
 On Thu, Oct 29, 2009 at 10:48 AM, loody milo...@gmail.com wrote:
 Hi:
 thanks for all your kind help.
 Take  8709ed20 writeback_inodes+0xb4/0x160 for example, what does
 0x160, the last hex mean? The value of parameter?

0x160 means the total size of your disassembled function and 0xb4 is
the offset in it where it crashed. If you do disas writeback_inodes
you should look around (writeback_inodes+0xb4) to find the instruction
where it crashed.

 appreciate your help,
 miloody


 It's the size (hexadecimal number) of the related function (in bytes, I think)


 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer and consultant

 blog: the-hydra.blogspot.com
 training: mulyaditraining.blogspot.com

 --
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: How to print Superblock(ext2) data

2009-10-21 Thread Manish Katiyar
On Wed, Oct 21, 2009 at 1:24 PM, mahesh sobale msobale...@gmail.com wrote:
 HI,

  I am new to kernelnewbies. I am trying to print meta data in kernel
 space for superblock.
 for that i have to fire ioctl and write char device driver(This part i
 know),

  But i don't know how create loop device and mount ext2 file system on
 that and then print
 superblock info.

You can just do dumpe2fs -h device_name



  Can anybody help on this.

 Thanx.
 Mahesh.





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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 Manish Katiyar
On Fri, Oct 9, 2009 at 11:16 AM, Prasad Joshi prasadjoshi...@gmail.com 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

 # 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.

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 ?


 Thanks and Regards,
 Prasad

 On Thu, Oct 8, 2009 at 6:41 PM, Manish Katiyar mkati...@gmail.com wrote:
 On Thu, Oct 8, 2009 at 12:38 PM, Prasad Joshi prasadjoshi...@gmail.com 
 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 block of the file systems, but it
 seems like it did not fail in superblock read

 # strace -o out mount -t ext2 /dev/ftl /mntpt/
 [  175.192033] Opening the device.
 [  175.193599] IftlIoRead: offset=0x400 Length=0x400
 [  175.193875] OffsetWithinPage: 400
 [  175.195104] Read pos=1002535424, length=8192
 [  175.195474]  0001  0004   eea5 0003 fff5   
 0002  0002  8000  8000  2000    8a9e 4acd 
 0020 ef53 0001 0001  8a9e 4acd 4e00 00ed   0001   
 000b  0100  0038  0002  0003  a037 8e0c d6b3 de11 abb8
 0635 bff9 2b36            
               
    

Re: Mounting block device fails.

2009-10-08 Thread Manish Katiyar
On Thu, Oct 8, 2009 at 12:38 PM, Prasad Joshi prasadjoshi...@gmail.com 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 block of the file systems, but it
 seems like it did not fail in superblock read

 # strace -o out mount -t ext2 /dev/ftl /mntpt/
 [  175.192033] Opening the device.
 [  175.193599] IftlIoRead: offset=0x400 Length=0x400
 [  175.193875] OffsetWithinPage: 400
 [  175.195104] Read pos=1002535424, length=8192
 [  175.195474]  0001  0004   eea5 0003 fff5   
 0002  0002  8000  8000  2000    8a9e 4acd 
 0020 ef53 0001 0001  8a9e 4acd 4e00 00ed   0001   
 000b  0100  0038  0002  0003  a037 8e0c d6b3 de11 abb8
 0635 bff9 2b36            
               
               
  003f             
  a037 8f0c d6b3 de11 abb8 0635 bff9 2b36 0001     
 8a9e 4acd             
               
             001c 001c 0001
          [  175.215929] Closing the
 device.
 mount: mounting /dev/ftl on /mntpt/ failed: Invalid argument

 I tried printing the data in hex format just to make sure proper ext2 magic
 code in present in the superblock read from the flash device.  ef53 is the
 magic code of ext2 superblock, ftl device is correctly reading the magic
 code

 # cat out
 execve(/bin/mount, [mount, -t, ext2, /dev/ftl, /mntpt/], [/* 4
 vars */]) = 0
 uname({sys=Linux, node=(none), ...}) = 0
 brk(0)  = 0x72f000
 brk(0x72ff40)   = 0x72ff40
 arch_prctl(ARCH_SET_FS, 0x72f880)   = 0
 open(/dev/urandom, O_RDONLY)  = -1 ENOENT (No such file or
 directory)
 brk(0x750f40)   = 0x750f40
 brk(0x751000)   = 0x751000
 getuid()    = 0
 getuid()    = 0
 geteuid()   = 0
 stat(/dev/ftl, {st_mode=S_IFBLK|0644, st_rdev=makedev(254, 0), ...}) = 0
 mount(/dev/ftl, /mntpt/, ext2, MS_SILENT, ) = -1 EINVAL (Invalid
 argument)
 vfork() = 869
 --- SIGCHLD (Child exited) @ 0 (0) ---
 write(2, mount: mounting /dev/ftl on /mntp..., 61) = 61
 exit_group(-1)  = ?

 What could be the reason of failure of mount?

 Thanks and Regards,
 Prasad





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: C question

2009-10-07 Thread Manish Katiyar
On Thu, Oct 8, 2009 at 7:42 AM, Rick Brown rick.brow...@gmail.com wrote:
 Hello list,

 As far as I recall from KR, 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:

But in the program, you aren't actually trying to dereference the
value. Just adding means it becomes normal arithmetic and that is why
you get result as 1. You will see the error if you try to dereference
it.

/tmp gcc a.c
a.c: In function ‘main’:
a.c:5: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘void *’
a.c:6: warning: dereferencing ‘void *’ pointer
a.c:6: error: invalid use of void expression
/tmp cat a.c
#include stdio.h
int main()
{
   void *ptr = 0;
   printf(%d \n, ptr+1);
   printf(%d \n, *(ptr+1));
}



 [r...@linux rick]$ cat t.c
 #include stdio.h
 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





-- 
Thanks -
Manish
==
[$\*.^ -- I miss being one of them
==

--
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: Per cpu data

2009-10-04 Thread Manish Katiyar
On Fri, Aug 28, 2009 at 1:17 PM, Pharaoh . pharaoh...@gmail.com wrote:


 On Thu, Aug 27, 2009 at 12:02 PM, Pharaoh . pharaoh...@gmail.com wrote:


 On Thu, Aug 27, 2009 at 12:34 AM, Mulyadi Santosa
 mulyadi.sant...@gmail.com wrote:

 On Wed, Aug 26, 2009 at 11:06 PM, Pharaoh .pharaoh...@gmail.com wrote:
 
 
  Hi list,
 
  1. A cpu can access its own per cpu data atomically but if it has to
  access
  other cpus per cpu data
  it might not be atomically accessed. Is this correct?

 IMO, assuming your per CPU data is something simple like word length
 (4 byte in x86 32 bit), then yes local access to per CPU data is
 atomic. But it can not be atomic if it's accessing complex data
 structure.

 And IIRC, per CPU API are written to store and retrieve simple type of
 data.

 If you're accessing other CPU data, I guess it still might done
 atomically by doing lock (e.g spinlock). But yes, without lock, you
 have to careful about race condition

 If my driver makes
  sure that no cpu accesses
  other cpu's per cpu data my code can be entirely lockless? Correct?

 IMO yes. Just make sure you use provided per CPU API. IIRC, when
 you're accessing per CPU data using the APIs, it will also disable
 preemption..thus preventing your code to be migrated to other
 core/CPU.

  2. Can I have a rather complex data structure like a radix tree as a
  per cpu
  data structure?

 Ehm, I don't think so. Well, theoritically you can but IIRC the kernel
 doesn't provide such API to store and retrieve such data structure by
 default.

  3. Is it guaranteed that all the accesses happening to this tree from a
  cpu
  which allocated it are atomic?
  I think they are atomic since the per cpu data access functions disable
  preemption.
 
 
  My main objective is to have a radix tree which will be accessed on
  multiple
  cores, I want to avoid the
  locking overhead of keeping a central lock for accessing this tree. I
  have
  just started investigating the
  possibilities.

Hi,

I was reading about lockless pagecache and seems it tries to do what
you want. You can have a look at its code. See the link
ftp://ftp.kernel.org/pub/linux/kernel/people/npiggin/patches/lockless/2.6.16-rc5/radix-intro.pdf
. Also search google for lockless pagecache protocol


Thanks -
Manish


 
 
  -pharaoh.
 




 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer
 blog: the-hydra.blogspot.com


 More generically put, how is a highly concurrent data structure designed
 in kernel space?

 If I keep a central lock for accessing the radix tree, wont it cause too
 much latency?
 I am sure there must be some other way which I am not aware of. Using
 read/write locks
 might be better idea so that atleast reads can happen concurrently.

 E.g. userspace concurrent programs have a concept of thread local storage,
 so each thread acccesses
 its own copy.

 If Linux is able to run on hundreds of cores, I am sure there must be a
 way to an optimal way to access
 these concurrent data structures.


 -pharaoh.


 How about RCU mechanism?

 I think using this I can design an efficient concurrently accessible rb
 tree.
 Any thoughts?

 -phraoh.




-- 
Thanks -
Manish

--
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: Search module in linux

2009-10-03 Thread Manish Katiyar
On Sat, Oct 3, 2009 at 8:29 PM, Deepak Mishra dpux4li...@gmail.com wrote:
 Hello everyone,
                          I am very new to this list and kernel programming.
 Maybe this is too early, but I am actually interested in knowing the file
 search module (inherently the source code for find program) in linux

Hi Deepak,

find is a userspace program and there is no kernel component in it.

 filesystem. I believe there would be seperate search module for every
 filesytem.

The only filesystem specific code which find needs to call is how to
traverse directories, and how to get the file names given that each
filesystem will have its own layout. However this is abstracted using
the syscall readdir(). so you don't need to worry about the underlying
layout of the filesystem. You can look at ext2_readdir() for example .

 I feel looking at the codes may help me appreciate the
 filesystems better. I searched the kernel tree and even googled for such
 code, but I feel I am yet not proficient enough to get anything. Hope you
 guys can help me out.

You can try to write your own find program in userspace. See the
usage of following syscalls.
readdir(), opendir()

Best of luck.

Thanks -
Manish


 Thanks in anticipation,
 Deepak Mishra



-- 
Thanks -
Manish

--
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: How to build DocBook in Linux kernel?

2009-09-30 Thread Manish Katiyar
On Wed, Sep 30, 2009 at 4:13 PM, NAHieu nah...@gmail.com wrote:
 Hi,

 There are a lot of DocBook files under Documentation/DocBook/. I tried
 to build them with make xmldocs, but that only produces .xml file,
 which cannot be viewed in Firefox.

make pdfdocs 


 So how to view those resulted .xml file, or if I want to buid those
 DocBook to .pdf files, what should I do?

 Thanks,
 Hieu

 --
 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





-- 
Thanks -
Manish

--
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: ext4 extents: How to determine if an extent points to a hole.

2009-09-14 Thread Manish Katiyar
On Mon, Sep 14, 2009 at 11:59 AM, SandeepKsinha sandeepksi...@gmail.com wrote:
 Hi Greg,

 Thanks a lot for such nice explanation. But I still have the same
 query lingering...


 On Mon, Sep 14, 2009 at 9:36 AM, Greg Freemyer greg.freem...@gmail.com 
 wrote:
 On Sun, Sep 13, 2009 at 1:49 PM, SandeepKsinha sandeepksi...@gmail.com 
 wrote:
 On Sun, Sep 13, 2009 at 11:08 PM, Manish Katiyar mkati...@gmail.com wrote:
 On Sun, Sep 13, 2009 at 10:12 PM, SandeepKsinha sandeepksi...@gmail.com 
 wrote:
 Hi,


 On Sun, Sep 13, 2009 at 10:07 PM, Manish Katiyar mkati...@gmail.com 
 wrote:
 On Sun, Sep 13, 2009 at 5:44 PM, SandeepKsinha sandeepksi...@gmail.com 
 wrote:
 Hi all,

 Looking at the flags in the extent info,  Is there any specifc flags
 which indicates an extent to be a HOLE??

 I am not sure if I understand the question correctly .. why would
 you need that ? Can you give an example where it should be used ??


 Look at e4defrag.c,
 it checks the file size and allocates the same number of blocks for
 donor inode. Which will eventually make a holey file into a normal
 one.
 Any tool/application should make sure that they leave a sparse file as 
 sparse.

 I think, as suggested by Greg Freemyer, we can use BMAP ioctl to get
 such information.

 Yes, but I think bmap would be costly if the file is large and is not
 holey :-(  but that would be probably same calling fiemap if the
 file is completely fragmented such that each extent size is 1.


 Since, ext2/ext3 did not have mutli block allocation thats why this is
 the  only way that we might have.
 But generally most of the new features work on with extent based files on 
 ext4.

 I am still wondering that how to we represent a hole using extents in
 a extent based file.
 Just like we had a convention of having the block number 0 in case of holes.

 Similarly, what do we look at to figure out if its a hole or not. BMAP
 is one way. But since, in a extent based file, we have only extents,
 there should be some flag to indicate the same.

 Sandeep,

 If you look at e4defrag, it first gets a list of all the extents.  I'm
 pretty sure extents only exist for allocated extents.  Holes do not
 have any associated extents.

I did a extent dump of a holey file.

Inode: 12   Type: regularMode:  0644   Flags: 0x8
Generation: 4284390079Version: 0x0001
User:  5572   Group:  5573   Size: 20877312000
File ACL: 0Directory ACL: 0
Links: 1   Blockcount: 16000
Fragment:  Address: 0Number: 0Size: 0
ctime: 0x4aae0975 -- Mon Sep 14 14:44:29 2009
atime: 0x4aad34e9 -- Sun Sep 13 23:37:37 2009
mtime: 0x4aae0975 -- Mon Sep 14 14:44:29 2009
EXTENTS:
(0-3999): 10241-14240, (20384000-20387999): 14337-18336

Level Entries LogicalPhysical Length Flags
 0/ 0   1/  20 - 3999  10241 -  14240   4000
 0/ 0   2/  2 20384000 - 20387999  14337 -  18336   4000

I am looking at the source, but as you can see it is not printing the
extents for the hole part.




 This is what my actual question is, think of this situation...

 |-|-|-|--|
 0              500          700            1200               3000
 [Logical block numbers for an inode]


 In this situation you will have four extents for sure.
 ext_1 - 0 -- 500
 ext_2 - 501 --700 [ This will be an initialized extent]
 ext_3 - 701 -- 1200
 ext_4 - 1200 -- 3000

 After looking at the sources and some comments in the ext4 source
 code, I could figure out that holes would be having an initialized
 extent.
 Reference: http://lxr.linux.no/#linux+v2.6.31/fs/ext4/extents.c#L2843

 I think we cannot have a mixture of both a BMAP and an EMAP, it will be 
 either.

 Then it calls merge_extents to create extent groups.  In e4defrag
 terminology, an extent group is a collection of all the logically
 contiguous extents.  I don't know if the kernel uses that terminology
 or not.


 Hope they are not merging together any initialized and uninitialized
 extents together, since they can be logically contiguous. Or rather
 they will be.


 In other words in e4defrag terminology a sparse file is a series of:

 extent group - hole - extent group - hole - extent group - etc.

 Then e4defrag creates a donor file with exactly the same allocated
 block areas by calling fallocate on the donor file for each extent
 group with the same starting offset and length as the extent group.


 This is true and should be applicable to initialized extents as well.
 I fear if they are


 Thus the donor file ends up have exactly the same holes as the
 original file.  Then the donor blocks are used to defrag the original
 file by calling move_extent.  In the kernel, the move_extent logic
 looks for holes and only replaces blocks that are allocated in the
 original file.


 This is true. I am sure of the kernel logic.

 Greg




 --
 Regards,
 Sandeep.






 “To learn is to change. Education is a process that changes the learner.”




-- 
Thanks -
Manish

Re: ext4 extents: How to determine if an extent points to a hole.

2009-09-14 Thread Manish Katiyar
On Mon, Sep 14, 2009 at 3:09 PM, SandeepKsinha sandeepksi...@gmail.com wrote:
 Hi Manish,

 On Mon, Sep 14, 2009 at 2:57 PM, Manish Katiyar mkati...@gmail.com wrote:
 On Mon, Sep 14, 2009 at 11:59 AM, SandeepKsinha sandeepksi...@gmail.com 
 wrote:
 Hi Greg,

 Thanks a lot for such nice explanation. But I still have the same
 query lingering...


 On Mon, Sep 14, 2009 at 9:36 AM, Greg Freemyer greg.freem...@gmail.com 
 wrote:
 On Sun, Sep 13, 2009 at 1:49 PM, SandeepKsinha sandeepksi...@gmail.com 
 wrote:
 On Sun, Sep 13, 2009 at 11:08 PM, Manish Katiyar mkati...@gmail.com 
 wrote:
 On Sun, Sep 13, 2009 at 10:12 PM, SandeepKsinha 
 sandeepksi...@gmail.com wrote:
 Hi,


 On Sun, Sep 13, 2009 at 10:07 PM, Manish Katiyar mkati...@gmail.com 
 wrote:
 On Sun, Sep 13, 2009 at 5:44 PM, SandeepKsinha 
 sandeepksi...@gmail.com wrote:
 Hi all,

 Looking at the flags in the extent info,  Is there any specifc flags
 which indicates an extent to be a HOLE??

 I am not sure if I understand the question correctly .. why would
 you need that ? Can you give an example where it should be used ??


 Look at e4defrag.c,
 it checks the file size and allocates the same number of blocks for
 donor inode. Which will eventually make a holey file into a normal
 one.
 Any tool/application should make sure that they leave a sparse file as 
 sparse.

 I think, as suggested by Greg Freemyer, we can use BMAP ioctl to get
 such information.

 Yes, but I think bmap would be costly if the file is large and is not
 holey :-(  but that would be probably same calling fiemap if the
 file is completely fragmented such that each extent size is 1.


 Since, ext2/ext3 did not have mutli block allocation thats why this is
 the  only way that we might have.
 But generally most of the new features work on with extent based files on 
 ext4.

 I am still wondering that how to we represent a hole using extents in
 a extent based file.
 Just like we had a convention of having the block number 0 in case of 
 holes.

 Similarly, what do we look at to figure out if its a hole or not. BMAP
 is one way. But since, in a extent based file, we have only extents,
 there should be some flag to indicate the same.

 Sandeep,

 If you look at e4defrag, it first gets a list of all the extents.  I'm
 pretty sure extents only exist for allocated extents.  Holes do not
 have any associated extents.

 I did a extent dump of a holey file.

 Inode: 12   Type: regular    Mode:  0644   Flags: 0x8
 Generation: 4284390079    Version: 0x0001
 User:  5572   Group:  5573   Size: 20877312000
 File ACL: 0    Directory ACL: 0
 Links: 1   Blockcount: 16000
 Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x4aae0975 -- Mon Sep 14 14:44:29 2009
 atime: 0x4aad34e9 -- Sun Sep 13 23:37:37 2009
 mtime: 0x4aae0975 -- Mon Sep 14 14:44:29 2009
 EXTENTS:
 (0-3999): 10241-14240, (20384000-20387999): 14337-18336

 Level Entries             Logical        Physical Length Flags
  0/ 0   1/  2        0 -     3999  10241 -  14240   4000
  0/ 0   2/  2 20384000 - 20387999  14337 -  18336   4000

 I am looking at the source, but as you can see it is not printing the
 extents for the hole part.


 I suspect the debugfs code masking that out for the output.

yes... and that is the flag/method that we are looking for ... isn't it :-) ???

 If you remember, for a normal block based file also, it does something
 similar, it does not prints the values for holes.

 It can be a case here as well.



 This is what my actual question is, think of this situation...

 |-|-|-|--|
 0              500          700            1200               3000
 [Logical block numbers for an inode]


 In this situation you will have four extents for sure.
 ext_1 - 0 -- 500
 ext_2 - 501 --700 [ This will be an initialized extent]
 ext_3 - 701 -- 1200
 ext_4 - 1200 -- 3000

 After looking at the sources and some comments in the ext4 source
 code, I could figure out that holes would be having an initialized
 extent.
 Reference: http://lxr.linux.no/#linux+v2.6.31/fs/ext4/extents.c#L2843

 I think we cannot have a mixture of both a BMAP and an EMAP, it will be 
 either.

 Then it calls merge_extents to create extent groups.  In e4defrag
 terminology, an extent group is a collection of all the logically
 contiguous extents.  I don't know if the kernel uses that terminology
 or not.


 Hope they are not merging together any initialized and uninitialized
 extents together, since they can be logically contiguous. Or rather
 they will be.


 In other words in e4defrag terminology a sparse file is a series of:

 extent group - hole - extent group - hole - extent group - etc.

 Then e4defrag creates a donor file with exactly the same allocated
 block areas by calling fallocate on the donor file for each extent
 group with the same starting offset and length as the extent group.


 This is true and should be applicable to initialized extents as well.
 I fear

Re: ext4 extents: How to determine if an extent points to a hole.

2009-09-13 Thread Manish Katiyar
On Sun, Sep 13, 2009 at 5:44 PM, SandeepKsinha sandeepksi...@gmail.com wrote:
 Hi all,

 Looking at the flags in the extent info,  Is there any specifc flags
 which indicates an extent to be a HOLE??

I am not sure if I understand the question correctly .. why would
you need that ? Can you give an example where it should be used ??


 I could only find the following ones...

  39#define FIEMAP_MAX_OFFSET       (~0ULL)
  40
  41#define FIEMAP_FLAG_SYNC        0x0001 /* sync file data before map */
  42#define FIEMAP_FLAG_XATTR       0x0002 /* map extended attribute tree 
 */
  43
  44#define FIEMAP_FLAGS_COMPAT     (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
  45
  46#define FIEMAP_EXTENT_LAST              0x0001 /* Last extent
 in file. */
  47#define FIEMAP_EXTENT_UNKNOWN           0x0002 /* Data
 location unknown. */
  48#define FIEMAP_EXTENT_DELALLOC          0x0004 /* Location
 still pending.
  49                                                    * Sets
 EXTENT_UNKNOWN. */
  50#define FIEMAP_EXTENT_ENCODED           0x0008 /* Data can not be read
  51                                                    * while fs is
 unmounted */
  52#define FIEMAP_EXTENT_DATA_ENCRYPTED    0x0080 /* Data is
 encrypted by fs.
  53                                                    * Sets
 EXTENT_NO_BYPASS. */
  54#define FIEMAP_EXTENT_NOT_ALIGNED       0x0100 /* Extent
 offsets may not be
  55                                                    * block aligned. */
  56#define FIEMAP_EXTENT_DATA_INLINE       0x0200 /* Data mixed
 with metadata.
  57                                                    * Sets
 EXTENT_NOT_ALIGNED.*/
  58#define FIEMAP_EXTENT_DATA_TAIL         0x0400 /* Multiple
 files in block.
  59                                                    * Sets
 EXTENT_NOT_ALIGNED.*/
  60#define FIEMAP_EXTENT_UNWRITTEN         0x0800 /* Space allocated, but
  61                                                    * no data
 (i.e. zero). */
  62#define FIEMAP_EXTENT_MERGED            0x1000 /* File does not 
 natively
  63                                                    * support
 extents. Result
  64                                                    * merged for
 efficiency. */


 --
 Regards,
 Sandeep.






 “To learn is to change. Education is a process that changes the learner.”

 --
 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





-- 
Thanks -
Manish

--
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: e4defrag: file extent map : redundant loop???

2009-09-13 Thread Manish Katiyar
On Sun, Sep 13, 2009 at 5:26 PM, SandeepKsinha sandeepksi...@gmail.com wrote:
 Hi all,

 Here is a code snippet from e4defrag.c, can be located @
 http://git.kernel.org/?p=fs/ext2/e2fsprogs.git;a=blob_plain;f=misc/e4defrag.c;hb=next


 /*
  * get_file_extents() - Get file's extent list.
  *
  * @fd:                 defrag target file's descriptor.
  * @ext_list_head:      the head of the extent list.
  */
 static int get_file_extents(int fd, struct fiemap_extent_list **ext_list_head)
 {
        __u32   i;
        int     ret;
        int     ext_buf_size, fie_buf_size;
        __u64   pos = 0;
        struct fiemap   *fiemap_buf = NULL;
        struct fiemap_extent    *ext_buf = NULL;
        struct fiemap_extent_list       *ext_list = NULL;

        /* Convert units, in bytes.
         * Be careful : now, physical block number in extent is 48bit,
         * and the maximum blocksize for ext4 is 4K(12bit),
         * so there is no overflow, but in future it may be changed.
         */

        /* Alloc space for fiemap */
        ext_buf_size = EXTENT_MAX_COUNT * sizeof(struct fiemap_extent);
        fie_buf_size = sizeof(struct fiemap) + ext_buf_size;

        fiemap_buf = malloc(fie_buf_size);
        if (fiemap_buf == NULL)
                return -1;

        ext_buf = fiemap_buf-fm_extents;
        memset(fiemap_buf, 0, fie_buf_size);
        fiemap_buf-fm_length = FIEMAP_MAX_OFFSET;
        fiemap_buf-fm_flags |= FIEMAP_FLAG_SYNC;
        fiemap_buf-fm_extent_count = EXTENT_MAX_COUNT;

        do {
                fiemap_buf-fm_start = pos;
                memset(ext_buf, 0, ext_buf_size);
                ret = ioctl(fd, FS_IOC_FIEMAP, fiemap_buf);
                if (ret  0)
                        goto out;
                for (i = 0; i  fiemap_buf-fm_mapped_extents; i++) {
                        ext_list = NULL;
                        ext_list = malloc(sizeof(struct fiemap_extent_list));
                        if (ext_list == NULL)
                                goto out;

                        ext_list-data.physical = ext_buf[i].fe_physical
                                                / block_size;
                        ext_list-data.logical = ext_buf[i].fe_logical
                                                / block_size;
                        ext_list-data.len = ext_buf[i].fe_length
                                                / block_size;

                        ret = insert_extent_by_physical(
                                        ext_list_head, ext_list);
                        if (ret  0) {
                                FREE(ext_list);
                                goto out;
                        }
                }
                /* Record file's logical offset this time */
                pos = ext_buf[EXTENT_MAX_COUNT-1].fe_logical +
                        ext_buf[EXTENT_MAX_COUNT-1].fe_length;
                /*
                 * If fm_extents array has been filled and
                 * there are extents left, continue to cycle.
                 */
        } while (fiemap_buf-fm_mapped_extents
                                        == EXTENT_MAX_COUNT 
                !(ext_buf[EXTENT_MAX_COUNT-1].fe_flags
                                         FIEMAP_EXTENT_LAST));

        FREE(fiemap_buf);
        return 0;
 out:
        FREE(fiemap_buf);
        return -1;
 }

 Why do we have a while loop here, we have already made sure that we
 are initially itself allocating memory for EXTENT_MAX_COUNT?
 This is the maximum number of extents supported by the file system.
Sandeep,

EXTENT_MAX_COUNT doesn't look to be the max extents supported by the
filesystem. It is the max chunk supported by e4defrag. Max supported
is FIEMAP_MAX_EXTENTS which is much larger.
 Is
 this loop not redundant ?

No, the loop just tries to get more extents as long as you haven't hit
the last one.





 --
 Regards,
 Sandeep.






 “To learn is to change. Education is a process that changes the learner.”

 --
 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





-- 
Thanks -
Manish

--
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: ext4 extents: How to determine if an extent points to a hole.

2009-09-13 Thread Manish Katiyar
On Sun, Sep 13, 2009 at 10:12 PM, SandeepKsinha sandeepksi...@gmail.com wrote:
 Hi,


 On Sun, Sep 13, 2009 at 10:07 PM, Manish Katiyar mkati...@gmail.com wrote:
 On Sun, Sep 13, 2009 at 5:44 PM, SandeepKsinha sandeepksi...@gmail.com 
 wrote:
 Hi all,

 Looking at the flags in the extent info,  Is there any specifc flags
 which indicates an extent to be a HOLE??

 I am not sure if I understand the question correctly .. why would
 you need that ? Can you give an example where it should be used ??


 Look at e4defrag.c,
 it checks the file size and allocates the same number of blocks for
 donor inode. Which will eventually make a holey file into a normal
 one.
 Any tool/application should make sure that they leave a sparse file as sparse.

 I think, as suggested by Greg Freemyer, we can use BMAP ioctl to get
 such information.

Yes, but I think bmap would be costly if the file is large and is not
holey :-(  but that would be probably same calling fiemap if the
file is completely fragmented such that each extent size is 1.





 I could only find the following ones...

  39#define FIEMAP_MAX_OFFSET       (~0ULL)
  40
  41#define FIEMAP_FLAG_SYNC        0x0001 /* sync file data before map 
 */
  42#define FIEMAP_FLAG_XATTR       0x0002 /* map extended attribute 
 tree */
  43
  44#define FIEMAP_FLAGS_COMPAT     (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
  45
  46#define FIEMAP_EXTENT_LAST              0x0001 /* Last extent
 in file. */
  47#define FIEMAP_EXTENT_UNKNOWN           0x0002 /* Data
 location unknown. */
  48#define FIEMAP_EXTENT_DELALLOC          0x0004 /* Location
 still pending.
  49                                                    * Sets
 EXTENT_UNKNOWN. */
  50#define FIEMAP_EXTENT_ENCODED           0x0008 /* Data can not be 
 read
  51                                                    * while fs is
 unmounted */
  52#define FIEMAP_EXTENT_DATA_ENCRYPTED    0x0080 /* Data is
 encrypted by fs.
  53                                                    * Sets
 EXTENT_NO_BYPASS. */
  54#define FIEMAP_EXTENT_NOT_ALIGNED       0x0100 /* Extent
 offsets may not be
  55                                                    * block aligned. */
  56#define FIEMAP_EXTENT_DATA_INLINE       0x0200 /* Data mixed
 with metadata.
  57                                                    * Sets
 EXTENT_NOT_ALIGNED.*/
  58#define FIEMAP_EXTENT_DATA_TAIL         0x0400 /* Multiple
 files in block.
  59                                                    * Sets
 EXTENT_NOT_ALIGNED.*/
  60#define FIEMAP_EXTENT_UNWRITTEN         0x0800 /* Space allocated, 
 but
  61                                                    * no data
 (i.e. zero). */
  62#define FIEMAP_EXTENT_MERGED            0x1000 /* File does not 
 natively
  63                                                    * support
 extents. Result
  64                                                    * merged for
 efficiency. */


 --
 Regards,
 Sandeep.






 “To learn is to change. Education is a process that changes the learner.”

 --
 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





 --
 Thanks -
 Manish




 --
 Regards,
 Sandeep.






 “To learn is to change. Education is a process that changes the learner.”




-- 
Thanks -
Manish

--
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: decoding kernel oops

2009-09-04 Thread Manish Katiyar
On Thu, Sep 3, 2009 at 6:45 AM, Mulyadi
Santosamulyadi.sant...@gmail.com wrote:
 On Wed, Sep 2, 2009 at 6:08 PM, Manish Katiyarmkati...@gmail.com wrote:
 Hi,

 I was going through this post
 http://kerneltrap.org/mailarchive/linux-kernel/2008/1/8/546623 and
 couldn't understand the steps around the below paragraph.

 
 and run it under gdb, and then when it gets the SIGSEGV (due to the
 obvious NULL pointer dereference), I can just ask gdb to disassemble
 around the array that contains the code[] stuff. Try a few offsets, to see
 when the disassembly makes sense (and gives the reported EIP as the
 beginning of one of the disassembled instructions).
 
 Has anyone tried this ?? I don't see any useful disas instructions
 when I do so ... Need help in interpreting the procedures of the above
 pos

 Hi Manish...

 I am not so clear either, but perhaps by exchanging each of our
 knowledge, we can teach each other. Specificly, which part that
 confuses you? The disas part? That's what the x/20i does toward the
 start address of array array. It turns that sequence of hex numbers
 into instructions.

 I think the real art here is spotting the offending instruction. I
 think Linus find it out actually by lookin that there is prefetch
 instruction in array+49. And since it's prefetching at the address
 stored in %eax, so the last instruction that modifies its content is
 surely the root of the problem.

 In the other cases, decoding might be not that easy. So IMO that's why
 stack trace provides code context. It's not just the offending
 instruction which is dumped, but ones sorrounding it.

thanks a lot.. now if I go back and read the post again, it is much
more clear. BTW probably a stupid question, why does the op code in
char string generates back the assembly ??



 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer
 blog: the-hydra.blogspot.com




-- 
Thanks -
Manish

--
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



decoding kernel oops

2009-09-02 Thread Manish Katiyar
Hi,

I was going through this post
http://kerneltrap.org/mailarchive/linux-kernel/2008/1/8/546623 and
couldn't understand the steps around the below paragraph.


and run it under gdb, and then when it gets the SIGSEGV (due to the
obvious NULL pointer dereference), I can just ask gdb to disassemble
around the array that contains the code[] stuff. Try a few offsets, to see
when the disassembly makes sense (and gives the reported EIP as the
beginning of one of the disassembled instructions).

Has anyone tried this ?? I don't see any useful disas instructions
when I do so ... Need help in interpreting the procedures of the above
post.

-- 
Thanks -
Manish

--
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: ext3 structure mapping to block device

2009-08-17 Thread Manish Katiyar
On Mon, Aug 17, 2009 at 11:06 AM, ajit motemail2black...@gmail.com wrote:

 Hello,

 I would like to know how file system structures are mapped to hard disk
 sector.

Each filesystem deals in the granularity of block size which is
generally configurable (typically 4K) during fs creation time. So each
block maps to 8 sectors (which are generally 512 bytes). Now given a
block number you can multiply it by 8 to get your hard disk sector.

 My goal is to understand how file system is created on block device
 and how superblocks are mapped to hard disk sectors.

Filesystem is created using a userspace binary (mke2fs for example in
case of ext2). Appropriate datastructures are written at appropiate
places during the FS creation time. See the sources of mkfs.c in
e2fsprogs.

Superblock will have a predefined block number where it resides. From
the above calculation you can know which sector to read.


 I am not sure whether I stated the problem precisely or not but if I did not
 described it properly then let me know.

I am not sure if that answers your question correctly  :-) . If not
please let me know.

Thanks -
Manish


 This is just an understanding sort of issue which I am looking for teaching
 purpose.

 Note:
   Please free to change the subject line if not proper.

 --
 Thanks  Regards,
 Ajit Subhash Mote





-- 
Thanks -
Manish

--
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: some question about open fail on /dev/sda nodes

2009-08-16 Thread Manish Katiyar
On Sun, Aug 16, 2009 at 3:09 PM, loodymilo...@gmail.com wrote:
 Dear all:
 I try to open /dev/sda1 with system call, open(/dev/sda1, O_RDONLY).
 But each time it will return negative value, that means fail.

Have you checked for the errno ? I guess it is permission denied.


/home/mkatiyar dd if=/dev/sda1 of=/dev/zero
dd: opening `/dev/sda1': Permission denied

Thanks -
Manish

 my program is like below:
 (gdb) list
 1       #includestdio.h
 2       #includefcntl.h
 3       int main(void)
 4       {
 5       int fd=0;
 6        fd = open(/dev/sda1, O_RDONLY);
 7
 8        printf(%d\n,fd);
 9       }
 10
 (gdb) b 8
 Breakpoint 1 at 0x8048423: file test.c, line 8.
 (gdb) r
 Starting program: /home/cc/a.out

 Breakpoint 1, main () at test.c:8
 8        printf(%d\n,fd);
 (gdb) p fd
 $1 = -1
 (gdb)


 But I am quite sure I really get /dev/sda1 on my linux system.
 below are the dmesg:
 $ dmesg |grep sda
 [    4.304624] sd 0:0:0:0: [sda] 117210240 512-byte hardware sectors (60012 
 MB)
 [    4.304642] sd 0:0:0:0: [sda] Write Protect is off
 [    4.304646] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
 [    4.304672] sd 0:0:0:0: [sda] Write cache: enabled, read cache:
 enabled, doesn't support DPO or FUA
 [    4.304742] sd 0:0:0:0: [sda] 117210240 512-byte hardware sectors (60012 
 MB)
 [    4.304757] sd 0:0:0:0: [sda] Write Protect is off
 [    4.304760] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
 [    4.304786] sd 0:0:0:0: [sda] Write cache: enabled, read cache:
 enabled, doesn't support DPO or FUA
 [    4.304790]  sda:4Driver 'sr' needs updating - please use bus_type 
 methods
 [    4.319499]  sda1 sda2 sda3  sda56usb 4-2: configuration #1
 chosen from 1 choice
 [    4.359729]  sda6  sda4
 [    4.359951] sd 0:0:0:0: [sda] Attached SCSI disk
 [   22.637589] EXT3 FS on sda4, internal journal
 [   23.586600] EXT3 FS on sda6, internal journal
 $
 Does that mean I use the wrong systemcall or we cannot open /dev/sda1 like 
 this?
 appreciate your help,
 miloody

 --
 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





-- 
Thanks -
Manish

--
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: Question about lock ordering.

2009-08-12 Thread Manish Katiyar
On Wed, Aug 12, 2009 at 11:15 AM, shailesh
jaincoolworldofsh...@gmail.com wrote:
 I haven't looked the code but ...
 You can unlock in any order, right ?  because whatever happens you will
 always be able to unlock and it the locks are acquired in the same order
 throughout  the system, then your system is guaranteed to make forward
 progress.

Hmmm ok ... same order throughout is the key.

Thanks -
Manish


 As an exercise try coming up with an example that leads to you deadlock when
 you unlock in incorrect order.


 Shailesh Jain


 On Wed, Aug 12, 2009 at 12:32 AM, Manish Katiyar mkati...@gmail.com wrote:

 Hi,

 I was going through this code below and was confused why do we need
 lock ordering here. What is the problem that it is trying to prevent
 given that the corresponding unlocking doesn't care for the order. I
 assume lock orders are primarily needed to avoid deadlocks, and if
 they are then they need to be unlocked in the same order too.

 File : fs/ext4/move_extent.c

 /**
  * mext_double_down_write - Acquire two inodes' write semaphore
  *
  * @orig_inode:         original inode structure
  * @donor_inode:        donor inode structure
  * Acquire write semaphore of the two inodes (orig and donor) by i_ino
 order.
  */
 static void
 mext_double_down_write(struct inode *orig_inode, struct inode
 *donor_inode)
 {
        struct inode *first = orig_inode, *second = donor_inode;

        BUG_ON(orig_inode == NULL || donor_inode == NULL);

        /*
         * Use the inode number to provide the stable locking order instead
         * of its address, because the C language doesn't guarantee you can
         * compare pointers that don't come from the same array.
         */
        if (donor_inode-i_ino  orig_inode-i_ino) {
                first = donor_inode;
                second = orig_inode;
        }

        down_write(EXT4_I(first)-i_data_sem);
        down_write(EXT4_I(second)-i_data_sem);
 }

 /**
  * mext_double_up_read - Release two inodes' read semaphore
  *
  * @orig_inode:         original inode structure to be released its lock
 first
  * @donor_inode:        donor inode structure to be released its lock
 second
  * Release read semaphore of two inodes (orig and donor).
  */
 static void
 mext_double_up_read(struct inode *orig_inode, struct inode *donor_inode)
 {
        BUG_ON(orig_inode == NULL || donor_inode == NULL);

        up_read(EXT4_I(orig_inode)-i_data_sem);
        up_read(EXT4_I(donor_inode)-i_data_sem);
 }


 --
 Thanks -
 Manish

 --
 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






-- 
Thanks -
Manish

--
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



Question about lock ordering.

2009-08-11 Thread Manish Katiyar
Hi,

I was going through this code below and was confused why do we need
lock ordering here. What is the problem that it is trying to prevent
given that the corresponding unlocking doesn't care for the order. I
assume lock orders are primarily needed to avoid deadlocks, and if
they are then they need to be unlocked in the same order too.

File : fs/ext4/move_extent.c

/**
 * mext_double_down_write - Acquire two inodes' write semaphore
 *
 * @orig_inode: original inode structure
 * @donor_inode:donor inode structure
 * Acquire write semaphore of the two inodes (orig and donor) by i_ino order.
 */
static void
mext_double_down_write(struct inode *orig_inode, struct inode *donor_inode)
{
struct inode *first = orig_inode, *second = donor_inode;

BUG_ON(orig_inode == NULL || donor_inode == NULL);

/*
 * Use the inode number to provide the stable locking order instead
 * of its address, because the C language doesn't guarantee you can
 * compare pointers that don't come from the same array.
 */
if (donor_inode-i_ino  orig_inode-i_ino) {
first = donor_inode;
second = orig_inode;
}

down_write(EXT4_I(first)-i_data_sem);
down_write(EXT4_I(second)-i_data_sem);
}

/**
 * mext_double_up_read - Release two inodes' read semaphore
 *
 * @orig_inode: original inode structure to be released its lock first
 * @donor_inode:donor inode structure to be released its lock second
 * Release read semaphore of two inodes (orig and donor).
 */
static void
mext_double_up_read(struct inode *orig_inode, struct inode *donor_inode)
{
BUG_ON(orig_inode == NULL || donor_inode == NULL);

up_read(EXT4_I(orig_inode)-i_data_sem);
up_read(EXT4_I(donor_inode)-i_data_sem);
}


-- 
Thanks -
Manish

--
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



Avoid uml opening virtual consoles

2009-08-07 Thread Manish Katiyar
[ I didn't get any response from UML mailing list, trying my luck here ]


-- Forwarded message --
From: Manish Katiyar mkati...@gmail.com
Date: Thu, Aug 6, 2009 at 9:07 PM
Subject: Avoid uml opening virtual consoles
To: user-mode-linux-user user-mode-linux-u...@lists.sourceforge.net


Hi,

I have downloaded fedora-10 uml images from
http://uml.nagafix.co.uk/filesystems/ . After booting it up it opens
up 6 virtual consoles for me. What I would like to have is just one
terminal and that also in the same terminal from where I am invoking
the UML kernel. (I used to get that with a different OS image that I
had downloaded from UML homepage). What settings change or parameters
I can pass to make this happen.

My current UML inittab looks like below.

==
/home/mkatiyar/personal/uml/mount/etc cat inittab|grep -v ^#

id:3:initdefault:

si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

ca::ctrlaltdel:/sbin/shutdown -t3 -r now

pf::powerfail:/sbin/shutdown -f -h +2 Power Failure; System Shutting Down

pr:12345:powerokwait:/sbin/shutdown -c Power Restored; Shutdown Cancelled



x:5:once:/etc/X11/prefdm -nodaemon
c0:1235:respawn:/sbin/mingetty tty0

=
--
Thanks -
Manish



-- 
Thanks -
Manish

--
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: Avoid uml opening virtual consoles

2009-08-07 Thread Manish Katiyar
On Sat, Aug 8, 2009 at 5:03 AM, Mulyadi
Santosamulyadi.sant...@gmail.com wrote:
 On Sat, Aug 8, 2009 at 12:44 AM, Manish Katiyarmkati...@gmail.com wrote:
 [ I didn't get any response from UML mailing list, trying my luck here ]


 -- Forwarded message --
 From: Manish Katiyar mkati...@gmail.com
 Date: Thu, Aug 6, 2009 at 9:07 PM
 Subject: Avoid uml opening virtual consoles
 To: user-mode-linux-user user-mode-linux-u...@lists.sourceforge.net


 Hi,

 I have downloaded fedora-10 uml images from
 http://uml.nagafix.co.uk/filesystems/ . After booting it up it opens
 up 6 virtual consoles for me. What I would like to have is just one
 terminal and that also in the same terminal from where I am invoking
 the UML kernel. (I used to get that with a different OS image that I
 had downloaded from UML homepage). What settings change or parameters
 I can pass to make this happen.

 Hi Manish...

 Looks like now things are a bit different in initscripts handling.
 From what I read directly from /etc/inittab comment in my F9 box, I
 think you might try to rename /etc/event.d/tty{1,2,3,4,5,6} into
 something else or simply move them to other directory. From their
 names, you can guess it's configuration file to spawn console on
 certain tty.

Thanks mulyadi, I will try that. As of now adding con0=null,fd:2
con1=fd:0,fd:1 con=/dev/null  to command line solves my issue. Only
thing is  I get lot of error msgs for other ttys.

Thanks -
Manish



 That away, I guess it will prevent the creation of virtual console on
 UML. IMO, just leave tty1 as is, so you will only have 1 console open
 and that console sits in the same console session you currently work
 on.


 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer
 blog: the-hydra.blogspot.com




-- 
Thanks -
Manish

--
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



Compiling modules on UML

2009-08-05 Thread Manish Katiyar
Hi,

I am trying to compile a module on UML. The kernel with which I am
booting UML is my custom kernel built on i386 machine with the command
line as make defconfig ARCH=um; make linux ARCH=um. After the kernel
boots up my uname shows something like below :-

bash-3.2# uname -a
Linux localhost.localdomain 2.6.30.4 #6 Wed Aug 5 15:12:08 IST 2009
i686 i686 i386 GNU/Linux

Now when I compile a module, by default it resolves the ARCH to x86.
And some of the compilation fails because somethings are expected to
be always defined on x86 but not on UML (e.g.
CONFIG_TRACE_IRQFLAGS_SUPPORT). because my asm directory resolves to
asm-um rather than asm-x86. It throws error like below.

In file included from include/linux/prefetch.h:14,
 from include/linux/list.h:6,
 from include/linux/wait.h:22,
 from include/linux/fs.h:359,
 from include/linux/buffer_head.h:11,
 from /home/mkatiyar/personal/ohsm/test/kernel/admin.c:23:
/mnt/host/home/mkatiyar/personal/uml/linux-2.6.30.4/arch/x86/include/asm/processor.h:
In function 'load_cr3':
/mnt/host/home/mkatiyar/personal/uml/linux-2.6.30.4/arch/x86/include/asm/processor.h:191:
error: 'CONFIG_PAGE_OFFSETUL' undeclared (first use in this function)
/mnt/host/home/mkatiyar/personal/uml/linux-2.6.30.4/arch/x86/include/asm/processor.h:191:
error: (Each undeclared identifier is reported only once
/mnt/host/home/mkatiyar/personal/uml/linux-2.6.30.4/arch/x86/include/asm/processor.h:191:
error: for each function it appears in.)
/mnt/host/home/mkatiyar/personal/uml/linux-2.6.30.4/arch/x86/include/asm/processor.h:
In function 'wbinvd_halt':
/mnt/host/home/mkatiyar/personal/uml/linux-2.6.30.4/arch/x86/include/asm/processor.h:771:
error: implicit declaration of function 'halt'


My question is how do people build modules which are specific to a
particular architecture on UML ? Is it possible ?

Once I export ARCH=um before doing a make, I can do a successful build.

-- 
Thanks -
Manish

--
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: [uml-user] Compiling modules on UML

2009-08-05 Thread Manish Katiyar
On Wed, Aug 5, 2009 at 4:46 PM, Flaviofbcyb...@gmail.com wrote:
 2009/8/5 Manish Katiyar mkati...@gmail.com:
 My question is how do people build modules which are specific to a
 particular architecture on UML ? Is it possible ?
 Sure!
 Are you compiling the kernel modules from the host system? If not,
 try to do it.
 The exact procedure is the following:
 # mount -o loop rootfs loop_dir/
 # cd /uml/src/linux
 # make modules ARCH=um
 # make modules_install INSTALL_MOD_PATH=/uml/loop_dir ARCH=um
 # umount /uml/loop_dir

 Then, boot the UML again.

Hi Flavio,

I have done that step and my UML kernel boots fine. My question is in
UML environment what will the ARCH resolve to ? will it be um or x86 ?

Thanks -
Manish



 Flavio




-- 
Thanks -
Manish

--
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: [uml-user] Compiling modules on UML

2009-08-05 Thread Manish Katiyar
On Wed, Aug 5, 2009 at 8:44 PM, H M Thalibhmtha...@gmail.com wrote:
 Hi  Manish,

 Manish Katiyar wrote:

 On Wed, Aug 5, 2009 at 4:46 PM, Flaviofbcyb...@gmail.com wrote:

 2009/8/5 Manish Katiyar mkati...@gmail.com:

 My question is how do people build modules which are specific to a
 particular architecture on UML ? Is it possible ?

 Sure!
 Are you compiling the kernel modules from the host system? If not,
 try to do it.
 The exact procedure is the following:
 # mount -o loop rootfs loop_dir/
 # cd /uml/src/linux
 # make modules ARCH=um
 # make modules_install INSTALL_MOD_PATH=/uml/loop_dir ARCH=um
 # umount /uml/loop_dir

 Then, boot the UML again.

 Hi Flavio,

 I have done that step and my UML kernel boots fine. My question is in
 UML environment what will the ARCH resolve to ? will it be um or x86 ?

 Thanks -
 Manish


 Flavio





 It will um. Actualy UML is a port of the Linux kernel as a normal Intel
 Linux process.

So that would mean that any new kernel module that I compile has to be
prefixed with ARCH=um ??? because my kernel source resides on host and
has been configured as um. If I compile any x86 module from UML it
will fail because the asm directory in kernel source points to asm-um
and not asm-x86. Isn't it ?? Or I am just talking senseless :-( ...

Below is how my directory structures look like.

-bash-3.2# ls -l /lib/modules/2.6.30.4/source/include/
total 120
-rw-r--r--  1 mkatiyar 5573   218 Jul 30 18:34 Kbuild
drwxr-xr-x  3 mkatiyar 5573  4096 Jul 30 18:34 acpi
lrwxrwxrwx  1 mkatiyar 5573 6 Aug  5 06:16 asm - asm-um

-bash-3.2# ls -l /lib/modules/2.6.30.4/
total 64
lrwxrwxrwx 1 root root   42 Aug  4 13:36 build -
/home/mkatiyar/personal/uml/linux-2.6.30.4
drwxr-xr-x 6 root root 4096 Aug  5 06:18 kernel
-rw-r--r-- 1 root root  265 Aug  5 11:01 modules.alias
..
...
-rw-r--r-- 1 root root  189 Aug  5 11:01 modules.usbmap
lrwxrwxrwx 1 root root   42 Aug  5 06:18 source -
/home/mkatiyar/personal/uml/linux-2.6.30.4

-bash-3.2# ls -l /home/mkatiyar
total 0
lrwxrwxrwx 1 root root 32 Aug  4 14:48 personal -
/mnt/host/home/mkatiyar/personal


-bash-3.2# mount
/dev/ubda on / type auto (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
none on /mnt/host type hostfs (rw)


Thanks -
Manish




 --
 Thanks  Regards,
 H M Thalib.




-- 
Thanks -
Manish

--
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 path in kernel object Debug of Kernel module with gdb

2009-08-05 Thread Manish Katiyar
On Wed, Aug 5, 2009 at 11:18 PM,
Microbit_Ubuntumicro...@virginbroadband.com.au wrote:
 Hello Lin/all,


 Following up on my reply to the u32 issue and Kernel compilation (in
 Eclipse/CDT), I am wondering about 2 issues someone here might have
 figured before :

 1. How do you (re) change path to set the module output when building ?
   - The hierarchy of my project (ideally) requires that my Kernel
   Module source resides in a sub-dir called 'src'.
   Thus, my (test) module is defined as such :

   obj-m  :=  ../src/my_test.o

   OK, all is good, no problem. But now my module output ends up
   in the /src/ sub directory.
   However, I want the executable code to land in my /Debug
   folder

   Can anyone give a hint how to accomplish this ?

A make install target ???

  I can't seem to
   readily find a solution to this...

   So, basically, the folders are like this :

   My Project :
   ...
   src/
   Debug/

   My Makefile is in the Debug folder - the module source is in /src.
   But the module output needs to go into Debug/ folder ?


 2. As referred to in the u32 previous post, I'm a bit stumped how to
   invoke GBD on debugging kernel modules.

The commands would depend on what environment are yoiu developing your
modules. A vmware based kernel can easily talk to gdb via some
predefined port as specified in vmx file. A UML kernel can be debugged
by just starting the kernel in gdb .

Thanks -
Manish

   Do I need a separate pre-command from the debugger, launching
   insmod, or some such ?


 I look forward to any help or suggestions I can get...

 --
 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





-- 
Thanks -
Manish

--
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: a couple questions about gdb vmlinux /proc/kcore

2009-08-02 Thread Manish Katiyar
On Sun, Aug 2, 2009 at 7:58 PM, Robert P. J. Dayrpj...@crashcourse.ca wrote:
 On Sun, 2 Aug 2009, Manish Katiyar wrote:

 Hi Robert,

 May be you can add how to see the already loaded modules and traverse
 or find a particular module. Something like 

 (gdb) p modules
 $1 = {next = 0x3502cea4, prev = 0x3502cea4}

 (gdb) p *((struct module *)0x3502cea0)
 $3 = {state = MODULE_STATE_LIVE, list = {next = 0x81e0dec, prev = 0x81e0dec},
   name = loop, '\0' repeats 55 times, mkobj = {kobj = {
       k_name = 0x3502ceec loop, name = loop, '\0' repeats 15 times,
       kref = {refcount = {counter = 2}}, entry = {next = 0x81e0ac8,
         prev = 0x34a486c8}, parent = 0x81e0ad0, kset = 0x81e0ac0, ktype = 
 0x0,
       dentry = 0x3297277c, poll = {lock = {raw_lock = {No data fields}},
         task_list = {next = 0x3502cf1c, prev = 0x3502cf1c}}},
     mod = 0x3502cea0}, param_attrs = 0x0, modinfo_attrs = 0x9598620,
   version = 0x0, srcversion = 0x0, syms = 0x3502bc20, num_syms = 2,
   crcs = 0x0, gpl_syms = 0x0, num_gpl_syms = 0, gpl_crcs = 0x0,
   unused_syms = 0x0, num_unused_syms = 0, unused_crcs = 0x0,
   unused_gpl_syms = 0x0, num_unused_gpl_syms = 0, unused_gpl_crcs = 0x0,
   gpl_future_syms = 0x0, num_gpl_future_syms = 0, gpl_future_crcs = 0x0,
   num_exentries = 0, extable = 0x0, init = 0x3502f000, module_init = 0x0,
   module_core = 0x3502a000, init_size = 0, core_size = 12328,
   init_text_size = 0, core_text_size = 6468, unwind_info = 0x0,
   arch = {No data fields}, unsafe = 0, license_gplok = 1, ref = {{count = {
         counter = 0}}}, modules_which_use_me = {next = 0x3502cfe0,
     prev = 0x3502cfe0}, waiter = 0x94cf7c0, exit = 0x3502b8b6,
   symtab = 0x3502bc30, num_symtab = 166, strtab = 0x3502c690 ,
   sect_attrs = 0x346e14d8, percpu = 0x0, args = 0x94c3698 }

 And similarly traversing the chain and printing the list .  Also
 to add that the loading address == $3.module_core and may be highlight
 on other important members.

  possibly, but to start with, i'm looking for simple variables that
 beginners can print out, just for the entertainment value, to convince
 themselves that they really are getting to examine kernel data values.
 by way of clarification, let me explain what i'm trying to do with my
 kernel newbie column over at linux.com.

  my main beef with documentation as long as i can remember is that it
 so often doesn't carefully explain how to get *started* doing
 something.  most of the time, it blasts through the initial install
 and setup, then launches straight into how to do involved and advanced
 stuff.  but a lot of the time, if so much as a single setup
 instruction is mistyped or forgotten, the poor beginner is left
 sitting there, not even able to get the program *started*.  and if
 only the newbie could get past that point to do the *simple* stuff,
 everything after that follows nicely.  so the critical issue is to get
 past that startup phase.

  that's what i'm trying to do -- get newbies past that introductory
 phase.

Hi Robert,

I understand and appreciate your effort and motive. My motive behind
suggesting that was that most of the beginners look kernel code as
black box with some smart or complex data structures and are afraid to
delve into it. Assuming most of them are already pretty good in
userspace, by traversing you are just trying to say that this is
nothing more than a simple linked list program and adding a loadable
modules is just adding a node in that list.

Thanks -
Manish

 as long as a beginner can write a simple module and get it
 compiled and loaded, that's a *huge* victory because, after that, they
 can simply start adding new features a little at a time to see how
 they work.  but if they can't even get that first hello, world
 module loaded and running, they get frustrated and walk away.  *my*
 focus in my columns is to get total beginners over that initial hump,
 at which point a lot of them will take off from there.

  so while printing out the loaded modules is cool (and i might even
 use that), i don't want to get into such advanced examples that the
 beginners lose sight of what they're trying to do.  anyway, for better
 or worse, that's the philosophy behind the weekly column -- to get
 people with *no* kernel programming experience into kernel
 programming.

 rday
 --

 
 Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

 Web page:                                          http://crashcourse.ca
 Twitter:                                       http://twitter.com/rpjday
 Kernel Newbie Corner column @ linux.com:          http://cli.gs/WG6WYX
 




-- 
Thanks -
Manish

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

Re: a couple questions about gdb vmlinux /proc/kcore

2009-08-01 Thread Manish Katiyar
On Sun, Aug 2, 2009 at 2:00 AM, Robert P. J. Dayrpj...@crashcourse.ca wrote:

  for an upcoming column on how to debug the kernel (and modules) with
 gdb, i'm showing how to use the above and, since it's been a while, i
 need a refresher.

  once i'm in gdb, i can list the section breakdown of the vmlinux
 file with:

 (gdb) info files
 ...
 Local exec file:
        `/home/rpjday/k/f11/vmlinux', file type elf64-x86-64.
        Entry point: 0x100
        0x8100 - 0x81009000 is .text.head
        0x81009000 - 0x813f2d3f is .text
        0x813f2d40 - 0x813f2ebc is .notes
        0x813f2ec0 - 0x813f6f80 is __ex_table
        0x813f7000 - 0x8158e10a is .rodata
        0x8158e110 - 0x8159417c is __bug_table
        0x81594180 - 0x81595810 is .pci_fixup
        0x81595810 - 0x81595838 is .tracedata
        0x81595840 - 0x815a26c0 is __ksymtab
        0x815a26c0 - 0x815a91d0 is __ksymtab_gpl
        0x815a91d0 - 0x815a91e0 is __ksymtab_unused
        0x815a91e0 - 0x815bf743 is __ksymtab_strings
        0x815bf750 - 0x815eacd0 is __init_rodata
        0x815eacd0 - 0x815ed000 is __param
        0x815ed000 - 0x8165ae60 is .data
        ... and so on.

 if i try to list the variables (obviously a long list) with

 (gdb) info variables

 gdb just goes away (perhaps I'm just asking for too much?).  is there
 a way to ask for the variable/symbol list within a single section?  i
 don't see the gdb command for that.

  also (and a simpler question), as an example of how to print kernel
 variables once you're in gdb, i always start with one of:

 (gdb) p jiffies
 (gdb) p jiffies_64

 depending on your architecture.  are there some other kernel vars that
 are informative and obvious to print?  there's loops_per_jiffy as
 well, but off the top of peoples' heads, given the stunning number of
 possible kernel variables to print, which ones would be good examples
 that would be meaningful for a newbie column?

how about p current ??


Thanks -
Manish



  thanks.

 rday
 --

 
 Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

 Web page:                                          http://crashcourse.ca
 Twitter:                                       http://twitter.com/rpjday
 Kernel Newbie Corner column @ linux.com:          http://cli.gs/WG6WYX
 

 --
 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





-- 
Thanks -
Manish

--
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: Tmpfs nr_inodes

2009-07-29 Thread Manish Katiyar
On Wed, Jul 29, 2009 at 10:08 AM, Mulyadi
Santosamulyadi.sant...@gmail.com wrote:
 On Wed, Jul 29, 2009 at 4:06 AM, Darvin Denmiandarvin.denm...@gmail.com 
 wrote:
 Hello,

 My question is about tmpfs:

 - If i increase the number of inodes avaliable in a tmpfs mounted
 directory, will i have some performance impact?

 # Before increase number of inodes
 df -i /media/queue
 tmpfs                 129384    4229  125155    4% /media/queue

 # After increase number of inodes
 tmpfs                2048000    4229 2043771    1% /media/queue

 Sorry for my Brazilian English :(

 I think no. AFAIK, number of inodes just tell you how many file you
 can make (since one inode represents the metadata of a file).

 However, IMO, depending on average file size you will create there,
 having more inodes doesn't mean you can cram more files into your
 tmpfs based directory. So it's more like balancing between inodes,
 predicted number of file and storage size. By default, mount do this
 for you.

Yes... In general increasing number of inodes shouldn't affect
performance unless you are going to pre-allocate space for that many
inodes on disk (things like expanding your bitmaps and other metadata
stuff).

Thanks -
Manish



 CMIIW people

 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer
 blog: the-hydra.blogspot.com

 --
 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





-- 
Thanks -
Manish

--
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: Accessing File system directories

2009-07-27 Thread Manish Katiyar
On Mon, Jul 27, 2009 at 2:49 PM, Dan Danillodandani...@ymail.com wrote:

 Hello,




 Hi Dan,


 On Mon, Jul 27, 2009 at 11:54 AM, Dan Danillowrote:
  Hello,
 
  I'm trying to find out how to browse the file system from the linux kernel.

 What exactly do you mean by that.
 Do you mean that you want to traverse the namespace being inside the
 kernel through some kernel module or something?

 Yes, I want to write a module which gets as parameter the path to a directory.
 In the module I want to be able to find all files and subfolders in that 
 directory.

  Especially the directory content is interesting to me.
  Can anyone give me a hint? Are there even some libc like functions to do
  that ?
 

 The libc functions like these map to the kernel code eventually, so
 mostly there will be one.

  So far I have found the filp_open, vfs_read and vfs_readdir functions.
 
  However, the vfs_readdir function expects a function pointer to somehow
  format the directory information.
  My assumption is that this is the wrong function.
  So I guess that's not the function I'm after.
 

 Do you want it at vfs layer 
 or at the file system level

 Mh, I don't really have a clue. What are the differences?
 I'm not  interested in all the inode information or some funky stuff.
 I just need to know if it is a file or directory, filesize and where to find 
 the data of the file.


Hi,

Have a look at vfs_path_lookup() . In particular probably you want path_walk().

Thanks -
Manish


 What all information do you have before you could call this function
 which will traverse the file system hierarchy for you?

 Just the path to the directory

 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





-- 
Thanks -
Manish

--
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: Checking Installed library

2009-07-22 Thread Manish Katiyar
On Sat, Jul 18, 2009 at 2:37 PM, Rishi Agrawalrishi.b.agra...@gmail.com wrote:


 On Sat, Jul 18, 2009 at 2:25 PM, Manish Katiyar mkati...@gmail.com wrote:

 On Sat, Jul 18, 2009 at 1:45 PM, Rishi Agrawalrishi.b.agra...@gmail.com
 wrote:
 
 
  On Sat, Jul 18, 2009 at 1:05 PM, Manish Katiyar mkati...@gmail.com
  wrote:
 
  On Sat, Jul 18, 2009 at 9:48 AM, Rishi
  Agrawalrishi.b.agra...@gmail.com
  wrote:
  
  
   On Fri, Jul 17, 2009 at 7:22 PM, Manish Katiyar mkati...@gmail.com
   wrote:
  
   On Fri, Jul 17, 2009 at 10:34 PM, Rishi
   Agrawalrishi.b.agra...@gmail.com wrote:
   
   
On Fri, Jul 17, 2009 at 12:40 PM, Rishi Agrawal
rishi.b.agra...@gmail.com
wrote:
   
   
On Fri, Jul 17, 2009 at 12:27 PM, Mulyadi Santosa
mulyadi.sant...@gmail.com wrote:
   
On 7/17/09, Rishi Agrawal rishi.b.agra...@gmail.com wrote:
 Is autoconfigure the only way to find this out.??

 On Wed, Jul 15, 2009 at 6:52 AM, Pei Lin telent...@gmail.com
 wrote:
   
Please don't do top posting...
   
Although it's OOT, I can help a bit. IMO, you can directly check
/usr/lib or parse /etc/ld.so.conf and so on to find the related
DSO
and header files. However, doing that will require more time and
probably not portable across system, in fact it's kinda
reinventing
the wheel.
   
So, I personally suggest to adopt autoconfigure.
   
--
regards,
   
Mulyadi Santosa
Freelance Linux trainer
blog: the-hydra.blogspot.com
   
   
I will have a detailed look at the autoconfigure utility and see.
   
Thanks for all the help.
   
--
Regards,
Rishi B. Agrawal
http://www.linkedin.com/in/rishibagrawal
http://code.google.com/p/fscops/
   
   
I have used it and it is working very good.
   
I wanted to know that
   
How to check the presence of libxml2 library using autoconfigure ?
  
   First link in google.
  
  
  
  
   http://www.kdevelop.org/index.html?filename=3.0/doc/tutorial_autoconf.html
  
   Thanks -
   Manish
  
   
   
--
Regards,
Rishi B. Agrawal
http://www.linkedin.com/in/rishibagrawal
http://code.google.com/p/fscops/
   
  
  
  
   --
   Thanks -
   Manish
  
   Actually I tried using that information earlier but somehow it did
   not
   work.
 
  Can you please tell us a little more why it didn't work ? Any errors
  or anything else ??
 
  
   Currently I am using a macro which checks wether a function is
   present
   in
   the mentioned library.
 
  I didn't understand this ? are you using something like nm ??
 
  
   like printf can be checked in libc
  
   I used a function xmlParsefile and libxml2 library and this works
   fine.
   The logic behind this is that when the function is present in the
   library
   then the library is also present on the system (is it correct ??)
 
  Should be... but by any chance are you relying the library to be
  present in a particular path ?? If that's the case it is not going to
  work anywhere ?
 
  Thanks -
  Manish
 
  
  
  
  
  
  
   --
   Regards,
   Rishi B. Agrawal
   http://www.linkedin.com/in/rishibagrawal
   http://code.google.com/p/fscops/
  
 
 
 
  --
  Thanks -
  Manish
 
  I am using this particular line:
 
  AC_CHECK_LIB(xml2,xmlParseFile,,AC_MSG_ERROR(oops! no function
  xmlParseFile
  function in xml?!?),) in my configure.in for autoconf

 You can try something like below too ... it doesn't depend on any
 particular function.

 /tmp/test ./configure
 checking for gcc... gcc
 checking for C compiler default output file name... a.out
 checking whether the C compiler works... yes
 checking whether we are cross compiling... no
 checking for suffix of executables...
 checking for suffix of object files... o
 checking whether we are using the GNU C compiler... yes
 checking whether gcc accepts -g... yes
 checking for gcc option to accept ISO C89... none needed
 checking for -pkg-config... no
 checking for pkg-config... /usr/bin/pkg-config
 checking for libxml2... yes
 configure: creating ./config.status


 /tmp/test cat configure.ac
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.

 AC_PREREQ([2.63])
 AC_INIT([Sample test package], [1.1.0], [mkati...@gmail.com])
 AC_CONFIG_SRCDIR([a.c])

 AC_PROG_CC

 AC_PATH_PROGS([PACKAGE_CONFIG], [$host_alias-pkg-config pkg-config],
 [none])
 if test x$PACKAGE_CONFIG = xnone; then
  AC_MSG_ERROR([*** pkg-config, needed to check for libxml2 existence
 has not been found.])
 fi

 AC_MSG_CHECKING(for libxml2)

 if $PACKAGE_CONFIG libxml-2.0 --libs  /dev/null 21; then
  AC_MSG_RESULT(yes)
 else
  AC_MSG_RESULT(no)
 fi

 AC_OUTPUT

 =

 Thanks -
 Manish

 
  The use of macro is
 
  AC_CHECK_LIB : Checks whether a function exists in the given library
  (library names without the leading lib, e.g., for libxml, use just xml
  here)
 
  It seems that it is not path dependant

Re: Checking Installed library

2009-07-18 Thread Manish Katiyar
On Sat, Jul 18, 2009 at 9:48 AM, Rishi Agrawalrishi.b.agra...@gmail.com wrote:


 On Fri, Jul 17, 2009 at 7:22 PM, Manish Katiyar mkati...@gmail.com wrote:

 On Fri, Jul 17, 2009 at 10:34 PM, Rishi
 Agrawalrishi.b.agra...@gmail.com wrote:
 
 
  On Fri, Jul 17, 2009 at 12:40 PM, Rishi Agrawal
  rishi.b.agra...@gmail.com
  wrote:
 
 
  On Fri, Jul 17, 2009 at 12:27 PM, Mulyadi Santosa
  mulyadi.sant...@gmail.com wrote:
 
  On 7/17/09, Rishi Agrawal rishi.b.agra...@gmail.com wrote:
   Is autoconfigure the only way to find this out.??
  
   On Wed, Jul 15, 2009 at 6:52 AM, Pei Lin telent...@gmail.com
   wrote:
 
  Please don't do top posting...
 
  Although it's OOT, I can help a bit. IMO, you can directly check
  /usr/lib or parse /etc/ld.so.conf and so on to find the related DSO
  and header files. However, doing that will require more time and
  probably not portable across system, in fact it's kinda reinventing
  the wheel.
 
  So, I personally suggest to adopt autoconfigure.
 
  --
  regards,
 
  Mulyadi Santosa
  Freelance Linux trainer
  blog: the-hydra.blogspot.com
 
 
  I will have a detailed look at the autoconfigure utility and see.
 
  Thanks for all the help.
 
  --
  Regards,
  Rishi B. Agrawal
  http://www.linkedin.com/in/rishibagrawal
  http://code.google.com/p/fscops/
 
 
  I have used it and it is working very good.
 
  I wanted to know that
 
  How to check the presence of libxml2 library using autoconfigure ?

 First link in google.


 http://www.kdevelop.org/index.html?filename=3.0/doc/tutorial_autoconf.html

 Thanks -
 Manish

 
 
  --
  Regards,
  Rishi B. Agrawal
  http://www.linkedin.com/in/rishibagrawal
  http://code.google.com/p/fscops/
 



 --
 Thanks -
 Manish

 Actually I tried using that information earlier but somehow it did not work.

Can you please tell us a little more why it didn't work ? Any errors
or anything else ??


 Currently I am using a macro which checks wether a function is present in
 the mentioned library.

I didn't understand this ? are you using something like nm ??


 like printf can be checked in libc

 I used a function xmlParsefile and libxml2 library and this works fine.
 The logic behind this is that when the function is present in the library
 then the library is also present on the system (is it correct ??)

Should be... but by any chance are you relying the library to be
present in a particular path ?? If that's the case it is not going to
work anywhere ?

Thanks -
Manish







 --
 Regards,
 Rishi B. Agrawal
 http://www.linkedin.com/in/rishibagrawal
 http://code.google.com/p/fscops/




-- 
Thanks -
Manish

--
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: Checking Installed library

2009-07-18 Thread Manish Katiyar
On Sat, Jul 18, 2009 at 1:45 PM, Rishi Agrawalrishi.b.agra...@gmail.com wrote:


 On Sat, Jul 18, 2009 at 1:05 PM, Manish Katiyar mkati...@gmail.com wrote:

 On Sat, Jul 18, 2009 at 9:48 AM, Rishi Agrawalrishi.b.agra...@gmail.com
 wrote:
 
 
  On Fri, Jul 17, 2009 at 7:22 PM, Manish Katiyar mkati...@gmail.com
  wrote:
 
  On Fri, Jul 17, 2009 at 10:34 PM, Rishi
  Agrawalrishi.b.agra...@gmail.com wrote:
  
  
   On Fri, Jul 17, 2009 at 12:40 PM, Rishi Agrawal
   rishi.b.agra...@gmail.com
   wrote:
  
  
   On Fri, Jul 17, 2009 at 12:27 PM, Mulyadi Santosa
   mulyadi.sant...@gmail.com wrote:
  
   On 7/17/09, Rishi Agrawal rishi.b.agra...@gmail.com wrote:
Is autoconfigure the only way to find this out.??
   
On Wed, Jul 15, 2009 at 6:52 AM, Pei Lin telent...@gmail.com
wrote:
  
   Please don't do top posting...
  
   Although it's OOT, I can help a bit. IMO, you can directly check
   /usr/lib or parse /etc/ld.so.conf and so on to find the related DSO
   and header files. However, doing that will require more time and
   probably not portable across system, in fact it's kinda reinventing
   the wheel.
  
   So, I personally suggest to adopt autoconfigure.
  
   --
   regards,
  
   Mulyadi Santosa
   Freelance Linux trainer
   blog: the-hydra.blogspot.com
  
  
   I will have a detailed look at the autoconfigure utility and see.
  
   Thanks for all the help.
  
   --
   Regards,
   Rishi B. Agrawal
   http://www.linkedin.com/in/rishibagrawal
   http://code.google.com/p/fscops/
  
  
   I have used it and it is working very good.
  
   I wanted to know that
  
   How to check the presence of libxml2 library using autoconfigure ?
 
  First link in google.
 
 
 
  http://www.kdevelop.org/index.html?filename=3.0/doc/tutorial_autoconf.html
 
  Thanks -
  Manish
 
  
  
   --
   Regards,
   Rishi B. Agrawal
   http://www.linkedin.com/in/rishibagrawal
   http://code.google.com/p/fscops/
  
 
 
 
  --
  Thanks -
  Manish
 
  Actually I tried using that information earlier but somehow it did not
  work.

 Can you please tell us a little more why it didn't work ? Any errors
 or anything else ??

 
  Currently I am using a macro which checks wether a function is present
  in
  the mentioned library.

 I didn't understand this ? are you using something like nm ??

 
  like printf can be checked in libc
 
  I used a function xmlParsefile and libxml2 library and this works
  fine.
  The logic behind this is that when the function is present in the
  library
  then the library is also present on the system (is it correct ??)

 Should be... but by any chance are you relying the library to be
 present in a particular path ?? If that's the case it is not going to
 work anywhere ?

 Thanks -
 Manish

 
 
 
 
 
 
  --
  Regards,
  Rishi B. Agrawal
  http://www.linkedin.com/in/rishibagrawal
  http://code.google.com/p/fscops/
 



 --
 Thanks -
 Manish

 I am using this particular line:

 AC_CHECK_LIB(xml2,xmlParseFile,,AC_MSG_ERROR(oops! no function xmlParseFile
 function in xml?!?),) in my configure.in for autoconf

You can try something like below too ... it doesn't depend on any
particular function.

/tmp/test ./configure
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for -pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
checking for libxml2... yes
configure: creating ./config.status


/tmp/test cat configure.ac
#   -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63])
AC_INIT([Sample test package], [1.1.0], [mkati...@gmail.com])
AC_CONFIG_SRCDIR([a.c])

AC_PROG_CC

AC_PATH_PROGS([PACKAGE_CONFIG], [$host_alias-pkg-config pkg-config], [none])
if test x$PACKAGE_CONFIG = xnone; then
  AC_MSG_ERROR([*** pkg-config, needed to check for libxml2 existence
has not been found.])
fi

AC_MSG_CHECKING(for libxml2)

if $PACKAGE_CONFIG libxml-2.0 --libs  /dev/null 21; then
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

AC_OUTPUT

=

Thanks -
Manish


 The use of macro is

 AC_CHECK_LIB : Checks whether a function exists in the given library
 (library names without the leading lib, e.g., for libxml, use just xml here)

 It seems that it is not path dependant.
 --
 Regards,
 Rishi B. Agrawal
 http://www.linkedin.com/in/rishibagrawal
 http://code.google.com/p/fscops/




-- 
Thanks -
Manish

--
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: Checking Installed library

2009-07-17 Thread Manish Katiyar
On Fri, Jul 17, 2009 at 10:34 PM, Rishi
Agrawalrishi.b.agra...@gmail.com wrote:


 On Fri, Jul 17, 2009 at 12:40 PM, Rishi Agrawal rishi.b.agra...@gmail.com
 wrote:


 On Fri, Jul 17, 2009 at 12:27 PM, Mulyadi Santosa
 mulyadi.sant...@gmail.com wrote:

 On 7/17/09, Rishi Agrawal rishi.b.agra...@gmail.com wrote:
  Is autoconfigure the only way to find this out.??
 
  On Wed, Jul 15, 2009 at 6:52 AM, Pei Lin telent...@gmail.com wrote:

 Please don't do top posting...

 Although it's OOT, I can help a bit. IMO, you can directly check
 /usr/lib or parse /etc/ld.so.conf and so on to find the related DSO
 and header files. However, doing that will require more time and
 probably not portable across system, in fact it's kinda reinventing
 the wheel.

 So, I personally suggest to adopt autoconfigure.

 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer
 blog: the-hydra.blogspot.com


 I will have a detailed look at the autoconfigure utility and see.

 Thanks for all the help.

 --
 Regards,
 Rishi B. Agrawal
 http://www.linkedin.com/in/rishibagrawal
 http://code.google.com/p/fscops/


 I have used it and it is working very good.

 I wanted to know that

 How to check the presence of libxml2 library using autoconfigure ?

First link in google.


http://www.kdevelop.org/index.html?filename=3.0/doc/tutorial_autoconf.html

Thanks -
Manish



 --
 Regards,
 Rishi B. Agrawal
 http://www.linkedin.com/in/rishibagrawal
 http://code.google.com/p/fscops/




-- 
Thanks -
Manish

--
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: help with ext3 reserved inode

2009-07-07 Thread Manish Katiyar
On Tue, Jul 7, 2009 at 2:41 PM, Donato Capitellad.capite...@tin.it wrote:
 On Tue, 2009-07-07 at 00:10 +0530, Manish Katiyar wrote:
 Hmm.. Can you try to write something like ext3_get_journal() and tell
 us the errors you are enountering.

 Here's the function I wrote:

 //
 struct inode *secdel_get_journal(struct super_block *sb)
 {
        struct inode *journal;

        journal = ext3_iget(sb, 3);
        if (IS_ERR(journal)) {
                printk(KERN_ERR ext3secdel - no journal found.\n);
                return NULL;
        }

        if (!S_ISREG(journal-i_mode)) {
                printk(KERN_ERR ext3secdel - invalid journal inode.\n);
                iput(journal);
                return NULL;
        }

        return journal;
 }
 //

 It doesn't crash, but stops on the first error, after the ext3_iget()
 call and returns NULL.

Can you also add print the value of journal after it is returned from
ext3_iget() in debug statement. It will have the error code and will
help to trace the problem.


 And also could you post what is the
 output of stat 3 after you have initialized your reserved inode.

 Here's the output:

May be you should also initialize i_nlinks = 1.

Thanks -
Manish



 Inode: 3 Type: regular Mode: 0600 Flags: 0x0 Generation: 0x0
 User: 0 Group: 0 Size: 0
 File ACL: 0 Directory ACL: 0
 Links: 0 Blockcount: 0
 Fragment: Address: 0 Number: 0 Size: 0
 ctime: 0x4622bea1 -- Mon Apr 16 08:09:05 2007
 atime: 0x462a2136 -- Sat Apr 21 22:35:34 2007
 mtime: 0x4622325e -- Sun Apr 15 22:10:38 2007
 BLOCKS:

 ps. never mind the dates, I put random values...

 Instead of trying to reference any pointer and do any operation, could
 you just try to print success or the errno from the ext3_iget()

 Thanks -
 Manish

 Thank you,
 Donato





-- 
Thanks -
Manish

--
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: help with ext3 reserved inode

2009-07-07 Thread Manish Katiyar
On Tue, Jul 7, 2009 at 6:16 PM, Donato Capitellad.capite...@tin.it wrote:
 On Tue, 2009-07-07 at 15:46 +0530, Manish Katiyar wrote:
 On Tue, Jul 7, 2009 at 3:21 PM, Donato Capitellad.capite...@tin.it wrote:
  On Tue, 2009-07-07 at 15:10 +0530, Manish Katiyar wrote:
  On Tue, Jul 7, 2009 at 2:41 PM, Donato Capitellad.capite...@tin.it 
  wrote:
  
   It doesn't crash, but stops on the first error, after the ext3_iget()
   call and returns NULL.
 
  Can you also add print the value of journal after it is returned from
  ext3_iget() in debug statement. It will have the error code and will
  help to trace the problem.
  journal after calling ext3_iget() has value -5.

 OK I think I understand your problem. My guess is that you chose
 the inode number to be 3 , but forgot to update the below function

 static inline int ext3_valid_inum(struct super_block *sb, unsigned
 long ino)
 {
         return ino == EXT3_ROOT_INO ||
                 ino == EXT3_JOURNAL_INO ||
                 ino == EXT3_RESIZE_INO ||
                 (ino = EXT3_FIRST_INO(sb) 
                  ino = le32_to_cpu(EXT3_SB(sb)-s_es-s_inodes_count));
 }

 Thanks, this helped. I just modified ext3_valid_inum() to accept inode
 3. Unfortunatelly, now I get error -116.

And this time you are probably hitting this code in ext3_iget()
because you forgot to initialize inode-i_nlink.

  if (inode-i_nlink == 0) {
if (inode-i_mode == 0 ||
!(EXT3_SB(inode-i_sb)-s_mount_state  EXT3_ORPHAN_FS)) {
/* this inode is deleted */
brelse (bh);
ret = -ESTALE;
goto bad_inode;
}
/* The only unlinked inodes we let through here have
 * valid i_mode and are being read by the orphan
 * recovery code: that's fine, we're about to complete
 * the process of deleting those. */
}

 How do I understand what this
 error corresponds to? Is it documented somewhere?

This error corresponds to -ESTALE. See the file
include/asm-generic/errno.h in kernel source tree.

Hope that helps

Thanks -
Manish






-- 
Thanks -
Manish

--
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: help with ext3 reserved inode

2009-07-06 Thread Manish Katiyar
On Mon, Jul 6, 2009 at 8:45 PM, Donato Capitellad.capite...@tin.it wrote:

[ Please keep kernelnewbies in cc while replying ]

 Well, I tried to initialize the inode 3 with debugfs, but nothing
 changed. I just set the file mode and the creation but when I try to
 read the inode with the ext3_iget() function, somehow it fails and
 dereferences a NULL pointer :(

What pointer is NULL ? ext3_iget doesn't return a NULL pointer (either
it returns a valid inode pointer or an errno typecasted as ptr). Where
is it crashing ? What are you using the reserved inode for ?



 Maybe I am missing something.

Unless you tell us the complete picture it might be hard to identify.
A snippet of code would definitely help, but I am pretty sure that it
is because you don't have a valid inode structure on disk and you need
to initialize it appropriately.

 Which fields do I need to initialize in
 order for this to work?

Have you tried the same thing on ext2 first ? I would suggest doing
that because ext2_iget() is much simpler than ext3_iget(). While
setting i_mode you also need to take care that mode also consists of
filetype apart from permissions. You also may have to initialize
i_nlinks appropriately

Shouldn't be this hard to just read an inode...
It isn't but you need to create a valid inode before that.

Thanks -
Manish


 Thanks again,
 Donato


 On Sun, 2009-07-05 at 22:37 +0530, Manish Katiyar wrote:
 On Sun, Jul 5, 2009 at 10:28 PM, Donato Capitellad.capite...@tin.it wrote:
  Well, as it's a reserved inode, I didn't create it. stat 3 shows that
  the inode has bad type... so this might be the problem. But how am I
  supposed to initialize the inode fields if I can't read it?

 What are you reserving it for ? Note that the reserved inodes today (2
 for root)  (8 for journal commonly) both are initialized during mkfs.
 You also need to do something similar. Depending on what you are using
 it for you may need to initialize it properly. To do that you can do
 the following :-

 a) Either write a simple C program to write the fields properly at
 correct offset.
 b) Hack the code of mkfs to include your inode too.
 c) Use debugfs to change the contents of inode 3. This is the easiest
 option but I am not sure if you can modify all the fields of the
 inode, so it depends on what you need.

 Thanks -
 Manish

 
 
  On Sun, 2009-07-05 at 22:06 +0530, Manish Katiyar wrote:
  On Sun, Jul 5, 2009 at 7:30 PM, Donato Capitellad.capite...@tin.it 
  wrote:
   Hi there,
   I need some help with a patch to the ext3 filesystem I'm developing. I'm
   completelly new to kernel programming and I need to understand
   practically how to use one of the ext3 reserved inode for storing a log.
  
   I thought it would be just as easy as getting the inode with the
   ext3_iget() function, but it doesn't seem to be the case. For example,
   if I try to load the third reserved inode like this :
  
   inode = ext3_iget(sb, 3);
  
   ext3_iget() fails somehow and crashes the process with a NULL pointer
   reference. What am I missing here?
  Have you created the inode 3 ? What entries does it have ? What does
  stat 3 show from the debugfs ?
 
  Thanks -
  Manish
 
 
   How do you use a reserved inode? Can
   anybody point to some documentation or project that uses reserved
   inodes?
  
   I'm really stuck :(
  
   Thanks a lot,
   Donato Capitella
  
  
  
   --
   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
  
  
 
 
 
 
 








-- 
Thanks -
Manish

--
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: help with ext3 reserved inode

2009-07-06 Thread Manish Katiyar
On Mon, Jul 6, 2009 at 11:50 PM, Donato Capitellad.capite...@tin.it wrote:
 Ok, this is what I want to do.

 I'm developing a patch to ext3; this patch uses a queue of structures
 representing tasks to be performed and a separated kernel thread that
 reads the structures from the queue as they become available and
 performs the required task on the filesystem.

 So, if the system crashes when there are still things to do in the
 queue, those tasks won't be accomplished. That's why I want to keep this
 queue in a reserved inode so that I can restart the tasks in case of
 system crash.

 Now, what am I trying to develop? Basically this function:

 write_to_log(my_struct *task) {
        1. get reserved inode
        2. append the struct pointed to by task to the reserved inode
 }

Hmm.. Can you try to write something like ext3_get_journal() and tell
us the errors you are enountering. And also could you post what is the
output of stat 3 after you have initialized your reserved inode.
Instead of trying to reference any pointer and do any operation, could
you just try to print success or the errno from the ext3_iget()

Thanks -
Manish



 I tried to be clear, my English doesn't help I guess :P.

 Thanks again for your time,
 Donato :D


 On Mon, 2009-07-06 at 22:47 +0530, Manish Katiyar wrote:
 On Mon, Jul 6, 2009 at 8:45 PM, Donato Capitellad.capite...@tin.it wrote:

 [ Please keep kernelnewbies in cc while replying ]

  Well, I tried to initialize the inode 3 with debugfs, but nothing
  changed. I just set the file mode and the creation but when I try to
  read the inode with the ext3_iget() function, somehow it fails and
  dereferences a NULL pointer :(

 What pointer is NULL ? ext3_iget doesn't return a NULL pointer (either
 it returns a valid inode pointer or an errno typecasted as ptr). Where
 is it crashing ? What are you using the reserved inode for ?


 
  Maybe I am missing something.

 Unless you tell us the complete picture it might be hard to identify.
 A snippet of code would definitely help, but I am pretty sure that it
 is because you don't have a valid inode structure on disk and you need
 to initialize it appropriately.

  Which fields do I need to initialize in
  order for this to work?

 Have you tried the same thing on ext2 first ? I would suggest doing
 that because ext2_iget() is much simpler than ext3_iget(). While
 setting i_mode you also need to take care that mode also consists of
 filetype apart from permissions. You also may have to initialize
 i_nlinks appropriately

 Shouldn't be this hard to just read an inode...
 It isn't but you need to create a valid inode before that.

 Thanks -
 Manish

 
  Thanks again,
  Donato
 
 
  On Sun, 2009-07-05 at 22:37 +0530, Manish Katiyar wrote:
  On Sun, Jul 5, 2009 at 10:28 PM, Donato Capitellad.capite...@tin.it 
  wrote:
   Well, as it's a reserved inode, I didn't create it. stat 3 shows that
   the inode has bad type... so this might be the problem. But how am I
   supposed to initialize the inode fields if I can't read it?
 
  What are you reserving it for ? Note that the reserved inodes today (2
  for root)  (8 for journal commonly) both are initialized during mkfs.
  You also need to do something similar. Depending on what you are using
  it for you may need to initialize it properly. To do that you can do
  the following :-
 
  a) Either write a simple C program to write the fields properly at
  correct offset.
  b) Hack the code of mkfs to include your inode too.
  c) Use debugfs to change the contents of inode 3. This is the easiest
  option but I am not sure if you can modify all the fields of the
  inode, so it depends on what you need.
 
  Thanks -
  Manish
 
  
  
   On Sun, 2009-07-05 at 22:06 +0530, Manish Katiyar wrote:
   On Sun, Jul 5, 2009 at 7:30 PM, Donato Capitellad.capite...@tin.it 
   wrote:
Hi there,
I need some help with a patch to the ext3 filesystem I'm developing. 
I'm
completelly new to kernel programming and I need to understand
practically how to use one of the ext3 reserved inode for storing a 
log.
   
I thought it would be just as easy as getting the inode with the
ext3_iget() function, but it doesn't seem to be the case. For 
example,
if I try to load the third reserved inode like this :
   
inode = ext3_iget(sb, 3);
   
ext3_iget() fails somehow and crashes the process with a NULL pointer
reference. What am I missing here?
   Have you created the inode 3 ? What entries does it have ? What does
   stat 3 show from the debugfs ?
  
   Thanks -
   Manish
  
  
How do you use a reserved inode? Can
anybody point to some documentation or project that uses reserved
inodes?
   
I'm really stuck :(
   
Thanks a lot,
Donato Capitella
   
   
   
--
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: help with ext3 reserved inode

2009-07-05 Thread Manish Katiyar
On Sun, Jul 5, 2009 at 10:28 PM, Donato Capitellad.capite...@tin.it wrote:
 Well, as it's a reserved inode, I didn't create it. stat 3 shows that
 the inode has bad type... so this might be the problem. But how am I
 supposed to initialize the inode fields if I can't read it?

What are you reserving it for ? Note that the reserved inodes today (2
for root)  (8 for journal commonly) both are initialized during mkfs.
You also need to do something similar. Depending on what you are using
it for you may need to initialize it properly. To do that you can do
the following :-

a) Either write a simple C program to write the fields properly at
correct offset.
b) Hack the code of mkfs to include your inode too.
c) Use debugfs to change the contents of inode 3. This is the easiest
option but I am not sure if you can modify all the fields of the
inode, so it depends on what you need.

Thanks -
Manish



 On Sun, 2009-07-05 at 22:06 +0530, Manish Katiyar wrote:
 On Sun, Jul 5, 2009 at 7:30 PM, Donato Capitellad.capite...@tin.it wrote:
  Hi there,
  I need some help with a patch to the ext3 filesystem I'm developing. I'm
  completelly new to kernel programming and I need to understand
  practically how to use one of the ext3 reserved inode for storing a log.
 
  I thought it would be just as easy as getting the inode with the
  ext3_iget() function, but it doesn't seem to be the case. For example,
  if I try to load the third reserved inode like this :
 
  inode = ext3_iget(sb, 3);
 
  ext3_iget() fails somehow and crashes the process with a NULL pointer
  reference. What am I missing here?
 Have you created the inode 3 ? What entries does it have ? What does
 stat 3 show from the debugfs ?

 Thanks -
 Manish


  How do you use a reserved inode? Can
  anybody point to some documentation or project that uses reserved
  inodes?
 
  I'm really stuck :(
 
  Thanks a lot,
  Donato Capitella
 
 
 
  --
  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
 
 








-- 
Thanks -
Manish

--
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: help with ext3 reserved inode

2009-07-05 Thread Manish Katiyar
On Sun, Jul 5, 2009 at 7:30 PM, Donato Capitellad.capite...@tin.it wrote:
 Hi there,
 I need some help with a patch to the ext3 filesystem I'm developing. I'm
 completelly new to kernel programming and I need to understand
 practically how to use one of the ext3 reserved inode for storing a log.

 I thought it would be just as easy as getting the inode with the
 ext3_iget() function, but it doesn't seem to be the case. For example,
 if I try to load the third reserved inode like this :

 inode = ext3_iget(sb, 3);

 ext3_iget() fails somehow and crashes the process with a NULL pointer
 reference. What am I missing here?
Have you created the inode 3 ? What entries does it have ? What does
stat 3 show from the debugfs ?

Thanks -
Manish


 How do you use a reserved inode? Can
 anybody point to some documentation or project that uses reserved
 inodes?

 I'm really stuck :(

 Thanks a lot,
 Donato Capitella



 --
 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





-- 
Thanks -
Manish

--
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: help with ext3 reserved inode

2009-07-05 Thread Manish Katiyar
On Sun, Jul 5, 2009 at 11:08 PM, Donato Capitellad.capite...@tin.it wrote:
 Ok, thanks, now it is clear to me. I thought that as the first 11 inodes
 were reserved, they could be used right away. Instead, if I want to use
 one I have to first initialize it.

 I'll try and let you know.

 Another question: do reserved inodes need to be referenced by a
 directory entry?

I would say it depends on how you are using it (btw you haven't told
us yet why you need a reserved inode :-) ). For example root inode
needs to be referenced by a directory entry but journal inode doesn't

Thanks -
Manish




 Thanks a lot,
 Donato

 On Sun, 2009-07-05 at 22:37 +0530, Manish Katiyar wrote:
 On Sun, Jul 5, 2009 at 10:28 PM, Donato Capitellad.capite...@tin.it wrote:
  Well, as it's a reserved inode, I didn't create it. stat 3 shows that
  the inode has bad type... so this might be the problem. But how am I
  supposed to initialize the inode fields if I can't read it?

 What are you reserving it for ? Note that the reserved inodes today (2
 for root)  (8 for journal commonly) both are initialized during mkfs.
 You also need to do something similar. Depending on what you are using
 it for you may need to initialize it properly. To do that you can do
 the following :-

 a) Either write a simple C program to write the fields properly at
 correct offset.
 b) Hack the code of mkfs to include your inode too.
 c) Use debugfs to change the contents of inode 3. This is the easiest
 option but I am not sure if you can modify all the fields of the
 inode, so it depends on what you need.

 Thanks -
 Manish

 
 
  On Sun, 2009-07-05 at 22:06 +0530, Manish Katiyar wrote:
  On Sun, Jul 5, 2009 at 7:30 PM, Donato Capitellad.capite...@tin.it 
  wrote:
   Hi there,
   I need some help with a patch to the ext3 filesystem I'm developing. I'm
   completelly new to kernel programming and I need to understand
   practically how to use one of the ext3 reserved inode for storing a log.
  
   I thought it would be just as easy as getting the inode with the
   ext3_iget() function, but it doesn't seem to be the case. For example,
   if I try to load the third reserved inode like this :
  
   inode = ext3_iget(sb, 3);
  
   ext3_iget() fails somehow and crashes the process with a NULL pointer
   reference. What am I missing here?
  Have you created the inode 3 ? What entries does it have ? What does
  stat 3 show from the debugfs ?
 
  Thanks -
  Manish
 
 
   How do you use a reserved inode? Can
   anybody point to some documentation or project that uses reserved
   inodes?
  
   I'm really stuck :(
  
   Thanks a lot,
   Donato Capitella
  
  
  
   --
   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
  
  
 
 
 
 
 








-- 
Thanks -
Manish

--
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: How the kernel printk works before do console_setup.

2009-06-23 Thread Manish Katiyar
On Wed, Jun 24, 2009 at 9:20 AM, Johnny Hungjohnny.hack...@gmail.com wrote:
 Hi All:
   I have a powerpc arch platform. The default console is ttyS1 not
 ttyS0 in the platform. My question is how the kernel print debug
 message
 like DBG before parse kernel command line and do console_setup
 function. The command line passed to kernel about console info is
 console=ttyS1.
 So kernel can not print anything before parse cmd line and initial
 console but the result is against. Anyone point me or give me a clue
 is appreciate.

I think you are looking for early_printk.
http://mail.nl.linux.org/kernelnewbies/2005-10/msg00176.html

Thanks -
Manish


 BR, H. Johnny

 --
 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





-- 
Thanks -
Manish

--
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: how to make system calls from kernel module?

2009-06-20 Thread Manish Katiyar
On Sat, Jun 20, 2009 at 10:29 PM, krushnaal paikrisonea...@gmail.com wrote:
 how to make system calls from kernel module?

 or

 how to include library headers in modules so as to use open,read write

Why do you need that ? What are you trying to do ? Isn't this a
repeated question ??

Thanks -
Manish

 functtions?




-- 
Thanks -
Manish

--
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: Recovering deleted file by editing inode..

2009-05-25 Thread Manish Katiyar
On Tue, May 26, 2009 at 8:03 AM, ranjith kannikara 
ranjithkannik...@gmail.com wrote:

 Hi,
 First we were using the tool logdump in debugfs, and now we use the jls and
 jcat. The recovery works fine now it shows the recover file atonce and is
 available also.



Can you post what was the problem and what was the fix. This would help
others too 

-Manish




 rgards
 ranju.


 --
 http://www.ranjithkannikara.blogspot.com/




-- 
Thanks -
Manish


Re: Recovering deleted file by editing inode..

2009-05-24 Thread Manish Katiyar
On Mon, May 25, 2009 at 9:04 AM, ranjith kannikara 
ranjithkannik...@gmail.com wrote:


 Hi,
 We are  a team of prefinal year computer science engineering students from
 kerala.We are trying to design an application which can recover deleted data
 from the ext3 filesystem. And we are doing it by editing the inode of the
 deleted file with the help of debugfs. As you told the 'modify_inode' in
 debugfs will be help ful we have written code to recover data . We could
 recover files of fairly larger size, we tried recovering files over 1Gb and
 we are sure to recover files of 4Gb in size if its not over-written.

 But in the middle we are having little doubts and little problems in
 recovery. Like , after we recover the file,it appears in the disk as not
 accessible but when we unmout and remount the device the file is available.


Btw, i think debugfs is not safe to use on a mounted file system since it
interacts with raw devices . Someone will correct me if i am wrong.


 I shallbrief what we are doing, in the following lines. Please do go
 through it if you see it interesting. We have regestered the project in
 sourceforge and we will be uploading the code soon so that you can have your
 advices if you are interested.

 * useing debugfs list the deleted files and their inode and select the file
 to be recovered.
 * using logdump the details of the file inode,  journal entry, size, links
 , blockcount.
 *if logdump yields a number of entries of none-zero size, the appropriate
 one is selected.
 *then the inode is set using command 'seti'
 *the inode is modified with the direct and indirect pointers which are
 taken from the journal.
 *now the inode is linked to a file in name of the deletd one.

 Here when the file is recovered it is appearing in the device but when we
 click on it, it will disappear


Before clicking can you try few commands like ls, ls -l ls dir if it
is a dir etc. on it ??


 but if the device is unmounted and remounted again, the file will behave as
 a usual file itself.
 And if we ever delete a file which is recovered like this then all other
 files in the device will become read-only , untill it is remounted.


do you get some error message in dmesg ?? I suspect this is because you have
mounted as errors=remount-ro

You must look at the sources of ext3grep or extundelete on sourceforge.

Thanks -
Manish



 Regards,
 Ranju.


 --
 http://www.ranjithkannikara.blogspot.com/




-- 
Thanks -
Manish


Re: using git

2009-05-18 Thread Manish Katiyar
On Mon, May 18, 2009 at 11:20 AM, SandeepKsinha sandeepksi...@gmail.com wrote:
 Hi all,

 I have recently started using git... I know quite late.

 Say, I make some changes and create a patch.
 I want to revert back the files to the original/initial revision( when
 I created git ), how to do that?

man git-reset

Thanks -
manish


 I tried
 git checkout -f

 This didn;t work for me.

 --
 Regards,
 Sandeep.






 “To learn is to change. Education is a process that changes the learner.”

 --
 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





-- 
Thanks -
Manish

--
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: Getting input from USB HID foot pedal. Where to get started?

2009-05-17 Thread Manish Katiyar
On Mon, May 18, 2009 at 8:02 AM, thzxcyl thzx...@gmail.com wrote:
 I have a foot pedal that is implemented as a USB HID device, and it sends
 one input: in binary, 0001, 0010, or 0100 corresponds to each pedal,
 respectively; combination of pedal presses sends combination of those binary
 number, and releases of pedal trigger input of whatever pedal still being
 pressed (if all pedal is up,  is sent). My intention is to have the
 pedal buttons behave as normal keyboard keys (ctrl, alt, and pgdn).

 I've read many writeup on related topics, some of them a few years old, and
 I'm still confused as to where to start: do I need to patch the kernel?
 write a driver translate the input to keycode? do both? I would really
 appreciate a pointer to some tutorials on how to get started and example
 codes if there are any.

Will this help ?

http://www.linuxjournal.com/article/7353

Thanks -
Manish


 Many thanks,
 T.



-- 
Thanks -
Manish

--
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: How to set env variable for an already running shell from other shell ?

2009-05-06 Thread Manish Katiyar
On Wed, May 6, 2009 at 2:55 PM, yogeshwar sonawane yog...@gmail.com wrote:
 Hi all,

 Can one export/set some variables for an already running shell from
 other shell ?
 Is there any command where i can specify env=value  shell process id ?

 This is similar to sending signals from one to another process.

Assuming it is C program, why can't you send the signal. just write a
signal handler to enable the debug variable when the signal is
received.



 We have one program, which prints some debugging information when a
 env variable is set. During execution, first a new shell is created 
 then program is executed.
 Sometimes that program gets stuck somewhere without printing anything.
 If i set the env variable  then execute, the messages will come from
 start of execution.
 I want some mechanism so that when program is stuck,

You can set the variable by attaching the process from gdb, isn't it ??

i can set that
 env variable which will enable printing debugging information.

 Is this possible using some command ? OR how to do this ?

 This question is somewhat out of topic(not related to kernel). But,
 still help will be appreciated.

I guess more details about the program (language, what it is trying to
do) would help others to answer the question better.

Thanks -
Manish


 TIA,
 Yogeshwar

 --
 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





-- 
Thanks -
Manish

--
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: how to kill defunct process ?

2009-04-09 Thread Manish Katiyar
On Thu, Apr 9, 2009 at 6:48 PM, yogeshwar sonawane yog...@gmail.com wrote:
 Hi all,

 If a process is stuck and in defunct state, how to kill it ?

 Finally, we had to reboot the node.

Aren't defunct processes already killed and just waiting for their
parents to pick up their state ?

 We faced such problem and kill -9 pid was not working.
Obviously killing a dead person :-)

 any other way out ?

IIRC init used to do the cleanups for all such processes.

Thanks -
Manish



 Thanks,
 Yogeshwar

 --
 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



Re: filesystem project idea

2009-03-24 Thread Manish Katiyar
On Wed, Mar 25, 2009 at 8:45 AM, Onkar onkar@gmail.com wrote:
 Hi All,
     Can anybody help me with project ideas on Filesystems,RAID,LVM etc.
 to which I can contribute.

TUX3

Thanks -
Manish


 regards,
 Onkar



--
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



  1   2   3   >