All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pat LaVarre <p.lavarre@ieee.org>
To: linux-fsdevel@vger.kernel.org
Cc: linux_udf@hpesjro.fc.hp.com
Subject: Re: editable udf metadata
Date: 08 Oct 2003 11:51:51 -0600	[thread overview]
Message-ID: <1065635511.7602.38.camel@patehci2> (raw)
In-Reply-To: <1065631668.6625.48.camel@patehci2>

[-- Attachment #1: Type: text/plain, Size: 1518 bytes --]

> > > 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



[-- Attachment #2: wnaspi32.cpp --]
[-- Type: text/x-c++, Size: 4590 bytes --]

/*
 * 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 <stddef.h>
#include <stdio.h>

#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 */


  reply	other threads:[~2003-10-08 17:52 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-07 19:02 zeroes read back more often than appended Pat LaVarre
2003-10-07 20:54 ` Pat LaVarre
2003-10-08  3:49 ` Ben Fennema
2003-10-08 16:41   ` Pat LaVarre
2003-10-08 16:47     ` editable udf metadata Pat LaVarre
2003-10-08 17:51       ` Pat LaVarre [this message]
2003-10-08 18:09         ` big-endian udfct_1_0r2 Pat LaVarre
2003-10-08 18:30           ` Matthew Wilcox
     [not found]             ` <3F8472FE.9040403@lougher.demon.co.uk>
2003-10-08 19:49               ` Matthew Wilcox
2003-10-08 20:43             ` Phillip Lougher
2003-10-21 21:54         ` editable udf metadata Pat LaVarre
2003-10-21 23:17           ` Pat LaVarre
2003-10-23 16:06             ` Pat LaVarre
2003-10-24 21:40               ` Pat LaVarre
2003-10-22  8:15           ` same page access Mark B
2003-10-22 11:21             ` Matthew Wilcox
2003-10-22 17:09               ` Mark B
2003-10-22 17:10                 ` Matthew Wilcox
2003-10-08 17:02     ` zeroes read back more often than appended Pat LaVarre
2003-10-08 17:06       ` toggling smp clears x86_mce_p4thermal of make xconfig Pat LaVarre
2003-10-08 17:21     ` zeroes read back more often than appended Pat LaVarre
2003-10-08 16:46   ` soft trace of read/write of drivers/block/loop.c Pat LaVarre
2003-10-08 20:32   ` zeroes read back more often than appended Pat LaVarre
2003-10-09 20:54   ` Pat LaVarre
2003-10-10  0:52     ` Pat LaVarre
2003-10-10 16:39       ` Pat LaVarre
2003-10-10 18:15         ` Pat LaVarre
2003-10-14  0:38           ` Pat LaVarre
2003-10-14  1:48             ` Pat LaVarre
2003-10-20 23:20               ` Pat LaVarre
2003-10-21 14:47                 ` Pat LaVarre
2003-10-21 16:46                   ` Pat LaVarre
2003-10-21 18:44                     ` Pat LaVarre
2003-10-23 18:52                     ` Pat LaVarre
2003-10-27 21:55                       ` Pat LaVarre
  -- strict thread matches above, loose matches on Subject: below --
2003-11-26 15:58 editable udf metadata Pat LaVarre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1065635511.7602.38.camel@patehci2 \
    --to=p.lavarre@ieee.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux_udf@hpesjro.fc.hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.