Re: [RFC] sane access to per-fs metadata (was Re: [PATCH] Documentation/ioctl-number.txt)

2001-04-10 Thread Tommi Virtanen

[EMAIL PROTECTED] (Chip Salzenberg) writes:

> AFAIK, Alex Viro's idea of bindable namespaces provides effective
> transaction support *ONLY* if there are per-process bindings.  With
> per-process bindings, each client that opens a connection does so
> through a distinct binding; when that client's responses go back
> through the same binding, only that client can see them.

Not really. We can both open /proc/partitions, read one char at a
time, and the kernel won't confuse our read positions. Different
file opens create different instances of state. See struct file,
void *private_data for how to store arbitrary data.

-- 
tv@{{hq.yok.utu,havoc,gaeshido}.fi,{debian,wanderer}.org,stonesoft.com}
unix, linux, debian, networks, security, | First snow, then silence.
kernel, TCP/IP, C, perl, free software,  | This thousand dollar screen dies
mail, www, sw devel, unix admin, hacks.  | so beautifully.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: 2.2.18 and Maxtor 96147H6 (61 GB)

2001-01-07 Thread Tommi Virtanen

On Fri, Jan 05, 2001 at 12:34:11AM +0200, Eric Lammerts wrote:
> I had the same problem with my 80Gb Maxtor. (Asus P2L97, works with
> 60Gb but hangs with 80Gb :-/) After clipping the drive with ibmsetmax
> (http://www.uwsg.indiana.edu/hypermail/linux/kernel/0012.1/0249.html)
> and removing the jumper, unclipping worked fine (kernel is 2.2.18+ide).
> 
> Andre: can you add unclipping support to 2.4 too?

I emailed a patch for 2.4.0-test13-pre5 some time
ago, has been working fine here ever since.

http://www.uwsg.iu.edu/hypermail/linux/kernel/0012.3/0559.html

-- 
tv@{{hq.yok.utu,havoc,gaeshido}.fi,{debian,wanderer}.org,stonesoft.com}
Perl this: sub fibo() {my ($a,$b)=(1,0);sub{my $o=$a;$a=$b;$b=$o+$a;$b}}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: [PATCH] Large "clipped" IDE disk support for 2.4 when using old BIOS (fixed patch)

2000-12-30 Thread Tommi Virtanen

On Sat, Nov 18, 2000 at 09:32:26PM +0200, Taisuke Yamada wrote:
> Earlier this month, I had sent in a patch to 2.2.18pre17 (with
> IDE-patch from http://www.linux-ide.org/ applied) to add support
> for IDE disk larger than 32GB, even if the disk required "clipping"
> to reduce apparent disk size due to BIOS limitation.
[..]
> Now I'm moving to 2.4-based system, and so ported the patch to
> 2.4-test10. It also applies cleanly to 2.4-test11.

Well, the patch in the message didn't apply cleanly and
had some problems, as discussed in the rest of the thread.
As no one seems to have posted an updated patch, here
goes. This works nicely for my Maxtor 81.9GB HDD.

--- linux-2.4.0-test13-pre5/drivers/ide/ide-disk.c  Fri Oct 27 09:35:48 2000
+++ linux/drivers/ide/ide-disk.cThu Dec 28 22:49:18 2000
@@ -513,24 +513,149 @@
current_capacity(drive));
 }
 
