Exemple #1
0
/* Foxconn modified start pling 11/18/2009 */
ssize_t vfs_pwrite_data(files_struct *fsp,const char *buffer,
                size_t N, SMB_OFF_T offset)
/*ssize_t vfs_pwrite_data(files_struct *fsp,const char *buffer,
                size_t N, SMB_BIG_UINT offset)*/
/* Foxconn modified end pling 11/18/2009 */
/*Foxconn modify end by Hank 09/13/2013*/
{
	/*Foxconn modify start by Hank 09/13/2013*/
	/*remove old function in 3.0.13 which cause md5 is wrong when access more than 4G file*/
    /* Foxconn modified start pling 11/18/2009 */
	size_t total=0;
	ssize_t ret;
	/*SMB_BIG_UINT total=0;
	SMB_BIG_UINT ret;*/
    /* Foxconn modified end pling 11/18/2009 */
	/*Foxconn modify end by Hank 09/13/2013*/

	while (total < N) {
		ret = SMB_VFS_PWRITE(fsp, fsp->fh->fd, buffer + total,
                                N - total, offset + total);

		if (ret == -1)
			return -1;
		if (ret == 0)
			return total;

		total += ret;
	}
	return (ssize_t)total;
}
Exemple #2
0
ssize_t vfs_pwrite_data(struct smb_request *req,
			files_struct *fsp,
			const char *buffer,
			size_t N,
			SMB_OFF_T offset)
{
	size_t total=0;
	ssize_t ret;

	if (req && req->unread_bytes) {
		SMB_ASSERT(req->unread_bytes == N);
		/* VFS_RECVFILE must drain the socket
		 * before returning. */
		req->unread_bytes = 0;
		return SMB_VFS_RECVFILE(smbd_server_fd(),
					fsp,
					offset,
					N);
	}

	while (total < N) {
		ret = SMB_VFS_PWRITE(fsp, buffer + total, N - total,
				     offset + total);

		if (ret == -1)
			return -1;
		if (ret == 0)
			return total;

		total += ret;
	}
	return (ssize_t)total;
}