public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: DENIEL Philippe <philippe.deniel@CEA.FR>
To: xfs@oss.sgi.com
Subject: open_by_handle on a file ?
Date: Wed, 12 May 2010 17:39:44 +0200	[thread overview]
Message-ID: <4BEACBC0.3080300@cea.fr> (raw)

Hi,

I start using libhandle.so from xfsprogs-3.0.3 package. I meet an issue 
here : I can get a handle from files or directory.
When used on diretories, open_by_handle works fine : I can read entries 
in it by using getdents, create stuff / removing stuff by using the 
ATFILE_FUNCTION (mkdirat, renameat, ...)

Trouble start when I want to open a file with open_by_handle. I have a 
small test program that does this :

        rc = path_to_fshandle( path_dir,  (void **)(&fshandle),
    &fshandlelen) ;
      if( rc < 0 ) exit( -1)
        
      rc = path_to_handle( path_dir,  (void **)(&filehandle), &handlelen) ;
      if( rc < 0 ) exit( -1 )

      fd = open_by_handle( filehandle, handlelen, O_RDONLY ) ;
      printf( "open_by_handle: fd=%d \n", fd ) ;
      if( fd < 0 )
           printf( "----> Error=%d | %s\n", errno, strerror( errno ) ) ;

The open_by_handle failed with errno=20 aka ENOTDIR, which is true, this 
is a file and no directory.
Question is : Can I use open_by_handle to open a regular file ? If yes, 
how should I proceed. If no, how should I do to open a file knowing its 
handle ?

    Thanks in advance for your time and answer.

       Regards

          Philippe


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

             reply	other threads:[~2010-05-12 15:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12 15:39 DENIEL Philippe [this message]
2010-05-12 22:21 ` open_by_handle on a file ? Dave Chinner
2010-05-25  8:44   ` DENIEL Philippe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BEACBC0.3080300@cea.fr \
    --to=philippe.deniel@cea.fr \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox