Tiny Core Base > Final Releases
Tiny Core v12.0
andyj:
@Rich Now that you point it out, yes it does not look like the division is necessary. Based on the surrounding code it is probably for consistency but I could clean it up for speed. There is another further down that I did not post that is used as an argument to some other function so it should stay:
--- Code: ---+ unsigned long x = ktime_get_seconds();
- epoch_min = ktime_get_seconds() / 60;
+ epoch_min = do_div(x, 60);
--- End code ---
@curaga Yes, I believe the time type should be time64_t, but throughout this module long is used so I am going to stick with that.
Rich:
Hi andyj
Forget what I said.
--- Quote from: Rich on February 20, 2021, 02:50:19 PM --- ... if a/c == b/c
to which my response would be:
then a == b ...
--- End quote ---
That's not true for integer math since the remainder gets discarded. I'm guessing the divide by 60 is to convert to
whole minutes and discard any fractional minute.
bela.d:
Hi all,
I get a kernel panic after updating to v12.0 in VirtualBox Version 6.1.18 amd64 (Windows host).
The VM is Tiny Core x86.
Is anybody else using TC x86 in Virtualbox?
andyj:
For the benefit of people who think TC is a minor distro and we can't create change in the world:
--- Quote from: curaga on February 20, 2021, 12:28:35 PM ---That's probably worth submitting upstream...
--- End quote ---
Done: https://www.spinics.net/lists/netfilter-devel/msg70361.html
btlneck:
Hi andyj.
In the original code check peer for NULL prepends peer->login_sec reference.
--- Code: --- static inline bool
has_logged_during_this_minute(const struct peer *peer)
{
- return peer != NULL && peer->login_sec / 60 == ktime_get_seconds() / 60;
+ unsigned long x = ktime_get_seconds();
+ unsigned long y = peer->login_sec;
+ return peer != NULL && do_div(y, 60) == do_div(x, 60);
}
--- End code ---
Excuse me for maybe stupid question, but if the
peer == NULL
whould this code work:
unsigned long y = peer->login_sec;
?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version