From: franklahm <fra...@us...> - 2009-09-14 10:04:28
|
Update of /cvsroot/netatalk/netatalk/libatalk/adouble In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5638/libatalk/adouble Modified Files: ad_flush.c Log Message: Untabify and reindent Index: ad_flush.c =================================================================== RCS file: /cvsroot/netatalk/netatalk/libatalk/adouble/ad_flush.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ad_flush.c 21 Jul 2009 13:41:16 -0000 1.10 --- ad_flush.c 14 Sep 2009 10:04:16 -0000 1.11 *************** *** 15,25 **** * implied warranties of any kind. * ! * Research Systems Unix Group ! * The University of Michigan ! * c/o Mike Clark ! * 535 W. William Street ! * Ann Arbor, Michigan ! * +1-313-763-0525 ! * net...@it... */ --- 15,25 ---- * implied warranties of any kind. * ! * Research Systems Unix Group ! * The University of Michigan ! * c/o Mike Clark ! * 535 W. William Street ! * Ann Arbor, Michigan ! * +1-313-763-0525 ! * net...@it... */ *************** *** 36,40 **** #include "ad_private.h" ! #if AD_VERSION == AD_VERSION1 #define EID_DISK(a) (a) --- 36,40 ---- #include "ad_private.h" ! #if AD_VERSION == AD_VERSION1 #define EID_DISK(a) (a) *************** *** 43,49 **** static const u_int32_t set_eid[] = { ! 0,1,2,3,4,5,6,7,8, ! 9,10,11,12,13,14,15, ! AD_DEV, AD_INO, AD_SYN, AD_ID }; --- 43,49 ---- static const u_int32_t set_eid[] = { ! 0,1,2,3,4,5,6,7,8, ! 9,10,11,12,13,14,15, ! AD_DEV, AD_INO, AD_SYN, AD_ID }; *************** *** 51,64 **** #endif ! /* rebuild the adouble header * XXX should be in a separate file ? ! */ int ad_rebuild_adouble_header(struct adouble *ad) { ! u_int32_t eid; ! u_int32_t temp; ! ! u_int16_t nent; ! char *buf, *nentp; /* --- 51,64 ---- #endif ! /* rebuild the adouble header * XXX should be in a separate file ? ! */ int ad_rebuild_adouble_header(struct adouble *ad) { ! u_int32_t eid; ! u_int32_t temp; ! ! u_int16_t nent; ! char *buf, *nentp; /* *************** *** 70,74 **** memcpy(buf, &temp, sizeof( temp )); buf += sizeof( temp ); ! temp = htonl( ad->ad_version ); memcpy(buf, &temp, sizeof( temp )); --- 70,74 ---- memcpy(buf, &temp, sizeof( temp )); buf += sizeof( temp ); ! temp = htonl( ad->ad_version ); memcpy(buf, &temp, sizeof( temp )); *************** *** 77,99 **** memcpy(buf, ad->ad_filler, sizeof( ad->ad_filler )); buf += sizeof( ad->ad_filler ); ! nentp = buf; buf += sizeof( nent ); for ( eid = 0, nent = 0; eid < ADEID_MAX; eid++ ) { ! if ( ad->ad_eid[ eid ].ade_off == 0 ) { ! continue; ! } ! temp = htonl( EID_DISK(eid) ); ! memcpy(buf, &temp, sizeof( temp )); ! buf += sizeof( temp ); ! temp = htonl( ad->ad_eid[ eid ].ade_off ); ! memcpy(buf, &temp, sizeof( temp )); ! buf += sizeof( temp ); ! temp = htonl( ad->ad_eid[ eid ].ade_len ); ! memcpy(buf, &temp, sizeof( temp )); ! buf += sizeof( temp ); ! nent++; } nent = htons( nent ); --- 77,99 ---- memcpy(buf, ad->ad_filler, sizeof( ad->ad_filler )); buf += sizeof( ad->ad_filler ); ! nentp = buf; buf += sizeof( nent ); for ( eid = 0, nent = 0; eid < ADEID_MAX; eid++ ) { ! if ( ad->ad_eid[ eid ].ade_off == 0 ) { ! continue; ! } ! temp = htonl( EID_DISK(eid) ); ! memcpy(buf, &temp, sizeof( temp )); ! buf += sizeof( temp ); ! temp = htonl( ad->ad_eid[ eid ].ade_off ); ! memcpy(buf, &temp, sizeof( temp )); ! buf += sizeof( temp ); ! temp = htonl( ad->ad_eid[ eid ].ade_len ); ! memcpy(buf, &temp, sizeof( temp )); ! buf += sizeof( temp ); ! nent++; } nent = htons( nent ); *************** *** 102,135 **** } ! /* ------------------- * XXX copy only header with same size or comment * doesn't work well for adouble with different version. ! * ! */ int ad_copy_header(struct adouble *add, struct adouble *ads) { ! u_int32_t eid; ! u_int32_t len; for ( eid = 0; eid < ADEID_MAX; eid++ ) { ! if ( ads->ad_eid[ eid ].ade_off == 0 ) { ! continue; ! } ! if ( add->ad_eid[ eid ].ade_off == 0 ) { ! continue; ! } ! len = ads->ad_eid[ eid ].ade_len; ! if (!len) { ! continue; ! } ! ! if (eid != ADEID_COMMENT && add->ad_eid[ eid ].ade_len != len ) { ! continue; ! } ! ! ad_setentrylen( add, eid, len ); ! memcpy( ad_entry( add, eid ), ad_entry( ads, eid ), len ); } add->ad_rlen = ads->ad_rlen; --- 102,135 ---- } ! /* ------------------- * XXX copy only header with same size or comment * doesn't work well for adouble with different version. ! * ! */ int ad_copy_header(struct adouble *add, struct adouble *ads) { ! u_int32_t eid; ! u_int32_t len; for ( eid = 0; eid < ADEID_MAX; eid++ ) { ! if ( ads->ad_eid[ eid ].ade_off == 0 ) { ! continue; ! } ! if ( add->ad_eid[ eid ].ade_off == 0 ) { ! continue; ! } ! len = ads->ad_eid[ eid ].ade_len; ! if (!len) { ! continue; ! } ! ! if (eid != ADEID_COMMENT && add->ad_eid[ eid ].ade_len != len ) { ! continue; ! } ! ! ad_setentrylen( add, eid, len ); ! memcpy( ad_entry( add, eid ), ad_entry( ads, eid ), len ); } add->ad_rlen = ads->ad_rlen; *************** *** 140,147 **** int ad_rebuild_sfm_header(struct adouble *ad) { ! u_int32_t temp; ! ! u_int16_t attr; ! char *buf; /* --- 140,147 ---- int ad_rebuild_sfm_header(struct adouble *ad) { ! u_int32_t temp; ! ! u_int16_t attr; ! char *buf; /* *************** *** 153,157 **** temp = ad->ad_magic; memcpy(buf, &temp, sizeof( temp )); ! /* temp = htonl( ad->ad_version ); */ temp = ad->ad_version; --- 153,157 ---- temp = ad->ad_magic; memcpy(buf, &temp, sizeof( temp )); ! /* temp = htonl( ad->ad_version ); */ temp = ad->ad_version; *************** *** 163,167 **** memcpy(buf +48 +4, &attr, sizeof(attr)); ! } return AD_SFM_LEN; --- 163,167 ---- memcpy(buf +48 +4, &attr, sizeof(attr)); ! } return AD_SFM_LEN; *************** *** 170,179 **** int ad_flush( ad ) ! struct adouble *ad; { int len; if (( ad->ad_md->adf_flags & O_RDWR )) { ! /* sync our header */ if (ad->ad_rlen > 0xffffffff) { ad_setentrylen(ad, ADEID_RFORK, 0xffffffff); --- 170,179 ---- int ad_flush( ad ) ! struct adouble *ad; { int len; if (( ad->ad_md->adf_flags & O_RDWR )) { ! /* sync our header */ if (ad->ad_rlen > 0xffffffff) { ad_setentrylen(ad, ADEID_RFORK, 0xffffffff); *************** *** 185,193 **** if (adf_pwrite(ad->ad_md, ad->ad_data, len, 0) != len) { ! if ( errno == 0 ) { ! errno = EIO; ! } ! return( -1 ); ! } } --- 185,193 ---- if (adf_pwrite(ad->ad_md, ad->ad_data, len, 0) != len) { ! if ( errno == 0 ) { ! errno = EIO; ! } ! return( -1 ); ! } } *************** *** 197,212 **** /* use refcounts so that we don't have to re-establish fcntl locks. */ int ad_close( ad, adflags ) ! struct adouble *ad; ! int adflags; { ! int err = 0; if (( adflags & ADFLAGS_DF ) && ad_data_fileno(ad) != -1 && ! !(--ad->ad_data_fork.adf_refcount)) { ! if ( close( ad_data_fileno(ad) ) < 0 ) { ! err = -1; ! } ! ad_data_fileno(ad) = -1; ! adf_lock_free(&ad->ad_data_fork); } --- 197,212 ---- /* use refcounts so that we don't have to re-establish fcntl locks. */ int ad_close( ad, adflags ) ! struct adouble *ad; ! int adflags; { ! int err = 0; if (( adflags & ADFLAGS_DF ) && ad_data_fileno(ad) != -1 && ! !(--ad->ad_data_fork.adf_refcount)) { ! if ( close( ad_data_fileno(ad) ) < 0 ) { ! err = -1; ! } ! ad_data_fileno(ad) = -1; ! adf_lock_free(&ad->ad_data_fork); } *************** *** 214,244 **** return err; } ! /* meta /resource fork */ if ( ad_meta_fileno(ad) != -1 && !(--ad->ad_md->adf_refcount)) { ! if ( close( ad_meta_fileno(ad) ) < 0 ) { ! err = -1; ! } ! ad_meta_fileno(ad) = -1; ! adf_lock_free(ad->ad_md); } if (ad->ad_flags != AD_VERSION1_SFM) { ! return err; } if ((adflags & ADFLAGS_DIR)) { ! return err; } if ( ad_reso_fileno(ad) != -1 && !(--ad->ad_resource_fork.adf_refcount)) { ! if ( close( ad_reso_fileno(ad) ) < 0 ) { ! err = -1; ! } ! ad_reso_fileno(ad) = -1; ! adf_lock_free(&ad->ad_resource_fork); } ! return err; } --- 214,244 ---- return err; } ! /* meta /resource fork */ if ( ad_meta_fileno(ad) != -1 && !(--ad->ad_md->adf_refcount)) { ! if ( close( ad_meta_fileno(ad) ) < 0 ) { ! err = -1; ! } ! ad_meta_fileno(ad) = -1; ! adf_lock_free(ad->ad_md); } if (ad->ad_flags != AD_VERSION1_SFM) { ! return err; } if ((adflags & ADFLAGS_DIR)) { ! return err; } if ( ad_reso_fileno(ad) != -1 && !(--ad->ad_resource_fork.adf_refcount)) { ! if ( close( ad_reso_fileno(ad) ) < 0 ) { ! err = -1; ! } ! ad_reso_fileno(ad) = -1; ! adf_lock_free(&ad->ad_resource_fork); } ! return err; } |