netatalk 4.4.3
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
nad.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2009,2011 Frank Lahm <franklahm@gmail.com>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13*/
14
15#ifndef AD_H
16#define AD_H
17
18#include <arpa/inet.h>
19#include <signal.h>
20#include <sys/stat.h>
21#include <sys/types.h>
22
23#include <atalk/globals.h>
24#include <atalk/cnid.h>
25#include <atalk/compat.h>
26#include <atalk/volume.h>
27
28#define DIR_DOT_OR_DOTDOT(a) \
29 ((strcmp(a, ".") == 0) || (strcmp(a, "..") == 0))
30
31#ifndef TIMESPEC_TO_TIMEVAL
32#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
33 (tv)->tv_sec = (ts)->tv_sec; \
34 (tv)->tv_usec = (ts)->tv_nsec / 1000; \
35 }
36#endif
37
38#define ADVOL_V2_OR_EA(ad) ((ad) == AD_VERSION2 || (ad) == AD_VERSION_EA)
39
40 enum logtype {STD, DBG};
41
42#define SLOG(...) \
43 _log(STD, __VA_ARGS__)
44
45#define ERROR(...) \
46 do { \
47 _log(STD, __VA_ARGS__); \
48 exit(1); \
49 } while (0)
50
51 typedef struct {
52 struct vol *vol;
53 char db_stamp[ADEDLEN_PRIVSYN];
54} afpvol_t;
55
56 extern int log_verbose;
57 extern void _log(enum logtype lt, char *fmt, ...);
58
59 extern int ad_ls(int argc, char **argv, AFPObj *obj);
60 extern int ad_cp(int argc, char **argv, AFPObj *obj);
61 extern int ad_rm(int argc, char **argv, AFPObj *obj);
62 extern int ad_mv(int argc, char **argv, AFPObj *obj);
63 extern int ad_set(int argc, char **argv, AFPObj *obj);
64 extern int ad_find(int argc, char **argv, AFPObj *obj);
65
66/* ad_util.c */
67 extern int openvol(AFPObj *obj, const char *path, afpvol_t *vol);
68 extern void closevol(afpvol_t *vol);
69 extern cnid_t cnid_for_paths_parent(const afpvol_t *vol, const char *path,
70 cnid_t *did);
71 extern char *utompath(const struct vol *, const char *);
72 extern int convert_dots_encoding(const afpvol_t *svol, const afpvol_t *dvol,
73 char *path);
74
75 typedef struct {
76 char *p_end;
77 char *target_end;
78 char p_path[MAXPATHLEN + 2];
79} PATH_T;
80
81 extern int fflag, iflag, lflag, nflag, pflag, vflag;
82
83#endif /* AD_H */
ADEDLEN_PRIVSYN
#define ADEDLEN_PRIVSYN
Definition adouble.h:112
cnid_t
uint32_t cnid_t
Definition adouble.h:156
cnid.h
compat.h
globals.h
volume.h
log_verbose
int log_verbose
Definition nad_util.c:77
vflag
int vflag
Definition nad.h:81
_log
void _log(enum logtype lt, char *fmt,...)
Definition nad_util.c:79
openvol
int openvol(AFPObj *obj, const char *path, afpvol_t *vol)
Load volinfo and initialize struct vol.
Definition nad_util.c:103
convert_dots_encoding
int convert_dots_encoding(const afpvol_t *svol, const afpvol_t *dvol, char *path)
Convert dot encoding of basename in place.
Definition nad_util.c:163
utompath
char * utompath(const struct vol *, const char *)
logtype
logtype
Definition nad.h:40
DBG
@ DBG
Definition nad.h:40
STD
@ STD
Definition nad.h:40
pflag
int pflag
Definition nad.h:81
nflag
int nflag
Definition nad.h:81
lflag
int lflag
Definition nad.h:81
ad_mv
int ad_mv(int argc, char **argv, AFPObj *obj)
closevol
void closevol(afpvol_t *vol)
Definition nad_util.c:140
ad_set
int ad_set(int argc, char **argv, AFPObj *obj)
Definition nad_set.c:312
cnid_for_paths_parent
cnid_t cnid_for_paths_parent(const afpvol_t *vol, const char *path, cnid_t *did)
Resolves CNID of a given paths parent directory.
Definition nad_util.c:219
fflag
int fflag
Definition nad_cp.c:90
ad_cp
int ad_cp(int argc, char **argv, AFPObj *obj)
iflag
int iflag
Definition nad.h:81
ad_rm
int ad_rm(int argc, char **argv, AFPObj *obj)
ad_ls
int ad_ls(int argc, char **argv, AFPObj *obj)
Definition nad_ls.c:671
ad_find
int ad_find(int argc, char **argv, AFPObj *obj)
Definition nad_find.c:191
did
cnid_t did
Definition nad_cp.c:93
obj
static AFPObj obj
Definition netatalk.c:62
AFPObj
Definition globals.h:158
PATH_T
Definition nad.h:75
PATH_T::p_end
char * p_end
Definition nad.h:76
PATH_T::target_end
char * target_end
Definition nad.h:77
PATH_T::p_path
char p_path[MAXPATHLEN+2]
Definition nad.h:78
afpvol_t
Definition nad.h:51
afpvol_t::db_stamp
char db_stamp[ADEDLEN_PRIVSYN]
Definition nad.h:53
afpvol_t::vol
struct vol * vol
Definition nad.h:52
path
Definition include/atalk/directory.h:82
vol
Definition include/atalk/volume.h:30