Re: contribute to linux kernel

2011-12-01 Thread Prabhakar Lad
Mayank,

If you creating something new  like some framework for example you should
create patches ans send them as RFC, for sending these patches you should
send appropriately to the community , for example if for video you got send
patches to that community, Later on when the community accepts your
patches, you can send a pull request for the appropriate
custodian.
Or else if you have patch which fixes some issue, you need to send directly
to  the community and CC to the change who had made.

Regards,
--Prabhakar Lad

On Fri, Dec 2, 2011 at 11:42 AM, Mayank Agarwal  wrote:

> Hi all,
>
> i have downloaded the linux kernel 2.6 from git.I have seen the you tube
> video of how to modify and submit a patch to the linux kernel.I want to
> know how should i get which projects i can contribute.I have failry good
> knowledge of embedded linux,c,c++,etc.
> Can any one guide me how can i effectively contribute to linux kernel.
>
> Thanks and Regards,
> Mayank
>
>
> On Tue, Nov 15, 2011 at 4:05 AM, Mayank Agarwal <
> mayank77fromin...@gmail.com> wrote:
>
>>
>> Hi all,
>>
>> I have just joined the kernelnewbies.I want to contribute to linux kernel
>> or to any of the open source ongoing projects.Has good experience in
>> c,c++ and linux programming.
>> Please suggest how can i go about that.
>>
>>
>> Regards,
>> Mayank
>>
>
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: contribute to linux kernel

2011-12-01 Thread Mayank Agarwal
Hi all,

i have downloaded the linux kernel 2.6 from git.I have seen the you tube
video of how to modify and submit a patch to the linux kernel.I want to
know how should i get which projects i can contribute.I have failry good
knowledge of embedded linux,c,c++,etc.
Can any one guide me how can i effectively contribute to linux kernel.

Thanks and Regards,
Mayank

On Tue, Nov 15, 2011 at 4:05 AM, Mayank Agarwal  wrote:

>
> Hi all,
>
> I have just joined the kernelnewbies.I want to contribute to linux kernel
> or to any of the open source ongoing projects.Has good experience in c,c++
> and linux programming.
> Please suggest how can i go about that.
>
>
> Regards,
> Mayank
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: What is the purpose of parse_elf() in misc.c

2011-12-01 Thread Mulyadi Santosa
Hi Graeme

On Fri, Nov 25, 2011 at 12:30, Graeme Russ  wrote:
> I wrote a little stand-alone parse_elf() program, and lo-and-behold, the
> outputs are identical. So, in theory, if bzImage contained a raw binary, it
> could be decompressed directly to the target address.

