;/* gcc -Wall -noixemul -O2 filesystemattr.c -o filesystemattr quit */ #include #include extern struct DosLibrary *DOSBase; int main(int argc, char **argv) { CONST_STRPTR file; BPTR lock; struct InfoData id; LONG rc; QUAD q; LONG l; if (argc != 2) { Printf("usage: %s volume:\n", argv[0]); return RETURN_ERROR; } file = argv[1]; lock = Lock(file, ACCESS_READ); if (!lock) { Printf("Could not lock %s\n", file); return RETURN_FAIL; } rc = Info(lock, &id); UnLock(lock); if (!rc) { Printf("Could not get info on volume %s\n", file); return RETURN_FAIL; } Printf("FileSystem attributes:\n"); if (GetFileSysAttr(file, FQA_MaxFileNameLength, &l, sizeof(l))) { Printf("maximum filename len: %ld\n", l); } else PrintFault(IoErr(), "GetFileSysAttr FQA_MaxFileNameLength"); if (GetFileSysAttr(file, FQA_MaxVolumeNameLength, &l, sizeof(l))) { Printf("maximum volumename len: %ld\n", l); } else PrintFault(IoErr(), "GetFileSysAttr FQA_MaxVolumeNameLength"); if (GetFileSysAttr(file, FQA_MaxFileSize, &q, sizeof(q))) { Printf("maximum file size: %lld\n", (ULONG) (q >> 32), (ULONG) q); } else PrintFault(IoErr(), "GetFileSysAttr FQA_MaxFileSize"); if (GetFileSysAttr(file, FQA_IsCaseSensitive, &l, sizeof(l))) { Printf("filesystem case sensitive: %ld\n", l); } else PrintFault(IoErr(), "GetFileSysAttr FQA_IsCaseSensitive"); if (GetFileSysAttr(file, FQA_DeviceType, &l, sizeof(l))) { Printf("filesystem device type: %ld\n", l); } else PrintFault(IoErr(), "GetFileSysAttr FQA_DeviceType"); if (GetFileSysAttr(file, FQA_NumBlocks, &q, sizeof(q))) { QUAD totalsize = q * (QUAD) id.id_BytesPerBlock; Printf("number of blocks: %lld\n", (ULONG) (q >> 32), (ULONG) q); Printf("volume total size: %ld GiB\n", (LONG) (totalsize / (1024 * 1024 * 1024))); } else PrintFault(IoErr(), "GetFileSysAttr FQA_NumBlocks"); if (GetFileSysAttr(file, FQA_NumBlocksUsed, &q, sizeof(q))) { QUAD totalused = q * (QUAD) id.id_BytesPerBlock; Printf("number of used blocks: %lld\n", (ULONG) (q >> 32), (ULONG) q); Printf("volume total used: %ld GiB\n", (LONG) (totalused / (1024 * 1024 * 1024))); } else PrintFault(IoErr(), "GetFileSysAttr FQA_NumBlocksUsed"); return RETURN_OK; }