1/* 2 * $Id: ad_size.c,v 1.8 2010-02-26 14:13:16 didg Exp $ 3 * 4 * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu) 5 * All rights reserved. See COPYRIGHT. 6 * 7 * if we could depend upon inline functions, this would be one. 8 */ 9 10#ifdef HAVE_CONFIG_H 11#include "config.h" 12#endif /* HAVE_CONFIG_H */ 13 14#include <string.h> 15#include <atalk/logger.h> 16#include <atalk/adouble.h> 17 18off_t ad_size(const struct adouble *ad, const u_int32_t eid) 19{ 20 if (eid == ADEID_DFORK) { 21 struct stat st; 22 23 if (ad->ad_data_fork.adf_syml) 24 return strlen(ad->ad_data_fork.adf_syml); 25 26 if (fstat(ad_data_fileno(ad), &st) < 0) 27 return 0; 28 return st.st_size; 29 } 30#if 0 31 return ad_getentrylen(ad, eid); 32#endif 33 return ad->ad_rlen; 34} 35