msc
msc

Reputation: 34658

error: ‘struct tty_driver’ has no member named ‘write’

I am new to kernel module programming and got some problem while compiling some old kernel code. I am getting following error messages,

 error: ‘struct tty_driver’ has no member named ‘write’
            ((my_tty->driver)->write) (my_tty,0,str,strlen(str));

I checked the tty_driver.h file, there write is defined. So, Whats going on? How can I access in version 3.13.0-24?

My code is here:

void print_string(char *str)
{
      struct tty_struct *my_tty;
      my_tty = get_current_tty();

      if (my_tty != NULL)
      {
             (*(my_tty->driver)->write)(my_tty, 0, str, strlen(str));
      }
}

Thanks in advance..

Upvotes: 0

Views: 2120

Answers (1)

msc
msc

Reputation: 34658

write is indeed defined, but not as members of tty_driver. It is defined as members of tty_operations, and tty_driver has a member ops, a pointer to a const tty_operations.

So, I used my_driver->ops->write instead of my_driver->driver->write.

Upvotes: 1

Related Questions