2 #include <dos/dosextens.h>
4 #include <proto/exec.h>
5 #include <utility/tagitem.h>
8 #include "../FS/packets.h"
9 #include "../FS/query.h"
11 const char version
[]="\0$VER: SFSquery 1.0 (" ADATE
")\r\n";
14 struct RDArgs
*readarg
;
15 UBYTE
template[]="DEVICE/A\n";
17 struct {char *name
;} arglist
={NULL
};
19 if((DOSBase
=(struct DosLibrary
*)OpenLibrary("dos.library",37))!=0) {
20 if((readarg
=ReadArgs(template,(IPTR
*)&arglist
,0))!=0) {
21 struct MsgPort
*msgport
;
23 UBYTE
*devname
=arglist
.name
;
33 dl
=LockDosList(LDF_DEVICES
|LDF_READ
);
34 if((dl
=FindDosEntry(dl
,arglist
.name
,LDF_DEVICES
))!=0) {
38 UnLockDosList(LDF_DEVICES
|LDF_READ
);
41 struct TagItem tags
[]={
42 {ASQ_CACHE_ACCESSES
, 0},
43 {ASQ_CACHE_MISSES
, 0},
45 {ASQ_START_BYTEH
, 0},
46 {ASQ_START_BYTEL
, 0},
52 {ASQ_TOTAL_BLOCKS
, 0},
55 {ASQ_ROOTBLOCK_OBJECTNODES
, 0},
56 {ASQ_ROOTBLOCK_EXTENTS
, 0},
57 {ASQ_FIRST_BITMAP_BLOCK
, 0},
58 {ASQ_FIRST_ADMINSPACE
, 0},
60 {ASQ_CACHE_LINES
, 0},
61 {ASQ_CACHE_READAHEADSIZE
, 0},
63 {ASQ_CACHE_BUFFERS
, 0},
65 {ASQ_IS_CASESENSITIVE
, 0},
66 {ASQ_HAS_RECYCLED
, 0},
71 printf("SFSquery information for %s:\n", arglist
.name
);
72 if((errorcode
=DoPkt(msgport
, ACTION_SFS_QUERY
, (SIPTR
)&tags
, 0, 0, 0, 0))!=DOSFALSE
) {
75 if(tags
[0].ti_Data
!=0) {
76 perc
=tags
[1].ti_Data
*100 / tags
[0].ti_Data
;
82 printf("Start/end-offset : 0x%08lx:%08lx - 0x%08lx:%08lx bytes\n", tags
[2].ti_Data
, tags
[3].ti_Data
, tags
[4].ti_Data
, tags
[5].ti_Data
);
83 printf("Device API : ");
85 switch(tags
[6].ti_Data
) {
87 printf("NSD (64-bit)\n");
92 case ASQDA_SCSIDIRECT
:
93 printf("SCSI direct\n");
96 printf("(standard)\n");
100 printf("Bytes/block : %-8ld Total blocks : %ld\n", tags
[7].ti_Data
, tags
[8].ti_Data
);
101 printf("Cache accesses : %-8ld Cache misses : %ld (%ld%%)\n", tags
[0].ti_Data
, tags
[1].ti_Data
, (long)perc
);
102 printf("Read-ahead cache : %ldx %ld bytes ",tags
[14].ti_Data
, tags
[15].ti_Data
);
104 if(tags
[16].ti_Data
!=0) {
105 printf("(Copyback)\n");
108 printf("(Write-through)\n");
111 printf("DOS buffers : %-8ld\n", tags
[17].ti_Data
);
113 printf("SFS settings : ");
115 if(tags
[18].ti_Data
!=0) {
116 printf("[CASE SENSITIVE] ");
119 if(tags
[19].ti_Data
!=0) {
120 printf("[RECYCLED] ");
128 VPrintf("Couldn't find device '%s:'.\n",(IPTR
*)&arglist
.name
);
129 UnLockDosList(LDF_DEVICES
|LDF_READ
);
135 PutStr("Wrong arguments!\n");
137 CloseLibrary((struct Library
*)DOSBase
);