How do I implement a file system driver driver in Linux?2019 Community Moderator ElectionHow does one install a camera driver from a c file, and what is this driver doing?what is the difference between Device driver and kernel moduledoes a user program always use system calls to access a device driverDevice files and drivers of a disk, partition, and filesystem?How to find the driver (module) associated with SATA device on Linux?Where does a device file come from?How is a wifi driver exposed to userspace?Locating kernel module from device node major, minor numberinteracting with kernel modules without giving users sudo access?How to check if a given driver kernel module supports a given device?

Could solar power be utilized and substitute coal in the 19th Century

Create all possible words using a set or letters

Has Darkwing Duck ever met Scrooge McDuck?

My friend sent me a screenshot of a transaction hash, but when I search for it I find divergent data. What happened?

Did US corporations pay demonstrators in the German demonstrations against article 13?

Gibbs free energy in standard state vs. equilibrium

Why do IPv6 unique local addresses have to have a /48 prefix?

Can someone explain how this makes sense electrically?

Are lightweight LN wallets vulnerable to transaction withholding?

Journal losing indexing services

Why did the EU agree to delay the Brexit deadline?

Can a significant change in incentives void an employment contract?

Transformation of random variables and joint distributions

How to express sadness?

Varistor? Purpose and principle

MAXDOP Settings for SQL Server 2014

How can Trident be so inexpensive? Will it orbit Triton or just do a (slow) flyby?

Global amount of publications over time

On a tidally locked planet, would time be quantized?

We have a love-hate relationship

Does having a TSA Pre-Check member in your flight reservation increase the chances that everyone gets Pre-Check?

Freedom of speech and where it applies

Is it improper etiquette to ask your opponent what his/her rating is before the game?

How do I implement a file system driver driver in Linux?



How do I implement a file system driver driver in Linux?



2019 Community Moderator ElectionHow does one install a camera driver from a c file, and what is this driver doing?what is the difference between Device driver and kernel moduledoes a user program always use system calls to access a device driverDevice files and drivers of a disk, partition, and filesystem?How to find the driver (module) associated with SATA device on Linux?Where does a device file come from?How is a wifi driver exposed to userspace?Locating kernel module from device node major, minor numberinteracting with kernel modules without giving users sudo access?How to check if a given driver kernel module supports a given device?










7















Assume that I have invented a new file system, and now I want to create a file system driver for it.



How would I implement this file system driver, is this done using a kernel module?



And how can the file system driver access the hard disk, should the file system driver contain code to access the hard disk, or does Linux contain a device driver to access the hard disk that is used by all the file system drivers?










share|improve this question









New contributor




user343344 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Title doesn't match with body, also this is asking for tutorial.

    – 炸鱼薯条德里克
    12 hours ago















7















Assume that I have invented a new file system, and now I want to create a file system driver for it.



How would I implement this file system driver, is this done using a kernel module?



And how can the file system driver access the hard disk, should the file system driver contain code to access the hard disk, or does Linux contain a device driver to access the hard disk that is used by all the file system drivers?










share|improve this question









New contributor




user343344 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Title doesn't match with body, also this is asking for tutorial.

    – 炸鱼薯条德里克
    12 hours ago













7












7








7


1






Assume that I have invented a new file system, and now I want to create a file system driver for it.



How would I implement this file system driver, is this done using a kernel module?



And how can the file system driver access the hard disk, should the file system driver contain code to access the hard disk, or does Linux contain a device driver to access the hard disk that is used by all the file system drivers?










share|improve this question









New contributor




user343344 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












Assume that I have invented a new file system, and now I want to create a file system driver for it.



How would I implement this file system driver, is this done using a kernel module?



And how can the file system driver access the hard disk, should the file system driver contain code to access the hard disk, or does Linux contain a device driver to access the hard disk that is used by all the file system drivers?







linux filesystems drivers






share|improve this question









New contributor




user343344 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




