30 #define FUSE_USE_VERSION 26
37 #if defined(__linux__)
40 #define _XOPEN_SOURCE 500
46 #include <fuse/fuse_opt.h>
58 #if defined(__linux__)
59 #include <sys/prctl.h>
61 #include <sys/xattr.h>
71 #define MAXROOTURLLEN 1024
87 struct XROOTDFS xrootdfs;
88 static struct fuse_opt xrootdfs_opts[14];
90 enum { OPT_KEY_HELP, OPT_KEY_SECSSS, };
94 static void* xrootdfs_init(
struct fuse_conn_info *conn)
96 struct passwd pw, *pwp;
101 rl.rlim_cur = RLIM_INFINITY;
102 rl.rlim_max = RLIM_INFINITY;
103 setrlimit(RLIMIT_CORE, &rl);
105 pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
106 pwbuf = (
char*)malloc(pwbuflen + 1);
108 if (xrootdfs.daemon_user != NULL)
111 len = strlen(xrootdfs.daemon_user);
112 for (i=0; i<len; i++)
114 if (isdigit(xrootdfs.daemon_user[i]) == 0)
116 getpwnam_r(xrootdfs.daemon_user, &pw, pwbuf, pwbuflen, &pwp);
120 if (i == len) getpwuid_r(atoi(xrootdfs.daemon_user), &pw, pwbuf, pwbuflen, &pwp);
121 if( setgid((gid_t)pw.pw_gid) != 0 )
122 syslog( LOG_ERR,
"ERROR: Unable to set gid to %d", pw.pw_gid );
123 if( setuid((uid_t)pw.pw_uid) != 0 )
124 syslog( LOG_ERR,
"ERROR: Unable to set uid to %d", pw.pw_uid );
125 #if defined(__linux__)
126 prctl(PR_SET_DUMPABLE, 1);
137 next = strtok_r(strdup(xrootdfs.rdr),
"//", &savptr);
138 next = strtok_r(NULL,
"//", &savptr);
139 char exportpath[1024];
140 while ((next = strtok_r(NULL,
"//", &savptr)) != NULL)
142 strcat(exportpath,
"/");
143 strcat(exportpath, next);
145 setenv(
"XRDEXPORTS", exportpath, 1);
158 syslog(LOG_INFO,
"INFO: Not compiled to use task queue");
161 if (fchdir(cwdfd)) {};
167 static int xrootdfs_getattr(
const char *path,
struct stat *stbuf)
197 if (xrootdfs.cns != NULL && xrootdfs.fastls != NULL)
199 strncat(rootpath,xrootdfs.cns,
MAXROOTURLLEN - strlen(rootpath) -1);
215 if (S_ISREG(stbuf->st_mode))
229 if (xrootdfs.cns != NULL && xrootdfs.fastls != NULL && strcmp(xrootdfs.fastls,
"RDR") == 0)
232 strncat(rootpath,xrootdfs.rdr,
MAXROOTURLLEN - strlen(rootpath) -1);
239 stbuf->st_mode |= 0666;
240 stbuf->st_mode &= 0772777;
241 stbuf->st_blksize = 32768;
244 else if (S_ISDIR(stbuf->st_mode))
246 stbuf->st_mode |= 0777;
247 stbuf->st_mode &= 0772777;
253 else if (res == -1 && xrootdfs.cns != NULL && xrootdfs.fastls != NULL)
255 else if (xrootdfs.cns == NULL)
260 strncat(rootpath,xrootdfs.cns,
MAXROOTURLLEN - strlen(rootpath) -1);
270 if (S_ISREG(stbuf->st_mode))
272 else if (S_ISDIR(stbuf->st_mode))
274 stbuf->st_mode |= 0777;
275 stbuf->st_mode &= 0772777;
284 static int xrootdfs_access(
const char *path,
int mask)
295 static int xrootdfs_readlink(
const char *path,
char *buf,
size_t size)
309 static int xrootdfs_readdir(
const char *path,
void *buf, fuse_fill_dir_t filler,
310 off_t offset,
struct fuse_file_info *fi)
325 if (xrootdfs.cns != NULL)
328 strncat(rootpath,xrootdfs.cns,
MAXROOTURLLEN - strlen(rootpath) -1);
344 if (filler(buf, de->d_name, NULL, 0))
353 char **dnarray = NULL;
357 for (i = 0; i < n; i++)
358 if (filler(buf, dnarray[i], NULL, 0))
break;
364 for (i = 0; i < n; i++)
372 static int xrootdfs_do_create(
const char *path,
const char *url,
int oflags,
bool use_link_id,
int *fd)
385 int *p_link_id = NULL;
389 p_link_id = &link_id;
392 strncat(rootpath, url,
MAXROOTURLLEN - strlen(rootpath) - 1);
393 strncat(rootpath, path,
MAXROOTURLLEN - strlen(rootpath) - 1);
404 static int xrootdfs_mknod(
const char *path, mode_t mode, dev_t rdev)
433 res = xrootdfs_do_create(path, xrootdfs.rdr, O_CREAT | O_WRONLY,
false, &fd);
434 if (res < 0)
return res;
436 if (xrootdfs.cns != NULL)
438 xrootdfs_do_create(path, xrootdfs.cns, O_CREAT | O_EXCL,
false, &fd);
444 static int xrootdfs_create(
const char *path, mode_t mode,
struct fuse_file_info *fi)
459 res = xrootdfs_do_create(path, xrootdfs.rdr, O_CREAT | O_WRONLY | O_EXCL,
true, &fd);
461 res = xrootdfs_do_create(path, xrootdfs.rdr, O_CREAT | O_WRONLY,
true, &fd);
462 if (res < 0)
return res;
465 if (xrootdfs.cns != NULL)
467 xrootdfs_do_create(path, xrootdfs.cns, O_CREAT | O_EXCL,
false, &fd);
473 static int xrootdfs_mkdir(
const char *path, mode_t mode)
486 if (xrootdfs.cns != NULL)
487 strncat(rootpath,xrootdfs.cns,
MAXROOTURLLEN - strlen(rootpath) -1);
489 strncat(rootpath,xrootdfs.rdr,
MAXROOTURLLEN - strlen(rootpath) -1);
497 if (res == 0)
return 0;
508 return ((res == -1)? -errno : 0);
511 static int xrootdfs_unlink(
const char *path)
517 strncat(rootpath,xrootdfs.rdr,
MAXROOTURLLEN - strlen(rootpath) -1);
521 if (xrootdfs.ofsfwd ==
true)
532 if (xrootdfs.cns != NULL && xrootdfs.ofsfwd ==
false)
535 strncat(rootpath,xrootdfs.cns,
MAXROOTURLLEN - strlen(rootpath) -1);
546 static int xrootdfs_rmdir(
const char *path)
553 strncat(rootpath,xrootdfs.rdr,
MAXROOTURLLEN - strlen(rootpath) -1);
557 if (xrootdfs.ofsfwd ==
true)
568 if (xrootdfs.cns != NULL && xrootdfs.ofsfwd ==
false)
571 strncat(rootpath,xrootdfs.cns,
MAXROOTURLLEN - strlen(rootpath) -1);
594 static int xrootdfs_symlink(
const char *from,
const char *
to)
606 static int xrootdfs_rename(
const char *from,
const char *
to)
613 strncat(from_path, xrootdfs.rdr,
MAXROOTURLLEN - strlen(from_path) -1);
614 strncat(from_path, from,
MAXROOTURLLEN - strlen(from_path) -1);
617 strncat(to_path, xrootdfs.rdr,
MAXROOTURLLEN - strlen(to_path) -1);
630 if (S_ISDIR(stbuf.st_mode))
633 if (xrootdfs.ofsfwd ==
true)
644 if (xrootdfs.cns != NULL && xrootdfs.ofsfwd ==
false)
647 strncat(from_path, xrootdfs.cns,
MAXROOTURLLEN - strlen(from_path) -1);
648 strncat(from_path, from,
MAXROOTURLLEN - strlen(from_path) -1);
651 strncat(to_path, xrootdfs.cns,
MAXROOTURLLEN - strlen(to_path) -1);
663 static int xrootdfs_link(
const char *from,
const char *
to)
675 static int xrootdfs_chmod(
const char *path, mode_t mode)
687 static int xrootdfs_chown(
const char *path, uid_t uid, gid_t gid)
700 static int xrootdfs_ftruncate(
const char *path, off_t size,
701 struct fuse_file_info *fi)
730 static int xrootdfs_truncate(
const char *path, off_t size)
736 strncat(rootpath,xrootdfs.rdr,
MAXROOTURLLEN - strlen(rootpath) -1);
740 if (xrootdfs.ofsfwd ==
true)
751 if (xrootdfs.cns != NULL && xrootdfs.ofsfwd ==
false)
754 strncat(rootpath,xrootdfs.cns,
MAXROOTURLLEN - strlen(rootpath) -1);
765 static int xrootdfs_utimens(
const char *path,
const struct timespec ts[2])
783 static int xrootdfs_open(
const char *path,
struct fuse_file_info *fi)
793 strncat(rootpath,xrootdfs.rdr,
MAXROOTURLLEN - strlen(rootpath) -1);
798 fd =
XrdFfsPosix_open(rootpath, fi->flags, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
810 static int xrootdfs_read(
const char *path,
char *buf,
size_t size, off_t offset,
811 struct fuse_file_info *fi)
823 off_t fsize = stbuf.st_size;
826 if ( offset >= fsize )
829 size = (size_t)(fsize - offset) > size ? size : fsize - offset;
832 if ( ! (fi->flags & O_RDWR) && (fi->flags &
O_DIRECT) )
846 static int xrootdfs_write(
const char *path,
const char *buf,
size_t size,
847 off_t offset,
struct fuse_file_info *fi)
865 static int xrootdfs_statfs(
const char *path,
struct statvfs *stbuf)
875 stbuf->f_bsize = 1024;
877 stbuf->f_bsize = 1024 * 128;
878 stbuf->f_frsize = stbuf->f_bsize;
932 static int xrootdfs_release(
const char *path,
struct fuse_file_info *fi)
938 struct stat xrdfile, cnsfile;
952 if (xrootdfs.cns == NULL || (fi->flags & 0100001) == (0100000 | O_RDONLY))
956 char xattr[256], xrdtoken[256];
957 char *token, *key, *value;
958 char *lasts_xattr[256], *lasts_tokens[128];
961 strncat(rootpath,xrootdfs.rdr,
MAXROOTURLLEN - strlen(rootpath) -1);
972 token = strtok_r(xattr,
"&", lasts_xattr);
973 while (token != NULL)
975 key = strtok_r(token,
"=", lasts_tokens);
976 value = strtok_r(NULL,
"=", lasts_tokens);
977 if (!strcmp(key,
"oss.cgroup"))
978 strcpy(xrdtoken, value);
980 if (!strcmp(key,
"oss.used"))
982 sscanf((
const char*)value,
"%lld", &llVal);
983 xrdfile.st_size = llVal;
985 token = strtok_r(NULL,
"&", lasts_xattr);
994 strncat(rootpath,xrootdfs.cns,
MAXROOTURLLEN - strlen(rootpath) -1);
998 if (xrdtoken[0] !=
'\0' && strstr(path,
"?oss.cgroup=") == NULL)
1000 strncat(rootpath,
"?oss.cgroup=",
MAXROOTURLLEN - strlen(rootpath) -1);
1001 strncat(rootpath,xrdtoken,
MAXROOTURLLEN - strlen(rootpath) -1);
1005 oflag = O_CREAT|O_WRONLY;
1007 oflag = O_TRUNC|O_WRONLY;
1013 if (cnsfile.st_size != xrdfile.st_size)
1027 static int xrootdfs_fsync(
const char *path,
int isdatasync,
1028 struct fuse_file_info *fi)
1039 static int xrootdfs_setxattr(
const char *path,
const char *name,
const char *value,
1040 size_t size,
int flags)
1042 if (fuse_get_context()->uid != 0 && fuse_get_context()->uid != getuid())
1045 if (!strcmp(name,
"xrootdfs.fs.dataserverlist"))
1050 else if (!strcmp(name,
"xrootdfs.fs.nworkers"))
1054 tmp_value=strdup(value);
1055 if (size > 0) tmp_value[size] =
'\0';
1058 j = atoi(tmp_value);
1066 syslog(LOG_INFO,
"INFO: Adjust the number of workers from %d to %d", i, j);
1072 static int xrootdfs_getxattr(
const char *path,
const char *name,
char *value,
1079 if (!strcmp(name,
"xroot.url"))
1082 strncat(rootpath,xrootdfs.rdr,
MAXROOTURLLEN - strlen(rootpath) -1);
1083 strncat(rootpath,path,
MAXROOTURLLEN - strlen(rootpath) -1);
1086 strcpy(rooturl, rootpath);
1089 return strlen(rooturl);
1090 else if (size > strlen(rooturl))
1092 size = strlen(rooturl);
1096 strcat(value, rooturl);
1106 else if (!strcmp(name,
"xrootdfs.fs.dataserverlist"))
1115 xattrlen = strlen(hostlist);
1119 else if (size > strlen(hostlist))
1121 size = strlen(hostlist);
1125 strcat(value, hostlist);
1137 else if (!strcmp(name,
"xrootdfs.fs.nworkers"))
1142 sprintf(nworkers,
"%d", n);
1145 return strlen(nworkers);
1146 else if (size > strlen(nworkers))
1148 size = strlen(nworkers);
1152 strcat(value, nworkers);
1162 else if (!strcmp(name,
"xrootdfs.file.permission"))
1165 strncat(rootpath,xrootdfs.rdr,
MAXROOTURLLEN - strlen(rootpath) -1);
1166 strncat(rootpath,path,
MAXROOTURLLEN - strlen(rootpath) -1);
1174 else if (size > (
size_t)xattrlen)
1176 strncpy(value, xattr, size);
1188 if (xrootdfs.cns != NULL)
1189 strncat(rootpath,xrootdfs.cns,
MAXROOTURLLEN - strlen(rootpath) -1);
1191 strncat(rootpath,xrootdfs.rdr,
MAXROOTURLLEN - strlen(rootpath) -1);
1192 strncat(rootpath,path,
MAXROOTURLLEN - strlen(rootpath) -1);
1203 static int xrootdfs_listxattr(
const char *path,
char *list,
size_t size)
1214 static int xrootdfs_removexattr(
const char *path,
const char *name)
1235 void* XrdFfsMisc_logging_url_cache_pthread_create_cast(
void *arg )
1241 void xrootdfs_sigusr1_handler(
int sig)
1245 pthread_attr_t attr;
1246 size_t stacksize = 2*1024*1024;
1248 pthread_attr_init(&attr);
1249 pthread_attr_setstacksize(&attr, stacksize);
1250 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
1252 thread = (pthread_t*) malloc(
sizeof(pthread_t));
1253 pthread_create(thread, &attr, XrdFfsMisc_logging_url_cache_pthread_create_cast,
1255 pthread_detach(*thread);
1258 pthread_attr_destroy(&attr);
1261 static struct fuse_operations xrootdfs_oper;
1263 static void xrootdfs_usage(
const char *progname)
1266 "usage: %s mountpoint options\n"
1268 "XrootdFS options:\n"
1269 " -h -help --help print help\n"
1271 "Default options:\n"
1272 " fsname=xrootdfs,allow_other,max_write=131072,attr_timeout=10,entry_timeout=10,negative_timeout=5\n"
1273 " In case of an Erasure Encoding storage, entry_timeout=0\n"
1276 " -o rdr=redirector_url root URL of the Xrootd redirector\n"
1279 " -o cns=cns_server_url root URL of the CNS server\n"
1280 " -o uid=username cause XrootdFS to switch effective uid to that of username if possible\n"
1281 " -o sss[=keytab] use Xrootd seciruty module \"sss\", specifying a keytab file is optional\n"
1282 " -o refreshdslist=NNNs/m/h/d refresh internal list of data servers in NNN sec/min/hour/day, default unit is second\n"
1283 " Absents of this option will disable automatically refreshing\n"
1284 " -o maxfd=N number of virtual file descriptors for posix requests, default 8192 (min 2048)\n"
1285 " -o nworkers=N number of workers to handle parallel requests to data servers, default 4\n"
1286 " -o fastls=RDR set to RDR when CNS is presented will cause stat() to go to redirector\n"
1290 static int xrootdfs_opt_proc(
void* data,
const char* arg,
int key,
struct fuse_args* outargs)
1297 case FUSE_OPT_KEY_OPT:
1299 case FUSE_OPT_KEY_NONOPT:
1301 case OPT_KEY_SECSSS:
1302 setenv(
"XROOTDFS_SECMOD",
"sss", 1);
1305 xrootdfs_usage(outargs->argv[0]);
1306 fuse_opt_add_arg(outargs,
"-ho");
1307 fuse_main(outargs->argc, outargs->argv, &xrootdfs_oper, NULL);
1315 int main(
int argc,
char *argv[])
1317 xrootdfs_oper.init = xrootdfs_init;
1318 xrootdfs_oper.getattr = xrootdfs_getattr;
1319 xrootdfs_oper.access = xrootdfs_access;
1320 xrootdfs_oper.readlink = xrootdfs_readlink;
1321 xrootdfs_oper.readdir = xrootdfs_readdir;
1322 xrootdfs_oper.mknod = xrootdfs_mknod;
1323 xrootdfs_oper.mkdir = xrootdfs_mkdir;
1324 xrootdfs_oper.create = xrootdfs_create;
1325 xrootdfs_oper.symlink = xrootdfs_symlink;
1326 xrootdfs_oper.unlink = xrootdfs_unlink;
1327 xrootdfs_oper.rmdir = xrootdfs_rmdir;
1328 xrootdfs_oper.rename = xrootdfs_rename;
1329 xrootdfs_oper.link = xrootdfs_link;
1330 xrootdfs_oper.chmod = xrootdfs_chmod;
1331 xrootdfs_oper.chown = xrootdfs_chown;
1332 xrootdfs_oper.ftruncate = xrootdfs_ftruncate;
1333 xrootdfs_oper.truncate = xrootdfs_truncate;
1334 xrootdfs_oper.utimens = xrootdfs_utimens;
1335 xrootdfs_oper.open = xrootdfs_open;
1336 xrootdfs_oper.read = xrootdfs_read;
1337 xrootdfs_oper.write = xrootdfs_write;
1338 xrootdfs_oper.statfs = xrootdfs_statfs;
1339 xrootdfs_oper.release = xrootdfs_release;
1340 xrootdfs_oper.fsync = xrootdfs_fsync;
1341 xrootdfs_oper.setxattr = xrootdfs_setxattr;
1342 xrootdfs_oper.getxattr = xrootdfs_getxattr;
1343 xrootdfs_oper.listxattr = xrootdfs_listxattr;
1344 xrootdfs_oper.removexattr = xrootdfs_removexattr;
1347 char **cmdline_opts;
1349 if (getenv(
"XRDCL_EC"))
usingEC =
true;
1351 cmdline_opts = (
char **) malloc(
sizeof(
char*) * (argc -1 + 3));
1352 cmdline_opts[0] = argv[0];
1353 cmdline_opts[1] = strdup(
"-o");
1354 if (getenv(
"XROOTDFS_NO_ALLOW_OTHER") != NULL && ! strcmp(getenv(
"XROOTDFS_NO_ALLOW_OTHER"),
"1") )
1357 cmdline_opts[2] = strdup(
"fsname=xrootdfs,max_write=131072,attr_timeout=10,entry_timeout=10,negative_timeout=5");
1359 cmdline_opts[2] = strdup(
"fsname=xrootdfs,max_write=131072,attr_timeout=10,entry_timeout=0,negative_timeout=5");
1364 cmdline_opts[2] = strdup(
"fsname=xrootdfs,allow_other,max_write=131072,attr_timeout=10,entry_timeout=10,negative_timeout=5");
1366 cmdline_opts[2] = strdup(
"fsname=xrootdfs,allow_other,max_write=131072,attr_timeout=10,entry_timeout=0,negative_timeout=5");
1369 for (
int i = 1; i < argc; i++)
1370 cmdline_opts[i+2] = argv[i];
1372 struct fuse_args args = FUSE_ARGS_INIT(argc -1 + 3, cmdline_opts);
1374 xrootdfs_opts[0].templ =
"-h";
1375 xrootdfs_opts[0].offset = -1U;
1376 xrootdfs_opts[0].value = OPT_KEY_HELP;
1378 xrootdfs_opts[1].templ =
"-help";
1379 xrootdfs_opts[1].offset = -1U;
1380 xrootdfs_opts[1].value = OPT_KEY_HELP;
1382 xrootdfs_opts[2].templ =
"--help";
1383 xrootdfs_opts[2].offset = -1U;
1384 xrootdfs_opts[2].value = OPT_KEY_HELP;
1386 xrootdfs_opts[3].templ =
"rdr=%s";
1387 xrootdfs_opts[3].offset = offsetof(
struct XROOTDFS, rdr);
1388 xrootdfs_opts[3].value = 0;
1390 xrootdfs_opts[4].templ =
"cns=%s";
1391 xrootdfs_opts[4].offset = offsetof(
struct XROOTDFS, cns);
1392 xrootdfs_opts[4].value = 0;
1394 xrootdfs_opts[5].templ =
"fastls=%s";
1395 xrootdfs_opts[5].offset = offsetof(
struct XROOTDFS, fastls);
1396 xrootdfs_opts[5].value = 0;
1398 xrootdfs_opts[6].templ =
"uid=%s";
1399 xrootdfs_opts[6].offset = offsetof(
struct XROOTDFS, daemon_user);
1400 xrootdfs_opts[6].value = 0;
1402 xrootdfs_opts[7].templ =
"ofsfwd=%s";
1403 xrootdfs_opts[7].offset = offsetof(
struct XROOTDFS, ofsfwd);
1404 xrootdfs_opts[7].value = 0;
1410 xrootdfs_opts[8].templ =
"sss";
1411 xrootdfs_opts[8].offset = -1U;
1412 xrootdfs_opts[8].value = OPT_KEY_SECSSS;
1415 xrootdfs_opts[9].templ =
"sss=%s";
1416 xrootdfs_opts[9].offset = offsetof(
struct XROOTDFS, ssskeytab);
1417 xrootdfs_opts[9].value = 0;
1420 xrootdfs_opts[10].templ =
"refreshdslist=%s";
1421 xrootdfs_opts[10].offset = offsetof(
struct XROOTDFS, urlcachelife);
1422 xrootdfs_opts[10].value = 0;
1425 xrootdfs_opts[11].templ =
"nworkers=%d";
1426 xrootdfs_opts[11].offset = offsetof(
struct XROOTDFS, nworkers);
1427 xrootdfs_opts[11].value = 0;
1430 xrootdfs_opts[12].templ =
"maxfd=%d";
1431 xrootdfs_opts[12].offset = offsetof(
struct XROOTDFS, maxfd);
1432 xrootdfs_opts[12].value = 0;
1434 xrootdfs_opts[13].templ = NULL;
1438 xrootdfs.rdr = NULL;
1439 xrootdfs.cns = NULL;
1440 xrootdfs.fastls = NULL;
1441 xrootdfs.daemon_user = NULL;
1442 xrootdfs.ofsfwd =
false;
1443 xrootdfs.ssskeytab = NULL;
1444 xrootdfs.urlcachelife = strdup(
"3650d");
1445 xrootdfs.nworkers = 4;
1446 xrootdfs.maxfd = 8192;
1449 xrootdfs.rdr = getenv(
"XROOTDFS_RDRURL");
1450 xrootdfs.cns = getenv(
"XROOTDFS_CNSURL");
1451 xrootdfs.fastls = getenv(
"XROOTDFS_FASTLS");
1453 xrootdfs.daemon_user = getenv(
"XROOTDFS_USER");
1454 if (getenv(
"XROOTDFS_OFSFWD") != NULL && ! strcmp(getenv(
"XROOTDFS_OFSFWD"),
"1")) xrootdfs.ofsfwd =
true;
1455 if (getenv(
"XROOTDFS_NWORKERS") != NULL) sscanf(getenv(
"XROOTDFS_NWORKERS"),
"%d", &xrootdfs.nworkers);
1456 if (getenv(
"XROOTDFS_MAXFD") != NULL) sscanf(getenv(
"XROOTDFS_MAXFD"),
"%d", &xrootdfs.maxfd);
1459 fuse_opt_parse(&args, &xrootdfs, xrootdfs_opts, xrootdfs_opt_proc);
1462 if (xrootdfs.rdr == NULL)
1465 argv[1] = strdup(
"-h");
1466 struct fuse_args xargs = FUSE_ARGS_INIT(argc, argv);
1467 fuse_opt_parse(&xargs, &xrootdfs, xrootdfs_opts, xrootdfs_opt_proc);
1471 if (xrootdfs.rdr != NULL && xrootdfs.rdr[0] ==
'x') xrootdfs.rdr += 1;
1472 if (xrootdfs.cns != NULL && xrootdfs.cns[0] ==
'x') xrootdfs.cns += 1;
1481 if (xrootdfs.cns == NULL) xrootdfs.ofsfwd =
false;
1483 if (xrootdfs.ssskeytab != NULL)
1485 setenv(
"XROOTDFS_SECMOD",
"sss", 1);
1486 setenv(
"XrdSecsssKT", xrootdfs.ssskeytab, 1);
1489 if (xrootdfs.maxfd < 2048) xrootdfs.maxfd = 2048;
1491 signal(SIGUSR1,xrootdfs_sigusr1_handler);
1493 cwdfd =
open(
".",O_RDONLY);
1496 return fuse_main(args.argc, args.argv, &xrootdfs_oper, NULL);
1502 printf(
"This platform does not have FUSE; xrootdfs cannot be started!");
int XrdFfsFsinfo_cache_search(int(*func)(const char *, const char *, struct statvfs *, uid_t), const char *rdrurl, const char *path, struct statvfs *stbuf, uid_t user_uid)
void XrdFfsMisc_logging_url_cache(const char *url)
void XrdFfsMisc_xrd_init(const char *rdrurl, const char *urlcachelife, int startQueue)
int XrdFfsMisc_get_list_of_data_servers(char *list)
void XrdFfsMisc_xrd_secsss_register(uid_t user_uid, gid_t user_gid, int *id)
void XrdFfsMisc_xrd_secsss_editurl(char *url, uid_t user_uid, int *id)
void XrdFfsMisc_refresh_url_cache(const char *url)
#define XrdFfs_MAX_NUM_NODES
int XrdFfsPosix_ftruncate(int fildes, off_t offset)
int XrdFfsPosix_rmdirall(const char *rdrurl, const char *path, uid_t user_uid)
int XrdFfsPosix_rename(const char *oldpath, const char *newpath)
DIR * XrdFfsPosix_opendir(const char *path)
int XrdFfsPosix_open(const char *path, int oflags, mode_t mode)
int XrdFfsPosix_fsync(int fildes)
int XrdFfsPosix_unlink(const char *path)
int XrdFfsPosix_renameall(const char *rdrurl, const char *from, const char *to, uid_t user_uid)
void XrdFfsPosix_clear_from_rdr_cache(const char *rdrurl)
int XrdFfsPosix_truncate(const char *path, off_t Size)
int XrdFfsPosix_truncateall(const char *rdrurl, const char *path, off_t size, uid_t user_uid)
int XrdFfsPosix_closedir(DIR *dirp)
int XrdFfsPosix_rmdir(const char *path)
struct dirent * XrdFfsPosix_readdir(DIR *dirp)
off_t XrdFfsPosix_lseek(int fildes, off_t offset, int whence)
int XrdFfsPosix_close(int fildes)
ssize_t XrdFfsPosix_pread(int fildes, void *buf, size_t nbyte, off_t offset)
int XrdFfsPosix_statvfsall(const char *rdrurl, const char *path, struct statvfs *stbuf, uid_t user_uid)
int XrdFfsPosix_readdirall(const char *rdrurl, const char *path, char ***direntarray, uid_t user_uid)
int XrdFfsPosix_statall(const char *rdrurl, const char *path, struct stat *stbuf, uid_t user_uid)
int XrdFfsPosix_unlinkall(const char *rdrurl, const char *path, uid_t user_uid)
int XrdFfsPosix_stat(const char *path, struct stat *buf)
int XrdFfsPosix_mkdir(const char *path, mode_t mode)
long long XrdFfsPosix_getxattr(const char *path, const char *name, void *value, unsigned long long size)
ssize_t XrdFfsPosix_write(int fildes, const void *buf, size_t nbyte)
int XrdFfsQueue_remove_workers(int n)
int XrdFfsQueue_count_workers()
int XrdFfsQueue_create_workers(int n)
void XrdFfsWcache_init(int basefd, int maxfd)
void XrdFfsWcache_destroy(int fd)
ssize_t XrdFfsWcache_pwrite(int fd, char *buf, size_t len, off_t offset)
ssize_t XrdFfsWcache_pread(int fd, char *buf, size_t len, off_t offset)
ssize_t XrdFfsWcache_flush(int fd)
int XrdFfsWcache_create(int fd, int flags)
int main(int argc, char *argv[])
int stat(const char *path, struct stat *buf)
int open(const char *path, int oflag,...)
int statvfs(const char *path, struct statvfs *buf)
POSIX interface to XRootD with some extensions, as noted.
static int Fstat(int fildes, struct stat *buf)
Fstat() conforms to POSIX.1-2001 fstat()
static INT to(const char *buffer)