ext2_find_near()

2012-11-13 Thread Anders Lind
Hi all,

Sorry to bother.
for ext2_find_near(), why we tro to find near block by tring priveous block? 
Why not forward?


static ext2_fsblk_t ext2_find_near(struct inode *inode, Indirect *ind)
{
    struct ext2_inode_info *ei = EXT2_I(inode);
    __le32 *start = ind->bh ? (__le32 *) ind->bh->b_data : ei->i_data;
    __le32 *p;
    ext2_fsblk_t bg_start;
    ext2_fsblk_t colour;

    /* Try to find previous block */
    for (p = ind->p - 1; p >= start; p--)
        if (*p)
            return le32_to_cpu(*p);

    /* No such thing, so let's try location of indirect block */
    if (ind->bh)
        return ind->bh->b_blocknr;






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


[junk] newbie test.

2012-11-13 Thread xu wang
test

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


Re: GPIO Watchdog device driver

2012-11-13 Thread anish singh
On Tue, Nov 13, 2012 at 9:03 AM, Mulyadi Santosa
 wrote:
> On Tue, Nov 13, 2012 at 10:37 PM, Andreas Schmidt
>  wrote:
>> Hi all,
>> I wrote a GPIO watchdog for a extern simple watchdog (LTC2917). It is a
>> voltage supervisor with watchdog timer functionality. Do you think
>> should I send this to maintainer? Could it be usefull for somebody else?
You can put it in staging directory if you suspect the code quality
and if someone
is looking for some kernel work they will definitely add the bells and
whistles so
that it can be mainlined.
I do think that you should just send the driver code to LKML.You will
definitely get
more responses and the right way of mainlining it.
>
> I am not familiar with Watchdog stuffs, but I think it might worth a
> shot if you try to send it to the maintainer.
>
> As long as you are descriptive enough when explaining about the
> patches, follow the patch sending's rules, I think it is likely to be
> accepted.
> --
> 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

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


Re: Callback function from kernel module

2012-11-13 Thread Anand Moon
Hi all,
 
You cand find number of example on how to use send_sig_info api.
 
please follow this link : 
http://lxr.linux.no/linux+v3.6.6/kernel/pid_namespace.c#L179
 
 
Regarding this warning

jeshwanth@jeshwanth:~/linux/kernel_user_space/code/signals$ make
make -C /lib/modules/3.0.0-26-generic-pae/build 
M=/home/jeshwanth/linux/kernel_user_space/code/signals modules
make[1]: Entering directory `/usr/src/linux-headers-3.0.0-26-generic-pae'
Building modules, stage 2.
MODPOST 1 modules
WARNING: "find_task_by_vpid" 
[/home/jeshwanth/linux/kernel_user_space/code/signals/signal_kernel.ko] 
undefined!
make[1]: Leaving directory `/usr/src/linux-headers-3.0.0-26-generic-pae'
[1]+  Donegedit signal_kernel.c

install Command:
root@jeshwanth:/home/jeshwanth/linux/kernel_user_space/code/signals# insmod 
signal_kernel.ko 
insmod: error inserting 'signal_kernel.ko': -1 Unknown symbol in module

/proc/kallsyms:

 T find_task_by_pid_ns
 T find_task_by_vpid

 

you need the export these functions so that you can use then in your module.
 
 
-Anand Moon
  


 From: Jeshwanth Kumar N K Jeshu 
To: SaNtosh kuLkarni ; moon.li...@yahoo.com 
Cc: Bernd Petrovitsch ; 
kernelnewbies@kernelnewbies.org 
Sent: Saturday, November 10, 2012 1:47 PM
Subject: Re: Callback function from kernel module
  

Hello Santosh and Anand,

Thanks for the reply and very good suggestions.

As Anand Moon 
suggestedhttp://people.ee.ethz.ch/%7Earkeller/linux/multi/kernel_user_space_howto-3.html
 

link in 
http://lists.kernelnewbies.org/pipermail/kernelnewbies/2012-November/006489.html
 previous thread, 
I read all the kernel to user space communication mechanism ( ExceptUpcall , ll 
read it). As of now for my application,
the signals passing from kernel to user space is enough. I was trying the 
sample code provided in  signals section of above link.

1. In the code he used find_task_by_pid_type, but find_task_by_pid_type not 
available in sched.h. So I have changed it to 
find_task_by_vpid(pid), is this right way ?

2. I tried to install the module but it is not finding the symbol, but the 
symbol is present in /proc/kallsyms.

Anything I am missing while compiling ? as I am getting warning.


Compile:

jeshwanth@jeshwanth:~/linux/kernel_user_space/code/signals$ make
make -C /lib/modules/3.0.0-26-generic-pae/build 
M=/home/jeshwanth/linux/kernel_user_space/code/signals modules
make[1]: Entering directory `/usr/src/linux-headers-3.0.0-26-generic-pae'
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: "find_task_by_vpid" 
[/home/jeshwanth/linux/kernel_user_space/code/signals/signal_kernel.ko] 
undefined!
make[1]: Leaving directory `/usr/src/linux-headers-3.0.0-26-generic-pae'
[1]+  Done    gedit signal_kernel.c

install Command:
root@jeshwanth:/home/jeshwanth/linux/kernel_user_space/code/signals# insmod 
signal_kernel.ko 
insmod: error inserting 'signal_kernel.ko': -1 Unknown symbol in module

/proc/kallsyms:

 T find_task_by_pid_ns
 T find_task_by_vpid

dmesg:
[15012.556740] signal_kernel: Unknown symbol find_task_by_vpid (err 0)

Code:
#include 
#include 
#include 
#include     //siginfo
#include     //rcu_read_lock
#include     //find_task_by_pid_type
#include 
#include 


#define SIG_TEST 44    // we choose 44 as our signal number (real-time signals 
are in the range of 33 to 64)