user343344 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago









Gilles

544k12811011619




544k12811011619






New contributor




user343344 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 12 hours ago









user343344user343344

361




361




New contributor




user343344 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user343344 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user343344 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Title doesn't match with body, also this is asking for tutorial.

    – 炸鱼薯条德里克
    12 hours ago

















  • Title doesn't match with body, also this is asking for tutorial.

    – 炸鱼薯条德里克
    12 hours ago
















Title doesn't match with body, also this is asking for tutorial.

– 炸鱼薯条德里克
12 hours ago





Title doesn't match with body, also this is asking for tutorial.

– 炸鱼薯条德里克
12 hours ago










4 Answers
4






active

oldest

votes


















11














Yes, filesystems in Linux can be implemented as kernel modules. But there is also the FUSE (Filesystem in USErspace) interface, which can allow a regular user-space process to act as a filesystem driver. If you're prototyping a new filesystem, implementing it first using the FUSE interface could make the testing and development easier. Once you have the internals of the filesystem worked out in FUSE form, you might then start implementing a performance-optimized kernel module version of it.



Here's some basic information on implementing a filesystem within kernel space. It's rather old (from 1996!), but that should at least give you a basic idea for the kind of things you'll need to do.



If you choose to go to the FUSE route, here's libfuse, the reference implementation of the userspace side of the FUSE interface.



Filesystem driver as a kernel module



Basically, the initialization function of your filesystem driver module needs just to call a register_filesystem() function, and give it as a parameter a structure that includes a function pointer that identifies the function in your filesystem driver that will be used as the first step in identifying your filesystem type and mounting it. Nothing more happens at that stage.



When a filesystem is being mounted, and either the filesystem type is specified to match your driver, or filesystem type auto-detection is being performed, the kernel's Virtual FileSystem (VFS for short) layer will call that function. It basically says "Here's a pointer to a kernel-level representation of a standard Linux block device. Take a look at it, see if it's something you can handle, and then tell me what you can do with it."



At that point, your driver is supposed to read whatever it needs to verify it's the right driver for the filesystem, and then return a structure that includes pointers to further functions your driver can do with that particular filesystem. Or if the filesystem driver does not recognize the data on the disk, it is supposed to return an appropriate error result, and then VFS will either report a failure to userspace or - if filesystem type auto-detection is being performed - will ask another filesystem driver to try.



The other drivers in the kernel will provide the standard block device interface, so the filesystem driver won't have to implement hardware support. Basically, the filesystem driver can read and write disk blocks using standard kernel-level functions with the device pointer given to it.



The VFS layer expects the filesystem driver to make a number of standard functions available to the VFS layer; a few of these are mandatory in order for the VFS layer to do anything meaningful with the filesystem, others are optional and you can just return a NULL in place of a pointer to such an optional function.






share|improve this answer

























  • This is a pretty good answer though to fully answer the question as stated you'd also need to say a bit about the functionality the block device layer provides for the file system layer to build upon.

    – kasperd
    4 hours ago











  • I sort of alluded to that with the "here's a pointer to a standard block device" bit, but good point; I expanded on that.

    – telcoM
    3 hours ago











  • This answer, specifically the description of what happens in what order, is divine. Is there some sort of book/website I could read that has descriptions like that for all of "how linux works"?

    – Adam Barnes
    1 hour ago











  • You might be interested in Linux Kernel Internals or Linux Device Drivers, 3rd Edition. And of course, there's the option of reading the actual source code.

    – telcoM
    1 hour ago



















2














Yes a kernel driver can manage a file-system .



The best solution to mock up , prototype a file-system is to use FUSE . And after you can think about transform it into a kernel driver .



Wikipedia =>
https://en.wikipedia.org/wiki/Filesystem_in_Userspace



Source => https://github.com/libfuse/libfuse



a tutorial => https://developer.ibm.com/articles/l-fuse/






