Lines 1139-1144
fuse_vnop_open(struct vop_open_args *ap)
Link Here
|
1139 |
struct fuse_vnode_data *fvdat; |
1139 |
struct fuse_vnode_data *fvdat; |
1140 |
|
1140 |
|
1141 |
int error, isdir = 0; |
1141 |
int error, isdir = 0; |
|
|
1142 |
int32_t fuse_open_flags; |
1142 |
|
1143 |
|
1143 |
FS_DEBUG2G("inode=%ju mode=0x%x\n", (uintmax_t)VTOI(vp), mode); |
1144 |
FS_DEBUG2G("inode=%ju mode=0x%x\n", (uintmax_t)VTOI(vp), mode); |
1144 |
|
1145 |
|
Lines 1150-1163
fuse_vnop_open(struct vop_open_args *ap)
Link Here
|
1150 |
if (vnode_isdir(vp)) { |
1151 |
if (vnode_isdir(vp)) { |
1151 |
isdir = 1; |
1152 |
isdir = 1; |
1152 |
} |
1153 |
} |
|
|
1154 |
fuse_open_flags = 0; |
1153 |
if (isdir) { |
1155 |
if (isdir) { |
1154 |
fufh_type = FUFH_RDONLY; |
1156 |
fufh_type = FUFH_RDONLY; |
1155 |
} else { |
1157 |
} else { |
1156 |
fufh_type = fuse_filehandle_xlate_from_fflags(mode); |
1158 |
fufh_type = fuse_filehandle_xlate_from_fflags(mode); |
|
|
1159 |
/* |
1160 |
* For WRONLY opens, force DIRECT_IO. This is necessary |
1161 |
* since writing a partial block through the buffer cache |
1162 |
* will result in a read of the block and that read won't |
1163 |
* be allowed by the WRONLY open. |
1164 |
*/ |
1165 |
if (fufh_type == FUFH_WRONLY) |
1166 |
fuse_open_flags = FOPEN_DIRECT_IO; |
1157 |
} |
1167 |
} |
1158 |
|
1168 |
|
1159 |
if (fuse_filehandle_valid(vp, fufh_type)) { |
1169 |
if (fuse_filehandle_valid(vp, fufh_type)) { |
1160 |
fuse_vnode_open(vp, 0, td); |
1170 |
fuse_vnode_open(vp, fuse_open_flags, td); |
1161 |
return 0; |
1171 |
return 0; |
1162 |
} |
1172 |
} |
1163 |
error = fuse_filehandle_open(vp, fufh_type, NULL, td, cred); |
1173 |
error = fuse_filehandle_open(vp, fufh_type, NULL, td, cred); |