Re: [PATCH] Adding a partfs translator.
Mikhail Karpov <[email protected]>
| Newsgroups | gmane.os.hurd.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hello, On Mon, 25 May 2026 22:27:53 Samuel Thibault wrote: > This way of managing the multiple disks seems to me it would be > confusing for users, and doing more than it should be. We of course > don't want to require users to set a partfs translator by hand with > the enumeration of the disks to be handled, we want that to be > automatic. And if we make it automatic, just numbering the entries > inside the partfs directory will prevent users from knowing what these > devices actually are: usb sticks, sata disks, etc. I believe we do want > to keep the underlying driver device name such as wd0. But then it's not > really useful to have just one partfs that would contain all disks, we > can as well just have one partfs per disk. Why not create a separate directory with the partfs translator for each type of media? The hd/ directory for disks, the usb/ directory for usb, and so on? > These are replicating a lot of the storeio logics, which we'd rather > avoid, to avoid having yet more code to maintain. We can just migrate > storeio into using netfs rather than trivfs, and make its root behave > like before, except it additionally implements get_dirents, and the > nodes thusly exposed can behave like a parted-based storeio. Essentially > that's a convergence of your current partfs and the existing storeio, > throwing away some parts of each. I think that's the right approach. The only question is about the storeio translator launch parameters: should keep the part:N:file:/root/... mechanism or open partitions automatically? > And notably that does get sense: if the disk is not partitioned, it's > not a "directory" :) I hadn't thought about that. Do you mean the disk has a GPT partitioning system, but no partitions? Also, while reviewing the code for the netfs_get_dirents function, I found a bug that was giving nodes an incorrect dirent_type instead of defining a dirent_type for each node. Interestingly, this didn't show up when using the stat and file commands. Thanks, -- Mikhail Karpov
0002-fix-netfs_get_dirents.patch
(text/x-patch, 1.7 KB)
From c69a792d6b0716ebb8e959938598ea050ce3e90d Mon Sep 17 00:00:00 2001 From: Mikhail Karpov <[email protected]> Date: Tue, 26 May 2026 17:34:41 +0700 Subject: [PATCH 2/2] fix netfs_get_dirents --- partfs/netfs.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/partfs/netfs.c b/partfs/netfs.c index 66a30129..ffe9a15b 100644 --- a/partfs/netfs.c +++ b/partfs/netfs.c @@ -375,7 +375,11 @@ netfs_get_dirents (struct iouser *cred, struct node *dir, int entry, *data = mmap (0, size, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); if ((void *) *data == (void *) -1) - return errno; + { + debug ("(void *) *data == (void *) -1\n"); + debug ("netfs_get_dirents end with errno: %d\n", errno); + return errno; + } *datacnt = size; *amt = count; @@ -396,18 +400,19 @@ netfs_get_dirents (struct iouser *cred, struct node *dir, int entry, } debug ("Fill in the real directory entries\n"); - int dirent_type; - if (dir->nn->entries_size > 0) - dirent_type = DT_DIR; - else - if (dir->nn->store->block_size == 1) - dirent_type = DT_CHR; - else - dirent_type = DT_BLK; + int dirent_type; for (size_t i = 0; i < dir->nn->entries_size; ++i) { current_node = dir->nn->entries[i]; + if (current_node->nn->entries_size > 0) + dirent_type = DT_DIR; + else + if (current_node->nn->store->block_size == 1) + dirent_type = DT_CHR; + else + dirent_type = DT_BLK; + add_dir_entry (&ptr_data, current_node->nn->name, current_node->nn_stat.st_ino, dirent_type, &count, nentries, &size); -- 2.43.0