• FooBarrington@lemmy.world
    link
    fedilink
    arrow-up
    10
    arrow-down
    1
    ·
    5 days ago

    Okay so if the point of the rust for Linux project isn’t to replace c code with rust then what is the point?

    The purpose is to allow new modules to be written in Rust, not to replace C code. Why are you acting like you don’t know this already?

    • Gayhitler@lemmy.ml
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      6
      ·
      5 days ago

      So why can’t rust modules use the c bindings?

      What im building towards is: if r4l isn’t about replacing c code then it doesn’t need to be in the kernel. If its about replacing c code (which it absolutely should be, that’s the whole point of memory safe languages like rust) then r4l people need to have a clear process and understanding of how they expect to accomplish that goal and be open about it.

      • FooBarrington@lemmy.world
        link
        fedilink
        arrow-up
        10
        arrow-down
        2
        ·
        5 days ago

        So why can’t rust modules use the c bindings?

        They can, if wrappers are written. These wrappers were blocked by a maintainer.

        What im building towards is: if r4l isn’t about replacing c code then it doesn’t need to be in the kernel.

        Why? It needs to be in the kernel for new code to get written in Rust. Why can it only be in the kernel if the goal is to replace existing code?

        r4l people need to have a clear process and understanding of how they expect to accomplish that goal and be open about it.

        They do!

        • Gayhitler@lemmy.ml
          link
          fedilink
          English
          arrow-up
          1
          arrow-down
          3
          ·
          5 days ago

          This is where you lose me. I’m not a good programmer or a very smart person, but I have enough experience with c, c++ and rust to know that those wrappers don’t need to be in the kernel if the kernel has c bindings.

          If I were writing something in rust I could just include the r4l wrapper for the kernels c bindings and everything would work fine. The wrapper doesn’t need to be in the kernel.

          There’s a fundamental disconnect here. When people speaking about r4l including official statements from the r4l project say “our plan to add rust, a language intended to address shortcomings of c, to the kernel is only for new code, not a rewrite of existing systems.” I don’t believe them.

          Not only do supporters of and contributors to the r4l project make offhanded remarks about how different things would be better if they were written in rust but if they truly believed in the language’s superiority to c then they would be trying to replace existing c code with rust.

          Then the whole rust using and supporting world melts down when people oppose adding it into an existing huge c codebase.

          Then they all complain that they’re being discriminated against for “nontechnical reasons”, which is becoming a great dog whistle for if you should just disregard someone’s opinion on rust outright.

          Perhaps that explains some of why I don’t believe rust people when they flip out over not being allowed to do the thing that no one else is allowed to do either.

          • FooBarrington@lemmy.world
            link
            fedilink
            arrow-up
            9
            ·
            5 days ago

            but I have enough experience with c, c++ and rust to know that those wrappers don’t need to be in the kernel if the kernel has c bindings.

            I think you have a fundamental misunderstanding of the topic.

            If I were writing something in rust I could just include the r4l wrapper for the kernels c bindings and everything would work fine. The wrapper doesn’t need to be in the kernel.

            We’re talking about device drivers, which are part of the Linux kernel. If you develop these wrappers outside the kernel tree, you’re making the situation even worse, since the kernel suddenly has a new dependency.

            This approach was never considered, even by the maintainers that blocked wrappers, because it would be far worse than every other possibility.

            Instead the question is: does every driver have to include a copy of the wrapper, or can there be one copy that’s used by all the drivers? And obviously one copy makes far more sense than N different copies.

            I’ll skip over the rest of your comment, since it all seems to be built on a broken foundation.

            • Gayhitler@lemmy.ml
              link
              fedilink
              English
              arrow-up
              1
              arrow-down
              3
              ·
              5 days ago

              Yes, literally include the wrapper code in every rust driver that needs it then when you push the wrapper on its own you can say “this code is currently duplicated 900 times because there isn’t a rust wrapper” not “this would make it easier for hypothetical rust drivers that might hypothetically exist in the future” and no one will bat an eye!

              That’s how you get things added to the kernel!

              If it was about adding rust code to the kernel, which is what r4l universally says they’re doing, then they’d be taking that approach instead of farting around with the chicken and egg problem trying to get rust everything first.

              That’s the whole point of the part of my comment that you dismissed out of hand. They’re nearly universally behaving in a way that it takes actual concerted brainpower to read as anything other than duplicitous.

              And then when people say “hey, why don’t you not act like that” you get responses like “Linus said we could!” And “nontechnical nonsense” and “Dino devs”.

              I don’t think that’s a broken foundation.

              • FooBarrington@lemmy.world
                link
                fedilink
                arrow-up
                6
                ·
                edit-2
                5 days ago

                Yes, literally include the wrapper code in every rust driver that needs it then when you push the wrapper on its own you can say “this code is currently duplicated 900 times because there isn’t a rust wrapper” not “this would make it easier for hypothetical rust drivers that might hypothetically exist in the future” and no one will bat an eye!

                That is what they are already doing and it’s introducing unnecessary work! There’s nothing about “hypothetical rust drivers”, it’s the case right now.

                That’s how you get things added to the kernel!

                Weird, how come C drivers don’t have to track these interfaces in their own trees? Why is this the way to get Rust code added to the kernel, but all other code doesn’t have to jump through these hoops?

                • Gayhitler@lemmy.ml
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  arrow-down
                  1
                  ·
                  5 days ago

                  I’m not at a computer with the source on it, so if you get to it before me, how many rust drivers are there? How many that would use the rust dma wrapper?

                  I ask because last year there were relatively few.

                  People writing in c don’t have to use a wrapper because there’s no need to wrap c code for use by other c code.

                  More broadly there are times when duplicated c code has been condensed into a library or something and added to the kernel.

                  • FooBarrington@lemmy.world
                    link
                    fedilink
                    arrow-up
                    5
                    ·
                    5 days ago

                    I’m not at a computer with the source on it, so if you get to it before me, how many rust drivers are there? How many that would use the rust dma wrapper?

                    … of course there aren’t many Rust drivers so far, since the project is still young, and it’s evidently still facing hurdles and not really accepted by everyone. But if there’s already a couple of Rust drivers and Rust has explicitly been accepted into the Kernel, we’re already past your “this would make it easier for hypothetical rust drivers that might hypothetically exist in the future”, so why argue such irrelevant points?

                    More broadly there are times when duplicated c code has been condensed into a library or something and added to the kernel.

                    And that’s what has been blocked here…