Skip to content

Commit

Permalink
Update rt_linux.c
Browse files Browse the repository at this point in the history
RtmpOSFileRead/RtmpOSFileWrite fix for Kernel >3.19
  • Loading branch information
Myria-de committed Mar 26, 2016
1 parent 4606187 commit 8fa235d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion os/linux/rt_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,17 +1083,28 @@ void RtmpOSFileSeek(RTMP_OS_FD osfd, int offset)
int RtmpOSFileRead(RTMP_OS_FD osfd, char *pDataPtr, int readLen)
{
/* The object must have a read method */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
if (osfd->f_op && osfd->f_op->read) {
return osfd->f_op->read(osfd, pDataPtr, readLen, &osfd->f_pos);
} else {
DBGPRINT(RT_DEBUG_ERROR, ("no file read method\n"));
return -1;
#else
if (osfd && osfd->f_mode & FMODE_CAN_READ) {
return __vfs_read(osfd, pDataPtr, readLen, &osfd->f_pos);
} else {
DBGPRINT(RT_DEBUG_ERROR, ("no file read method\n"));
#endif
return -1;
}
}

int RtmpOSFileWrite(RTMP_OS_FD osfd, char *pDataPtr, int writeLen)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
return osfd->f_op->write(osfd, pDataPtr, (size_t) writeLen, &osfd->f_pos);
#else
return __vfs_write(osfd, pDataPtr, (size_t) writeLen, &osfd->f_pos);
#endif
}

static inline void __RtmpOSFSInfoChange(OS_FS_INFO * pOSFSInfo, BOOLEAN bSet)
Expand Down

0 comments on commit 8fa235d

Please sign in to comment.