|
@ -112,29 +112,30 @@ namespace fs |
|
|
string &basepath) |
|
|
string &basepath) |
|
|
{ |
|
|
{ |
|
|
int rv; |
|
|
int rv; |
|
|
|
|
|
dev_t dev; |
|
|
string fullpath; |
|
|
string fullpath; |
|
|
unsigned long fsid; |
|
|
|
|
|
struct statvfs buf; |
|
|
|
|
|
|
|
|
struct stat st; |
|
|
|
|
|
|
|
|
rv = ::fstatvfs(fd,&buf); |
|
|
|
|
|
if(rv == -1) |
|
|
|
|
|
|
|
|
rv = ::fstat(fd,&st); |
|
|
|
|
|
if(FSTAT_FAILED(rv)) |
|
|
return -1; |
|
|
return -1; |
|
|
|
|
|
|
|
|
fsid = buf.f_fsid; |
|
|
|
|
|
|
|
|
dev = st.st_dev; |
|
|
for(int i = 0, ei = srcmounts.size(); i != ei; i++) |
|
|
for(int i = 0, ei = srcmounts.size(); i != ei; i++) |
|
|
{ |
|
|
{ |
|
|
fs::path::make(&srcmounts[i],fusepath,fullpath); |
|
|
fs::path::make(&srcmounts[i],fusepath,fullpath); |
|
|
|
|
|
|
|
|
rv = ::statvfs(fullpath.c_str(),&buf); |
|
|
|
|
|
if(rv == -1) |
|
|
|
|
|
|
|
|
rv = ::lstat(fullpath.c_str(),&st); |
|
|
|
|
|
if(FSTAT_FAILED(rv)) |
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
if(st.st_dev != dev) |
|
|
continue; |
|
|
continue; |
|
|
|
|
|
|
|
|
if(buf.f_fsid == fsid) |
|
|
|
|
|
{ |
|
|
|
|
|
basepath = srcmounts[i]; |
|
|
basepath = srcmounts[i]; |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return (errno=ENOENT,-1); |
|
|
return (errno=ENOENT,-1); |
|
|
} |
|
|
} |
|
|