X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fatalk%2Fadouble.h;h=78a35b02909ecd932bbf86d00cb5d908402e9426;hb=6dd1fb33fedf945027b2b69ec180af5135ce16c8;hp=a9cd08bd69b4b399d36a51709dd9ad16787abf3b;hpb=815d557e167e76015934397dffbfa869180dcdbc;p=netatalk.git diff --git a/include/atalk/adouble.h b/include/atalk/adouble.h index a9cd08bd..78a35b02 100644 --- a/include/atalk/adouble.h +++ b/include/atalk/adouble.h @@ -1,5 +1,5 @@ /* - * $Id: adouble.h,v 1.44 2009-10-13 22:55:37 didg Exp $ + * $Id: adouble.h,v 1.55 2010-03-30 12:55:26 franklahm Exp $ * Copyright (c) 1990,1991 Regents of The University of Michigan. * All Rights Reserved. * @@ -22,6 +22,11 @@ * netatalk@itd.umich.edu */ +/*! + * @file + * @brief Part of Netatalk's AppleDouble implementatation + */ + #ifndef _ATALK_ADOUBLE_H #define _ATALK_ADOUBLE_H @@ -29,33 +34,7 @@ #include #endif -/* ------------------- - * need pread() and pwrite() - */ -#ifdef HAVE_PREAD - -#ifndef HAVE_PWRITE -#undef HAVE_PREAD -#endif - -#endif - -#ifdef HAVE_PWRITE -#ifndef HAVE_PREAD -#undef HAVE_PWRITE -#endif -#endif - -/* - Still have to figure out which platforms really - need _XOPEN_SOURCE defined for pread. -*/ -#if defined(HAVE_PREAD) && !defined(SOLARIS) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(TRU64) -#ifdef _XOPEN_SOURCE -#undef _XOPEN_SOURCE -#endif -#define _XOPEN_SOURCE 500 -#endif +#include #include #include @@ -73,6 +52,7 @@ #endif #include + #ifdef HAVE_SYS_TIME_H #include #endif @@ -227,8 +207,8 @@ typedef u_int32_t cnid_t; */ struct ad_entry { - u_int32_t ade_off; - u_int32_t ade_len; + off_t ade_off; + ssize_t ade_len; }; typedef struct adf_lock_t { @@ -238,12 +218,13 @@ typedef struct adf_lock_t { } adf_lock_t; struct ad_fd { - int adf_fd; + int adf_fd; /* -1: invalid, -2: symlink */ #ifndef HAVE_PREAD off_t adf_off; #endif + char *adf_syml; int adf_flags; int adf_excl; adf_lock_t *adf_lock; @@ -295,7 +276,9 @@ struct adouble_fops { #define ADFLAGS_DF (1<<0) #define ADFLAGS_HF (1<<1) #define ADFLAGS_DIR (1<<2) +/* #define ADFLAGS_NOADOUBLE (1<<3) +*/ #define ADFLAGS_V1COMPAT (1<<4) #define ADFLAGS_NOHF (1<<5) /* not an error if no ressource fork */ #define ADFLAGS_RDONLY (1<<6) /* don't try readwrite */ @@ -307,10 +290,9 @@ struct adouble_fops { /* adouble v2 cnid cache */ #define ADVOL_NODEV (1 << 0) #define ADVOL_CACHE (1 << 1) -/* adouble unix priv */ -#define ADVOL_UNIXPRIV (1 << 2) -/* dot files (.DS_Store) are invisible) */ -#define ADVOL_INVDOTS (1 << 3) +#define ADVOL_UNIXPRIV (1 << 2) /* adouble unix priv */ +#define ADVOL_INVDOTS (1 << 3) /* dot files (.DS_Store) are invisible) */ +#define ADVOL_NOADOUBLE (1 << 4) /* lock flags */ #define ADLOCK_CLR (0) @@ -328,8 +310,12 @@ struct adouble_fops { /* synchronization locks */ #define AD_FILELOCK_BASE (0x80000000) #else +#if _FILE_OFFSET_BITS == 64 +#define AD_FILELOCK_BASE (0x7FFFFFFFFFFFFFFFULL - 9) +#else #define AD_FILELOCK_BASE (0x7FFFFFFF -9) #endif +#endif /* FIXME: * AD_FILELOCK_BASE case @@ -447,6 +433,8 @@ extern int ad_fcntl_tmplock (struct adouble *, const u_int32_t /*eid*/, const int /*type*/, const off_t /*offset*/, const off_t /*len*/, const int /*user*/); extern int ad_testlock (struct adouble * /*adp*/, int /*eid*/, off_t /*off*/); + +extern u_int16_t ad_openforks (struct adouble * /*adp*/, u_int16_t); extern int ad_excl_lock (struct adouble * /*adp*/, const u_int32_t /*eid*/); #define ad_lock ad_fcntl_lock @@ -465,9 +453,11 @@ extern int ad_mode (const char *, int); extern int ad_mkdir (const char *, int); extern void ad_init (struct adouble *, int, int ); extern int ad_open (const char *, int, int, int, struct adouble *); +extern int ad_openat (int dirfd, const char *, int, int, int, struct adouble *); extern int ad_refresh (struct adouble *); extern int ad_stat (const char *, struct stat *); extern int ad_metadata (const char *, int, struct adouble *); +extern int ad_metadataat (int, const char *, int, struct adouble *); #define ad_open_metadata(name, flags, mode, adp)\ ad_open(name, ADFLAGS_MD|(flags), O_RDWR |(mode), 0666, (adp)) @@ -499,7 +489,24 @@ static inline mode_t ad_hf_mode (mode_t mode) return mode; } +/* ad_ea.c */ +ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size); +ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size); +ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size); +ssize_t sys_listxattr (const char *path, char *list, size_t size); +ssize_t sys_llistxattr (const char *path, char *list, size_t size); +ssize_t sys_flistxattr (int filedes, char *list, size_t size); +int sys_removexattr (const char *path, const char *name); +int sys_lremovexattr (const char *path, const char *name); +int sys_fremovexattr (int filedes, const char *name); +int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags); +int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags); +int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags); +int sys_copyxattr (const char *src, const char *dst); + /* ad_read.c/ad_write.c */ +extern int sys_ftruncate(int fd, off_t length); + extern ssize_t ad_read (struct adouble *, const u_int32_t, const off_t, char *, const size_t); extern ssize_t ad_pread (struct ad_fd *, void *, size_t, off_t); @@ -521,7 +528,7 @@ extern void *ad_mmapwrite (struct adouble *, const u_int32_t, #define ad_munmap(buf, len) (munmap((buf), (len))) /* ad_date.c */ -extern int ad_setdate (const struct adouble *, unsigned int, u_int32_t); +extern int ad_setdate (struct adouble *, unsigned int, u_int32_t); extern int ad_getdate (const struct adouble *, unsigned int, u_int32_t *); /* ad_attr.c */ @@ -540,8 +547,9 @@ extern u_int32_t ad_forcegetid (struct adouble *adp); #endif #ifdef WITH_SENDFILE -extern ssize_t ad_readfile (const struct adouble *, const int, - const int, off_t, const size_t); +extern int ad_readfile_init(const struct adouble *ad, + const int eid, off_t *off, + const int end); #endif #if 0 @@ -551,13 +559,4 @@ extern ssize_t ad_writefile (struct adouble *, const int, #endif /* HAVE_SENDFILE_WRITE */ #endif /* 0 */ -/* ad_unix.c */ -extern int netatalk_unlink(const char *name); -extern char *fullpathname(const char *); -extern int netatalk_rmdir(const char *name); -extern int setfilmode(const char *, mode_t, struct stat *, mode_t); -extern int dir_rx_set(mode_t mode); -extern int stickydirmode(const char *name, const mode_t mode, const int dropbox, const mode_t v_umask); -extern int unix_rename(const char *oldpath, const char *newpath); - #endif /* _ATALK_ADOUBLE_H */