From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pat LaVarre Subject: Re: editable udf metadata Date: 08 Oct 2003 11:51:51 -0600 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <1065635511.7602.38.camel@patehci2> References: <1065553341.8172.45.camel@patehci2> <20031007204951.A25423@falcon.csc.calpoly.edu> <1065631289.6625.34.camel@patehci2> <1065631668.6625.48.camel@patehci2> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-HSU2eZn6aPiqypjXT8TC" Cc: linux_udf@hpesjro.fc.hp.com Return-path: Received: from email-out2.iomega.com ([147.178.1.83]:56230 "EHLO email.iomega.com") by vger.kernel.org with ESMTP id S261506AbTJHRwE (ORCPT ); Wed, 8 Oct 2003 13:52:04 -0400 To: linux-fsdevel@vger.kernel.org In-Reply-To: <1065631668.6625.48.camel@patehci2> List-Id: linux-fsdevel.vger.kernel.org --=-HSU2eZn6aPiqypjXT8TC Content-Type: text/plain Content-Transfer-Encoding: 7bit > > > Do you mean to say you see the metadata ... > > > > I know I haven't yet found > > a convenient printer of metadata for udf files. Kindly offline I received the ...philips.com/udf/ link. I wonder if that means people somewhere know how to extract just the metadata of a single file from the udfct_1_0r2 tool. The web trail I know to the udfct_1_0r2 tool is: http://www.google.com/search?q=philips+udf+verifier http://www.google.com/search?q=philips+udf+verifier&btnI=1 http://www.extra.research.philips.com/udf/ http://www.extra.research.philips.com/udf/download.html I see udfct_1_0r2 describes itself as designed to work in Win 9X/ME. I see compiling a wnaspi32.dll (e.g. via the wnaspi32.cpp for mingw gcc attached) makes udfct_1_0r2 work in Win 2K/XP too. I'm told Linux udfct_1_0r2 as yet works only on disk images ... such as we create by default any time we substitute a loop device for a real device. But I see that wnaspi32.dll I compiled rests on top of gccscsi, which by design talks thru Linux /dev/sg, not just Win/ Dos/ MacOF, so I wonder if we are close to seeing udfct_1_0r2 run in linux. I hear udfct_1_0r2 dumps only all the metadata of a disk, never the metadata of a single file. I of course welcome any correction/ elaboration you have to offer. Pat LaVarre P.S. Google at this moment no longer requires us to remember to say Verifier rather than Test. That is, to rediscover udfct_1_0r2 we now can use the more concise link: http://www.google.com/search?q=philips+udf+test --=-HSU2eZn6aPiqypjXT8TC Content-Disposition: attachment; filename=wnaspi32.cpp Content-Type: text/x-c++; name=wnaspi32.cpp; charset=UTF-8 Content-Transfer-Encoding: 7bit /* * wnaspi32.cpp * * This source file for Win 2K/XP exists to make: * * LoadLibrary("wnaspi32.dll"); * * work enough like it did in Win 9X/ME to allow * trivial apps to function. * * Our "wnaspi32.h" appears unattributed, unlicensed, * and without copyright, precisely as it reached us * via Google. * * msdn.microsoft.com probably documents what our * history of pain has taught us of this interface. * * Bugs include: * * Misbehaviour above 2 GiB per CDB. * * Drive letter = ('C' + SRB_Target). * No CloseHandle. * CreateFile called til success, for each cdb sent to a drive letter. * * Auto sense data echod out stderr, never passed back. * No check for unused for the fields not copied, e.g. SRB_SenseLen. * * x00 SC_HA_INQUIRY never becomes IOCTL_SCSI_GET_CAPABILITIES * x02 SC_EXEC_SCSI_CMD never becomes IOCTL_SCSI_PASS_THROUGH_DIRECT * * x80 SS_INVALID_CMD includes x08 SC_GETSET_TIMEOUTS * x80 SS_INVALID_CMD includes x07 SC_RESCAN_SCSI_BUS * x80 SS_INVALID_CMD includes x06 SC_GET_DISK_INFO * x80 SS_INVALID_CMD includes x05 SC_SET_HA_PARMS * x80 SS_INVALID_CMD includes x04 SC_RESET_DEV * x80 SS_INVALID_CMD includes x03 SC_ABORT_SRB * x80 SS_INVALID_CMD includes x01 SC_GET_DEV_TYPE */ #include "windows.h" #include "ntddscsi.hpp" #include #include #include "gccscsi.h" #include "wnaspi32.hpp" #define TARGET_COUNT (1 << 5) /* enough for 'C' .. 'Z' and one host */ int devs[TARGET_COUNT]; extern "C" { extern DWORD GetASPI32SupportInfo(void); extern DWORD SendASPI32Command(LPSRB v); } __declspec(dllexport) extern DWORD GetASPI32SupportInfo(void) { BYTE srbStatus = SS_NO_ADAPTERS; /* xE8 */ BYTE haCount = ('Z' - 'A' + 1); srbStatus = SS_COMP; /* x01 */ return ((srbStatus << 8) | haCount); } static BYTE ha_inquiry(SRB_HAInquiry * shai) { WORD alignment_mask = (4 * Ki); BYTE may_count_data = 0x01; DWORD max_length = (64 * Ki); shai->HA_Count = 1; shai->HA_SCSI_ID = (TARGET_COUNT - 1); memset(&shai->HA_ManagerId[0], '\0', sizeof shai->HA_ManagerId); memset(&shai->HA_Identifier[0], '\0', sizeof shai->HA_Identifier); memset(&shai->HA_Unique[0], '\0', sizeof shai->HA_Unique); strncpy((char *) &shai->HA_ManagerId[0], "Wnaspi32.dll", sizeof shai->HA_ManagerId); strncpy((char *) &shai->HA_Identifier[0], "Slow SPT (not SPTD)", sizeof shai->HA_Identifier); * (WORD *) &shai->HA_Unique[0x00] = alignment_mask; * (BYTE *) &shai->HA_Unique[0x02] = may_count_data; * (BYTE *) &shai->HA_Unique[0x03] = TARGET_COUNT; * (DWORD *) &shai->HA_Unique[0x04] = max_length; return SS_COMP; /* x01 */ } static BYTE exec_scsi_cmd(SRB_ExecSCSICmd * sesc) { BYTE SRB_Target = sesc->SRB_Target; BYTE SRB_Lun = sesc->SRB_Lun; int letter = ('C' + SRB_Target); if (!(('A' <= letter) & (letter <= 'Z'))) return SS_NO_DEVICE; /* x82 */ if (SRB_Lun != 0x00) return SS_NO_DEVICE; /* x82 */ int dev = devs[SRB_Target]; if (dev == 0) { char name[123] = "//./A:"; sprintf(&name[0], "\\\\.\\%c:", letter); dev = sp_open(&name[0]); } if (dev == 0) return SS_NO_DEVICE; /* x82 */ char * cdbChars = (char *) &sesc->CDBByte[0]; int cdbLength = sesc->SRB_CDBLen; char * inChars = (char *) sesc->SRB_BufPointer; char * outChars = inChars; int maxLength = (int) sesc->SRB_BufLen; BYTE SRB_Flags = sesc->SRB_Flags; BYTE SRB_Flags_In_Out = (SRB_Flags & (SRB_DIR_OUT|SRB_DIR_IN)); /* x18 */ if (maxLength == 0) { outChars = inChars = NULL; } else if (SRB_Flags_In_Out == SRB_DIR_IN) { /* x08 */ outChars = NULL; } else if (SRB_Flags_In_Out == SRB_DIR_OUT) { /* x10 */ inChars = NULL; } else { return SS_INVALID_SRB; /* xE0 */ } int rc = sp_say(dev, cdbChars, cdbLength, outChars, inChars, maxLength); if (rc == 0) { sesc->SRB_HaStat = HASTAT_OK; /* x00 */ sesc->SRB_TargStat = 0x00; /* good */ return SS_COMP; /* x01 */ } if (0 < rc) { sesc->SRB_HaStat = HASTAT_DO_DU; /* x12 */ sesc->SRB_TargStat = 0x00; /* good */ return SS_ERR; /* x04 */ } sesc->SRB_HaStat = HASTAT_BUS_FREE; /* x13 */ sesc->SRB_TargStat = 0x00; /* good */ return SS_ERR; /* x04 */ } __declspec(dllexport) extern DWORD SendASPI32Command(LPSRB v) { BYTE srbStatus = SS_INVALID_CMD; /* x80 */ SRB_Abort * sa = (SRB_Abort *) v; if (sa->SRB_HaId != 0) { return SS_INVALID_HA; } switch (sa->SRB_Cmd) { case SC_HA_INQUIRY: /* x00 */ srbStatus = ha_inquiry((SRB_HAInquiry *) v); break; case SC_EXEC_SCSI_CMD: /* x02 */ srbStatus = exec_scsi_cmd((SRB_ExecSCSICmd *) v); break; default: break; } sa->SRB_Status = srbStatus; return srbStatus; } /* end of file */ --=-HSU2eZn6aPiqypjXT8TC--