sdisk_unix.h

00001 /*<std-header orig-src='shore' incl-file-exclusion='SDISK_UNIX_H'>
00002 
00003  $Id: sdisk_unix.h,v 1.9 2010/05/26 01:21:29 nhall Exp $
00004 
00005 SHORE -- Scalable Heterogeneous Object REpository
00006 
00007 Copyright (c) 1994-99 Computer Sciences Department, University of
00008                       Wisconsin -- Madison
00009 All Rights Reserved.
00010 
00011 Permission to use, copy, modify and distribute this software and its
00012 documentation is hereby granted, provided that both the copyright
00013 notice and this permission notice appear in all copies of the
00014 software, derivative works or modified versions, and any portions
00015 thereof, and that both notices appear in supporting documentation.
00016 
00017 THE AUTHORS AND THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY
00018 OF WISCONSIN - MADISON ALLOW FREE USE OF THIS SOFTWARE IN ITS
00019 "AS IS" CONDITION, AND THEY DISCLAIM ANY LIABILITY OF ANY KIND
00020 FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
00021 
00022 This software was developed with support by the Advanced Research
00023 Project Agency, ARPA order number 018 (formerly 8230), monitored by
00024 the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518.
00025 Further funding for this work was provided by DARPA through
00026 Rome Research Laboratory Contract No. F30602-97-2-0247.
00027 
00028 */
00029 
00030 #ifndef SDISK_UNIX_H
00031 #define SDISK_UNIX_H
00032 
00033 #include "w_defines.h"
00034 
00035 /*  -- do not edit anything above this line --   </std-header>*/
00036 
00037 /*
00038  *   NewThreads I/O is Copyright 1995, 1996, 1997, 1998 by:
00039  *
00040  *    Josef Burger    <bolo@cs.wisc.edu>
00041  *
00042  *   All Rights Reserved.
00043  *
00044  *   NewThreads I/O may be freely used as long as credit is given
00045  *   to the above author(s) and the above copyright is maintained.
00046  */
00047 
00048 /**\cond skip */
00049 class sdisk_unix_t : public sdisk_t {
00050     int    _fd;
00051     char _path[256];
00052 
00053     enum    { FD_NONE = -1 };
00054 
00055     // sdisk_unix_t() : _fd(FD_NONE) { }
00056     sdisk_unix_t(const char *path) : _fd(FD_NONE) 
00057     { 
00058         strncpy(&_path[0], path, 255);
00059         _path[255] = '0';
00060     }
00061 
00062 public:
00063     static    w_rc_t    make(const char *name,
00064                  int flags, int mode,
00065                  sdisk_t *&disk);
00066     ~sdisk_unix_t();
00067 
00068     const char *    path() const { return &_path[0]; }
00069     int             fd() const { return _fd; }
00070     w_rc_t    open(const char *name, int flags, int mode);
00071     w_rc_t    close();
00072 
00073     w_rc_t    read(void *buf, int count, int &done);
00074     w_rc_t    write(const void *buf, int count, int &done);
00075 
00076     w_rc_t    readv(const iovec_t *iov, int iovcnt, int &done);
00077     w_rc_t    writev(const iovec_t *iov, int iovcnt, int &done);
00078 
00079     w_rc_t    pread(void *buf, int count, fileoff_t pos, int &done);
00080     w_rc_t    pwrite(const void *buf, int count, fileoff_t pos, int &done);
00081 
00082     w_rc_t    seek(fileoff_t pos, int origin, fileoff_t &newpos);
00083 
00084     w_rc_t    truncate(fileoff_t size);
00085 
00086     w_rc_t    sync();
00087 
00088     w_rc_t    stat(filestat_t &st);
00089 
00090     /* convert sdisk mode+flags to unix mode+flags */
00091     static    int    convert_flags(int);
00092 };
00093 /**\endcond skip */
00094 
00095 /*<std-footer incl-file-exclusion='SDISK_UNIX_H'>  -- do not edit anything below this line -- */
00096 
00097 #endif          /*</std-footer>*/

Generated on Wed Jul 7 17:22:32 2010 for Shore Storage Manager by  doxygen 1.4.7