]> arthur.barton.de Git - netatalk.git/commitdiff
Add debug log statement to afp_getfildirparms.
authorfranklahm <franklahm>
Mon, 18 Jan 2010 12:55:28 +0000 (12:55 +0000)
committerfranklahm <franklahm>
Mon, 18 Jan 2010 12:55:28 +0000 (12:55 +0000)
Add logging of AFP return code.

etc/afpd/afp_dsi.c
etc/afpd/afp_util.c
etc/afpd/filedir.c
etc/afpd/globals.h

index 9fc2beb970b383ce1f1b65f1bb9d21313f331164..041db2ce7a0b3fa901eface873dc278aa5135277 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_dsi.c,v 1.48 2009-11-14 05:18:50 didg Exp $
+ * $Id: afp_dsi.c,v 1.49 2010-01-18 12:55:28 franklahm Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -381,13 +381,14 @@ void afp_over_dsi(AFPObj *obj)
                 dsi->datalen = DSI_DATASIZ;
                 child.flags |= CHILD_RUNNING;
 
-                LOG(log_debug, logtype_afpd, "=> Start AFP command: %s", AfpNum2name(function));
+                LOG(log_debug, logtype_afpd, "<== Start AFP command: %s", AfpNum2name(function));
 
                 err = (*afp_switch[function])(obj,
                                               (char *)&dsi->commands, dsi->cmdlen,
                                               (char *)&dsi->data, &dsi->datalen);
 
-                LOG(log_debug, logtype_afpd, "=> Finished AFP command: %s", AfpNum2name(function));
+                LOG(log_debug, logtype_afpd, "==> Finished AFP command: %s -> %s",
+                    AfpNum2name(function), AfpErr2name(err));
 #ifdef FORCE_UIDGID
                /* bring everything back to old euid, egid */
                 if (obj->force_uid)
index a8cefc6e4b7a6c0410f45f80f521c146bc049d04..970a93a5d9bb7bba7be98eed5871658c02b7e297 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_util.c,v 1.8 2009-12-11 13:11:19 franklahm Exp $
+ * $Id: afp_util.c,v 1.9 2010-01-18 12:55:28 franklahm Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -100,3 +100,58 @@ const char *AfpNum2name(int num)
        }
        return "not yet defined";                                                                 
 }
+
+#define AFPERR2NAME(err) case err : return #err
+
+const char *AfpErr2name(int err)
+{
+    switch (err) {
+        AFPERR2NAME(AFP_OK);
+        AFPERR2NAME(AFPERR_DID1);
+        AFPERR2NAME(AFPERR_ACCESS);
+        AFPERR2NAME(AFPERR_AUTHCONT);
+        AFPERR2NAME(AFPERR_BADUAM);
+        AFPERR2NAME(AFPERR_BADVERS);
+        AFPERR2NAME(AFPERR_BITMAP);
+        AFPERR2NAME(AFPERR_CANTMOVE);
+        AFPERR2NAME(AFPERR_DENYCONF);
+        AFPERR2NAME(AFPERR_DIRNEMPT);
+        AFPERR2NAME(AFPERR_DFULL);
+        AFPERR2NAME(AFPERR_EOF);
+        AFPERR2NAME(AFPERR_BUSY);
+        AFPERR2NAME(AFPERR_FLATVOL);
+        AFPERR2NAME(AFPERR_NOITEM);
+        AFPERR2NAME(AFPERR_LOCK);
+        AFPERR2NAME(AFPERR_NOSRVR);
+        AFPERR2NAME(AFPERR_EXIST);
+        AFPERR2NAME(AFPERR_NOOBJ);
+        AFPERR2NAME(AFPERR_PARAM);
+        AFPERR2NAME(AFPERR_NORANGE);
+        AFPERR2NAME(AFPERR_RANGEOVR);
+        AFPERR2NAME(AFPERR_SESSCLOS);
+        AFPERR2NAME(AFPERR_NOTAUTH);
+        AFPERR2NAME(AFPERR_NOOP);
+        AFPERR2NAME(AFPERR_BADTYPE);
+        AFPERR2NAME(AFPERR_NFILE);
+        AFPERR2NAME(AFPERR_SHUTDOWN);
+        AFPERR2NAME(AFPERR_NORENAME);
+        AFPERR2NAME(AFPERR_NODIR);
+        AFPERR2NAME(AFPERR_ITYPE);
+        AFPERR2NAME(AFPERR_VLOCK);
+        AFPERR2NAME(AFPERR_OLOCK);
+        AFPERR2NAME(AFPERR_CTNSHRD);
+        AFPERR2NAME(AFPERR_NOID);
+        AFPERR2NAME(AFPERR_EXISTID);
+        AFPERR2NAME(AFPERR_DIFFVOL);
+        AFPERR2NAME(AFPERR_CATCHNG);
+        AFPERR2NAME(AFPERR_SAMEOBJ);
+        AFPERR2NAME(AFPERR_BADID);
+        AFPERR2NAME(AFPERR_PWDSAME);
+        AFPERR2NAME(AFPERR_PWDSHORT);
+        AFPERR2NAME(AFPERR_INTRASH);
+        AFPERR2NAME(AFPERR_PWDCHNG);
+        AFPERR2NAME(AFPERR_PWDPOLCY);
+        AFPERR2NAME(AFPERR_USRLOGIN);
+    }
+       return "not yet defined";
+}
index 2f82fca446005a0316de1b73e8c53e802acc4f16..c91ca7d00552809df71d60ac237c4558553f1bd2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: filedir.c,v 1.66 2010-01-05 12:06:33 franklahm Exp $
+ * $Id: filedir.c,v 1.67 2010-01-18 12:55:28 franklahm Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -171,6 +171,9 @@ int afp_getfildirparams(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *r
         return get_afp_errno(AFPERR_NOOBJ); 
     }
 
+    LOG(log_debug, logtype_afpd, "getfildirparams(vid:%u, did:%u, name:'%s', f/d:%04x/%04x) {cwd: %s}",
+        ntohs(vid), ntohl(did), s_path->u_name, fbitmap, dbitmap, getcwdpath());
+
     st   = &s_path->st;
     if (!s_path->st_valid) {
         /* it's a dir and it should be there
@@ -184,6 +187,7 @@ int afp_getfildirparams(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *r
         return( AFPERR_NOOBJ );
     }
 
+
     buflen = 0;
     if (S_ISDIR(st->st_mode)) {
         if (dbitmap) {
index c1f8986e8da8ab7fac16ae6117390229e13afae3..a88adab9d99a379135ff51f72a0d58822ed6c411 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: globals.h,v 1.30 2009-11-05 14:38:07 franklahm Exp $
+ * $Id: globals.h,v 1.31 2010-01-18 12:55:28 franklahm Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -136,7 +136,8 @@ extern void initline   (int, char *);
 extern int  parseline  (int, char *);
 
 /* afp_util.c */
-const char *AfpNum2name (int );
+extern const char *AfpNum2name (int );
+extern const char *AfpErr2name(int err);
 
 #ifndef NO_DDP
 extern void afp_over_asp (AFPObj *);