in reply to letting a browser client select a file to download by inode

inode is already unique by the filesystem.

This is not true. Under many unix filesystems the inode (Index NODE) number is unique within a partition.

This is important because multiple filesystems (each on it's own partition) can be mounted by a unix system at the same time at different directories. This means your web server's /usr and /var can both have inode number 4615 for one file below it's mount point.

Some filesystems do not use inodes. Eg FAT and FAT-32. When Linux (used beause I'm familiar with it) mounts a fat32 filesystem it assigns inode numbers as the directories and files are accessed.

This means if you unmount and remount the filesystem you are quite likely to get different inode numbers assigned to the same file. UPDATE: Just to be clear this referrers to filesystems that do not use inodes.

Personally I would be tempted to use a database "sequence" since I would be storing account info, etc in a database anyway. In MySQL you can use an "auto increment" field.

If you are not using a database you can still keep track of a sequence number in a file but you have to be sure your scripts lock the file so you never reuse a sequence number.

Replies are listed 'Best First'.
Re^2: letting a browser client select a file to download by inode
by leocharre (Priest) on Feb 02, 2006 at 02:47 UTC

    Yes indeed. Mounting and umount ing.. Great hell fun that was. A lot of the junk we serve will possibly be on .. guess what.. ntfs.. yeah.

    I want to support this kind of activity (renaming via fs and keeping db reliable) - but i just see no way. with reg files, i use md5sums.. and that's a charm. But with directories ? oh boy..

    if a mounted section of the data being served is umount ed, then changes happen, dirs get renamed.. and it gets mounted again a day later.. i'm screwed!