+ ad_setentrylen( adp, ADEID_PRIVINO, sizeof(ino_t));
+ memcpy(ad_entry( adp, ADEID_PRIVINO ), &ino, sizeof(ino_t));
+
+ ad_setentrylen( adp, ADEID_DID, sizeof(did));
+ memcpy(ad_entry( adp, ADEID_DID ), &did, sizeof(did));
+
+ ad_setentrylen( adp, ADEID_PRIVSYN, ADEDLEN_PRIVSYN);
+ memcpy(ad_entry( adp, ADEID_PRIVSYN ), stamp, ADEDLEN_PRIVSYN);
+ return 1;
+ }
+ return 0;
+}
+
+/* ----------------------------- */
+u_int32_t ad_getid (struct adouble *adp, const dev_t st_dev, const ino_t st_ino , const cnid_t did, const void *stamp)
+{
+ u_int32_t aint = 0;
+ dev_t dev;
+ ino_t ino;
+ cnid_t a_did;
+ char temp[ADEDLEN_PRIVSYN];
+
+ /* look in AD v2 header
+ * note inode and device are opaques and not in network order
+ * only use the ID if adouble is writable for us.
+ */
+ if (adp
+ && (adp->ad_options & ADVOL_CACHE)
+ && (adp->ad_md->adf_flags & O_RDWR )
+ && (sizeof(dev_t) == ad_getentrylen(adp, ADEID_PRIVDEV)) /* One check to ensure ALL values are there */
+ ) {
+ memcpy(&dev, ad_entry(adp, ADEID_PRIVDEV), sizeof(dev_t));
+ memcpy(&ino, ad_entry(adp, ADEID_PRIVINO), sizeof(ino_t));
+ memcpy(temp, ad_entry(adp, ADEID_PRIVSYN), sizeof(temp));
+ memcpy(&a_did, ad_entry(adp, ADEID_DID), sizeof(cnid_t));
+
+ if ( ((adp->ad_options & ADVOL_NODEV) || dev == st_dev)
+ && ino == st_ino
+ && (!did || a_did == did)
+ && (memcmp(stamp, temp, sizeof(temp)) == 0) ) {
+ memcpy(&aint, ad_entry(adp, ADEID_PRIVID), sizeof(aint));
+ return aint;
+ }
+ }
+ return 0;
+}
+
+/* ----------------------------- */
+u_int32_t ad_forcegetid (struct adouble *adp)
+{
+ u_int32_t aint = 0;
+
+ if (adp && (adp->ad_options & ADVOL_CACHE)) {
+ memcpy(&aint, ad_entry(adp, ADEID_PRIVID), sizeof(aint));
+ return aint;
+ }
+ return 0;
+}
+#endif
+
+/* -----------------
+ * set resource fork filename attribute.
+ */
+int ad_setname(struct adouble *ad, const char *path)
+{
+ if (ad_getentryoff(ad, ADEID_NAME)) {
+ ad_setentrylen( ad, ADEID_NAME, strlen( path ));
+ memcpy(ad_entry( ad, ADEID_NAME ), path, ad_getentrylen( ad, ADEID_NAME ));
+ return 1;
+ }
+ return 0;