• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/ap/gpl/timemachine/netatalk-2.2.0/etc/afpd/

Lines Matching refs:ofork

46 struct ofork *writtenfork;
49 static int getforkparams(struct ofork *ofork, u_int16_t bitmap, char *buf, size_t *buflen)
61 && (ofork->of_flags & AFPFORK_RSRC))
64 && (ofork->of_flags & AFPFORK_DATA))) {
68 if ( ad_reso_fileno( ofork->of_ad ) == -1 ) { /* META ? */
71 adp = ofork->of_ad;
74 vol = ofork->of_vol;
75 dir = dirlookup(vol, ofork->of_did);
77 if (NULL == (path.u_name = mtoupath(vol, of_name(ofork), dir->d_did, utf8_encoding()))) {
80 path.m_name = of_name(ofork);
86 if ( ad_data_fileno( ofork->of_ad ) <= 0 ) {
93 if ( fstat( ad_data_fileno( ofork->of_ad ), st ) < 0 ) {
253 struct ofork *ofork, *opened;
347 if (( ofork = of_alloc(vol, curdir, path, &ofrefnum, eid,
355 if (ad_open(upath, adflags, O_RDWR, 0, ofork->of_ad) < 0) {
365 if (ad_open(upath, ADFLAGS_DF, O_RDWR, 0, ofork->of_ad) < 0) {
373 if (ad_open(upath, adflags, O_RDWR | O_CREAT, 0666, ofork->of_ad) < 0)
375 ofork->of_flags |= AFPFORK_OPEN;
396 ofork->of_flags |= AFPFORK_OPEN;
401 if (ad_open(upath, adflags, O_RDONLY, 0, ofork->of_ad) < 0) {
411 if (ad_open(upath, ADFLAGS_DF, O_RDONLY, 0, ofork->of_ad) < 0) {
443 ofork->of_flags |= AFPFORK_OPEN;
447 if ((adflags & ADFLAGS_HF) && (ad_get_HF_flags( ofork->of_ad) & O_CREAT)) {
448 if (ad_setname(ofork->of_ad, path)) {
449 ad_flush( ofork->of_ad );
453 if (( ret = getforkparams(ofork, bitmap, rbuf + 2 * sizeof( u_int16_t ),
455 ad_close( ofork->of_ad, adflags );
467 if (ad_meta_fileno(ofork->of_ad) != -1) { /* META */
468 ad_getattr(ofork->of_ad, &bshort);
470 ad_close( ofork->of_ad, adflags );
471 of_dealloc( ofork );
483 if ((eid == ADEID_DFORK) || (ad_meta_fileno(ofork->of_ad) != -1)) { /* META */
485 ret = fork_setmode(ofork->of_ad, eid, access, ofrefnum);
489 ad_close( ofork->of_ad, adflags );
490 of_dealloc( ofork );
506 ofork->of_flags |= AFPFORK_ACCWR;
510 ofork->of_flags |= AFPFORK_ACCRD;
516 of_dealloc( ofork );
524 struct ofork *ofork;
542 if (NULL == ( ofork = of_find( ofrefnum )) ) {
547 if (ofork->of_vol->v_flags & AFPVOL_RO)
550 if ((ofork->of_flags & AFPFORK_ACCWR) == 0)
553 if ( ofork->of_flags & AFPFORK_DATA) {
555 } else if (ofork->of_flags & AFPFORK_RSRC) {
587 st_size = ad_size(ofork->of_ad, eid);
590 ad_tmplock(ofork->of_ad, eid, ADLOCK_WR, size, st_size -size, ofork->of_refnum) < 0)
593 err = ad_dtruncate( ofork->of_ad, size );
595 ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, size, st_size -size, ofork->of_refnum);
599 ad_refresh( ofork->of_ad );
601 st_size = ad_size(ofork->of_ad, eid);
604 ad_tmplock(ofork->of_ad, eid, ADLOCK_WR, size, st_size -size, ofork->of_refnum) < 0) {
607 err = ad_rtruncate(ofork->of_ad, size);
609 ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, size, st_size -size, ofork->of_refnum);
613 if (ad_flush( ofork->of_ad ) < 0) {
614 LOG(log_error, logtype_afpd, "afp_setforkparams(%s): ad_flush: %s", of_name(ofork), strerror(errno) );
621 if ( flushfork( ofork ) < 0 ) {
622 LOG(log_error, logtype_afpd, "afp_setforkparams(%s): flushfork: %s", of_name(ofork), strerror(errno) );
661 struct ofork *ofork;
677 if (NULL == ( ofork = of_find( ofrefnum )) ) {
682 if ( ofork->of_flags & AFPFORK_DATA) {
684 } else if (ofork->of_flags & AFPFORK_RSRC) {
697 } else if ((length >= AD_FILELOCK_BASE) && -1 == (ad_reso_fileno(ofork->of_ad))) { /* HF ?*/
702 offset += ad_size(ofork->of_ad, eid);
714 if (ad_lock(ofork->of_ad, eid, lockop, offset, length,
715 ofork->of_refnum) < 0) {
752 static int crlf(struct ofork *of)
771 static ssize_t read_file(struct ofork *ofork, int eid,
780 cc = ad_read(ofork->of_ad, eid, offset, rbuf, *rbuflen);
782 LOG(log_error, logtype_afpd, "afp_read(%s): ad_read: %s", of_name(ofork), strerror(errno) );
841 struct ofork *ofork;
852 if (NULL == ( ofork = of_find( ofrefnum )) ) {
858 if ((ofork->of_flags & AFPFORK_ACCRD) == 0) {
880 if ( ofork->of_flags & AFPFORK_DATA) {
882 xlate = (ofork->of_vol->v_flags & AFPVOL_CRLF) ? crlf(ofork) : 0;
883 } else if (ofork->of_flags & AFPFORK_RSRC) {
898 if (ad_tmplock(ofork->of_ad, eid, ADLOCK_RD, saveoff, savereqcount,ofork->of_refnum) < 0) {
905 err = read_file(ofork, eid, offset, nlmask, nlchar, rbuf, rbuflen, xlate);
916 size = ad_size(ofork->of_ad, eid);
939 fd = ad_readfile_init(ofork->of_ad, eid, &offset, 0);
944 LOG(log_error, logtype_afpd, "afp_read(%s): ad_readfile: %s", of_name(ofork), strerror(errno));
958 cc = read_file(ofork, eid, offset, nlmask, nlchar, rbuf,rbuflen, xlate);
979 LOG(log_error, logtype_afpd, "afp_read(%s): %s", of_name(ofork), strerror(errno));
981 ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, saveoff, savereqcount,ofork->of_refnum);
986 ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, saveoff, savereqcount,ofork->of_refnum);
1026 struct ofork *ofork;
1033 if (NULL == ( ofork = of_find( ofrefnum )) ) {
1038 if ( flushfork( ofork ) < 0 ) {
1039 LOG(log_error, logtype_afpd, "afp_flushfork(%s): %s", of_name(ofork), strerror(errno) );
1053 struct ofork *ofork;
1062 if (NULL == ( ofork = of_find( ofrefnum )) ) {
1067 if ( flushfork( ofork ) < 0 ) {
1068 LOG(log_error, logtype_afpd, "flushfork(%s): %s", of_name(ofork), strerror(errno) );
1076 int flushfork(struct ofork *ofork)
1082 if ( ad_data_fileno( ofork->of_ad ) != -1 &&
1083 fsync( ad_data_fileno( ofork->of_ad )) < 0 ) {
1085 of_name(ofork), ad_data_fileno(ofork->of_ad), strerror(errno) );
1089 if ( ad_reso_fileno( ofork->of_ad ) != -1 && /* HF */
1090 (ofork->of_flags & AFPFORK_RSRC)) {
1093 ad_refresh(ofork->of_ad);
1096 if ((ofork->of_flags & AFPFORK_DIRTY) && !gettimeofday(&tv, NULL)) {
1097 ad_setdate(ofork->of_ad, AD_DATE_MODIFY|AD_DATE_UNIX, tv.tv_sec);
1098 ofork->of_flags &= ~AFPFORK_DIRTY;
1103 if (doflush && ad_flush(ofork->of_ad) < 0)
1106 if (fsync( ad_reso_fileno( ofork->of_ad )) < 0)
1111 of_name(ofork), ad_reso_fileno(ofork->of_ad), strerror(errno) );
1119 struct ofork *ofork;
1126 if (NULL == ( ofork = of_find( ofrefnum )) ) {
1130 if ( of_closefork( ofork ) < 0 ) {
1131 LOG(log_error, logtype_afpd, "afp_closefork(%s): of_closefork: %s", of_name(ofork), strerror(errno) );
1139 static ssize_t write_file(struct ofork *ofork, int eid,
1159 if (( cc = ad_write(ofork->of_ad, eid, offset, 0,
1169 LOG(log_error, logtype_afpd, "afp_write(%s): ad_write: %s", of_name(ofork), strerror(errno) );
1183 struct ofork *ofork;
1199 if (NULL == ( ofork = of_find( ofrefnum )) ) {
1205 if ((ofork->of_flags & AFPFORK_ACCWR) == 0) {
1211 writtenfork = ofork;
1214 if ( ofork->of_flags & AFPFORK_DATA) {
1216 xlate = (ofork->of_vol->v_flags & AFPVOL_CRLF) ? crlf(ofork) : 0;
1217 } else if (ofork->of_flags & AFPFORK_RSRC) {
1225 offset += ad_size(ofork->of_ad, eid);
1247 if (ad_tmplock(ofork->of_ad, eid, ADLOCK_WR, saveoff,
1248 reqcount, ofork->of_refnum) < 0) {
1269 if ((cc = write_file(ofork, eid, offset, rbuf, *rbuflen,
1272 ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, saveoff, reqcount, ofork->of_refnum);
1285 if (!cc || (cc = write_file(ofork, eid, offset, rbuf, cc, xlate)) < 0) {
1288 ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, saveoff, reqcount, ofork->of_refnum);
1295 if ((cc = ad_writefile(ofork->of_ad, eid, dsi->socket,
1309 ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, saveoff,
1310 reqcount, ofork->of_refnum);
1322 if ((cc = write_file(ofork, eid, offset, rbuf, cc, xlate)) < 0) {
1325 ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, saveoff,
1326 reqcount, ofork->of_refnum);
1335 ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, saveoff, reqcount, ofork->of_refnum);
1336 if ( ad_meta_fileno( ofork->of_ad ) != -1 ) /* META */
1337 ofork->of_flags |= AFPFORK_DIRTY;
1340 ofork->of_flags |= AFPFORK_MODIFIED;
1343 ofork->of_vol->v_written += reqcount;
1376 struct ofork *ofork;
1388 if (NULL == ( ofork = of_find( ofrefnum )) ) {
1393 if ( ad_meta_fileno( ofork->of_ad ) != -1 ) { /* META */
1394 if ( ad_refresh( ofork->of_ad ) < 0 ) {
1395 LOG(log_error, logtype_afpd, "getforkparams(%s): ad_refresh: %s", of_name(ofork), strerror(errno) );
1400 if (AFP_OK != ( ret = getforkparams( ofork, bitmap,