Re: Listing a directory using the file system session
Dear Genode community, Christian, Emery, NobodyIII, thanks for your suggestions. I see the benefit for using the VFS library, but for the component I’m working on right now, using a file system session directly is more appropriate. Therefore I implemented the functionality of listing the directory entries similar to the dirent() implementation for VFS as hinted by Christian. This works like a charm. Met vriendelijke groet / kind regards, Martijn Verschoor Cyber Security Labs B.V. | Gooimeer 6-31 | 1411 DD Naarden | The Netherlands +31 35 631 3253 (office) | +31 616 014 087 (mobile) -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Re: Listing a directory using the file system session
I have written a file manager for Genode, so that could be useful if you don't want to use the VFS system. It's part of my work on a desktop environment, and it's not entirely complete, but it should be fairly usable still. If you want to use that as a starting point, here's a link: https://github.com/NobodyIII/genode-desktop-environment Here's the specific file with the _dir() function: https://github.com/NobodyIII/genode-desktop-environment/blob/master/src/app/file_manager/genodefs.cpp On Thu, Dec 15, 2016 at 7:32 AM, Emery Hemingwaywrote: > Hello Martijn, > > The File_system client in the VFS library is the only example that I can > think of > for reading directory entries. I would recommend using the VFS library > rather than > using a File_system session directly, the library is easier to use and > this would > give you a lot more power for free, such as merging the same directory > present in > multiple File_system sessions. > > https://github.com/genodelabs/genode/blob/master/repos/os/ > src/lib/vfs/fs_file_system.h#L279 > > Cheers, > Emery Hemingway > > On Thu, Dec 15, 2016 at 01:42:45PM +0100, Martijn Verschoor wrote: > > Dear Genode community, > > > > I’m looking for a way to list the files (nodes) in a directory using a > file system session. Amongst other, I studied the File_system::Session and > file_system/utils.h but cannot find a hook to get started. I see that > reading the directory nodes is supported -> this returns the > Directory_entry struct with information about the directory itself, but not > about the nodes the directory contains (right?). Is there a way retrieve > the latter? > > > > Any help is appreciated! > > > > Met vriendelijke groet / kind regards, > > > > Martijn Verschoor > > > > Cyber Security Labs B.V. | Gooimeer 6-31 | 1411 DD Naarden | The > Netherlands > > +31 35 631 3253 (office) | +31 616 014 087 (mobile) > > > > > > > > > > > > > > > > > -- > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > > ___ > > genode-main mailing list > > genode-main@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/genode-main > > > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > genode-main mailing list > genode-main@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/genode-main > > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Re: Listing a directory using the file system session
Hello Martijn, The File_system client in the VFS library is the only example that I can think of for reading directory entries. I would recommend using the VFS library rather than using a File_system session directly, the library is easier to use and this would give you a lot more power for free, such as merging the same directory present in multiple File_system sessions. https://github.com/genodelabs/genode/blob/master/repos/os/src/lib/vfs/fs_file_system.h#L279 Cheers, Emery Hemingway On Thu, Dec 15, 2016 at 01:42:45PM +0100, Martijn Verschoor wrote: > Dear Genode community, > > I’m looking for a way to list the files (nodes) in a directory using a file > system session. Amongst other, I studied the File_system::Session and > file_system/utils.h but cannot find a hook to get started. I see that reading > the directory nodes is supported -> this returns the Directory_entry struct > with information about the directory itself, but not about the nodes the > directory contains (right?). Is there a way retrieve the latter? > > Any help is appreciated! > > Met vriendelijke groet / kind regards, > > Martijn Verschoor > > Cyber Security Labs B.V. | Gooimeer 6-31 | 1411 DD Naarden | The Netherlands > +31 35 631 3253 (office) | +31 616 014 087 (mobile) > > > > > > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > genode-main mailing list > genode-main@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/genode-main > signature.asc Description: PGP signature -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Re: Listing a directory using the file system session
Hello Martijn, On Thu, Dec 15, 2016 at 01:42:45PM +0100, Martijn Verschoor wrote: > I’m looking for a way to list the files (nodes) in a directory using > a file system session. Amongst other, I studied the > File_system::Session and file_system/utils.h but cannot find a hook > to get started. I see that reading the directory nodes is supported > -> this returns the Directory_entry struct with information about > the directory itself, but not about the nodes the directory contains > (right?). Is there a way retrieve the latter? You are on the right track, that reading directory entries (like in dirent()) is provided as read operation on directory nodes. Please have a look at os/src/lib/vfs/fs_file_system.h for an implementation of dirent(). The trick is to use n * sizeof(::File_system::Directory_entry) as file_offset parameter to read the n-th entry. Hope this helps -- Christian Helmuth Genode Labs https://www.genode-labs.com/ · https://genode.org/ https://twitter.com/GenodeLabs · /ˈdʒiː.nəʊd/ Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main
Listing a directory using the file system session
Dear Genode community, I’m looking for a way to list the files (nodes) in a directory using a file system session. Amongst other, I studied the File_system::Session and file_system/utils.h but cannot find a hook to get started. I see that reading the directory nodes is supported -> this returns the Directory_entry struct with information about the directory itself, but not about the nodes the directory contains (right?). Is there a way retrieve the latter? Any help is appreciated! Met vriendelijke groet / kind regards, Martijn Verschoor Cyber Security Labs B.V. | Gooimeer 6-31 | 1411 DD Naarden | The Netherlands +31 35 631 3253 (office) | +31 616 014 087 (mobile) -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ genode-main mailing list genode-main@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/genode-main