revert between 56095 -> 55830 in arch
[AROS.git] / rom / filesys / SFS / FS / req.c
blob767e92b1425335ed110259492eb811d643679434
1 #include <exec/types.h>
3 #include <proto/exec.h>
4 #include <proto/intuition.h>
6 #include "asmsupport.h"
7 #include "debug.h"
8 #include "transactions_protos.h"
10 #include "req_protos.h"
13 void dreqArgs(UBYTE *fmt, APTR params)
15 UBYTE *fmt2;
17 if(globals->debugreqs!=FALSE) {
18 struct {
19 CONST_STRPTR name, device;
20 ULONG unit;
21 CONST_STRPTR fmt;
22 } __packed args = {
23 AROS_BSTR_ADDR(globals->devnode->dn_Name),
24 AROS_BSTR_ADDR(globals->startupmsg->fssm_Device),
25 globals->startupmsg->fssm_Unit,
26 (CONST_STRPTR)fmt
29 if((fmt2=AllocVec(strlen(fmt)+100,0))!=0) {
30 _DEBUG(("\nREQUESTER\n\n"));
31 RawDoFmt("SmartFilesystem %s: (%s, unit %ld)\n\n%s",(RAWARG)&args,putChFunc,fmt2);
33 if (requestArgs(PROGRAMNAME, fmt2, "Continue|No more requesters", params) == 0)
34 globals->debugreqs=FALSE;
36 FreeVec(fmt2);
43 LONG reqArgs(UBYTE *fmt, UBYTE *gads, APTR params)
45 struct {
46 CONST_STRPTR dl;
47 CONST_STRPTR dn;
48 CONST_STRPTR device;
49 ULONG unit;
50 CONST_STRPTR fmt;
51 } __packed args;
53 UBYTE *fmt2;
54 LONG gadget=0;
56 /* Simple requester function. It will put up a requester
57 in the form of:
59 "Volume 'BOOT' (DH0: scsi.device, unit 0)"
61 or:
63 "Device DH0: (scsi.device, unit 0)"
65 This depends on whether or not there is a valid
66 VolumeNode. */
68 if(globals->volumenode!=0) {
69 args.dl=AROS_BSTR_ADDR(globals->volumenode->dl_Name);
72 args.dn=AROS_BSTR_ADDR(globals->devnode->dn_Name);
73 args.device=AROS_BSTR_ADDR(globals->startupmsg->fssm_Device);
74 args.unit=globals->startupmsg->fssm_Unit;
75 args.fmt=fmt;
77 if((fmt2=AllocVec(strlen(fmt)+100,0))!=0) {
79 if(globals->volumenode!=0) {
80 RawDoFmt("Volume '%s' (%s: %s, unit %ld)\n\n%s",(RAWARG)&args.dl,putChFunc,fmt2);
82 else {
83 RawDoFmt("Device %s: (%s, unit %ld)\n\n%s",(RAWARG)&args.dn,putChFunc,fmt2);
86 gadget = requestArgs(PROGRAMNAME " request", fmt2, gads, params);
87 FreeVec(fmt2);
90 return(gadget);
95 LONG req_unusualArgs(UBYTE *fmt, APTR params)
97 struct {
98 CONST_STRPTR dn;
99 CONST_STRPTR device;
100 ULONG unit;
101 CONST_STRPTR fmt;
102 CONST_STRPTR msg;
103 } __packed args;
104 UBYTE *fmt2;
105 LONG gadget=0;
107 /* Simple requester function. */
108 args.dn=AROS_BSTR_ADDR(globals->devnode->dn_Name);
109 args.device=AROS_BSTR_ADDR(globals->startupmsg->fssm_Device);
110 args.unit=globals->startupmsg->fssm_Unit;
111 args.fmt=fmt;
112 args.msg="This is a safety check requester, which should\n"\
113 "never appear under normal conditions. Please\n"\
114 "notify the author about the error above and if\n"\
115 "possible under what circumstances it appeared.\n\n"\
116 "BEWARE: SFS might crash if you click Continue.\n"\
117 " Please save your work first!";
119 if((fmt2=AllocVec(strlen(fmt)+400,0))!=0) {
121 RawDoFmt("SmartFilesystem %s: (%s, unit %ld)\n\n%s\n\n%s",(RAWARG)&args,putChFunc,fmt2);
122 gadget = requestArgs(PROGRAMNAME " request", fmt2, "Continue", params);
123 FreeVec(fmt2);
126 return(gadget);
131 void request2(UBYTE *text) {
132 request(PROGRAMNAME, text, "Ok", 0);
137 LONG requestArgs(UBYTE *title, UBYTE *fmt, UBYTE *gads, APTR params)
139 struct EasyStruct es;
141 es.es_StructSize=sizeof(struct EasyStruct);
142 es.es_Flags=0;
143 es.es_Title=title;
144 es.es_TextFormat=fmt;
145 es.es_GadgetFormat=gads;
147 return EasyRequestArgs(0, &es, 0, params);
152 void outputcachebuffer(struct CacheBuffer *cb) {
153 ULONG *a;
154 UWORD n;
156 _DEBUG(("CacheBuffer at address 0x%08lx of block %ld (Locked = %ld, Bits = 0x%02lx)\n",cb,cb->blckno,(LONG)cb->locked,(LONG)cb->bits));
158 a=cb->data;
160 for(n=0; n<(globals->bytes_block>>5); n++) {
161 _DEBUG(("%08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]));
162 a+=8;