2011/6/23 mowang da <whooya.xxl@xxxxxxxxx>: > I am currently testing Ceph , l write some code like this: > > size_t fd = open("/mnt/aaa", O_CREAT | O_RDWR | O_APPEND , 0755); > > then l can not write buffer to the fd, 1 think there is something wrong in : > > int ceph_flags_to_mode(int flags) > > { > > ... > > if ((flags & O_ACCMODE) == O_RDWR) > mode = CEPH_FILE_MODE_RDWR; > else if ((flags & O_ACCMODE) == O_WRONLY) //? > mode = CEPH_FILE_MODE_WR; > else > mode = CEPH_FILE_MODE_RD; > > ... > > } > > if change the "(flags & O_ACCMODE) == O_WRONLY" to "(flags & > O_ACCMODE) == O_ACCMODE", l can write success! > Can you verify that you're sending the right flags? According to this: #define O_ACCMODE 0003 #define O_RDONLY 00 #define O_WRONLY 01 #define O_RDWR 02 your check will only work if you pass O_RDWR | O_RDONLY, which is obviously not what you meant to do. -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html