[Libsysio-commit] libsysio/drivers/yod Makefile.am,NONE,1.1.2.1 fs_yod.c,NONE,1.1.2.1 fs_yod.h,NONE,
Brought to you by:
lward
From: <rk...@us...> - 2003-04-28 20:21:43
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1:/tmp/cvs-serv17795/yod Added Files: Tag: cplant Makefile.am fs_yod.c fs_yod.h portals_io.c portals_io.h Log Message: add cplant yod driver, mostly stubs --- NEW FILE: Makefile.am --- lib_LIBRARIES = libsysio_yod.a EXTRA_DIST = fs_yod.h libsysio_yod_a_SOURCES = fs_yod.c portals_io.c include $(top_srcdir)/Rules.make AM_CPPFLAGS += $(PORTALS_INCLUDE) --- NEW FILE: fs_yod.c --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2003 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* [...1114 lines suppressed...] yod_inop_gone(struct inode *ino) { struct yod_inode *nino = I2NI(ino); if (nino->ni_fd) (void )close(nino->ni_fd); free(ino->i_private); } static void yod_fsop_gone(struct filesys *fs) { /* * Release fs private data */ if (fs->fs_private) free(fs->fs_private); } --- NEW FILE: fs_yod.h --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2003 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Questions or comments about this library should be sent to: * * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 * Albuquerque, NM 87185-1110 * * le...@sa... */ /* * Native file system driver support. */ extern int _sysio_yod_init(int, int, int, off_t, off_t, off_t); --- NEW FILE: portals_io.c --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2003 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Questions or comments about this library should be sent to: * * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 * Albuquerque, NM 87185-1110 * * le...@sa... */ #ifdef __linux__ #define _BSD_SOURCE #endif #include <fcntl.h> #include <ctype.h> #include <unistd.h> #include <stdlib.h> #include <stdarg.h> #include <errno.h> #include <string.h> #include <utime.h> #include <dirent.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/vfs.h> #include <sys/uio.h> #include "portals/rpc_msgs.h" #include "portals_io.h" /* * server nid, pid, ptl and yod std{in,out,err} file * handles are established in startup.c and passed * to _sysio_yod_init which records them in the * variables below. rank and nnodes are also set in * startup.c */ extern server_t _yod_server; extern off_t _yodfd_handles[]; extern int _my_rank; extern int _my_nnodes; int rpc_stat (const char *path, struct stat *sbuf); int rpc_fstat (int fd, struct stat *sbuf); int rpc_chmod (const char *path, mode_t mode); int rpc_fchmod (int fd, mode_t mode); int rpc_chdir (const char *path); int rpc_fchdir (int fd); int rpc_chown (const char *path, uid_t user, gid_t group); int rpc_fchown (int fd, uid_t user, gid_t group); int rpc_truncate (const char *path, off_t len); int rpc_ftruncate(int fd, off_t len); int rpc_utime (const char *path, struct utimbuf *buf); int rpc_mkdir (const char *path, mode_t mode); int rpc_rmdir (const char *path, mode_t mode); int rpc_symlink (const char *old, const char *new); int rpc_readlink (const char *path, char *buf, size_t bufsiz); int rpc_unlink (const char *path); int rpc_open (const char *path, int flags, mode_t mode); int rpc_creat (const char *path, mode_t mode); int rpc_close (int fd); int rpc_statfs (const char *path, struct statfs *buf); int rpc_fstatfs (int fd, struct statfs *buf); int rpc_fsync (int fd); int rpc_fdatasync(int fd); int rpc_getdents (unsigned int fd, struct dirent *dirp, unsigned int count); off_t rpc_lseek (int fd, off_t off, int whence); ssize_t rpc_read (int fd, char *buf, size_t len); ssize_t rpc_write (int fd, const char *buf, size_t len); int rpc_stat(const char *path, struct stat *sbuf) { hostCmd_t cmd; hostReply_t ack; size_t len; len = strlen(path); cmd.info.statCmd.fnameLen = len; if (_host_rpc(&cmd, &ack, CMD_STAT, _yod_server.nid, _yod_server.pid, _yod_server.ptl, path, len, (char *) sbuf, sizeof(struct stat)) != 0) return -1; if (ack.retVal == -1) errno = ack.hostErrno; return(ack.retVal); } int rpc_fstat(int fd, struct stat *sbuf) { return 0; } int rpc_chmod (const char *path, mode_t mode) { return 0; } int rpc_fchmod (int fd, mode_t mode) { return 0; } int rpc_chdir (const char *path) { return 0; } int rpc_fchdir (int fd) { return 0; } int rpc_chown (const char *path, uid_t user, gid_t group) { return 0; } int rpc_fchown (int fd, uid_t user, gid_t group) { return 0; } int rpc_truncate (const char *path, off_t len) { return 0; } int rpc_ftruncate(int fd, off_t len) { return 0; } int rpc_utime (const char *path, struct utimbuf *buf) { return 0; } int rpc_mkdir (const char *path, mode_t mode) { return 0; } int rpc_rmdir (const char *path, mode_t mode) { return 0; } int rpc_symlink (const char *old, const char *new) { return 0; } int rpc_readlink (const char *path, char *buf, size_t bufsiz) { return 0; } int rpc_unlink (const char *path) { return 0; } int rpc_open (const char *path, int flags, mode_t mode) { hostCmd_t cmd; hostReply_t ack; size_t len; UID_INIT(cmd); cmd.info.openCmd.fnameLen = strlen(path); cmd.info.openCmd.mode = mode; cmd.info.openCmd.flags = flags; if (_host_rpc(&cmd, &ack, CMD_OPEN, _yod_server.nid, _yod_server.pid, _yod_server.ptl, path, len, NULL, 0) != 0 ) return( -1); if (ack.retVal == -1) errno = ack.hostErrno; return (ack.retVal); } int rpc_creat (const char *path, mode_t mode) { return open(path, O_WRONLY | O_CREAT | O_TRUNC, mode); } int rpc_dup (int fd) { return fcntl(fd, F_DUPFD, 0); } int rpc_close (int fd) { return 0; } ssize_t rpc_read(int fd, char *buf, size_t len) { hostCmd_t cmd; hostReply_t ack; UID_INIT(cmd); cmd.info.readCmd.hostFileIndex = _yodfd_handles[fd]; cmd.info.readCmd.nbytes = len; cmd.info.readCmd.curPos = 0; cmd.info.readCmd.rank = _my_rank; cmd.info.readCmd.nnodes = _my_nnodes; if (_host_rpc(&cmd, &ack, CMD_READ, _yod_server.nid, _yod_server.pid, _yod_server.ptl, NULL, 0, (void *)buf, len) != 0 ) return( -1); if (ack.retVal == -1) errno = ack.hostErrno; return((ssize_t)ack.retVal); } ssize_t rpc_write(int fd, const char *buf, size_t len) { hostCmd_t cmd; hostReply_t ack; UID_INIT(cmd); cmd.info.writeCmd.hostFileIndex = _yodfd_handles[fd]; cmd.info.writeCmd.nbytes = len; cmd.info.writeCmd.curPos = 0; cmd.info.writeCmd.rank = _my_rank; cmd.info.writeCmd.nnodes = _my_nnodes; if (_host_rpc(&cmd, &ack, CMD_WRITE, _yod_server.nid, _yod_server.pid, _yod_server.ptl, (void *)buf, len, NULL, 0) != 0 ) return( -1); if (ack.retVal == -1) errno = ack.hostErrno; return((ssize_t )ack.retVal); } int rpc_statfs (const char *path, struct statfs *buf) { return 0; } int rpc_fstatfs (int fd, struct statfs *buf) { return 0; } int rpc_fsync (int fd) { return 0; } int rpc_fdatasync(int fd) { return 0; } int rpc_getdents64 (unsigned int fd, struct dirent *dirp, unsigned int count) { return 0; } off_t rpc_lseek (int fd, off_t off, int whence) { return 0; } --- NEW FILE: portals_io.h --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2003 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Questions or comments about this library should be sent to: * * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 * Albuquerque, NM 87185-1110 * * le...@sa... */ typedef struct { int nid; int pid; int ptl; } server_t; extern server_t _yod_server; extern uid_t _yod_uid, _yod_euid; extern gid_t _yod_gid, _yod_egid; #define UID_INIT(c) \ do { \ c.uid = _yod_uid; \ c.gid = _yod_gid; \ c.euid = _yod_euid; \ c.egid = _yod_egid; \ } while(0) /* stuff defined in yod_io_fns that * isn't in libsysio closeHost creat_cplant dup_cplant fcntl_cplant fcntlHost ioctl_cplant lstat_cplant mmap_cplant munmap_cplant rename_cplant ttyname_cplant */ |