Skip to contentSkip to conversation

user-space cmd/lib to compute hash filename ordering?

DISCUSSION Bennett Todd 2 participants 3 messages Sep 10, 2003 – Sep 11, 2003

lore
Share & tools
lore
#0 lore raw

I'm continuing to work on my new software packaging system.

I'm going to have to make a custom archive-builder, stock cpio isn't suitable even though the file format will be cpio, since the pkg creator needs to have explicit control over the owner/group/perms of the files installed without having the package building user actually able to set those perms on real files.

Since I'm going to need to create my own cpio file builder, and since I've decided to teach it how to order files in the archives (so it can put the metadata and manifest info up at the front for quick access) I'm thinking it'd be sexy to add a --reiser option that orders all the files in the archive in reiserfs hash order, so a simple naive unpack will deposit files in the most efficient fashion into a Reiserfs filesystem.

Is there a library routine or cmdline utility I can use to compute this ordering?

Thanks,

-Bennett

#1 lore raw
Quoted 8 lines · Bennett Todd

I'm continuing to work on my new software packaging system.

I'm going to have to make a custom archive-builder, stock cpio isn't suitable even though the file format will be cpio, since the pkg creator needs to have explicit control over the owner/group/perms of the files installed without having the package building user actually able to set those perms on real files.

Quoted 8 lines

Since I'm going to need to create my own cpio file builder, and since I've decided to teach it how to order files in the archives (so it can put the metadata and manifest info up at the front for quick access) I'm thinking it'd be sexy to add a --reiser option that orders all the files in the archive in reiserfs hash order, so a simple naive unpack will deposit files in the most efficient fashion into a Reiserfs filesystem.

Hello,

Quoted 2 lines

Is there a library routine or cmdline utility I can use to compute this ordering?

Actually you can use libreiserfs (progsreierfs package) or standard reiserfsprogs. They both contains routines for generating hashes, reiserfs supports them.

But probably it is better to cut them out and write small and simple cmd tool for hashes generating.

Besides, there should lots of tools for generating different hashes. They (tools) are used for discovering for instance how often particular hash function generates collided hashes.

If you are interested, I will find out details.

Quoted 4 lines

Thanks,

-Bennett

Signature · 1 line
umka
#2 lore raw
2003-09-11T03:17:49 Yury Umanets:
Quoted 1 line

If you are interested, I will find out details.

Thanks anyway, I get the message that a stock, standard distro of ReiserFS doesn't have a single, consistent way to lay hands on the available hashes for purposes like this, so if I do ever do it, I'll be making my tool dependent on the ReiserFS dev tooling.

If someone wanted to enhance ReiserFS to make this job easier for people, I've got a recommendation: include a reiserfs_hashsort filter, reads a list of full pathnames from stdin, takes a hash name as a cmdline arg, and prints the files sorted according to that hash; slap that between the find that generates filenames and the cpio that packs 'em, and you get a ReiserFS-tuned archive order.

I may pursue doing that eventually, but it's somewhere pretty far down on my priority list at the moment. In other words, if it had been there, I'd have used it, but it'll take me a while to get around to coding it up myself.

Thanks again for the very helpful answer --- "no, what you want isn't there, here's how you'd go about constructing it" is every bit as valuable as "yes, here's where to find it". Maybe even more so, negative answers are harder to research.

-Bennett