exec.library: do not clone value of task storage slot to children of task
[AROS.git] / test / mountlist.c
blob883ebe37b51f98d3fe344478b53e642b0f9d3ee9
1 #define AROS_ALMOST_COMPATIBLE
3 #include <dos/dos.h>
4 #include <dos/filehandler.h>
5 #include <libraries/expansionbase.h>
6 #include <proto/dos.h>
7 #include <proto/exec.h>
9 #include <ctype.h>
10 #include <stdio.h>
11 #include <string.h>
13 #ifndef __AROS__
14 #define BNULL 0
15 #define AROS_BSTR_ADDR(s) ((char *)(s << 2) + 1)
16 #define AROS_BSTR_strlen(s) *((unsigned char *)(s << 2))
17 #endif
19 int __nocommandline = 1;
21 static void PrintDosType(ULONG dt)
23 unsigned int i;
25 for (i = 0; i < 4; i++)
27 unsigned char c = dt >> (24 - i * 8);
29 if (isprint(c))
30 putchar(c);
31 else
32 printf("\\%X", c);
36 static BOOL IsMounted(struct DeviceNode *dn)
38 BOOL ret = FALSE;
39 struct DosList *dl = LockDosList(LDF_DEVICES|LDF_READ);
41 while ((dl = NextDosEntry(dl, LDF_DEVICES)))
43 if (dl == (struct DosList *)dn)
45 ret = TRUE;
46 break;
50 UnLockDosList(LDF_DEVICES|LDF_READ);
51 return ret;
54 int main(void)
56 struct BootNode *n;
57 struct ExpansionBase *base = (struct ExpansionBase *)OpenLibrary("expansion.library", 0);
59 if (!base)
61 printf("Failed to open expansion.library!\n");
62 return RETURN_FAIL;
65 ForeachNode(&base->MountList, n)
67 struct DeviceNode *dn = n->bn_DeviceNode;
69 printf("BootNode %p, Flags 0x%08X, ConfigDev %p\n", n, n->bn_Flags, n->bn_Node.ln_Name);
70 printf("DeviceNode %p <%s>", dn, AROS_BSTR_ADDR(dn->dn_Name));
72 if (dn->dn_Handler)
73 printf(" Handler %s", AROS_BSTR_ADDR(dn->dn_Handler));
74 if (IsMounted(dn))
75 printf(" [MOUNTED]");
77 printf("\nType %d, Task %p, SegList %p\n", (int)dn->dn_Type, BADDR(dn->dn_Task), BADDR(dn->dn_SegList));
79 if (dn->dn_Startup)
81 struct FileSysStartupMsg *fssm = BADDR(dn->dn_Startup);
83 printf("FileSysStartupMsg %p", fssm);
84 if (fssm->fssm_Device != BNULL && AROS_BSTR_strlen(fssm->fssm_Device))
85 printf(" <%s unit %ld flags 0x%08X>", AROS_BSTR_ADDR(fssm->fssm_Device), (long)fssm->fssm_Unit, (unsigned int)fssm->fssm_Flags);
86 printf("\n");
88 if (fssm->fssm_Environ)
90 struct DosEnvec *de = BADDR(fssm->fssm_Environ);
92 printf("DosEnvec %p DosType 0x%08lX <", de, de->de_DosType);
93 PrintDosType(de->de_DosType);
94 printf("> BootPri %ld LowCyl %ld HighCyl %ld\n", de->de_BootPri, de->de_LowCyl, de->de_HighCyl);
97 printf("\n");
100 CloseLibrary(&base->LibNode);
101 return RETURN_OK;