nfs-ganesha 1.4
|
00001 /* 00002 * vim:expandtab:shiftwidth=8:tabstop=8: 00003 * 00004 * Copyright CEA/DAM/DIF (2008) 00005 * contributeur : Philippe DENIEL philippe.deniel@cea.fr 00006 * Thomas LEIBOVICI thomas.leibovici@cea.fr 00007 * 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 3 of the License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00022 * 00023 * ---------------------------------------*/ 00024 00034 #ifdef HAVE_CONFIG_H 00035 #include "config.h" 00036 #endif 00037 00038 #include <stdio.h> 00039 #include <string.h> 00040 #include <pthread.h> 00041 #include <fcntl.h> 00042 #include "log.h" 00043 #include "fsal.h" 00044 00045 #ifdef _USE_HPSS 00046 #include "../FSAL/FSAL_HPSS/HPSSclapiExt/hpssclapiext.h" 00047 #endif 00048 00049 #define CMD_BUFFER_SIZE 1024 00050 00051 #define CONFIG_FILE "/var/hpss/etc/hpss.ganesha.nfsd.conf" 00052 00053 time_t ServerBootTime; 00054 00055 int main(int argc, char *argv[]) 00056 { 00057 int c; 00058 char exec_name[MAXPATHLEN]; 00059 char *tempo_exec_name = NULL; 00060 00061 #ifdef _USE_HPSS 00062 char buffer[CMD_BUFFER_SIZE]; 00063 fsal_handle_t fsal_handle; 00064 char str[2 * CMD_BUFFER_SIZE]; 00065 uint64_t objid; 00066 ns_ObjHandle_t hpss_hdl; 00067 hpss_Attrs_t hpss_attr; 00068 char *tmp_str_uuid; 00069 #endif 00070 char options[] = "h@"; 00071 char usage[] = "%s [-h] <FSAL_Handle>\n" " -h : prints this help\n"; 00072 00073 /* Set the server's boot time and epoch */ 00074 ServerBootTime = time(NULL); 00075 ServerEpoch = ServerBootTime; 00076 00077 /* What is the executable file's name */ 00078 if((tempo_exec_name = strrchr(argv[0], '/')) != NULL) 00079 strcpy((char *)exec_name, tempo_exec_name + 1); 00080 00081 /* now parsing options with getopt */ 00082 while((c = getopt(argc, argv, options)) != EOF) 00083 { 00084 switch (c) 00085 { 00086 case '@': 00087 printf("%s compiled on %s at %s\n", exec_name, __DATE__, __TIME__); 00088 exit(0); 00089 break; 00090 00091 case 'h': 00092 printf(usage, exec_name); 00093 exit(0); 00094 break; 00095 00096 case '?': 00097 printf("Unknown option: %c\n", optopt); 00098 printf(usage, exec_name); 00099 exit(1); 00100 } 00101 } 00102 00103 if(optind != argc - 1) 00104 { 00105 printf("Missing argument: <FSAL_Handle>\n"); 00106 printf(usage, exec_name); 00107 exit(1); 00108 } 00109 #ifdef _USE_HPSS 00110 sscanHandle(&fsal_handle, argv[optind]); 00111 00112 snprintmem((caddr_t) str, 2 * CMD_BUFFER_SIZE, (caddr_t) & fsal_handle.ns_handle, 00113 sizeof(ns_ObjHandle_t)); 00114 printf("NS Handle = %s\n", str); 00115 00116 objid = hpss_GetObjId(&(fsal_handle.ns_handle)); 00117 printf("FileId = %llu\n", objid); 00118 #endif 00119 00120 exit(0); 00121 }