xfs
[Top] [All Lists]

Re: Dmapi questions

To: John Groves <John@xxxxxxxxxx>
Subject: Re: Dmapi questions
From: Dean Roehrich <roehrich@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 02 Feb 2004 10:15:56 -0600
Cc: linux-xfs@xxxxxxxxxxx
Sender: linux-xfs-bounce@xxxxxxxxxxx
>From:  John Groves <John@xxxxxxxxxx>
>I'm trying to track changes to a filesystem via dmapi.  There are a few 
>things that I haven't figured out yet, and I'm hoping somebody can set 
>me straight. My filesystems can be huge, so want to avoid full scans to 
>the extent possible.  I can get CREATE events, but in some cases I need 
>the filename & path to pass to a separate program. 

Maybe.  Does it just need to access the file, or does it really need to know
it's pathname?


>    * If I have a file handle, can I get the relevant the relevant
>      directory handle somehow?  If so I could presumably use

The CREATE event gave you the filehandle of the parent directory....

>      dm_handle_to_path() to generate the path...

You won't like it.  Unix-based filesystems don't provide anything special for
translating an inode into a filename; you just have to search the filesystem
for the inode--and then you know the filename.

There's nothing special about XFS in this regard.

Also, the implementation of dm_handle_to_path that I wrote for libdm is
aweful.  I won't turn down a better implementation if it's offered.

Anyway, you won't like it.

>    * Given a handle, how can I tell whether it is for a file or directory?

dm_get_fileattr() will give you that info.

Dean


<Prev in Thread] Current Thread [Next in Thread>