- if (( ofork = of_find( ofrefnum )) == NULL ) {
- LOG(log_error, logtype_afpd, "afp_flushfork: of_find");
+ if (NULL == ( ofork = of_find( ofrefnum )) ) {
+ LOG(log_error, logtype_afpd, "afp_flushfork: of_find(%d) could not locate fork", ofrefnum );
+ return( AFPERR_PARAM );
+ }
+
+ if ( flushfork( ofork ) < 0 ) {
+ LOG(log_error, logtype_afpd, "afp_flushfork(%s): %s", of_name(ofork), strerror(errno) );
+ }
+
+ return( AFP_OK );
+}
+
+/*
+ FIXME
+ There is a lot to tell about fsync, fdatasync, F_FULLFSYNC.
+ fsync(2) on OSX is implemented differently than on other platforms.
+ see: http://mirror.linux.org.au/pub/linux.conf.au/2007/video/talks/278.pdf.
+ */
+int afp_syncfork(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)
+{
+ struct ofork *ofork;
+ u_int16_t ofrefnum;
+
+ *rbuflen = 0;
+ ibuf += 2;
+
+ memcpy(&ofrefnum, ibuf, sizeof(ofrefnum));
+ ibuf += sizeof( ofrefnum );
+
+ if (NULL == ( ofork = of_find( ofrefnum )) ) {
+ LOG(log_error, logtype_afpd, "afpd_syncfork: of_find(%d) could not locate fork", ofrefnum );