Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build error with message: invalid initializer on 4.10.0 version kernel. #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

iysheng
Copy link

@iysheng iysheng commented Sep 27, 2024

Add kernel version compare based on torvalds/linux@2456e85

@stappersg
Copy link
Collaborator

Please do understand there is something as "commit summary" and "commit message".

image

And make the commit message matching the actual change.

image

@iysheng
Copy link
Author

iysheng commented Sep 28, 2024

Please do understand there is something as "commit summary" and "commit message".

image

And make the commit message matching the actual change.

image

  1. Maybe I need to change the commit message later.
  2. As you can see the commit of torvalds/linux@2456e85. The changes of ktime_t type was in v4.10.rc1, so I add a compare with KERNEL_VERSION(4,10,0)。But I found the build error was on a centos 7 PC with kernel 3.10.0 version,Linux localhost.localdomain 3.10.0-1160.71.1.el7.x86_64 #1 SMP Tue Jun 28 15:37:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux I'm so sorry to make this confused misunderstandings。
    image

@stappersg
Copy link
Collaborator

stappersg commented Sep 28, 2024 via email

@stappersg
Copy link
Collaborator

There was an update.

stappers@paddy:~/src/githubforks/tty0tty
$ git show
commit a074fb57e876bb5240d8a85f0ffa99561cf1a412 (HEAD -> mr63, iysheng/master)
Author: iysheng <[email protected]>
Date:   Fri Sep 27 18:36:57 2024 +0000

    Fix build error for kernel < 4.10.0
    
    See https://github.com/torvalds/linux/commit/2456e855354415bfaeb7badaa14e11b3e02c8466
    
    Signed-off-by: iysheng <[email protected]>

diff --git a/module/tty0tty.c b/module/tty0tty.c
index 03a7455..3224675 100644
--- a/module/tty0tty.c
+++ b/module/tty0tty.c
@@ -228,7 +228,11 @@ static int tty0tty_write(struct tty_struct *tty, const unsigned char *buffer,
        int retval = 0;
        struct tty_struct *ttyx = NULL;
        u64 elapsed, delay;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
        ktime_t start_time = ktime_get_ns();
+#else
+       u64 start_time = ktime_get_ns();
+#endif
 
        if (!tty0tty)
                return -ENODEV;
stappers@paddy:~/src/githubforks/tty0tty
$

Now waiting on a new attempt.

@iysheng
Copy link
Author

iysheng commented Sep 28, 2024

There was an update.

stappers@paddy:~/src/githubforks/tty0tty
$ git show
commit a074fb57e876bb5240d8a85f0ffa99561cf1a412 (HEAD -> mr63, iysheng/master)
Author: iysheng <[email protected]>
Date:   Fri Sep 27 18:36:57 2024 +0000

    Fix build error for kernel < 4.10.0
    
    See https://github.com/torvalds/linux/commit/2456e855354415bfaeb7badaa14e11b3e02c8466
    
    Signed-off-by: iysheng <[email protected]>

diff --git a/module/tty0tty.c b/module/tty0tty.c
index 03a7455..3224675 100644
--- a/module/tty0tty.c
+++ b/module/tty0tty.c
@@ -228,7 +228,11 @@ static int tty0tty_write(struct tty_struct *tty, const unsigned char *buffer,
        int retval = 0;
        struct tty_struct *ttyx = NULL;
        u64 elapsed, delay;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
        ktime_t start_time = ktime_get_ns();
+#else
+       u64 start_time = ktime_get_ns();
+#endif
 
        if (!tty0tty)
                return -ENODEV;
stappers@paddy:~/src/githubforks/tty0tty
$

Now waiting on a new attempt.

As you can see, I changed the commit message.😊

@stappersg
Copy link
Collaborator

stappersg commented Sep 28, 2024 via email

@stappersg stappersg changed the title Fix build error with message: invalid initializer on 3.10.0 version kernel. Fix build error with message: invalid initializer on 4.10.0 version kernel. Sep 28, 2024
@iysheng
Copy link
Author

iysheng commented Sep 28, 2024

On Sat, Sep 28, 2024 at 03:49:31AM -0700, Yang sheng wrote: I changed the commit message.😊
Still waiting on a new attempt.

How about the new commit message, I changed again.

@stappersg
Copy link
Collaborator

stappers@paddy:~/src/githubforks/tty0tty
$ git show
commit 0bc63b7602a25d859150cd2373327b0929de8e6b
Author: iysheng <[email protected]>
Date:   Fri Sep 27 18:36:57 2024 +0000

    Fix build error with message: invalid initializer on < 4.10.0 version
    kernel
    
    See https://github.com/torvalds/linux/commit/2456e855354415bfaeb7badaa14e11b3e02c8466
    
    Signed-off-by: iysheng <[email protected]>

diff --git a/module/tty0tty.c b/module/tty0tty.c
index 03a7455..3224675 100644
--- a/module/tty0tty.c
+++ b/module/tty0tty.c
@@ -228,7 +228,11 @@ static int tty0tty_write(struct tty_struct *tty, const unsigned char *buffer,
 	int retval = 0;
 	struct tty_struct *ttyx = NULL;
 	u64 elapsed, delay;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
 	ktime_t start_time = ktime_get_ns();
+#else
+	u64 start_time = ktime_get_ns();
+#endif
 
 	if (!tty0tty)
 		return -ENODEV;
stappers@paddy:~/src/githubforks/tty0tty
$ 

@stappersg
Copy link
Collaborator

stappersg commented Sep 28, 2024 via email

@iysheng
Copy link
Author

iysheng commented Sep 29, 2024

On Sat, Sep 28, 2024 at 06:28:23AM -0700, Geert Stappers wrote:

@.:~/src/githubforks/tty0tty
$ git show
commit 0bc63b7
Author: iysheng @.
>
Date: Fri Sep 27 18:36:57 2024 +0000

Fix build error with message: invalid initializer on < 4.10.0 version
kernel

See https://github.com/torvalds/linux/commit/2456e855354415bfaeb7badaa14e11b3e02c8466

Signed-off-by: iysheng ***@***.***>

diff --git a/module/tty0tty.c b/module/tty0tty.c
index 03a7455..3224675 100644
--- a/module/tty0tty.c
+++ b/module/tty0tty.c
@@ -228,7 +228,11 @@ static int tty0tty_write(struct tty_struct *tty, const unsigned char *buffer,
int retval = 0;
struct tty_struct *ttyx = NULL;
u64 elapsed, delay;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
ktime_t start_time = ktime_get_ns();
+#else

  • u64 start_time = ktime_get_ns();
    +#endif

    if (!tty0tty)
    return -ENODEV;
    @.***:~/src/githubforks/tty0tty
    $

The next attempt has a much better commit message.

Groeten
Geert Stappers

Silence is hard to parse

tks, do you have any better suggestions?

@stappersg
Copy link
Collaborator

stappersg commented Oct 6, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants