[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inode to filename mapping



>>> "escii zer0for0je" 2-Jun-03 01:19 >>>
>
> Hello everyone.
> Thank you for your reply, I'm going to try explain a bit more of my
> situation so you can get an idea of what I'm trying to do.
>
> I've wrote a little C program that gets the pid of mpg123, uses lsof
> to find out what mp3 it has open, then mpg123info to get information
> from the mp3, and this end result is dumped to stdout.
>
> THE PROBLEM: the kernel does not store the entire filename in memory
>              only a porition of it and inodes and such, so i can only
>              properly locate mp3's if thier shorter than N ( N being
>              the biggest possible file name without openbsd's kernel
>              truncicating it)
>
> Do you have any solutions to my problem, speed is also and issue. so
> searching a entire parition for a certain inode is a bad idea.

Alternatively, depending how often your list of MP3s changes, have a
weekly/daily cron job that creates an inode -> filename index, using
find(1) or something like that.

That's how the locate(1) database is built, after all.

For example,

   find /home/tom/mp3s -type f -name '*.mp3' -print0 |  \
     xargs -0 ls -i1 > /home/tom/mp3s/index.lst


> Thank you.

HTH

Tom