struct dentry *file;

static ssize_t write_pid(struct file *file, const char __user *buf,
    size_t count, loff_t *ppos)
{
    char mybuf[10];
    int pid = 0;
    int ret;
    struct siginfo info;
    struct task_struct *t;
    /* read the value from user space */
    if(count > 10)
        return -EINVAL;
    copy_from_user(mybuf, buf, count);
    sscanf(mybuf, "%d", &pid);
    printk("pid = %d\n", pid);

    /* send the signal */
    memset(&info, 0, sizeof(struct siginfo));
    info.si_signo = SIG_TEST;
    info.si_code = SI_QUEUE;    // this is bit of a trickery: SI_QUEUE is 
normally used by sigqueue from user space,
                    // and kernel space should use SI_KERNEL. But if SI_KERNEL 
is used the real_time data 
                    // is not delivered to the user space signal handler 
function. 
    info.si_int = 1234;          //real time signals may have 32 bits of data.

    rcu_read_lock();
    //t = find_task_by_pid_type(PIDTYPE_PID, pid);  //find the task_struct 
associated with this pid
    t = find_task_by_vpid(pid);
    if(t == NULL){
        printk("no such pid\n");
        rcu_read_unlock();
        return -ENODEV;
    }
    rcu_read_unlock();
    ret = send_sig_info(SIG_TEST, &info, t);    //send the signal
    if (ret < 0) {
        printk("error sending signal\n");
        return ret;
    }
    return count;
}

static const struct file_operations my_fops 

Re: GPIO Watchdog device driver

2012-11-13 Thread Mulyadi Santosa
On Tue, Nov 13, 2012 at 10:37 PM, Andreas Schmidt
 wrote:
> Hi all,
> I wrote a GPIO watchdog for a extern simple watchdog (LTC2917). It is a
> voltage supervisor with watchdog timer functionality. Do you think
> should I send this to maintainer? Could it be usefull for somebody else?

I am not familiar with Watchdog stuffs, but I think it might worth a
shot if you try to send it to the maintainer.

As long as you are descriptive enough when explaining about the
patches, follow the patch sending's rules, I think it is likely to be
accepted.
-- 
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


Manually accessing file contents from bprm->file

2012-11-13 Thread stl
Hello,
I  am trying to boot a custom linux-2.6.37 port, but I am stuck at the
point where the kernel launches /init executable (since the initial
filesystem was mounted with initramfs support).

After investigations, it appears that a problem occurs during
prepare_binprm() function.
This function is responsible for copying the 128 bytes header of the
executable to bprm->buf.

However in my case, bprm->buf is filled with zeroes after this step.

The kernel_read() function receives bprm->buf and bprm->file as operand.

So the address in memory (in the initramfs) of the executable should be
accessible from bprm->file (file object of /init).

My question is:
How can I manually (e.g. in the debugger) access the contents of the /init
file (stored in memory, in the initramfs), from the bprm->file structure?
(I'd like to check the data structures are in good shape and correctly
point to the /init contents).

Thanks in advance for your help.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


GPIO Watchdog device driver

2012-11-13 Thread Andreas Schmidt
Hi all,
I wrote a GPIO watchdog for a extern simple watchdog (LTC2917). It is a
voltage supervisor with watchdog timer functionality. Do you think
should I send this to maintainer? Could it be usefull for somebody else?

Thanks

Andreas

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


Re: Linux stable test kernels

2012-11-13 Thread Peter Senna Tschudin
On Tue, Nov 13, 2012 at 11:31 AM, Luis R. Rodriguez
 wrote:
> On Tue, Nov 13, 2012 at 2:28 AM, WANG Chao  wrote:
>> On 11/13/2012 05:36 PM, Peter Senna Tschudin wrote:
>>> Dear list,
>>>
>>> Where / how can I get latest Linux stable test kernels like
>>> 3.0.51-rc1, 3.4.18-rc1, and 3.6.6-rc1?
>>>
>>
>> http://www.kernel.org/
>
> To be more exact:
>
> http://www.kernel.org/pub/linux/kernel/v3.x/stable-review/

Thank you!

>
>   Luis



--
Peter

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


Re: Linux stable test kernels

2012-11-13 Thread Luis R. Rodriguez
On Tue, Nov 13, 2012 at 2:28 AM, WANG Chao  wrote:
> On 11/13/2012 05:36 PM, Peter Senna Tschudin wrote:
>> Dear list,
>>
>> Where / how can I get latest Linux stable test kernels like
>> 3.0.51-rc1, 3.4.18-rc1, and 3.6.6-rc1?
>>
>
> http://www.kernel.org/

To be more exact:

http://www.kernel.org/pub/linux/kernel/v3.x/stable-review/

  Luis

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


Re: Linux stable test kernels

2012-11-13 Thread WANG Chao
On 11/13/2012 05:36 PM, Peter Senna Tschudin wrote:
> Dear list,
> 
> Where / how can I get latest Linux stable test kernels like
> 3.0.51-rc1, 3.4.18-rc1, and 3.6.6-rc1?
> 

http://www.kernel.org/

> Thanks,
> 
> Peter
> 
> --
> Peter
> 
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 


-- 
Thanks,
WANG Chao

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


Linux stable test kernels

2012-11-13 Thread Peter Senna Tschudin
Dear list,

Where / how can I get latest Linux stable test kernels like
3.0.51-rc1, 3.4.18-rc1, and 3.6.6-rc1?

Thanks,

Peter

--
Peter

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