alsa.audio: add debug logs
[AROS.git] / test / mountlist.c
blob2c9d83131e9272fef23bd3f83c9e00e2abf9b4b1
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define AROS_ALMOST_COMPATIBLE
8 #include <dos/dos.h>
9 #include <dos/filehandler.h>
10 #include <libraries/expansionbase.h>
11 #include <proto/dos.h>
12 #include <proto/exec.h>
14 #include <ctype.h>
15 #include <stdio.h>
16 #include <string.h>
18 #ifndef __AROS__
19 #define BNULL 0
20 #define AROS_BSTR_ADDR(s) ((char *)(s << 2) + 1)
21 #define AROS_BSTR_strlen(s) *((unsigned char *)(s << 2))
22 #endif
24 int __nocommandline = 1;
26 static void PrintDosType(ULONG dt)
28 unsigned int i;
30 for (i = 0; i < 4; i++)
32 unsigned char c = dt >> (24 - i * 8);
34 if (isprint(c))
35 putchar(c);
36 else
37 printf("\\%X", c);
41 static BOOL IsMounted(struct DeviceNode *dn)
43 BOOL ret = FALSE;
44 struct DosList *dl = LockDosList(LDF_DEVICES|LDF_READ);
46 while ((dl = NextDosEntry(dl, LDF_DEVICES)))
48 if (dl == (struct DosList *)dn)
50 ret = TRUE;
51 break;
55 UnLockDosList(LDF_DEVICES|LDF_READ);
56 return ret;
59 int main(void)
61 struct BootNode *n;
62 struct ExpansionBase *base = (struct ExpansionBase *)OpenLibrary("expansion.library", 0);
64 if (!base)
66 printf("Failed to open expansion.library!\n");
67 return RETURN_FAIL;
70 ForeachNode(&base->MountList, n)
72 struct DeviceNode *dn = n->bn_DeviceNode;
74 printf("BootNode %p, Flags 0x%08X, ConfigDev %p\n", n, n->bn_Flags, n->bn_Node.ln_Name);
75 printf("DeviceNode %p <%s>", dn, AROS_BSTR_ADDR(dn->dn_Name));
77 if (dn->dn_Handler)
78 printf(" Handler %s", AROS_BSTR_ADDR(dn->dn_Handler));
79 if (IsMounted(dn))
80 printf(" [MOUNTED]");
82 printf("\nType %d, Task %p, SegList %p\n", (int)dn->dn_Type, BADDR(dn->dn_Task), BADDR(dn->dn_SegList));
84 if (dn->dn_Startup)
86 struct FileSysStartupMsg *fssm = BADDR(dn->dn_Startup);
88 printf("FileSysStartupMsg %p", fssm);
89 if (fssm->fssm_Device != BNULL && AROS_BSTR_strlen(fssm->fssm_Device))
90 printf(" <%s unit %ld flags 0x%08X>", AROS_BSTR_ADDR(fssm->fssm_Device), (long)fssm->fssm_Unit, (unsigned int)fssm->fssm_Flags);
91 printf("\n");
93 if (fssm->fssm_Environ)
95 struct DosEnvec *de = BADDR(fssm->fssm_Environ);
97 printf("DosEnvec %p DosType 0x%08lX <", de, de->de_DosType);
98 PrintDosType(de->de_DosType);
99 printf("> BootPri %ld LowCyl %ld HighCyl %ld\n", de->de_BootPri, de->de_LowCyl, de->de_HighCyl);
102 printf("\n");
105 CloseLibrary(&base->LibNode);
106 return RETURN_OK;