+
+/*
+ * Tests if the drive supports Host Protected Area feature.
+ * Returns true if supported, false otherwise.
+ */
+static inline int idedisk_supports_host_protected_area(ide_drive_t *drive)
+{
+int flag = (drive->id->command_set_1 & 0x0400) ? 1 : 0;
+printk("%s: host protected area => %d\n", drive->name, flag);
+return flag;
+}
+
+/*
+ * Queries for true maximum capacity of the drive.
+ * Returns maximum LBA address (> 0) of the drive, 0 if failed.
+ */
+static unsigned long idedisk_read_native_max_address(ide_drive_t *drive)
+{
+byte args[7];
+unsigned long addr = 0;
+
+printk("%s: checking for max native LBA...\n", drive->name);
+
+/* Create IDE/ATA command request structure
+ *
+ * NOTE: I'm not sure if I can safely use IDE_*_OFFSET macro
+ *   here...For real ATA command structure, offset for IDE
+ *   command is 7, but in IDE driver, it needs to be at 0th
+ *   index (same goes for IDE status offset below). Hmm...
+ */
+args[0]  = 0xf8; /* READ_NATIVE_MAX - see ATA spec */
+args[IDE_FEATURE_OFFSET] = 0x00;
+args[IDE_NSECTOR_OFFSET] = 0x00;
+args[IDE_SECTOR_OFFSET]  = 0x00;
+args[IDE_LCYL_OFFSET]= 0x00;
+args[IDE_HCYL_OFFSET]= 0x00;
+args[IDE_SELECT_OFFSET]  = 0x40;
+
+/* submit command request - if OK, read current max LBA value */
+if (ide_wait_cmd_task(drive, args) == 0) {
+if ((args[0] & 0x01) == 0) {
+addr = ((args[IDE_SELECT_OFFSET] & 0x0f) << 24)
+ | ((args[IDE_HCYL_OFFSET] ) << 16)
+ | ((args[IDE_LCYL_OFFSET] ) <<  8)
+ | ((args[IDE_SECTOR_OFFSET]   ));
+}
+}
+
+printk("%s: max native LBA is %lu\n", drive->name, addr);
+
+return addr;
+}
+
+/*
+ * Sets maximum virtual LBA address of the drive.
+ * Returns new maximum virtual LBA address (> 0) or 0 on failure.
+ */
+static unsigned long idedisk_set_max_address(ide_drive_t  *drive,
+ unsigned long addr_req)
+{
+byte args[7];
+unsigned long addr_set = 0;
+
+printk("%s: (un)clipping max LBA...\n", drive->name);
+
+/* Create IDE/ATA command request structure
+ *
+ * NOTE: I'm not sure if I can safely use IDE_*_OFFSET macro
+ *   here...For real ATA command structure, offset for IDE
+ *   command is 7, but in IDE driver, it needs to be at 0th
+ *   index (same goes for IDE status offset below). Hmm...
+ */
+args[0]  = 0xf9; /* SET_MAX - see ATA spec */
+   args[IDE_FEATURE_OFFSET] = 0x00;
+args[IDE_NSECTOR_OFFSET] = 0x00;
+args[IDE_SECTOR_OFFSET]  = ((addr_req  ) & 0xff);
+args[IDE_LCYL_OFFSET]= ((addr_req >>  8) & 0xff);
+args[IDE_HCYL_OFFSET]= ((addr_req >> 16) & 0xff);
+args[IDE_SELECT_OFFSET]  = ((addr_req >> 24) & 0x0f) | 0x40;
+
+/* submit command request - if OK, read new max LBA value */
+if (ide_wait_cmd_task(drive, args) == 0) {
+if ((args[0] & 0x01) == 0) {
+addr_set = ((args[IDE_SELECT_OFFSET] & 0x0f) << 24)
+ | ((args[IDE_HCYL_OFFSET] ) << 16)
+ | ((args[IDE_LCYL_OFFSET] ) <<  8)
+ | ((args[IDE_SECTOR_OFFSET]   ));
+}
+}
+
+printk("%s: max LBA (un)clipped to %lu\n", drive->name, addr_set);
+
+return addr_set;
+}
+
 /*
  * Compute drive->capacity, the full capacity of the drive
  * Called with drive->id != NULL.
+ *
+ * To compute capacity, this uses either of
+ *
+ *1. CHS value set by user   (whatever user sets will be trusted)
+ *2. LBA value from target drive (require new ATA feature)
+ *3. LBA value from system BIOS  (new one is OK, old one may break)
+ *4. CHS value from system BIOS  (traditional style)
+ *
+ * in above order (i.e., if value of higher priority is available,
+ * rest of the values are ignored).
  */
 static void init_idedisk_capacity (ide_drive_t  *drive)
 {
+unsigned long  hd_max;
+unsigned long  hd_