]> arthur.barton.de Git - netatalk.git/blob - libatalk/adouble/ad_size.c
- merge branch-netatalk-afp-3x-dev, HEAD was tagged before
[netatalk.git] / libatalk / adouble / ad_size.c
1 /*
2  * $Id: ad_size.c,v 1.6 2005-04-28 20:49:52 bfernhomberg 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 <atalk/logger.h>
15 #include <atalk/adouble.h>
16
17 off_t ad_size(const struct adouble *ad, const u_int32_t eid)
18 {
19   if (eid == ADEID_DFORK) {
20     struct stat st;
21     
22     if (fstat(ad_dfileno(ad), &st) < 0)
23       return 0;
24     return st.st_size;
25   }  
26 #if 0
27   return ad_getentrylen(ad, eid);
28 #endif
29   return ad->ad_rlen;  
30