xfs
[Top] [All Lists]

libhandle, open_by_handle()

To: linux-xfs@xxxxxxxxxxx
Subject: libhandle, open_by_handle()
From: Ethan Benson <erbenson@xxxxxxxxxx>
Date: Sun, 1 Jun 2003 19:17:04 -0800
Mail-copies-to: nobody
Mail-followup-to: linux-xfs@xxxxxxxxxxx
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.3.28i
Hi,

I am trying to figure out how libhandle is used and have run into some
difficulties.

when i use the following code:

          if (path_to_handle(path, &handle, &hlen) != 0) {
               perror("path_to_handle");
               return 1;
          }

          if ((fd = open_by_handle(handle, hlen, O_RDWR)) == -1)
                perror("open_by_handle");

open_by_handle returns EBADF, the docs are not clear on whether it
wants a handle or a fshandle, so i tried with a fshandle and this time
it returns ENOTDIR if i try to open a regular file, and EINVAL if i
try to open a directory.

am i missing something obvious? or does this simply not work in linux?

also when looking at the libhandle source i noticed a few cases where
it calls exit(1) rather then return 1; from functions (path_to_handle
does this if its internal open() call fails) this is really bad form
for a shared library.

-- 
Ethan Benson
http://www.alaska.net/~erbenson/

Attachment: pgpalhlgNnjoD.pgp
Description: PGP signature

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