#define ADEDOFF_FINDERI_OSX (AD_HEADER_LEN + ADEID_NUM_OSX*AD_ENTRY_LEN)
#define ADEDOFF_RFORK_OSX (ADEDOFF_FINDERI_OSX + ADEDLEN_FINDERI)
+/* special fd value used to indicate an open fork file is a (not open) symlink */
+#define AD_SYMLINK -2
+
typedef uint32_t cnid_t;
struct ad_entry {
} adf_lock_t;
struct ad_fd {
- int adf_fd; /* -1: invalid, -2: symlink */
+ int adf_fd; /* -1: invalid, AD_SYMLINK: symlink */
char *adf_syml;
int adf_flags;
adf_lock_t *adf_lock;
int ad_refcount; /* multiple forks may open one adouble */
off_t ad_rlen; /* ressource fork len with AFP 3.0 *
* the header parameter size is too small. */
- char *ad_m_name; /* mac name for open fork */
- int ad_m_namelen;
+ char *ad_name; /* name in server encoding (usually UTF8) */
struct adouble_fops *ad_ops;
uint16_t ad_open_forks; /* open forks (by others) */
char ad_data[AD_DATASZ_MAX];
#define ad_reso_fileno(ad) ((ad)->ad_rfp->adf_fd)
#define ad_meta_fileno(ad) ((ad)->ad_mdp->adf_fd)
-/* -1 means not open, -2 is a symlink */
+/* -1: not open, AD_SYMLINK (-2): it's a symlink */
#define AD_DATA_OPEN(ad) ((ad)->ad_data_fork.adf_fd >= 0)
#define AD_META_OPEN(ad) ((ad)->ad_mdp->adf_fd >= 0)
#define AD_RSRC_OPEN(ad) ((ad)->ad_rfp->adf_fd >= 0)
#define ad_unref(ad) --((ad)->ad_refcount)
/* ad_flush.c */
-extern int ad_rebuild_adouble_header (struct adouble *);
+extern int ad_rebuild_adouble_header_v2(struct adouble *);
+extern int ad_rebuild_adouble_header_ea(struct adouble *);
extern int ad_copy_header (struct adouble *, struct adouble *);
extern int ad_flush (struct adouble *);
extern int ad_close (struct adouble *, int);
extern int ad_metadata (const char *, int, struct adouble *);
extern int ad_metadataat (int, const char *, int, struct adouble *);
extern mode_t ad_hf_mode(mode_t mode);
-extern int ad_convert(const char *path, const struct stat *sp, const struct vol *vol);
extern int ad_valid_header_osx(const char *path);
+
+/* ad_conv.c */
+extern int ad_convert(const char *path, const struct stat *sp, const struct vol *vol, const char **newpath);
+
/* ad_read.c/ad_write.c */
extern int sys_ftruncate(int fd, off_t length);
extern ssize_t ad_read(struct adouble *, uint32_t, off_t, char *, size_t);
extern int ad_getdate(const struct adouble *, unsigned int, uint32_t *);
/* ad_attr.c */
-extern int ad_setattr(const struct adouble *, uint16_t);
+extern int ad_setattr(const struct adouble *, const uint16_t);
extern int ad_getattr(const struct adouble *, uint16_t *);
extern int ad_setname(struct adouble *, const char *);
extern int ad_setid(struct adouble *, dev_t dev, ino_t ino, uint32_t, uint32_t, const void *);