share|improve this answer






























    0














    Yes this would typically be done using a kernel driver that can either be loaded as a kernel module or compiled into the kernel.



    You can check out similar filesystem drivers and how they work here.



    These drivers likely use internal kernel functions to access storage devices as blocks of bytes but you could also use blockdevices as exposed by drivers in the block devices and character devices folders.






    share|improve this answer








    New contributor




    Erik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.



























      0














      You can use fuse, to make a user-land file-system, or write a kernel module.
      It is easier to do with fuse, as you have a choice of languages, and won't crash the kernel (and therefore the whole system).



      Kernel modules can be faster, but the first rule of optimisation is: Don't do it until you have tested working code. The second is like it: Don't do it until you have evidence that it is too slow. And the third: Don't keep it unless you have evidence that it makes it faster/smaller.



      And yes the kernel already has drivers for the hardware, you don't re-implement them.






      share|improve this answer























      • There are major downsides to FUSE other than performance: it's hard to use it for your root filesystem. (Maybe possible with an initrd, but the FUSE binary couldn't be freed after booting because it would still be executing from the ramdisk.)

        – Peter Cordes
        6 hours ago










      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );






      user343344 is a new contributor. Be nice, and check out our Code of Conduct.









      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508314%2fhow-do-i-implement-a-file-system-driver-driver-in-linux%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      11














      Yes, filesystems in Linux can be implemented as kernel modules. But there is also the FUSE (Filesystem in USErspace) interface, which can allow a regular user-space process to act as a filesystem driver. If you're prototyping a new filesystem, implementing it first using the FUSE interface could make the testing and development easier. Once you have the internals of the filesystem worked out in FUSE form, you might then start implementing a performance-optimized kernel module version of it.



      Here's some basic information on implementing a filesystem within kernel space. It's rather old (from 1996!), but that should at least give you a basic idea for the kind of things you'll need to do.



      If you choose to go to the FUSE route, here's libfuse, the reference implementation of the userspace side of the FUSE interface.



      Filesystem driver as a kernel module



      Basically, the initialization function of your filesystem driver module needs just to call a register_filesystem() function, and give it as a parameter a structure that includes a function pointer that identifies the function in your filesystem driver that will be used as the first step in identifying your filesystem type and mounting it. Nothing more happens at that stage.



      When a filesystem is being mounted, and either the filesystem type is specified to match your driver, or filesystem type auto-detection is being performed, the kernel's Virtual FileSystem (VFS for short) layer will call that function. It basically says "Here's a pointer to a kernel-level representation of a standard Linux block device. Take a look at it, see if it's something you can handle, and then tell me what you can do with it."



      At that point, your driver is supposed to read whatever it needs to verify it's the right driver for the filesystem, and then return a structure that includes pointers to further functions your driver can do with that particular filesystem. Or if the filesystem driver does not recognize the data on the disk, it is supposed to return an appropriate error result, and then VFS will either report a failure to userspace or - if filesystem type auto-detection is being performed - will ask another filesystem driver to try.



      The other drivers in the kernel will provide the standard block device interface, so the filesystem driver won't have to implement hardware support. Basically, the filesystem driver can read and write disk blocks using standard kernel-level functions with the device pointer given to it.



      The VFS layer expects the filesystem driver to make a number of standard functions available to the VFS layer; a few of these are mandatory in order for the VFS layer to do anything meaningful with the filesystem, others are optional and you can just return a NULL in place of a pointer to such an optional function.






      share|improve this answer

























      • This is a pretty good answer though to fully answer the question as stated you'd also need to say a bit about the functionality the block device layer provides for the file system layer to build upon.

        – kasperd
        4 hours ago











      • I sort of alluded to that with the "here's a pointer to a standard block device" bit, but good point; I expanded on that.

        – telcoM
        3 hours ago











      • This answer, specifically the description of what happens in what order, is divine. Is there some sort of book/website I could read that has descriptions like that for all of "how linux works"?

        – Adam Barnes
        1 hour ago











      • You might be interested in Linux Kernel Internals or Linux Device Drivers, 3rd Edition. And of course, there's the option of reading the actual source code.

        – telcoM
        1 hour ago
















      11














      Yes, filesystems in Linux can be implemented as kernel modules. But there is also the FUSE (Filesystem in USErspace) interface, which can allow a regular user-space process to act as a filesystem driver. If you're prototyping a new filesystem, implementing it first using the FUSE interface could make the testing and development easier. Once you have the internals of the filesystem worked out in FUSE form, you might then start implementing a performance-optimized kernel module version of it.



      Here's some basic information on implementing a filesystem within kernel space. It's rather old (from 1996!), but that should at least give you a basic idea for the kind of things you'll need to do.



      If you choose to go to the FUSE route, here's libfuse, the reference implementation of the userspace side of the FUSE interface.



      Filesystem driver as a kernel module



      Basically, the initialization function of your filesystem driver module needs just to call a register_filesystem() function, and give it as a parameter a structure that includes a function pointer that identifies the function in your filesystem driver that will be used as the first step in identifying your filesystem type and mounting it. Nothing more happens at that stage.



      When a filesystem is being mounted, and either the filesystem type is specified to match your driver, or filesystem type auto-detection is being performed, the kernel's Virtual FileSystem (VFS for short) layer will call that function. It basically says "Here's a pointer to a kernel-level representation of a standard Linux block device. Take a look at it, see if it's something you can handle, and then tell me what you can do with it."



      At that point, your driver is supposed to read whatever it needs to verify it's the right driver for the filesystem, and then return a structure that includes pointers to further functions your driver can do with that particular filesystem. Or if the filesystem driver does not recognize the data on the disk, it is supposed to return an appropriate error result, and then VFS will either report a failure to userspace or - if filesystem type auto-detection is being performed - will ask another filesystem driver to try.



      The other drivers in the kernel will provide the standard block device interface, so the filesystem driver won't have to implement hardware support. Basically, the filesystem driver can read and write disk blocks using standard kernel-level functions with the device pointer given to it.



      The VFS layer expects the filesystem driver to make a number of standard functions available to the VFS layer; a few of these are mandatory in order for the VFS layer to do anything meaningful with the filesystem, others are optional and you can just return a NULL in place of a pointer to such an optional function.






      share|improve this answer

























      • This is a pretty good answer though to fully answer the question as stated you'd also need to say a bit about the functionality the block device layer provides for the file system layer to build upon.

        – kasperd
        4 hours ago











      • I sort of alluded to that with the "here's a pointer to a standard block device" bit, but good point; I expanded on that.

        – telcoM
        3 hours ago











      • This answer, specifically the description of what happens in what order, is divine. Is there some sort of book/website I could read that has descriptions like that for all of "how linux works"?

        – Adam Barnes
        1 hour ago











      • You might be interested in Linux Kernel Internals or Linux Device Drivers, 3rd Edition. And of course, there's the option of reading the actual source code.

        – telcoM
        1 hour ago














      11












      11








      11







      Yes, filesystems in Linux can be implemented as kernel modules. But there is also the FUSE (Filesystem in USErspace) interface, which can allow a regular user-space process to act as a filesystem driver. If you're prototyping a new filesystem, implementing it first using the FUSE interface could make the testing and development easier. Once you have the internals of the filesystem worked out in FUSE form, you might then start implementing a performance-optimized kernel module version of it.



      Here's some basic information on implementing a filesystem within kernel space. It's rather old (from 1996!), but that should at least give you a basic idea for the kind of things you'll need to do.



      If you choose to go to the FUSE route, here's libfuse, the reference implementation of the userspace side of the FUSE interface.



      Filesystem driver as a kernel module



      Basically, the initialization function of your filesystem driver module needs just to call a register_filesystem() function, and give it as a parameter a structure that includes a function pointer that identifies the function in your filesystem driver that will be used as the first step in identifying your filesystem type and mounting it. Nothing more happens at that stage.



      When a filesystem is being mounted, and either the filesystem type is specified to match your driver, or filesystem type auto-detection is being performed, the kernel's Virtual FileSystem (VFS for short) layer will call that function. It basically says "Here's a pointer to a kernel-level representation of a standard Linux block device. Take a look at it, see if it's something you can handle, and then tell me what you can do with it."



      At that point, your driver is supposed to read whatever it needs to verify it's the right driver for the filesystem, and then return a structure that includes pointers to further functions your driver can do with that particular filesystem. Or if the filesystem driver does not recognize the data on the disk, it is supposed to return an appropriate error result, and then VFS will either report a failure to userspace or - if filesystem type auto-detection is being performed - will ask another filesystem driver to try.



      The other drivers in the kernel will provide the standard block device interface, so the filesystem driver won't have to implement hardware support. Basically, the filesystem driver can read and write disk blocks using standard kernel-level functions with the device pointer given to it.



      The VFS layer expects the filesystem driver to make a number of standard functions available to the VFS layer; a few of these are mandatory in order for the VFS layer to do anything meaningful with the filesystem, others are optional and you can just return a NULL in place of a pointer to such an optional function.






      share|improve this answer















      Yes, filesystems in Linux can be implemented as kernel modules. But there is also the FUSE (Filesystem in USErspace) interface, which can allow a regular user-space process to act as a filesystem driver. If you're prototyping a new filesystem, implementing it first using the FUSE interface could make the testing and development easier. Once you have the internals of the filesystem worked out in FUSE form, you might then start implementing a performance-optimized kernel module version of it.



      Here's some basic information on implementing a filesystem within kernel space. It's rather old (from 1996!), but that should at least give you a basic idea for the kind of things you'll need to do.



      If you choose to go to the FUSE route, here's libfuse, the reference implementation of the userspace side of the FUSE interface.



      Filesystem driver as a kernel module



      Basically, the initialization function of your filesystem driver module needs just to call a register_filesystem() function, and give it as a parameter a structure that includes a function pointer that identifies the function in your filesystem driver that will be used as the first step in identifying your filesystem type and mounting it. Nothing more happens at that stage.



      When a filesystem is being mounted, and either the filesystem type is specified to match your driver, or filesystem type auto-detection is being performed, the kernel's Virtual FileSystem (VFS for short) layer will call that function. It basically says "Here's a pointer to a kernel-level representation of a standard Linux block device. Take a look at it, see if it's something you can handle, and then tell me what you can do with it."



      At that point, your driver is supposed to read whatever it needs to verify it's the right driver for the filesystem, and then return a structure that includes pointers to further functions your driver can do with that particular filesystem. Or if the filesystem driver does not recognize the data on the disk, it is supposed to return an appropriate error result, and then VFS will either report a failure to userspace or - if filesystem type auto-detection is being performed - will ask another filesystem driver to try.



      The other drivers in the kernel will provide the standard block device interface, so the filesystem driver won't have to implement hardware support. Basically, the filesystem driver can read and write disk blocks using standard kernel-level functions with the device pointer given to it.



      The VFS layer expects the filesystem driver to make a number of standard functions available to the VFS layer; a few of these are mandatory in order for the VFS layer to do anything meaningful with the filesystem, others are optional and you can just return a NULL in place of a pointer to such an optional function.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited 3 hours ago

























      answered 11 hours ago









      telcoMtelcoM

      19.8k12450




      19.8k12450












      • This is a pretty good answer though to fully answer the question as stated you'd also need to say a bit about the functionality the block device layer provides for the file system layer to build upon.

        – kasperd
        4 hours ago











      • I sort of alluded to that with the "here's a pointer to a standard block device" bit, but good point; I expanded on that.

        – telcoM
        3 hours ago











      • This answer, specifically the description of what happens in what order, is divine. Is there some sort of book/website I could read that has descriptions like that for all of "how linux works"?

        – Adam Barnes
        1 hour ago











      • You might be interested in Linux Kernel Internals or Linux Device Drivers, 3rd Edition. And of course, there's the option of reading the actual source code.

        – telcoM
        1 hour ago


















      • This is a pretty good answer though to fully answer the question as stated you'd also need to say a bit about the functionality the block device layer provides for the file system layer to build upon.

        – kasperd
        4 hours ago











      • I sort of alluded to that with the "here's a pointer to a standard block device" bit, but good point; I expanded on that.

        – telcoM
        3 hours ago











      • This answer, specifically the description of what happens in what order, is divine. Is there some sort of book/website I could read that has descriptions like that for all of "how linux works"?

        – Adam Barnes
        1 hour ago











      • You might be interested in Linux Kernel Internals or Linux Device Drivers, 3rd Edition. And of course, there's the option of reading the actual source code.

        – telcoM
        1 hour ago

















      This is a pretty good answer though to fully answer the question as stated you'd also need to say a bit about the functionality the block device layer provides for the file system layer to build upon.

      – kasperd
      4 hours ago





      This is a pretty good answer though to fully answer the question as stated you'd also need to say a bit about the functionality the block device layer provides for the file system layer to build upon.

      – kasperd
      4 hours ago













      I sort of alluded to that with the "here's a pointer to a standard block device" bit, but good point; I expanded on that.

      – telcoM
      3 hours ago





      I sort of alluded to that with the "here's a pointer to a standard block device" bit, but good point; I expanded on that.

      – telcoM
      3 hours ago













      This answer, specifically the description of what happens in what order, is divine. Is there some sort of book/website I could read that has descriptions like that for all of "how linux works"?

      – Adam Barnes
      1 hour ago





      This answer, specifically the description of what happens in what order, is divine. Is there some sort of book/website I could read that has descriptions like that for all of "how linux works"?

      – Adam Barnes
      1 hour ago













      You might be interested in Linux Kernel Internals or Linux Device Drivers, 3rd Edition. And of course, there's the option of reading the actual source code.

      – telcoM
      1 hour ago






      You might be interested in Linux Kernel Internals or Linux Device Drivers, 3rd Edition. And of course, there's the option of reading the actual source code.

      – telcoM
      1 hour ago














      2














      Yes a kernel driver can manage a file-system .



      The best solution to mock up , prototype a file-system is to use FUSE . And after you can think about transform it into a kernel driver .



      Wikipedia =>
      https://en.wikipedia.org/wiki/Filesystem_in_Userspace



      Source => https://github.com/libfuse/libfuse



      a tutorial => https://developer.ibm.com/articles/l-fuse/






      share|improve this answer



























        2














        Yes a kernel driver can manage a file-system .



        The best solution to mock up , prototype a file-system is to use FUSE . And after you can think about transform it into a kernel driver .



        Wikipedia =>
        https://en.wikipedia.org/wiki/Filesystem_in_Userspace



        Source => https://github.com/libfuse/libfuse



        a tutorial => https://developer.ibm.com/articles/l-fuse/






        share|improve this answer

























          2












          2








          2







          Yes a kernel driver can manage a file-system .



          The best solution to mock up , prototype a file-system is to use FUSE . And after you can think about transform it into a kernel driver .



          Wikipedia =>
          https://en.wikipedia.org/wiki/Filesystem_in_Userspace



          Source => https://github.com/libfuse/libfuse



          a tutorial => https://developer.ibm.com/articles/l-fuse/






          share|improve this answer













          Yes a kernel driver can manage a file-system .



          The best solution to mock up , prototype a file-system is to use FUSE . And after you can think about transform it into a kernel driver .



          Wikipedia =>
          https://en.wikipedia.org/wiki/Filesystem_in_Userspace



          Source => https://github.com/libfuse/libfuse



          a tutorial => https://developer.ibm.com/articles/l-fuse/







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 11 hours ago









          EchoMike444EchoMike444

          1,0305




          1,0305





















              0














              Yes this would typically be done using a kernel driver that can either be loaded as a kernel module or compiled into the kernel.



              You can check out similar filesystem drivers and how they work here.



              These drivers likely use internal kernel functions to access storage devices as blocks of bytes but you could also use blockdevices as exposed by drivers in the block devices and character devices folders.






              share|improve this answer








              New contributor




              Erik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.
























                0














                Yes this would typically be done using a kernel driver that can either be loaded as a kernel module or compiled into the kernel.



                You can check out similar filesystem drivers and how they work here.



                These drivers likely use internal kernel functions to access storage devices as blocks of bytes but you could also use blockdevices as exposed by drivers in the block devices and character devices folders.






                share|improve this answer








                New contributor




                Erik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






















                  0












                  0








                  0







                  Yes this would typically be done using a kernel driver that can either be loaded as a kernel module or compiled into the kernel.



                  You can check out similar filesystem drivers and how they work here.



                  These drivers likely use internal kernel functions to access storage devices as blocks of bytes but you could also use blockdevices as exposed by drivers in the block devices and character devices folders.






                  share|improve this answer








                  New contributor




                  Erik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  Yes this would typically be done using a kernel driver that can either be loaded as a kernel module or compiled into the kernel.



                  You can check out similar filesystem drivers and how they work here.



                  These drivers likely use internal kernel functions to access storage devices as blocks of bytes but you could also use blockdevices as exposed by drivers in the block devices and character devices folders.







                  share|improve this answer








                  New contributor




                  Erik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer






                  New contributor




                  Erik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 12 hours ago









                  ErikErik

                  31




                  31




                  New contributor




                  Erik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  Erik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  Erik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





















                      0














                      You can use fuse, to make a user-land file-system, or write a kernel module.
                      It is easier to do with fuse, as you have a choice of languages, and won't crash the kernel (and therefore the whole system).



                      Kernel modules can be faster, but the first rule of optimisation is: Don't do it until you have tested working code. The second is like it: Don't do it until you have evidence that it is too slow. And the third: Don't keep it unless you have evidence that it makes it faster/smaller.



                      And yes the kernel already has drivers for the hardware, you don't re-implement them.






                      share|improve this answer























                      • There are major downsides to FUSE other than performance: it's hard to use it for your root filesystem. (Maybe possible with an initrd, but the FUSE binary couldn't be freed after booting because it would still be executing from the ramdisk.)

                        – Peter Cordes
                        6 hours ago















                      0














                      You can use fuse, to make a user-land file-system, or write a kernel module.
                      It is easier to do with fuse, as you have a choice of languages, and won't crash the kernel (and therefore the whole system).



                      Kernel modules can be faster, but the first rule of optimisation is: Don't do it until you have tested working code. The second is like it: Don't do it until you have evidence that it is too slow. And the third: Don't keep it unless you have evidence that it makes it faster/smaller.



                      And yes the kernel already has drivers for the hardware, you don't re-implement them.






                      share|improve this answer























                      • There are major downsides to FUSE other than performance: it's hard to use it for your root filesystem. (Maybe possible with an initrd, but the FUSE binary couldn't be freed after booting because it would still be executing from the ramdisk.)

                        – Peter Cordes
                        6 hours ago













                      0












                      0








                      0







                      You can use fuse, to make a user-land file-system, or write a kernel module.
                      It is easier to do with fuse, as you have a choice of languages, and won't crash the kernel (and therefore the whole system).



                      Kernel modules can be faster, but the first rule of optimisation is: Don't do it until you have tested working code. The second is like it: Don't do it until you have evidence that it is too slow. And the third: Don't keep it unless you have evidence that it makes it faster/smaller.



                      And yes the kernel already has drivers for the hardware, you don't re-implement them.






                      share|improve this answer













                      You can use fuse, to make a user-land file-system, or write a kernel module.
                      It is easier to do with fuse, as you have a choice of languages, and won't crash the kernel (and therefore the whole system).



                      Kernel modules can be faster, but the first rule of optimisation is: Don't do it until you have tested working code. The second is like it: Don't do it until you have evidence that it is too slow. And the third: Don't keep it unless you have evidence that it makes it faster/smaller.



                      And yes the kernel already has drivers for the hardware, you don't re-implement them.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered 11 hours ago









                      ctrl-alt-delorctrl-alt-delor

                      12.1k42561




                      12.1k42561












                      • There are major downsides to FUSE other than performance: it's hard to use it for your root filesystem. (Maybe possible with an initrd, but the FUSE binary couldn't be freed after booting because it would still be executing from the ramdisk.)

                        – Peter Cordes
                        6 hours ago

















                      • There are major downsides to FUSE other than performance: it's hard to use it for your root filesystem. (Maybe possible with an initrd, but the FUSE binary couldn't be freed after booting because it would still be executing from the ramdisk.)

                        – Peter Cordes
                        6 hours ago
















                      There are major downsides to FUSE other than performance: it's hard to use it for your root filesystem. (Maybe possible with an initrd, but the FUSE binary couldn't be freed after booting because it would still be executing from the ramdisk.)

                      – Peter Cordes
                      6 hours ago





                      There are major downsides to FUSE other than performance: it's hard to use it for your root filesystem. (Maybe possible with an initrd, but the FUSE binary couldn't be freed after booting because it would still be executing from the ramdisk.)

                      – Peter Cordes
                      6 hours ago










                      user343344 is a new contributor. Be nice, and check out our Code of Conduct.









                      draft saved

                      draft discarded


















                      user343344 is a new contributor. Be nice, and check out our Code of Conduct.












                      user343344 is a new contributor. Be nice, and check out our Code of Conduct.











                      user343344 is a new contributor. Be nice, and check out our Code of Conduct.














                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508314%2fhow-do-i-implement-a-file-system-driver-driver-in-linux%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      How to create a command for the “strange m” symbol in latex? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)How do you make your own symbol when Detexify fails?Writing bold small caps with mathpazo packageplus-minus symbol with parenthesis around the minus signGreek character in Beamer document titleHow to create dashed right arrow over symbol?Currency symbol: Turkish LiraDouble prec as a single symbol?Plus Sign Too Big; How to Call adfbullet?Is there a TeX macro for three-legged pi?How do I get my integral-like symbol to align like the integral?How to selectively substitute a letter with another symbol representing the same letterHow do I generate a less than symbol and vertical bar that are the same height?

                      Българска екзархия Съдържание История | Български екзарси | Вижте също | Външни препратки | Литература | Бележки | НавигацияУстав за управлението на българската екзархия. Цариград, 1870Слово на Ловешкия митрополит Иларион при откриването на Българския народен събор в Цариград на 23. II. 1870 г.Българската правда и гръцката кривда. От С. М. (= Софийски Мелетий). Цариград, 1872Предстоятели на Българската екзархияПодмененият ВеликденИнформационна агенция „Фокус“Димитър Ризов. Българите в техните исторически, етнографически и политически граници (Атлас съдържащ 40 карти). Berlin, Königliche Hoflithographie, Hof-Buch- und -Steindruckerei Wilhelm Greve, 1917Report of the International Commission to Inquire into the Causes and Conduct of the Balkan Wars

                      Category:Tremithousa Media in category "Tremithousa"Navigation menuUpload media34° 49′ 02.7″ N, 32° 26′ 37.32″ EOpenStreetMapGoogle EarthProximityramaReasonatorScholiaStatisticsWikiShootMe