I find your experiment quite interesting. After looking at parse_elf
(http://lxr.linux.no/#linux+v3.1.4/arch/x86/boot/compressed/misc.c#L276),
I guess it could be codes introduced long time before objcopy support
"binary" form. And since then is rarely touched again.

But maybe it's left there in case there is a platform that doesn't
have objcopy version that supports "binary" form conversion. So I
think it's more about portability issue.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

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

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: VFAT i_pos value

2011-12-01 Thread Kai Meyer


On 12/01/2011 12:20 PM, OGAWA Hirofumi wrote:
> Kai Meyer  writes:
>
>>> The i_pos means directory entry (contains inode information in unix-fs)
>>> position,
>>>
>>>   block number == i_pos / (logical-blocksize / 32)
>>>   offset   == i_pos&   (logical-blocksize / 32)
>>>
>>> the above position's directory entry contains information for
>>> problematic file. This is how to use i_pos information.
>>>
>>> FWIW, in this error case, the cluster chain in FAT table which is
>>> pointed by that entry, it has invalid cluster value.
>>>
>>> Thanks.
>> If you would verify my math for me, I would appreciate it.
>>
>> In this case, my logical block size is 4096, because byte 13 of the 8Gb
>> file system is 8, and I take that to be 8 * 512, which is 4096. So:
>>
>> block_number = 523791 / (4096 / 32) = 4092
>> offset = 523791 % (4096 / 32) = 15  // I assume you meant modulo in your
>> original post, and not binary AND.
> Whoops, you are right. (I forgot "-1")
>
>> So if the block_number is 4092, I would multiply that by 8 (sectors per
>> logical block) to get the sector number:
>> 32736
> Right.
>
>> Does the error indicate that sector contains the corrupted data?
> No.
>
>> Or is it the sector that contains the information that points to the
>> corrupted data?
> Right.
>
> The i_pos is pointing a directory entry (include/linux/msdos_fs.h:
> struct msdos_dir_entry).
>
> And starthi (if FAT32) and start contain the pointer to next cluster
> number. That message was outputted when walking in cluster chain.
>
> If you want to see actual corrupted data, you can check the cluster
> chain by pointing from that directory entry.
>
> Thanks.

Thanks for the helpful response. I'm not entirely sure I understand the 
next part though. I hacked a dirty entry dumper tool:

#include 
#include 
#include 
#include 
#include 
#include 
#include 

int main(int argc, char** argv)
{
 off_t pos = atoi(argv[2]);
 unsigned long block;
 off_t sector;
 unsigned int offset;
 int fd = open(argv[1], O_RDONLY);
 char buf[512];
 struct msdos_dir_entry dirent;
 block = pos / (4096 / 32);
 sector = block * 8;
 offset = pos % (4096 / 32);
 printf("block %lu, sector %lu, offset %u\n", block, sector, 
offset);
 lseek(fd, sector * 512, SEEK_SET);
 if (read(fd, buf, 512) < 0) {
 fprintf(stderr, "Unable to read from device %s\n", 
argv[1]);
 return -1;
 }
 memcpy(&dirent, buf + offset, sizeof(dirent));
 printf("name  %s\n", dirent.name);
 printf("attr  %u\n", dirent.attr);
 printf("lcase %u\n", dirent.lcase);
 printf("ctime_cs  %u\n", dirent.ctime_cs);
 printf("ctime %u\n", dirent.ctime);
 printf("cdate %u\n", dirent.cdate);
 printf("adate %u\n", dirent.adate);
 printf("starthi   %u\n", dirent.starthi);
 printf("time  %u\n", dirent.time);
 printf("date  %u\n", dirent.date);
 printf("start %u\n", dirent.start);
 printf("size  %u\n", dirent.size);
}

Here's what it outputs:

./vfat_entry /dev/sblsnap0 523793
block 4092, sector 32736, offset 17
name
attr  255
lcase 255
ctime_cs  255
ctime 12799
cdate 12670
adate 8224
starthi   8224
time  23072
date  21061
start 32
size  2171155456

So, I take starthi, and shift 16 bits left, then and in the start value. 
That should give me the byte address of the first cluster of the file, 
correct?

Then I need to follow the cluster chain until I get a bad value.

Thanks

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Understanding kmap/kunmap

2011-12-01 Thread Kai Meyer
Correction. The problem occurs when 8 bios of size 512 with 1 bvec each 
all share the same page. I made a bad assumption previously.

-Kai Meyer

On 12/01/2011 10:49 AM, Kai Meyer wrote:
> I want to be able to copy data into a struct bio *, so I use
> bio_for_each_segment to loop through each bvec, like so:
>
> void some_function(struct bio *bio, char *some_data) {
>   struct bio_vec *bvec;
>   int i;
>   unsigned int bio_so_far = 0;
>   bio_for_each_segment(bvec, bio, i) {
>   char *bio_buffer = __bio_kmap_atomic(bio, i, KM_USER0);
>   memcpy(bio_buffer, some_data + bio_so_far, bvec->bv_len);
>   __bio_kunmap_atomic(bio, KM_USER0);
>   bio_so_far += bvec->bv_len;
>   }
> }
>
> There's lots more to the function, but this is basically the distilled
> version with out any extra stuff.
>
> What I'm finding is that when the bio has multiple bvecs that share the
> same page, only the first bvec's data actually gets copied back up to
> user-space, the rest is garbage or null (meaning, what was there
> already). For instance, I see a lot of bios from vfat that are 4096
> bytes long but are comprised of 8 bvecs that are 512 bytes long that all
> have an offset to the same page.
>
> I've tried doing just one kmap_atomic on the page by keeping track of
> what the last page I kmap'ed was, but that didn't fix the problem either.
>
> Any documentation or high level explanation of kmap/kunmap or other
> ideas to try are welcome.
>
> -Kai Meyer
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: VFAT i_pos value

2011-12-01 Thread OGAWA Hirofumi
Kai Meyer  writes:

>> The i_pos means directory entry (contains inode information in unix-fs)
>> position,
>>
>>  block number == i_pos / (logical-blocksize / 32)
>>  offset   == i_pos&  (logical-blocksize / 32)
>>
>> the above position's directory entry contains information for
>> problematic file. This is how to use i_pos information.
>>
>> FWIW, in this error case, the cluster chain in FAT table which is
>> pointed by that entry, it has invalid cluster value.
>>
>> Thanks.
>
> If you would verify my math for me, I would appreciate it.
>
> In this case, my logical block size is 4096, because byte 13 of the 8Gb 
> file system is 8, and I take that to be 8 * 512, which is 4096. So:
>
> block_number = 523791 / (4096 / 32) = 4092
> offset = 523791 % (4096 / 32) = 15  // I assume you meant modulo in your 
> original post, and not binary AND.

Whoops, you are right. (I forgot "-1")

> So if the block_number is 4092, I would multiply that by 8 (sectors per 
> logical block) to get the sector number:
> 32736

Right.

> Does the error indicate that sector contains the corrupted data?

No.

> Or is it the sector that contains the information that points to the
> corrupted data?

Right.

The i_pos is pointing a directory entry (include/linux/msdos_fs.h:
struct msdos_dir_entry).

And starthi (if FAT32) and start contain the pointer to next cluster
number. That message was outputted when walking in cluster chain.

If you want to see actual corrupted data, you can check the cluster
chain by pointing from that directory entry.

Thanks.
-- 
OGAWA Hirofumi 

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Understanding kmap/kunmap

2011-12-01 Thread Kai Meyer
I want to be able to copy data into a struct bio *, so I use 
bio_for_each_segment to loop through each bvec, like so:

void some_function(struct bio *bio, char *some_data) {
 struct bio_vec *bvec;
 int i;
 unsigned int bio_so_far = 0;
 bio_for_each_segment(bvec, bio, i) {
 char *bio_buffer = __bio_kmap_atomic(bio, i, KM_USER0);
 memcpy(bio_buffer, some_data + bio_so_far, bvec->bv_len);
 __bio_kunmap_atomic(bio, KM_USER0);
 bio_so_far += bvec->bv_len;
 }
}

There's lots more to the function, but this is basically the distilled 
version with out any extra stuff.

What I'm finding is that when the bio has multiple bvecs that share the 
same page, only the first bvec's data actually gets copied back up to 
user-space, the rest is garbage or null (meaning, what was there 
already). For instance, I see a lot of bios from vfat that are 4096 
bytes long but are comprised of 8 bvecs that are 512 bytes long that all 
have an offset to the same page.

I've tried doing just one kmap_atomic on the page by keeping track of 
what the last page I kmap'ed was, but that didn't fix the problem either.

Any documentation or high level explanation of kmap/kunmap or other 
ideas to try are welcome.

-Kai Meyer

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: VFAT i_pos value

2011-12-01 Thread Kai Meyer
On 12/01/2011 07:38 AM, OGAWA Hirofumi wrote:
> Kai Meyer  writes:
>
>> I'm getting this error:
>> FAT: Filesystem error (dev sblsnap0)
>>   fat_get_cluster: invalid cluster chain (i_pos 523791)
>>
>> I'm wondering if there was a way to figure out what sector is causing
>> the error? I would like to try and track down what is changing that
>> sector and fix the problem. Is there a straight forward way to convert
>> i_pos to a sector value? I've been staring at the fat.c and fat.h code
>> all morning, and I'm having trouble grok'ing the flow.
> The i_pos means directory entry (contains inode information in unix-fs)
> position,
>
>  block number == i_pos / (logical-blocksize / 32)
>  offset   == i_pos&  (logical-blocksize / 32)
>
> the above position's directory entry contains information for
> problematic file. This is how to use i_pos information.
>
> FWIW, in this error case, the cluster chain in FAT table which is
> pointed by that entry, it has invalid cluster value.
>
> Thanks.

If you would verify my math for me, I would appreciate it.

In this case, my logical block size is 4096, because byte 13 of the 8Gb 
file system is 8, and I take that to be 8 * 512, which is 4096. So:

block_number = 523791 / (4096 / 32) = 4092
offset = 523791 % (4096 / 32) = 15  // I assume you meant modulo in your 
original post, and not binary AND.

So if the block_number is 4092, I would multiply that by 8 (sectors per 
logical block) to get the sector number:
32736

Does the error indicate that sector contains the corrupted data? Or is 
it the sector that contains the information that points to the corrupted 
data? Or is it something entirely different?

-Kai Meyer

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: VFAT i_pos value

2011-12-01 Thread OGAWA Hirofumi
Kai Meyer  writes:

> I'm getting this error:
> FAT: Filesystem error (dev sblsnap0)
>  fat_get_cluster: invalid cluster chain (i_pos 523791)
>
> I'm wondering if there was a way to figure out what sector is causing 
> the error? I would like to try and track down what is changing that 
> sector and fix the problem. Is there a straight forward way to convert 
> i_pos to a sector value? I've been staring at the fat.c and fat.h code 
> all morning, and I'm having trouble grok'ing the flow.

The i_pos means directory entry (contains inode information in unix-fs)
position,

block number == i_pos / (logical-blocksize / 32)
offset   == i_pos & (logical-blocksize / 32)

the above position's directory entry contains information for
problematic file. This is how to use i_pos information.

FWIW, in this error case, the cluster chain in FAT table which is
pointed by that entry, it has invalid cluster value.

Thanks.
-- 
OGAWA Hirofumi 

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Booting root filesystem from usb device

2011-12-01 Thread Ezequiel García


--- El mié 30-nov-11, Greg KH  escribió:

> Then just pass the command line option to sleep for a while
> before
> looking for the root device.  I do that just fine on
> my tiny dns server
> that runs from a USB flash drive.
> 
> Look in Documentation/kernel-parameters.txt for the
> rootdelay= option
> for more details as to what to do.
> 
It worked like a charm. Looking at kernel-parameters.txt, I also 
came across rootwait option. 

If someone reads this and is trying 
something similar (using lilo) you may find this useful:

http://lkml.indiana.edu/hypermail/linux/kernel/1105.2/03866.html

Thanks,
Ezequiel.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: About signal handler install info

2011-12-01 Thread rahul dev
See sigaction.

--- On Thu, 1/12/11, naveen yadav  wrote:

> From: naveen yadav 
> Subject: About signal handler install info
> To: Kernelnewbies@kernelnewbies.org, kernelnewb...@nl.linux.org
> Date: Thursday, 1 December, 2011, 3:33 PM
> Dear All,
> 
> I want to know is there any method/API  to know
> whether there is
> previous signal handler for specific signal no.
> 
> Example:
> 
> In below case  we install 3 handler. So my question is
> if before
> calling signal (SIGUSR1, handler2); is there any way i can
> get info
> that there is "handler1" already install with SIGUSR1.
> 
>         signal (SIGUSR1, handler1);
>         signal (SIGUSR1, handler2);
>         signal (SIGUSR1, handler3);
> 
> #include 
> #include 
> #include 
> #include 
> 
> void *func ();
> 
> void handler1 ()
> {
>         printf ("\nIn handler 1\n");
> }
> 
> void handler2 ()
> {
>         printf ("\nIn handler 2\n");
> }
> 
> void handler3 ()
> { printf ("\nIn handler 3\n"); }
> int main ()
> {
>         int err=-1;
>         pthread_t t1,t2;
> 
> 
>         signal (SIGUSR1, handler1);
>         sleep(5);
>         signal (SIGUSR1, handler2);
>         sleep(5);
>         signal (SIGUSR1, handler3);
>         sleep(5);
>         pthread_create (&t1, NULL,
> &func, NULL);
> 
>         sleep(20);
> 
>         return 0;
> }
> 
> void *func()
> {
>         while (1) usleep(10);
> }
> 
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


About signal handler install info

2011-12-01 Thread naveen yadav
Dear All,

I want to know is there any method/API  to know whether there is
previous signal handler for specific signal no.

Example:

In below case  we install 3 handler. So my question is if before
calling signal (SIGUSR1, handler2); is there any way i can get info
that there is "handler1" already install with SIGUSR1.

signal (SIGUSR1, handler1);
signal (SIGUSR1, handler2);
signal (SIGUSR1, handler3);

#include 
#include 
#include 
#include 

void *func ();

void handler1 ()
{
printf ("\nIn handler 1\n");
}

void handler2 ()
{
printf ("\nIn handler 2\n");
}

void handler3 ()
{ printf ("\nIn handler 3\n"); }
int main ()
{
int err=-1;
pthread_t t1,t2;


signal (SIGUSR1, handler1);
sleep(5);
signal (SIGUSR1, handler2);
sleep(5);
signal (SIGUSR1, handler3);
sleep(5);
pthread_create (&t1, NULL, &func, NULL);

sleep(20);

return 0;
}

void *func()
{
while (1) usleep(10);
}

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies