Fixed Issue 355

1) Patch in support for special file and block device types( Issue 355 )
    Patched codes, and s3fs can make special files on S3.



git-svn-id: http://s3fs.googlecode.com/svn/trunk@460 df820570-a93a-0410-bd06-b72b767a4274
This commit is contained in:
ggtakec@gmail.com 2013-07-30 07:27:22 +00:00
parent bf11a0444f
commit b24c868417
2 changed files with 42 additions and 24 deletions

View File

@ -746,11 +746,24 @@ static int create_file_object(const char* path, mode_t mode, uid_t uid, gid_t gi
static int s3fs_mknod(const char *path, mode_t mode, dev_t rdev) static int s3fs_mknod(const char *path, mode_t mode, dev_t rdev)
{ {
FGPRINT("s3fs_mknod[path=%s][mode=%d]\n", path, mode); int result;
headers_t meta;
struct fuse_context* pcxt;
// Could not make block or character special files on S3, FGPRINT("s3fs_mknod[path=%s][mode=0%o][dev=%lu]\n", path, mode, rdev);
// always return a error.
return -EPERM; if(NULL == (pcxt = fuse_get_context())){
return -EIO;
}
if(0 != (result = create_file_object(path, mode, pcxt->uid, pcxt->gid))){
FGPRINT("s3fs_mknod: could not create object for special file(result=%d)\n", result);
SYSLOGERR("could not create object for special file(result=%d)", result);
return result;
}
StatCache::getStatCacheData()->DelStat(path);
return result;
} }
static int s3fs_create(const char* path, mode_t mode, struct fuse_file_info* fi) static int s3fs_create(const char* path, mode_t mode, struct fuse_file_info* fi)

View File

@ -647,6 +647,10 @@ mode_t get_mode(headers_t& meta, const char* path, bool checkdir, bool forcedir)
isS3sync = true; isS3sync = true;
} }
} }
// Checking the bitmask, if the last 3 bits are all zero then process as a regular
// file type (S_IFDIR or S_IFREG), otherwise return mode unmodified so that S_IFIFO,
// S_IFSOCK, S_IFCHR, S_IFLNK and S_IFBLK devices can be processed properly by fuse.
if(!(mode & S_IFMT)){
if(!isS3sync){ if(!isS3sync){
if(checkdir){ if(checkdir){
if(forcedir){ if(forcedir){
@ -677,6 +681,7 @@ mode_t get_mode(headers_t& meta, const char* path, bool checkdir, bool forcedir)
mode &= ~S_IFREG; mode &= ~S_IFREG;
} }
} }
}
return mode; return mode;
} }