extern osi_mutex_t cm_Freelance_Lock;
#endif
-#ifdef AFS_LARGEFILES
/* we can access connp->serverp without holding a lock because that
never changes since the connection is made. */
#define SERVERHAS64BIT(connp) (!((connp)->serverp->flags & CM_SERVERFLAG_NO64BIT))
#define SET_SERVERHASNO64BIT(connp) (cm_SetServerNo64Bit((connp)->serverp, TRUE))
-#else
-#define SERVERHAS64BIT(connp) (FALSE)
-#define SET_SERVERHASNO64BIT(connp) (FALSE)
-#endif
/* functions called back from the buffer package when reading or writing data,
* or when holding or releasing a vnode pointer.
long code, code1;
cm_scache_t *scp = vscp;
afs_int32 nbytes;
-#ifdef AFS_LARGEFILES
afs_int32 save_nbytes;
-#endif
long temp;
AFSFetchStatus outStatus;
AFSStoreStatus inStatus;
lock_ReleaseWrite(&scp->rw);
/* now we're ready to do the store operation */
-#ifdef AFS_LARGEFILES
save_nbytes = nbytes;
-#endif
do {
code = cm_ConnFromFID(&scp->fid, userp, reqp, &connp);
if (code)
rxcallp = rx_NewCall(rxconnp);
rx_PutConnection(rxconnp);
-#ifdef AFS_LARGEFILES
if (SERVERHAS64BIT(connp)) {
call_was_64bit = 1;
osi_Log0(afsd_logp, "CALL StartRXAFS_StoreData SUCCESS");
}
}
-#else
- osi_Log4(afsd_logp, "CALL StartRXAFS_StoreData scp 0x%p, offset 0x%x:%08x, length 0x%x",
- scp, biod.offset.HighPart, biod.offset.LowPart, nbytes);
-
- code = StartRXAFS_StoreData(rxcallp, &tfid, &inStatus,
- biod.offset.LowPart, nbytes, truncPos.LowPart);
- if (code)
- osi_Log1(afsd_logp, "CALL StartRXAFS_StoreData FAILURE, code 0x%x", code);
- else
- osi_Log0(afsd_logp, "CALL StartRXAFS_StoreData SUCCESS");
-#endif
if (code == 0) {
/* write the data from the the list of buffers */
code1 = rx_EndCall(rxcallp, code);
-#ifdef AFS_LARGEFILES
if ((code == RXGEN_OPCODE || code1 == RXGEN_OPCODE) && SERVERHAS64BIT(connp)) {
SET_SERVERHASNO64BIT(connp);
qdp = NULL;
nbytes = save_nbytes;
goto retry;
}
-#endif
+
/* Prefer StoreData error over rx_EndCall error */
if (code1 != 0)
code = code1;
rxcallp = rx_NewCall(rxconnp);
rx_PutConnection(rxconnp);
-#ifdef AFS_LARGEFILES
if (SERVERHAS64BIT(connp)) {
call_was_64bit = 1;
0, 0, truncPos.LowPart);
}
}
-#else
- code = StartRXAFS_StoreData(rxcallp, &tfid, &inStatus,
- 0, 0, truncPos.LowPart);
-#endif
if (code == 0) {
if (call_was_64bit)
}
code1 = rx_EndCall(rxcallp, code);
-#ifdef AFS_LARGEFILES
if ((code == RXGEN_OPCODE || code1 == RXGEN_OPCODE) && SERVERHAS64BIT(connp)) {
SET_SERVERHASNO64BIT(connp);
goto retry;
}
-#endif
+
/* prefer StoreData error over rx_EndCall error */
if (code == 0 && code1 != 0)
code = code1;
rxcallp = rx_NewCall(rxconnp);
rx_PutConnection(rxconnp);
-#ifdef AFS_LARGEFILES
nbytes = nbytes_hi = 0;
if (SERVERHAS64BIT(connp)) {
}
/* for the moment, nbytes_hi will always be 0 if code == 0
because biod.length is a 32-bit quantity. */
-#else
- osi_Log3(afsd_logp, "CALL FetchData scp 0x%p, off 0x%x, size 0x%x",
- scp, biod.offset.LowPart, biod.length);
-
- code = StartRXAFS_FetchData(rxcallp, &tfid, biod.offset.LowPart,
- biod.length);
-
- /* now copy the data out of the pipe and put it in the buffer */
- if (code == 0) {
- temp = rx_Read32(rxcallp, &nbytes);
- if (temp == sizeof(afs_int32)) {
- length_found = ntohl(nbytes);
- if (length_found > biod.length) {
- /*
- * prior to 1.4.12 and 1.5.65 the file server would return
- * (filesize - offset) if the requested offset was greater than
- * the filesize. The correct return value would have been zero.
- * Force a retry by returning an RX_PROTOCOL_ERROR. If the cause
- * is a race between two RPCs issues by this cache manager, the
- * correct thing will happen the second time.
- */
- osi_Log0(afsd_logp, "cm_GetBuffer length_found > biod.length");
- fs_fetchdata_offset_bug = 1;
- }
- }
- else {
- osi_Log1(afsd_logp, "cm_GetBuffer rx_Read32 returns %d != 4", temp);
- code = (rxcallp->error < 0) ? rxcallp->error : RX_PROTOCOL_ERROR;
- }
- }
-#endif
if (code == 0) {
qdp = biod.bufListEndp;
if (*inp->wctp == 10) {
/* we were sent a request with 64-bit file offsets */
-#ifdef AFS_LARGEFILES
offset.HighPart = smb_GetSMBParm(inp, 8) | (smb_GetSMBParm(inp, 9) << 16);
if (LargeIntegerLessThanZero(offset)) {
osi_Log0(smb_logp, "smb_ReceiveCoreReadRaw received negative 64-bit offset");
goto send1;
}
-#else
- if ((smb_GetSMBParm(inp, 8) | (smb_GetSMBParm(inp, 9) << 16)) != 0) {
- osi_Log0(smb_logp, "smb_ReceiveCoreReadRaw received 64-bit file offset. Dropping request.");
- goto send1;
- } else {
- offset.HighPart = 0;
- }
-#endif
} else {
/* we were sent a request with 32-bit file offsets */
offset.HighPart = 0;
#ifdef DFS_SUPPORT
NTNEGOTIATE_CAPABILITY_DFS |
#endif
-#ifdef AFS_LARGEFILES
NTNEGOTIATE_CAPABILITY_LARGEFILES |
-#endif
NTNEGOTIATE_CAPABILITY_NTFIND |
NTNEGOTIATE_CAPABILITY_RAWMODE |
NTNEGOTIATE_CAPABILITY_NTSMB;
if (*inp->wctp == 14) {
/* we received a 64-bit file offset */
-#ifdef AFS_LARGEFILES
offset.HighPart = smb_GetSMBParm(inp, 12) | (smb_GetSMBParm(inp, 13) << 16);
if (LargeIntegerLessThanZero(offset)) {
offset.HighPart, offset.LowPart);
return CM_ERROR_BADSMB;
}
-#else
- if ((smb_GetSMBParm(inp, 12) | (smb_GetSMBParm(inp, 13) << 16)) != 0) {
- osi_Log0(smb_logp,
- "smb_ReceiveCoreWriteRaw received 64-bit file offset, but we don't support large files");
- return CM_ERROR_BADSMB;
- }
-
- offset.HighPart = 0;
-#endif
} else {
offset.HighPart = 0; /* 32-bit file offset */
}
if (*inp->wctp == 14) {
/* we have a request with 64-bit file offsets */
-#ifdef AFS_LARGEFILES
offset.HighPart = smb_GetSMBParm(inp, 12) | (smb_GetSMBParm(inp, 13) << 16);
-#else
- if ((smb_GetSMBParm(inp, 12) | (smb_GetSMBParm(inp, 13) << 16)) != 0) {
- /* uh oh */
- osi_Log0(smb_logp, "smb_ReceiveV3WriteX offset requires largefile support");
- /* we shouldn't have received this op if we didn't specify
- largefile support */
- return CM_ERROR_INVAL;
- }
-#endif
}
op = inp->data + smb_GetSMBParm(inp, 11);
if (*inp->wctp == 12) {
/* a request with 64-bit offsets */
-#ifdef AFS_LARGEFILES
offset.HighPart = smb_GetSMBParm(inp, 10) | (smb_GetSMBParm(inp, 11) << 16);
if (LargeIntegerLessThanZero(offset)) {
offset.HighPart, offset.LowPart);
return CM_ERROR_BADSMB;
}
-#else
- if ((smb_GetSMBParm(inp, 10) | (smb_GetSMBParm(inp, 11) << 16)) != 0) {
- osi_Log0(smb_logp, "smb_ReceiveV3Read offset is 64-bit. Dropping");
- return CM_ERROR_BADSMB;
- } else {
- offset.HighPart = 0;
- }
-#endif
} else {
offset.HighPart = 0;
}