Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] pktcdvd: cleanup

- update documentation

- use clear_bdi_congested/set_bdi_congested functions directly instead of
old wrappers

- removed DECLARE_BUF_AS_STRING macro

Signed-off-by: Thomas Maier <balagi@justmail.de>
Cc: Peter Osterlund <petero2@telia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Thomas Maier and committed by
Linus Torvalds
83f3aa3d b035b6de

+11 -24
+2 -3
Documentation/ABI/testing/debugfs-pktcdvd
··· 1 1 What: /debug/pktcdvd/pktcdvd[0-7] 2 2 Date: Oct. 2006 3 - KernelVersion: 2.6.19 3 + KernelVersion: 2.6.20 4 4 Contact: Thomas Maier <balagi@justmail.de> 5 5 Description: 6 6 ··· 11 11 these files in debugfs: 12 12 13 13 /debug/pktcdvd/pktcdvd[0-7]/ 14 - info (0444) Lots of human readable driver 15 - statistics and infos. Multiple lines! 14 + info (0444) Lots of driver statistics and infos. 16 15 17 16 Example: 18 17 -------
+1 -1
Documentation/ABI/testing/sysfs-class-pktcdvd
··· 1 1 What: /sys/class/pktcdvd/ 2 2 Date: Oct. 2006 3 - KernelVersion: 2.6.19 3 + KernelVersion: 2.6.20 4 4 Contact: Thomas Maier <balagi@justmail.de> 5 5 Description: 6 6
+1 -1
Documentation/cdrom/packet-writing.txt
··· 93 93 Using the pktcdvd sysfs interface 94 94 --------------------------------- 95 95 96 - Since Linux 2.6.19, the pktcdvd module has a sysfs interface 96 + Since Linux 2.6.20, the pktcdvd module has a sysfs interface 97 97 and can be controlled by it. For example the "pktcdvd" tool uses 98 98 this interface. (see http://people.freenet.de/BalaGi#pktcdvd ) 99 99
+7 -19
drivers/block/pktcdvd.c
··· 190 190 NULL 191 191 }; 192 192 193 - /* declares a char buffer[64] _dbuf, copies data from 194 - * _b with length _l into it and ensures that _dbuf ends 195 - * with a \0 character. 196 - */ 197 - #define DECLARE_BUF_AS_STRING(_dbuf, _b, _l) \ 198 - char _dbuf[64]; int dlen = (_l) < 0 ? 0 : (_l); \ 199 - if (dlen >= sizeof(_dbuf)) dlen = sizeof(_dbuf)-1; \ 200 - memcpy(_dbuf, _b, dlen); _dbuf[dlen] = 0 201 - 202 193 static ssize_t kobj_pkt_show(struct kobject *kobj, 203 194 struct attribute *attr, char *data) 204 195 { ··· 255 264 { 256 265 struct pktcdvd_device *pd = to_pktcdvdkobj(kobj)->pd; 257 266 int val; 258 - DECLARE_BUF_AS_STRING(dbuf, data, len); /* ensure sscanf scans a string */ 259 267 260 - if (strcmp(attr->name, "reset") == 0 && dlen > 0) { 268 + if (strcmp(attr->name, "reset") == 0 && len > 0) { 261 269 pd->stats.pkt_started = 0; 262 270 pd->stats.pkt_ended = 0; 263 271 pd->stats.secs_w = 0; ··· 264 274 pd->stats.secs_r = 0; 265 275 266 276 } else if (strcmp(attr->name, "congestion_off") == 0 267 - && sscanf(dbuf, "%d", &val) == 1) { 277 + && sscanf(data, "%d", &val) == 1) { 268 278 spin_lock(&pd->lock); 269 279 pd->write_congestion_off = val; 270 280 init_write_congestion_marks(&pd->write_congestion_off, ··· 272 282 spin_unlock(&pd->lock); 273 283 274 284 } else if (strcmp(attr->name, "congestion_on") == 0 275 - && sscanf(dbuf, "%d", &val) == 1) { 285 + && sscanf(data, "%d", &val) == 1) { 276 286 spin_lock(&pd->lock); 277 287 pd->write_congestion_on = val; 278 288 init_write_congestion_marks(&pd->write_congestion_off, ··· 359 369 size_t count) 360 370 { 361 371 unsigned int major, minor; 362 - DECLARE_BUF_AS_STRING(dbuf, buf, count); 363 - if (sscanf(dbuf, "%u:%u", &major, &minor) == 2) { 372 + if (sscanf(buf, "%u:%u", &major, &minor) == 2) { 364 373 pkt_setup_dev(MKDEV(major, minor), NULL); 365 374 return count; 366 375 } ··· 370 381 size_t count) 371 382 { 372 383 unsigned int major, minor; 373 - DECLARE_BUF_AS_STRING(dbuf, buf, count); 374 - if (sscanf(dbuf, "%u:%u", &major, &minor) == 2) { 384 + if (sscanf(buf, "%u:%u", &major, &minor) == 2) { 375 385 pkt_remove_dev(MKDEV(major, minor)); 376 386 return count; 377 387 } ··· 1365 1377 && pd->bio_queue_size <= pd->write_congestion_off); 1366 1378 spin_unlock(&pd->lock); 1367 1379 if (wakeup) 1368 - blk_clear_queue_congested(pd->disk->queue, WRITE); 1380 + clear_bdi_congested(&pd->disk->queue->backing_dev_info, WRITE); 1369 1381 1370 1382 pkt->sleep_time = max(PACKET_WAIT_TIME, 1); 1371 1383 pkt_set_state(pkt, PACKET_WAITING_STATE); ··· 2586 2598 spin_lock(&pd->lock); 2587 2599 if (pd->write_congestion_on > 0 2588 2600 && pd->bio_queue_size >= pd->write_congestion_on) { 2589 - blk_set_queue_congested(q, WRITE); 2601 + set_bdi_congested(&q->backing_dev_info, WRITE); 2590 2602 do { 2591 2603 spin_unlock(&pd->lock); 2592 2604 congestion_wait(WRITE, HZ);