ad_open so that we can keep file locks together.
FIXME: add the fork we are opening?
*/
- if ((opened = of_findname(s_path))) {
+ if ((opened = of_findname(vol, s_path))) {
adsame = opened->of_ad;
}
case EDQUOT:
case EFBIG:
case ENOSPC:
+ LOG(log_error, logtype_afpd, "afp_setforkparams: DISK FULL");
return AFPERR_DFULL;
default:
return AFPERR_PARAM;
goto afp_read_err;
}
+ LOG(log_debug, logtype_afpd, "afp_read(name: \"%s\", offset: %jd, reqcount: %jd)",
+ of_name(ofork), (intmax_t)offset, (intmax_t)reqcount);
+
savereqcount = reqcount;
saveoff = offset;
if (ad_tmplock(ofork->of_ad, eid, ADLOCK_RD, saveoff, savereqcount,ofork->of_refnum) < 0) {
goto afp_read_err;
}
-#ifdef WITH_SENDFILE
- *rbuflen = 0;
-#else
*rbuflen = MIN(reqcount, *rbuflen);
+ LOG(log_debug, logtype_afpd, "afp_read(name: \"%s\", offset: %jd, reqcount: %jd): reading %jd bytes from file",
+ of_name(ofork), (intmax_t)offset, (intmax_t)reqcount, (intmax_t)*rbuflen);
err = read_file(ofork, eid, offset, nlmask, nlchar, rbuf, rbuflen, xlate);
if (err < 0)
goto afp_read_done;
-#endif
+ LOG(log_debug, logtype_afpd, "afp_read(name: \"%s\", offset: %jd, reqcount: %jd): got %jd bytes from file",
+ of_name(ofork), (intmax_t)offset, (intmax_t)reqcount, (intmax_t)*rbuflen);
+
/* dsi can stream requests. we can only do this if we're not checking
* for an end-of-line character. oh well. */
if ((obj->proto == AFPPROTO_DSI) && (*rbuflen < reqcount) && !nlmask) {
int fd;
fd = ad_readfile_init(ofork->of_ad, eid, &offset, 0);
+
if (dsi_stream_read_file(dsi, fd, offset, dsi->datasize) < 0) {
if (errno == EINVAL || errno == ENOSYS)
goto afp_read_loop;
goto afp_read_exit;
offset += *rbuflen;
-#ifdef DEBUG1
- if (obj->options.flags & OPTION_DEBUG) {
- printf( "(read) reply: %d, %d\n", *rbuflen, dsi->clientID);
- bprint(rbuf, *rbuflen);
- }
-#endif
/* dsi_read() also returns buffer size of next allocation */
cc = dsi_read(dsi, rbuf, *rbuflen); /* send it off */
if (cc < 0)
case EDQUOT :
case EFBIG :
case ENOSPC :
+ LOG(log_error, logtype_afpd, "write_file: DISK FULL");
return( AFPERR_DFULL );
case EACCES:
return AFPERR_ACCESS;
/* offset can overflow on 64-bit capable filesystems.
* report disk full if that's going to happen. */
if (sum_neg(is64, offset, reqcount)) {
+ LOG(log_error, logtype_afpd, "write_fork: DISK FULL");
err = AFPERR_DFULL;
goto afp_write_err;
}
/* update write count */
ofork->of_vol->v_appended += (newsize > oldsize) ? (newsize - oldsize) : 0;
- LOG(log_error, logtype_afpd, "write_file: %jd", (intmax_t)((newsize > oldsize) ? (newsize - oldsize) : 0));
*rbuflen = set_off_t (offset, rbuf, is64);
return( AFP_OK );