XRootD
XrdCephOssDir.cc
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2014-2015 by European Organization for Nuclear Research (CERN)
3 // Author: Sebastien Ponce <sebastien.ponce@cern.ch>
4 //------------------------------------------------------------------------------
5 // This file is part of the XRootD software suite.
6 //
7 // XRootD is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // XRootD is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
19 //
20 // In applying this licence, CERN does not waive the privileges and immunities
21 // granted to it by virtue of its status as an Intergovernmental Organization
22 // or submit itself to any jurisdiction.
23 //------------------------------------------------------------------------------
24 
25 #include "XrdCeph/XrdCephPosix.hh"
26 #include "XrdCeph/XrdCephOssDir.hh"
27 #include "XrdSys/XrdSysError.hh"
28 #include "XrdOuc/XrdOucTrace.hh"
29 
31 
32 XrdCephOssDir::XrdCephOssDir(XrdCephOss *cephOss) : m_dirp(0), m_cephOss(cephOss) {}
33 
34 int XrdCephOssDir::Opendir(const char *path, XrdOucEnv &env) {
35  try {
36  m_dirp = ceph_posix_opendir(&env, path);
37  if (0 == m_dirp) {
38  return -errno;
39  }
40  return XrdOssOK;
41  } catch (std::exception &e) {
42  XrdCephEroute.Say("opendir : invalid syntax in file parameters");
43  return -EINVAL;
44  }
45 }
46 
47 int XrdCephOssDir::Close(long long *retsz) {
48  ceph_posix_closedir(m_dirp);
49  return XrdOssOK;
50 }
51 
52 int XrdCephOssDir::Readdir(char *buff, int blen) {
53  return ceph_posix_readdir(m_dirp, buff, blen);
54 }
XrdSysError XrdCephEroute
int ceph_posix_readdir(DIR *dirp, char *buff, int blen)
DIR * ceph_posix_opendir(XrdOucEnv *env, const char *pathname)
int ceph_posix_closedir(DIR *dirp)
#define XrdOssOK
Definition: XrdOss.hh:50
virtual int Close(long long *retsz=0)
virtual int Opendir(const char *, XrdOucEnv &)
virtual int Readdir(char *buff, int blen)
XrdCephOssDir(XrdCephOss *cephoss)
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
Definition: XrdSysError.cc:141